AutoCAD Custom Setup Review

AutoCAD Custom Setup Review

MarkSanchezSPEC
Advocate Advocate
1,489 Views
10 Replies
Message 1 of 11

AutoCAD Custom Setup Review

MarkSanchezSPEC
Advocate
Advocate

We’ve been customizing AutoCAD for many years and do things today in much the same way as we did many years ago.  We are now undertaking the effort to modernize our processes with a goal to be able to install Out-of-the-box AutoCAD and have the setup be as zero touch as possible.  To that end, I’ve listed in detail the steps we’ve taken in the past for two reasons; first to document what we’ve learned and have been doing over the years, and second, and with the communities help, document any improved/better/preferred way to accomplish something similar that you’ve learned.

Please note that we do not have any pride of authorship issues so I ask that you let me know what you think of our process and any way you’ve learned to improve a step, or ways you’ve learned to completely eliminate a step.  I can explain what we were attempting to achieve, but that doesn’t mean that it remains a necessary step.

Please let me know your thoughts or suggestions.

(NOTE: the items below have also been attached)

 

  1. Update the OOTB “Civil 3D 20xx Imperial” desktop icon to include the “/b” switch, which calls a custom script file as follows:
    1. /b "D:\IDSP_2018\AutoCAD 2018\Support\SCRIPT.scr"
  2. The SCRIPT.scr contains a single line, which loads a custom lisp routine:
    1. (load "C:\SomePath\XXX.lsp")
  3. When the user enters AutoCAD for the very first time, AutoCAD is initialized and our custom script is called, which in turn loads our custom XXX.lsp routine.
  4. From within the same session of AutoCAD, the user enters the XXX command, which is defined in the “XXX.lsp” routine and carries out the following steps:
    1. Copies the following files from established network locations to various %APPDATA%, %LOCALAPPDATA%, or AutoCAD installation folders:
      1. ARG file – Our custom profile exported as an arg file. This gets copied to the local “Support” folder and loaded below.
      2. CUIX/BMP Menu files – Customization/menu files and associated Bitmap files. These CUIX files get copied to the “%APPDATA%\Support” and “%APPDATA%\Support\Icons” folders respectively. The CUIX files are loaded below by the XXX lisp routine.
  • Tool Palette files – This includes Profile.aws file (copied to “%APPDATA%\Support\Profiles”, AcTpCatalog.atc, compiled palettes (atc), and associated bitmap images (copied to “%APPDATA%\Support\ToolPalette”)
  1. DWT Template – Our custom template is created from the OOTB “acad.dwt” file with the following items added to it:
    1. Add two (2) custom layers
    2. Add our custom text style named SIMPLEX and set it current.
    3. Run a custom script file that:
      1. Sets various system variables and dimension variables
      2. Temporarily inserts and deletes a custom “arrow.dwg” block and sets it for use with the DIMBLK and DIMLDRBLK variables
      3. Creates our custom Dimension style and sets it current.
    4. Run a custom script file that adds custom Multiline Styles
    5. Manually sets up a custom Multileader style
    6. Manually sets up a custom Table style
  2. Custom lsp files – This includes acaddoc.lsp, which:
    1. Sets various custom “global” system variable settings
    2. Defines global AutoLisp variables for use by other custom Lisp routines
    3. Loads various custom AutoLisp routines
    4. Calls S::STARTUP to run a Lisp routine when a drawing is initialized to display current settings in the AutoCAD tray area.
  3. Custom Acad.lin file – This includes our custom linetype definitions merged into the OOTB file
  • Custom Acad.pgp file – This includes our custom command alias definitions merged into the OOTB file
  • SLB slide libraries – For supporting DCL/LSP routine images.
  1. CTB files – Standard plot style table for ensuring consistent line widths during Plotting or Publishing
  2. PC3 files – For plotting to installed devices.
  3. Custom .NET assemblies – Custom .NET utilities that are called on demand. The command names and locations are added to the HKEY_LOCAL_MACHINE area of the registry by a separate network deployment.
  • SHX Files - These get copied to the local “Fonts” folder to support custom blocks.

 

  1. Loads our custom profile from the locally copied ARG file, which includes the following previously saved options and preferences:
    1. Files tab
      1. Support Paths
        1. Network Path to Lisp routines
        2. Network path to ARX applications
        3. Raster Design paths (if not included)
      2. Trusted Locations
        1. Network Path to Lisp routines
        2. Network path to ARX applications
        3. Path to standard Script (SCR) files that are manually run as needed
        4. Path to standard VBA (DVB) files that are manually via Lisp shortcut commends
      3. Template settings path and path/file for QNEW
      4. “Temporary Drawing File Location” set to folder on largest drive on PC (Ex: “D:\Temp”)
      5. “Temporary External Reference File Location” set to folder on largest drive on PC (Ex: “D:\Temp”)
      6. “Print Spooler File Location” set to folder on largest drive on PC (Ex: “D:\Temp”)
    2. Display tab
      1. Sets the “Crosshair size” to 100 - a visual preference by most users
      2. Sets the “Xref display” to 100 – a visual preference to display xrefs and regular objects with the same intensity on screen.
      3. Change the “2D model pace” and “Command line” colors. Simply a visual indicator to specify when AutoCAD has been setup,
  • Open and Save tab
    1. Disables the “Automatic save” option to encourage regular saving by users
    2. Check the “Display full path in title” option. Simply a preference.
    3. Ensure the “Show proxy Information” dialog box is checked to notify users of missing 3rd-party plug-ins
  1. Plot and Publish tab
    1. Select the “Use last successful plot settings” option for new drawings. Simply a preference to pre-select the most likely plotter in the Plot dialog
    2. Uncheck the “Enable background plot when Publishing” option. This option has proved resource intensive.
    3. Uncheck the “Automatically save plot and publish log” option. We have our own custom .NET application that captures plot-related information so these files are not required.
    4. Set the default Plot Style table to a specific (most-likely used) CTB
  2. System tab
    1. Disable balloon notifications for “Product Support Info channel” and “Did you know” messages.
    2. Choose the “Load acad.lsp when opening each drawing” option to support custom Lisp routines across multiple open drawings.
  3. Selection tab
    1. “Selection preview” options disabled for better graphics performance:
      1. Disable “When a command is active”
      2. Disable “When no command is active”
  • Miscellaneous
    1. Create custom “Palette Groups” to support grouping of loaded tool palettes
    2. Load the Raster Design menu

 

  1. Loads menu (cuix) files
    1. Custom menus
    2. Raster Design menu
  • These are loaded from the “%APPDATA%\Support” folder
0 Likes
1,490 Views
10 Replies
Replies (10)
Message 2 of 11

ronjonp
Mentor
Mentor

I've been doing something similar for quite a few years using menuload for a custom_menu that has an associated custom_menu.mnl file which has the lisp code within. The /b which calls a script which then loads XXX which then needs to be run by the user seems a bit cumbersome IMO.

0 Likes
Message 3 of 11

MarkSanchezSPEC
Advocate
Advocate

Nice idea! I had forgotten about MNL files. Adding the /b switch is tedious, even if we are only doing it "once" (for each vertical) on a PC "gold" image. I found the cached version of "c3D.mnl" located at "D:\IDSP_2018\AutoCAD 2018\C3D\UserDataCache\Support". We can add our lisp there (on our PC image) such that it is both instantly available and Trusted to the user.

0 Likes
Message 4 of 11

Sea-Haven
Mentor
Mentor

I try not to touch out of the box so no acad.pgp or acaddoc.lsp rather add our custom lisp (multiple function inside) to Appload "Start up suite". All our custom is on server so an update is available straight away after a cad start.

 

Turning off Autosave yeah till a crash that will cost you, better to play with the settings how often etc. Make the save percentage 50% is good.

 

I have the temp drive set to C:\acadtemp reduces junk on the server. just run  a batch file every now and then to clean up.

 

One thing we did was to create a script for each user which had their toolbar preferences and load them, you could do this by looking at userID and load certain toolbars. -toolbar name show

 

 

0 Likes
Message 5 of 11

MarkSanchezSPEC
Advocate
Advocate

The mnl file does load our routine fine, however you seemed to imply that the same routine can be automatically run after it is loaded, without a user entering the command.. When we call the routine within the MNL, it runs in a non-stop loop.and AutoCAD has to be killed. Please clarify if this is what you meant.

 

Thank you

0 Likes
Message 6 of 11

ronjonp
Mentor
Mentor

Post the code you're running. I've never seen this behavior?

0 Likes
Message 7 of 11

ronjonp
Mentor
Mentor

@Sea-Haven wrote:

....

I have the temp drive set to C:\acadtemp reduces junk on the server. just run  a batch file every now and then to clean up.

...

 

 


Same here put a bunch of temp files as well as 15 minute backups in C:\AutoCAD-BAK

Sample directory structure for backups:
"C:\AutoCAD-BAK\2019.10.23\09-00\KH.GLENDALESTUDY._Maps\GlendaleParksAsBuilts.dwg"

0 Likes
Message 8 of 11

MarkSanchezSPEC
Advocate
Advocate

Even just trying this:

(defun C:HELLOMARK ()
    (alert "Hello Mark")
)
(C:HELLOMARK)

Results in the alert displaying 4-6 times, but it does stop.

We also tried setting a "flag" like this  but while it only runs once at startup, it also runs every time a new drawing is open (not the behavior we wanted):

(setq HelloMarkWasRun 0)
(defun C:HELLOMARK ()
    (alert "Hello Mark")
)
(if (= HelloMarkWasRun 0)
    (C:HELLOMARK)
)
(setq HelloMarkWasRun 1)

 

Our actual function does the following:

1. Calls SHELL to a BAT file that copies files from a server to local paths.  Files include acaddoc.lsp, acad.pgp, acad.lin, two custom cuix files, acad.dwt, CTB files and custom .NET DLL files.

2. Sets Options support paths, trusted locations, enterprise menu, template path/file, and other preferences.

3. Loads 3 partial CUIX files if they are not already loaded (2 custom, 1 raster design)

 

The MNL file we are using is the "acetmain.mnl" file that ships with Acad (located at "...\AutoCAD 2016\Support\en-us"). We chose this file because the Express Tools menu gets loaded inside both Civil and Plant 3D so our command is available inside both.

0 Likes
Message 9 of 11

ronjonp
Mentor
Mentor

@MarkSanchezSPEC wrote:

Even just trying this:

(defun C:HELLOMARK ()
    (alert "Hello Mark")
)
(C:HELLOMARK)

Results in the alert displaying 4-6 times, but it does stop.

We also tried setting a "flag" like this  but while it only runs once at startup, it also runs every time a new drawing is open (not the behavior we wanted):

(setq HelloMarkWasRun 0)
(defun C:HELLOMARK ()
    (alert "Hello Mark")
)
(if (= HelloMarkWasRun 0)
    (C:HELLOMARK)
)
(setq HelloMarkWasRun 1)

 

Our actual function does the following:

1. Calls SHELL to a BAT file that copies files from a server to local paths.  Files include acaddoc.lsp, acad.pgp, acad.lin, two custom cuix files, acad.dwt, CTB files and custom .NET DLL files.

2. Sets Options support paths, trusted locations, enterprise menu, template path/file, and other preferences.

3. Loads 3 partial CUIX files if they are not already loaded (2 custom, 1 raster design)

 

The MNL file we are using is the "acetmain.mnl" file that ships with Acad (located at "...\AutoCAD 2016\Support\en-us"). We chose this file because the Express Tools menu gets loaded inside both Civil and Plant 3D so our command is available inside both.


The MNL is designed to run on each drawing open. I still don't know why your code is running multiple times.  You should make your own mnl for your menu and see if that cures the multiple fire.

 

If you  want a portion of your code to load only once then create an environment variable like so:

(or (getenv "MyCodeHasRun") (c:foo nil (alert "Hello World!") (setenv "MyCodeHasRun" "1")))
0 Likes
Message 10 of 11

MarkSanchezSPEC
Advocate
Advocate

@ronjonp wrote:

If you  want a portion of your code to load only once then create an environment variable like so:
(or (getenv "MyCodeHasRun") (c:foo nil (alert "Hello World!") (setenv "MyCodeHasRun" "1")))

This has the effect of it running once ever. It will not run on subsequent restarts, which is what we wanted.

Thanks

0 Likes
Message 11 of 11

ronjonp
Mentor
Mentor

OK .. once daily? 

(or (= (rtos (getvar 'cdate) 2 0) (getenv "MyCodeHasRun"))
    (c:foo nil (alert "Hello World!") (setenv "MyCodeHasRun" (rtos (getvar 'cdate) 2 0)))
)

Not exactly sure what you're doing but maybe just keep on with what you were doing before as it seemed to accomplish your task ??

0 Likes