📜 ⬆️ ⬇️

Creating a nanoCAD distribution with custom settings


In large organizations, the process of preparing and setting up designer workplaces is often difficult and routine. It would seem that to solve such a trivial task as installing a CAD system, you do not need to spend a lot of resources, you just need to distribute the distribution package through domain policies or simply “share” the folder with the ready distribution package and boldly start working in the CAD system. The question arises: “What if the organization has its own design standards for the release of documentation, if there are own developments in the form of ready-made blocks or teams? Do you plan to use a common database (if SPDS, Reinforced concrete or Construction site is used)? ”

In this case, we face another task - to set up users' workplaces, and it’s extremely irrational to do this with each individual place. Distributing an already customized distribution is the only correct solution. Where does your nanoCAD settings store? How to create your own distribution? We will consider these and some other questions in more detail. The instruction is intended for machines on Windows 7 and above.

Distribution preparation


You need to download the product distribution from the site nanocad.ru . In our example, we will work with the nanoCAD SPDS 6 NCSP60x32_468.exe distribution .
We need to install the program, because in the future we will work with its files. After installation, go to the distribution .exe file.
')
Unpack the downloaded .exe file (for example, using the 7-zip archiver) into an arbitrary folder (in our case we called it nanoInstall). After unpacking, we get the next set of files presented in Fig. one.


Fig. 1. Unpacked distribution kit nanoCAD SPDS 6

The nanoCAD program stores its settings in several files located in different directories. For correct distribution of the distribution kit it is necessary to decompose these settings into different folders. Therefore, we will create in nanoInstall a folder for storing LocalEx settings with subdirectories, as shown in fig. 2


Fig. 2 Folder structure customizable distribution

After creating the necessary folder structure in nanoinstall, you need to find and prepare configuration files that are responsible for the settings of our distribution (Settings.xml; AppOptions.xml; CAD.cfg; nCAD.ini, etc.).
They are located in the appropriate directories, which will be discussed below.

Note: We can change the settings on the already installed nanoCAD, but in order for them to take effect, you need to reset the interface settings (Fig. 3) or clear the registry.


Fig. 3. nanoCAD interface settings window

More about configuration files


There are several configuration files: some are responsible for the program interface, others are for the design elements, and others are for the general settings of the platform. Below will be presented all the files separately. For better understanding, we introduce small notation for the location of files.
On pcfile storage location on your computer with nanoCAD preinstalled.
On the installation diskThis is the path where the changed configuration files should be placed after the settings are completed.

Default.ntb

On pcC: \ Users \ User \ AppData \ Roaming \ Nanosoft \ nanoCAD DPS 6.0 \ en-RU
On the installation disknanoInstall \ LocalEx \ AppData \ UserTemplates \ ru-RU
It is a binary file that stores the data of a notebook (Fig. 4).
Data is configured through the program interface.

Fig. 4. Notebook nanoCAD SPDS

tinfo.xml

On pcC: \ Users \ User \ AppData \ Roaming \ Nanosoft \ nanoCAD DPS 6.0 \ en-RU
On the installation disknanoInstall \ LocalEx \ AppData \ UserTemplates \ ru-RU
It is a text file that stores the data in select lists. Allows you to add your fields to the selection lists. Data is configured via the program interface when entering a new value that is different from the value shown in the list.

std.mcs

On pcC: \ ProgramData \ Nanosoft \ nanoCAD DPS 6.0 \ DataRO \ en-RU
On the installation disknanoInstall \ LocalEx \ CommonAppData \ DataRO \ ru-RU
It is a binary file that stores the data of objects. This file can be located locally on each machine or on the server, having previously installed SQL Server.
Data is configured through the program interface.

Fig. 5. Object database nanoCAD SPDS

Settings.xml

On pcC: \ ProgramData \ Nanosoft \ nanoCAD DPS 6.0 \ DataRO \ en-RU
On the installation disknanoInstall \ LocalEx \ CommonAppData \ DataRO \ ru-RU
This file contains the program configuration settings (adding / limiting the list of scales, predefined fields of the format title block). In fig. 3 shows a list of scales of appearance, which can be configured in this file.

Adding a design scale to the standard scale list

To add the nanoCAD value of the new design scale, you need to find in the Settings.xml file the corresponding code in the tags ... (Fig. 6.1) and edit the existing list of scales. The xml file contains comments on the assignment of parameters. For example, you can specify the scale that will be used by default.

Adding your scale to the list:
<Scale name="400:1" val="400" /> 

Set the default scale to 1: 400:
 <Scale name="400:1" val="400" default="-1" /> 

Fig. 6.1. Scale List CodeFig. 6.2. Customized scale list
After editing is complete, save the changes to the file and run nanoCAD. You will see how your settings affected the list of scales (Fig. 6.2).

Adding a measurement scale to the standard scale list

To add the nanoCAD value of a nonstandard measurement scale, you need to find the corresponding code in the Settings.xml file (Fig. 7.1) and add similar lines with your own parameters to the existing list of scales. The xml file contains comments on the assignment of parameters.
Adding your scale to the list:
 <Scale name="200:1" val="200" /> 

In fig. 7.1 the code of the list of measurement scales and the corresponding list of scales in the nanoCAD window are compared.
Fig. 7.1. Code of measurement scale listFig. 7.2. Customized list of measurement scales
After editing is complete, save the changes to the file and run nanoCAD. You will see how your settings affected the list of scales (Fig. 7.2).

AppOptions.xml

On pcC: \ Users \ User \ AppData \ Roaming \ Nanosoft \ nanoCAD DPS 6.0 \ en-RU
On the installation disknanoInstall \ LocalEx \ AppData \ UserTemplates \ ru-RU
This file stores the settings of the design (menu Tools → Customize design). Here you can customize line types, dimensions, callouts, shapes, etc.
As an example, we will change the positioning settings in the SPDS profile, as shown in Fig. 8. We changed the color of the callout lines and the thickness of the line. Override values ​​are highlighted in blue - these are settings that differ from the standard AppOptions.xml file.

Fig. 8. Positional settings window

After the settings are completed, they must be saved in an xml file. Click File → Save Settings As. Specify the nanoInstall \ LocalEx \ AppData \ UserTemplates \ ru-RU \ folder and click the Save button (Figure 9).

Fig. 9. Saving the AppOptions.xml Settings File

Myblocks.hsf

On pcC: \ Program Files (x86) \ Nanosoft \ nanoCAD DPS 6.0
On the installation disknanoInstall \ LocalEx \ Program
In the last article, we created our own teams, which allowed us to insert two ready blocks. Now we can add these commands to our distribution. To do this, place the nsf-file in the correct directory of the installer. In this way, you can distribute your own applications written for the nanoCAD environment to all users along with the distribution.

ncadbase.cfg and userdata.cfg

On pcC: \ Program Files (x86) \ Nanosoft \ nanoCAD DPS 6.0
On the installation disknanoInstall \ LocalEx \ Program
This file stores the platform interface settings: the location of the panels, menu items, mouse context menu, etc.

Note: to see the changed settings of cfg-files in the program, you need to clear the registry nanoCAD SPDS in the branch HKEY_LOCAL_MACHINE \ SOFTWARE \ Nanosoft \ nanoCAD SPDS after saving the settings made.

Preloading Applications


The created nsf-file with the commands (you can read about it in the last article) must be loaded in the program at startup. Previously, we used the Application Download item for this (Tools → Applications → Application Download → Startup). To preset this option, we register a special command that will load the nsf file.
 [\configman\commands\sload_myblocks_nsf] weight=i30 |cmdtype=i0 | intername=sload_myblocks_nsf RealCommandName=snsf Keyword=smyblocks.nsf^MCloseDocument^MNewDocument^M 


Change context menu

nanoCAD 7 does not support CUI files, however we have access to all cfg files responsible for interface settings.
Let's try to change the standard context menu. In fig. 10a presents the standard context menu nanoCAD. Go to the folder with the product C: \ Program Files \ Nanosoft \ nanoCAD SPDS 6.0 in the file ncadbase.cfg and find the lines that describe the standard right-click menu. They are represented by a list with the prefix \ ViewPopupMenu \.
 [\ViewPopupMenu] |Intername=sViewPopupMenu [\ViewPopupMenu\LastCommand] |intername=sLastCommand1 [\ViewPopupMenu\LastCommandPopup] |name=s&Last commands [\ViewPopupMenu\LastCommandPopup\LC0] |intername=sLastCommand1 …. [\ViewPopupMenu\Inspector] |name=sP&roperties |intername=sProperties [\ViewPopupMenu\DrawingExplorer] |name=sDrawing &Explorer |intername=sDrawingExplorer 


Fig. 10a. Standard right-click menu nanoCAD SPDS

The standard menu seemed to me too big, and I made some changes to it: I removed some commands, others I grouped in the drop-down items, and added some new commands. As a result, I got the following code:

Reveal code
 [\ViewPopupMenu] |Intername=sViewPopupMenu [\ViewPopupMenu\LastCommand] |intername=sLastCommand1 [\ViewPopupMenu\LastCommandPopup] |name=s&Last commands [\ViewPopupMenu\LastCommandPopup\LC0] |intername=sLastCommand1 [\ViewPopupMenu\LastCommandPopup\LC1] |intername=sLastCommand2 [\ViewPopupMenu\LastCommandPopup\LC2] |intername=sLastCommand3 [\ViewPopupMenu\LastCommandPopup\LC3] |intername=sLastCommand4 [\ViewPopupMenu\LastCommandPopup\LC4] |intername=sLastCommand5 [\ViewPopupMenu\LastCommandPopup\LC5] |intername=sLastCommand6 [\ViewPopupMenu\LastCommandPopup\LC6] |intername=sLastCommand7 [\ViewPopupMenu\LastCommandPopup\LC7] |intername=sLastCommand8 [\ViewPopupMenu\LastCommandPopup\LC8] |intername=sLastCommand9 [\ViewPopupMenu\sep2] [\ViewPopupMenu\Undo] |name=s&Undo |intername=sEditUndo [\ViewPopupMenu\Redo] |name=s&Redo |intername=sEditRedo [\ViewPopupMenu\sep3] [\ViewPopupMenu\Move] |name=sMove object [\ViewPopupMenu\Move\erase] |name=sErase |intername=sDelete [\ViewPopupMenu\Move\MoveCopy] |Name=sCop&y |InterName=sMoveCopy [\ViewPopupMenu\Move\Mirror] |Name=sMirror |InterName=sMirror [\ViewPopupMenu\Move\Offset] |name=sOffset |intername=svcOffsetCmd [\ViewPopupMenu\Move\Array] |Name=sArray |InterName=sArray [\ViewPopupMenu\Move\sep4] [\ViewPopupMenu\Move\MoveObject] |Name=sMov&e |InterName=sMove [\ViewPopupMenu\Move\RotateObject] |Name=s&Rotate |InterName=sRotate [\ViewPopupMenu\Move\sep10] [\ViewPopupMenu\Move\scale] |Name=s&Scale |InterName=sScale [\ViewPopupMenu\Move\stretch] |name=sStretch |intername=sstretch [\ViewPopupMenu\Move\sep5] [\ViewPopupMenu\Move\Trim] |name=s&Trim Vectors |intername=svcTrimByEdgeCmd [\ViewPopupMenu\Move\smarttrim] |name=sSmart &Trim |intername=ssmarttrim [\ViewPopupMenu\Move\Extend] |name=s&Extend Vectors |intername=svcExpandByEdgeCmd [\ViewPopupMenu\Move\Break] |name=s&Break Vectors |intername=svcBreakCmd [\ViewPopupMenu\Move\Join] |name=s&Join objects |intername=sJoin [\ViewPopupMenu\Move\Extend] |name=s&Extend Vectors |intername=svcExpandByEdgeCmd [\ViewPopupMenu\Move\Break] |name=s&Break Vectors |intername=svcBreakCmd [\ViewPopupMenu\Move\Join] |name=s&Join objects |intername=sJoin [\ViewPopupMenu\Clipboard] |name=s  [\ViewPopupMenu\Clipboard\Cut] |Name=s&Cut |InterName=sCut [\ViewPopupMenu\Clipboard\Copy] |Name=s&Copy |InterName=sCopy [\ViewPopupMenu\Clipboard\CopyWithBasePoint] |Name=s&Copy With Base Point |InterName=sCopyWithBasePoint [\ViewPopupMenu\Clipboard\Paste] |Name=s&Paste |InterName=sPaste [\ViewPopupMenu\Clipboard\PasteBlock] |Name=s&Paste as Block |InterName=sPasteBlock [\ViewPopupMenu\Clipboard\PasteOriginal] |Name=sPaste to Original Coor&dinates |InterName=sPasteOrigin [\ViewPopupMenu\Isolate] |name=sIsolate [\ViewPopupMenu\Isolate\IsolateObjects] |name=sIsolate &Objects |InterName=sIsolateObjects [\ViewPopupMenu\Isolate\HideObjects] |name=sHide Objects |InterName=sHideObjects [\ViewPopupMenu\Isolate\UnisolateObjects] |name=sUnisolate Objects |InterName=sUnisolateObjects [\ViewPopupMenu\DisplayOrder] |name=sDispla&y Order [\ViewPopupMenu\DisplayOrder\BringToFront] |name=s&Bring to Front |InterName=sdraworder1 [\ViewPopupMenu\DisplayOrder\SendToBack] |name=s&Send to Back |InterName=sdraworder2 [\ViewPopupMenu\DisplayOrder\BringForward] |name=sBring &Forward |InterName=sdraworder3 [\ViewPopupMenu\DisplayOrder\SendBackward] |name=sSend Back&ward |InterName=sdraworder4 [\ViewPopupMenu\Select] |name=sSelect [\ViewPopupMenu\Select\selectsimilar] |name=sSelect similar objects |intername=sselectsimilar [\ViewPopupMenu\Select\SelectAll] |name=sSelect Al&l |intername=sSelectAll [\ViewPopupMenu\Select\QuickSelect] |name=s&Quick Select |intername=sqs [\ViewPopupMenu\Select\UnSelectAll] |name=sUnSelect All |intername=sUnSelectAll [\ViewPopupMenu\sep1] [\ViewPopupMenu\AddSelected] |Name=sAdd Selected |InterName=sAddSelected [\ViewPopupMenu\sep5] [\ViewPopupMenu\Find] |name=sSearch and Replace... |intername=sfind [\ViewPopupMenu\sep4] [\ViewPopupMenu\Inspector] |name=sP&roperties |intername=sProperties [\ViewPopupMenu\preferences] |name=sPreferences |intername=sPreferencesCmd 

After editing is complete, save the file with ANSI encoding. In fig. 10b shows the result of the changes made.

Fig. 10b. New right click menu

If you configure the context menu on an already installed nanoCAD, then after saving the changes in the ncadbase.cfg file, you must clear the nanoCAD SPDS registry in the HKEY_LOCAL_MACHINE \ SOFTWARE \ Nanosoft \ nanoCAD SPDS registry.

nprof.ini (nApp.ini)

On pcC: \ Program Files (x86) \ Nanosoft \ nanoCAD DPS 6.0
On the installation disknanoInstall \ LocalEx \ Program
This file contains the settings of the nanoCAD platform itself. To make it easier to navigate in lines of code, I advise you to go to Tools → Settings and get acquainted with the structure and sequence of parameters.
In our example, we will place the standard nanoCAD folders (templates, fonts, print styles, forms) in a shared folder on the server and add our own dwt template, which we will use by default.
  1. Create the necessary directories on the server:
    \\ Server \ Templates
    \\ Server \ shx
    \\ Server \ PlotConfigs
    \\ Server \ PlotStyles
  2. Create a template test.dwt and place it in a folder on the server: \\ Server \ Templates \ test.dwt .
  3. Create a nApp.ini file with notepad and copy the necessary settings from nprof.ini or from the ready-made example below.

 [\DefProf\StdDirs] TemplatesDir=s\\ServerTemplates Shx=s\\Server\shx PlotConfigsDir=s\\Server\PlotConfigs PlotStylesDir=s\\Server\PlotStyles Pat=s\\Server\shx [\DefProf\TemplateDoc] UseTemplateFile=i1 TemplateName=sTest.dwt [\DefProf\TemplateImport] UseTemplateFile=i1 TemplateName=sTest.dwt 

Note:
[\ DefProf \ StdDirs] - this section contains the parameters of the standard folders.
[\ DefProf \ TemplateDoc] and [\ DefProf \ TemplateImport] are the parameters for using templates for new and imported documents, respectively.
In fig. 11 shows the result of changes to the nrof.ini configuration file.

Fig. 11. Standard folders and template usage.
Previously, we registered a special command to load blocks, now in nApp.ini we will indicate the load of this command when nanoCAD is started.
 [\DefProf\Startup\load_myblocks_nsf] 
Now when you start nanoCAD, our application for inserting blocks will start with it.
After saving the nApp.ini file , copy it to the appropriate distribution directory. The nprof.ini file does not need to be copied.

Setup.ini


Let's move on to the setup.ini file - the last one we need to prepare. This distribution file of the distribution kit itself is located in the folder with the unpacked installer (nanoinstall). You can enter the serial number of the product in it or specify the address of the license server, as well as the folder for the DPS database and the path to the STP settings. To customize the installation, uncomment the keys and set your own values ​​to them. You only need to edit the keys in the [InstallProperties] section. When uncommenting parameters, do not forget to uncomment the [InstallProperties] section. Below is a list of available options.

   FLEXLM_VENDOR_NAME=Nanosoft FLEXLM_LICENSE_FILE=@server   SERIALNUMBER=ZZZ10-TRIAL-00000   INSTALLLOCATION=c:\Best program    DATABASE_PATH=c:\std.mcs      DATABASE_PATH=SQL:SERVER:base     SETTINGS=\\server\Settings.xml     CORP_OPTIONS=\\server\CorpOptions.xml 

The name of the current profile prefix is ​​done by adding the prefix to the layer names. You can manually change it in the settings: General settings → General settings → Current profile.
APP_OPTIONS_PROFILE = name

If any of these keys is commented out, then it will be set to the default value stored in the application.

Transferring Settings Files


After editing all the above files, they must be placed in the appropriate directory of the installer (nanoinstall) . If you use additional files (scripts, lisp, etc.), they can be placed in the Program folder ( nanoInstall \ LocalEx \ Program ) and they will be placed in the Program Files of the product folder during installation.

Silent Installation


Such parameters are necessary if you are going to install the customized distribution kit locally.
Using notepad, you should create a new text file with the .bat extension in the nanoInstall folder (Fig. 8) and specify one of two installation parameters:


Fig. 12. Creating a bat-file to run the installer

Conclusion


We showed you how you can adapt nanoCAD to your settings, save them in your files and include them in your installation package, which is very convenient for deploying nanoCAD to a large number of workplaces within an enterprise network. With this knowledge, you will not only simplify your life when installing software, but also be able to control uniform CAD settings at all users' workplaces: all users will now work with uniform templates, fonts, design settings, etc. You can even lay out your scripts and commands for each user's workplace.

It remains to be noted that this article will be useful for installing not only the nanoCAD SPDS, but also for the remaining vertical solutions and for the nanoCAD platform itself. Have a good design!

Sergey Spirin, mahbak
ZAO Nanosoft

Source: https://habr.com/ru/post/279537/


All Articles