PDA

View Full Version : Programmatically Assigning Support File Search Paths



CEHill
2013-05-10, 09:53 AM
Can someone share tips or a snippet showing the example code on how the subject item might be accomplished?:p

bk2gsta
2013-05-10, 03:14 PM
You can do this by changing the values in the windows registry. Here is a sample of what i use in my startup routine:

;This sets a reference to the files portion of the acad preferences
(setq *files* (vla-get-files (vla-get-preferences (vlax-get-acad-object))))

;This Gets the supportpaths in one string
(setq searchpath (vla-get-supportpath *files*))

;Searches if a path is already in the supportpaths,
;if not add the path to the string, using the ";" as a separator
(if (= (wcmatch searchpath "*F:\\Autocad\\Dynamic Blocks*") nil)
(setq searchpath(strcat searchpath ";F:\\Autocad\\Dynamic Blocks")))

;write the new string of paths in the windows registry
(vla-put-supportpath *files* searchpath)

CEHill
2013-05-10, 05:25 PM
I feel enlightened. Seriously: Thanks!

bk2gsta
2013-05-10, 08:07 PM
You're Welcome :)

pbejse
2013-05-11, 07:55 AM
Can someone share tips or a snippet showing the example code on how the subject item might be accomplished?:p



(if (setq new (findfile "F:\\Autocad\\Dynamic Blocks"))
(setenv "ACAD" (strcat (getenv "ACAD") ";" new))
)

greg.battin
2013-05-23, 05:42 PM
At work we have an enterprise .cui and an accompanying tool palette that sometimes users will lose their support paths...
This routine has been made to generically reflect these paths.

The users simply drag & drop into their session of autocad to run...

~Greg


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;;
;;; Load the custom Tools ;;;
;;; ;;;
;;; For AutoCAD 2011 ;;;
;;; ;;;
;;; ;;;
;;; Adds a Support File Search Path (In the Options Dialog) ;;;
;;; Adds the Enterprise File search path ;;;
;;; .cuix file for the tools ;;;
;;; ;;;
;;; Simply drag & drop into drawing area to run ;;;
;;; ;;;
;;;---------------------------------------------------------------------- ;;;
;;; ;;;
;;; Version History: ;;;
;;; ;;;
;;;3/30/2012 Changed from partially loading the cui to adding the support path ;;;
;;; for the cui in the enterprise menu ;;;
;;; ;;;
;;;4/18/2012 Added the support path for the custom Tool Palette ;;;
;;; ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; Checks to see if the "Support File Search Path" already exists
;;; If not, creates it

(vl-load-com)
(setq
*files* (vla-get-files (vla-get-preferences (vlax-get-acad-object)))
)
(SETQ ORIGPATH (vla-get-SupportPath *files*))
(SETQ ONEPATH (setq w ";C:\\Folder1\\Subfolder2\\Subfolder3"))
(if (not (vl-string-search w ORIGPATH))
(progn
(SETQ MYENV (STRCAT ORIGPATH ONEPATH))
(if (< (strlen myenv) 1000)
(vla-put-SupportPath *files* myenv)
)
)
)
;;; Sets the Enterprise Menu

(setq files2
(vla-get-files (vla-get-preferences (vlax-get-acad-object)))
)
(vla-put-EnterpriseMenuFile
files2
"C:\\Folder1\\Subfolder2\\Subfolder3\\custom_stuff.cuix"
)
(princ)

;;; Sets the tool palette support path

(setq pFiles (vla-get-files (vla-get-preferences (vlax-get-acad-object)))) ;; get file preferences
(setq tpPath (vla-get-toolPalettePath pFiles)) ;; get current tool palette path
(setq tpPath "%InstallFolder%\\UserDataCache\\Support\\ToolPalette;C:\\Folder1\\Subfolder2\\Subfolder3\\ToolPalette\\Custom TP") ;; set your path here
(vla-put-toolPalettePath pFiles tpPath) ;; set tool palette path
)
(princ)

greg.battin
2013-05-23, 05:44 PM
these might help as well:

; Items in brackets [] are meant to be replaced with your specific values.


; If using any vlax functions:
(vl-load-com)


; A common task is to make sure a user has a certain directory in their support paths.
; The following snippet adds a given support directory to AutoCAD's support paths.
(setq suppdir "[YourSupportDir]")
(if (not (vl-string-search suppdir (getenv "ACAD")))
(setenv "ACAD" (strcat (vl-string-right-trim ";" (getenv "ACAD")) ";" suppdir))
)
(setq suppdir nil)
; If you want to explicitly set the support paths, just use (setenv "ACAD" "[SupportPathsHere]").
; The paths must be separated by semicolons.


; If your company uses a standard profile, you can use this snippet to make sure everyone uses it.
; Use yesterday's post to determine the current revision and version of AutoCAD and replace
; the x's with the correct values.
(vl-registry-write
"HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\Rxx.x\\ACAD-xxxx:xxx\\Profiles"
nil
"[YourDefaultProfile]"
)


; Say you want to make sure your users all have a certain tool palette.
(setq tooldir "[YourToolPaletteDirectory]"
toolpaths (vlax-get-property (vlax-get-property (vlax-get-property (vlax-get-acad-object) 'Preferences) 'Files) 'ToolPalettePath)
)
(if (not (vl-string-search tooldir toolpaths))
(vlax-put-property
(vlax-get-property (vlax-get-property (vlax-get-acad-object) 'Preferences) 'Files)
'ToolPalettePath
(strcat (vl-string-right-trim ";" toolpaths) ";" tooldir)
)
)
(setq tooldir nil toolpaths nil)

; If you want to disallow your users from having their own tool palettes, use this:
(vlax-put-property
(vlax-get-property (vlax-get-property (vlax-get-acad-object) 'Preferences) 'Files)
'ToolPalettePath
[ToolPalettePaths]
)
; These paths should also be separated by semicolons.


; Last but not least, if you want to do something for a specific user:
(if (= "johndoe" (getvar "LOGINNAME"))
; do stuff for John Doe
)

; You can modify the above snippet with an OR statement to do something for a group of users as well:
(if (or
(= "johndoe" (getvar "LOGINNAME"))
(= "janedoe" (getvar "LOGINNAME"))
)
; do stuff for the Does
)

CEHill
2013-06-05, 10:09 PM
I have been very busy and have just re-visited this very important thread.

I think that my work environment is much more simplistic than the provided examples allow for as:

I am the sole full-version AutoCAD operator in this company.
All AutoCAD (Mechanical 2012) support (and custom) files are located on my workstation.


A description of my support folder structure follows.
One of the main support file folders is: C:\I-CAD.

The following subfolders reside under C:\I-CAD and include:

I-LISP\
I-LOG\
I-PALETTES\
I-PLOT\
I-TEMP\
I-TEMPLATES\

NOTE: Any "log" or "temp" type of file will reside in the folder containing that same ("log" or "temp") name.
For example, external reference temp files will reside under the I-TEMP folder
I also have a support file folder for the acad.pgp file: C:\I-CADPGP.

Question:

Which lines from the preceding code examples given in this thread need to be assigned to the folders/paths I described above?

I will check this thread tomorrow. Thanks again for your kind assistance for "this coding newbie but oldie"!

rkmcswain
2013-06-06, 12:25 PM
Can someone share tips or a snippet showing the example code on how the subject item might be accomplished?:p

Take a look: http://cadpanacea.com/node/52

CEHill
2013-06-06, 12:39 PM
Hello R.K.,

How do I change the code that you supplied to use support files residing on my hard drive under C:\I-CAD :?:

P.S.: I had the code below working at one time from network-based support based files until the network became so slow here.


(vl-load-com)
; This sets a reference to the install path of your product
(setq acadloc
(vl-registry-read
(strcat "HKEY_LOCAL_MACHINE\\" (vlax-product-key))
"ACADLOCATION")
); This sets a reference to the files portion of the acad preferences
(setq *files* (vla-get-files
(vla-get-preferences (vlax-get-acad-object))
))
; This builds the string of support file search paths
(setq sfsp
(strcat
"\\\\SERVER\\CAD\\SUPPORT;"
"\\\\SERVER\\CAD\\LISP;"
"\\\\SERVER\\CAD\\FONTS;"
(getvar "ROAMABLEROOTPREFIX") "SUPPORT;"
acadloc "\\SUPPORT;"
acadloc "\\HELP;"
acadloc "\\EXPRESS;"
acadloc "\\SUPPORT\\COLOR;"
acadloc "\\LAND;"
(getvar "LOCALROOTPREFIX") "SUPPORT;"
"C:\\Program Files\\Common Files\\Autodesk Shared\\GIS\\FDO\\2.0;"
"C:\\Program Files\\Common Files\\Autodesk Shared\\GIS\\FDO\\2.0\\Oracle;"
"C:\\Program Files\\Common Files\\Autodesk Shared\\GIS\\FDO\\2.0\\ArcSDE;"
"C:\\Program Files\\Autodesk Land Desktop 2006\\Land;"
"C:\\Program Files\\Dotsoft\\Toolpac\\;"
"C:\\Program Files\\Dotsoft\\XL2CAD"
)
)
; This actually applies the above string to the current session of AutoCAD.
(vla-put-SupportPath *files* sfsp)
; Here are some examples of setting other things
; Set the template directory
(vla-put-TemplateDwgPath *files* "\\\\SERVER\\CAD\\TEMPLATE")
; Set the default template (QNEW) name
(vla-put-QNewTemplateFile *files* "\\\\SERVER\\CAD\\TEMPLATE\\my-custom.dwt")
; Set the printer (PC3) support file path
(vla-put-PrinterConfigPath *files* "\\\\SERVER\\CAD\\PLOTTERS")
; Release the object
(vlax-release-object *files*)

rkmcswain
2013-06-10, 11:41 AM
You just edit the paths.
For example, "\\\\server\\cad\\......" might become "c:\\i-cad\\...."

CEHill
2013-06-13, 07:09 PM
Mr. McSwain...

Before testing begins, I understand what most of the code does.
Being one who has little experience in LISP to this point, there is one EXCEPTION!

That is in the code line (setq sfsp.

How does AutoCAD use the above line?

I am including the code snippet given in addition to a code snippet given by another (with a reference to my hard drive-based, support file search path).
The code resides in a custom ACADDOC.LSP file that is otherwise populated only with AUTOLOAD statements for LISP routines.
I am trying to figure out if the code line (setq sfsp fits into the support file search path definition code in this ACADDOC.LSP file:

Can you help?



;
; ********************* Define AutoCAD Support File Paths *********************
;
;;; This sets a reference to the install path of your product
(setq acadloc (vl-registry-read
(strcat "HKEY_LOCAL_MACHINE\\" (vlax-product-key))
"AcadLocation"
)
)
;;; This sets the root folder for your own customizations
(setq myCAD
"C:\\CAD\\I-CAD\\"
)
;;; This sets a reference to the files portion of the acad preferences
(setq *files* (vla-get-files
(vla-get-preferences
(vlax-get-acad-object)
)
)
)
;;; This builds the string of support file search paths
(setq sfsp
(strcat
myCAD
";"
myCAD
"LISP;"
acadloc
"\\acadm;"
acadloc
"\\acadm\\g3v;"
acadloc
"\\acadm\\gen;"
acadloc
"\\acadm\\sys;"
acadloc
"\\help;"
acadloc
";"
"C:\\program files\\common files\\autodesk shared;"
(getvar "RoamableRootPrefix")
"Support;"
acadloc
"\\fonts;"
acadloc
"\\support;"
acadloc
"\\acadm\\migration;"
acadloc
"\\express;"
acadloc
"\\sample\\mechanical\\environments;"
(getvar "RoamableRootPrefix")
"acadm;"
)
)
;;; This actually applies the above string to the current session of AutoCAD.
(vla-put-SupportPath *files* sfsp)
(vla-put-TemplateDwgPath *files* (strcat myCAD "TEMPLATES"))
(vla-put-AutoSavePath *files* (strcat myCAD "TEMP"))
(vla-put-PrinterConfigPath *files* (strcat myCAD "PLOT"))
(vla-put-PrinterDescPath *files* (strcat myCAD "PLOT"))
(vla-put-PrinterStyleSheetPath *files* (strcat myCAD "PLOT"))
(vla-put-CustomIconPath *files* (strcat myCAD "ICONS"))
(vla-put-LogFilePath *files* (strcat myCAD "LOG"))
(vla-put-TempFilePath *files* (strcat myCAD "TEMP"))
(vla-put-TempXrefPath *files* (strcat myCAD "TEMP"))
;
; ;

rkmcswain
2013-06-13, 09:54 PM
"(setq sfsp" --- is just setting the variable "sfsp" to the string we are going to pass to AutoCAD, later on, here > (vla-put-SupportPath *files* sfsp)
Does that help?

CEHill
2013-06-13, 11:15 PM
It surely does. I will eventually learn LISP piece by piece - simpler with the good guidance from nice folks like you.
With a little massaging and help in resolving a syntax error from my AutoCAD colleagues on the WAUN's LISP E-MAIL GROUP (Join the WAUN at www.waun.org (http://www.waun.org) . It's free!), the routine is running on all cylinders.

Here is what works for me (feel free to make suggestions or comments for our LISP edification):


;; ACADDOC.LSP
;; Purpose: Load LISP Routines and Support File Search Paths at Startup
;; Created on 6/28/2010 by Clint Hill
;; Modified on 10/20/2010 by Clint Hill - Added autoload statements (per Steven LaKose)
;; Modified on 01/08/2013 by Clint Hill - Added LISP Routine - RenAttr
;; Modified on 04/29/2013 by Clint Hill - Rem'd Commented Out Load Statements Replaced by AutoLoad Statements
;; Modified on 06/13/2013 by Clint Hill - Added Support File Search Path Code (per Multiple Sources)
;;
;;
(vl-load-com)
(autoload "addstr" '("addstr"))
(autoload "alignit" '("ali"))
(autoload "arrow" '("aaa"))
(autoload "ats" '("ats"))
(autoload "attdef2text" '("attd"))
(load "attinc")
(autoload "AttModSuiteV1-1" '("roatt"))
(load "backgroundchanger")
(autoload "BFindV2-0" '("BFind"))
(autoload "BlockRename" '("BlockRename"))
(autoload "BreakObjects21" '("MMB"))
(autoload "BTC" '("BTC"))
(autoload "CA" '("CA"))
(autoload "CENDIM" '("CENDIM"))
;(load "ChBlkTxt")
(autoload "ChBtextA" '("CBA"))
(load "ctr")
(autoload "CSViewport" '("CCVV"))
(load "Ctxt")
(autoload "CurveAlignedTextV1-1" '("CAT"))
(autoload "DELPAGESETUPS" '("delpagesetups"))
(autoload "dimse" '("dimse"))
(autoload "dimlinechange" '("DLC"))
(autoload "DSS" '("DSS"))
(autoload "DynOff V2-1" '("DynOff"))
(autoload "EASD" '("EASD"))
(load "ecd")
(autoload "ECD" '("ECD"))
(autoload "fast" '("FAST"))
(autoload "fx" '("FX"))
(load "gauges")
(autoload "hose" '("HOSE"))
(autoload "howfar" '("HH"))
(autoload "HSS" '("HSS"))
(autoload "I-Arial_N" '("III"))
(autoload "isodim" '("IOD"))
(load "killdots")
(autoload "layer_creator" '("LC"))
(autoload "LCK" '("LCK"))
(autoload "linklists" '("LLL"))
(autoload "LST" '("LST"))
(autoload "LZE" '("LZE"))
(autoload "MacAtt" '("MacAtt"))
(autoload "NumIncV3-1" '("NNN"))
(autoload "on" '("on"))
(autoload "quickgroup" '("QQ"))
(autoload "quickungroup" '("QQW"))
(autoload "patt" '("patt"))
(autoload "psfixtxt" '("PSFIXTXT"))
(load "RenAttrib")
(load "rotate-text")
(autoload "S-Deck" '("SDK"))
(autoload "sent" '("SENT"))
(autoload "snake" '("SNAKE"))
(autoload "StealV1-8" '("StealV1-8"))
(autoload "stl" '("STL"))
(load "TextFunctions")
(autoload "tchange" '("TCH"))
(autoload "transfer" '("TX"))
(load "txtmrg")
(load "txtrot")
(autoload "UPA" '("UPA"))
(load "vpmove")
(autoload "vp2ms" '("VP2MS"))
(autoload "vp-outline" '("VV"))
(autoload "wd" '("WD"))
(autoload "ZZ" '("ZZ"))
(princ "\n\"Acaddoc.lsp\" loaded.")
(princ)
;
; This sets a reference to the install path of your product
(setq acadloc
(vl-registry-read
(strcat "HKEY_LOCAL_MACHINE\\" (vlax-product-key))
"ACADLOCATION")
)
; This sets a reference to the files portion of the acad preferences
(setq *files* (vla-get-files (vla-get-preferences (vlax-get-acad-object))
))
;;; This sets the root folder for your own customizations
(setq myCAD
"C:\\I-CAD\\")
; This builds the string of support file search paths
(setq sfsp
(strcat
myCAD
";"
myCAD
"I-LISP;"
"C:\\I-CADPGP;"
(getvar "ROAMABLEROOTPREFIX") "SUPPORT;"
acadloc "\\SUPPORT (file://\\SUPPORT);"
acadloc "\\HELP (file://\\HELP);"
acadloc "\\EXPRESS (file://\\EXPRESS);"
(getvar "LOCALROOTPREFIX") "SUPPORT;"
"C:\\Program Files (x86)\\ManuSoft\\SuperPurge\\;"
"C:\\Program Files (x86)\\DotSoft\\ToolPac\\;"
"C:\\Program Files (x86)\\DotSoft\\XL2CAD\\"
))
; This actually applies the above string to the current session of AutoCAD.
(vla-put-SupportPath *files* sfsp)
; Here are some examples of setting other things
; Set the default template (QNEW) name
;(vla-put-QNewTemplateFile *files* "C:\\I-CAD\\I-TEMPLATES\\.dwt")
; Set the printer (PC3) support file path
(vla-put-PrinterConfigPath *files* (strcat myCAD "I-PLOT"))
; Set the printer plot style support file path
(vla-put-PrinterStyleSheetPath *files* (strcat myCAD "I-PLOT"))
; Set the printer (PMP) support file path
(vla-put-PrinterDescPath *files* (strcat myCAD "I-PLOT"))
; Set the template support file path
(vla-put-TemplateDwgPath *files* (strcat myCAD "I-TEMPLATES"))
; Set the autosave support file path
(vla-put-AutoSavePath *files* (strcat myCAD "I-TEMP"))
; Set the custom icon support file path
(vla-put-CustomIconPath *files* (strcat myCAD "I-ICONS"))
; Set the log support file path
(vla-put-LogFilePath *files* (strcat myCAD "I-LOG"))
; Set the temporary file support file path
(vla-put-TempFilePath *files* (strcat myCAD "I-TEMP"))
; Set the temporary XREF file support file path
(vla-put-TempXrefPath *files* (strcat myCAD "I-TEMP"))
; Release the object
(vlax-release-object *files*)

CEHill
2013-06-14, 02:02 PM
*** HELP ***
The routine is working TOO WELL!!!!:shock:

ITEM 1: The code does not include the support paths nor code that makes up the default - and AutoCAD Mechanical's (2012) own - ACADDOC.LSP
AutoCAD Mechanical bombs while AutoCAD vanilla works well/as expected.
Background: I have combined AUTOLOAD statements for load LISP routines and this Mecahnical ACADDOC.LSP file successfully in the past. although, I have not tried adding the file search support path code.

ITEM 2: An aftermarket add-on software, CADWorx, includes four products that all have their own unique startup, AutoCAD Profile and Support File (especially their ARX files) to account for and now in a desktop icon. Each of their unique Support File Paths (including their ARX) are not included in the just posted code.

QUESTION

Must I have various ACADDOC.LSP files to account for both Item 1 & 2?

Opie
2013-06-14, 02:11 PM
You could have one with multiple test conditions depending on what you are loading. Or you could add a specific support folder to the top of the list containing your profile specific acad.lsp and acaddoc.lsp as well as the other specific files.

CEHill
2013-06-14, 02:29 PM
You could have one with multiple test conditions depending on what you are loading. Or you could add a specific support folder to the top of the list containing your profile specific acad.lsp and acaddoc.lsp as well as the other specific files.

Hello Opie,

Could you provide a beginner level code snippet required for multiple test conditions?
For example, I will use the following flavors of AutoCAD:


AutoCAD Vanilla
AutoCAD Mechanical
CADWorx Plant
CADWorx P&ID
CADWorx Equipment
CADWorx IP


About the second option that you mentioned:
The only variation in my ACADDOC.LSP and ACAD.LSP files is between the AutoCAD Vanilla (used with CADWorx flavors as well ) and the vertical; AutoCAD Mechanical, having its own code in an ACADDOC.LSP file.
Could you explain how this folder structure defines what is and what is not loaded and an example?

I do not want fries with that...

Opie
2013-06-14, 02:45 PM
I cannot provide workable code for you to test as I do not use the same software. You will need to determine what makes each program distinguishable from the others through code and make your own tests.

(cond ((if this is AutoCAD, then use this branch)
(code for AutoCAD starts here)
(another bit of AutoCAD code)
); End AutoCAD code
((if thie is AutoCAD Mechanical, then use this branch)
(code for AutoCAD Mechanical starts here)
(another bit of AutoCAD Mechanical code)
); End AutoCAD Mechanical code
((if thie is CADWorx Plant, then use this branch)
(code for CADWorx Plant starts here)
(another bit of CADWorx Plant code)
); End CADWorx Plant code
)
You could look through the custom code for each flavor to see what makes them unique.

HTH

BlackBox
2013-06-14, 02:48 PM
Hello Opie,

Could you provide a beginner level code snippet required for multiple test conditions?
For example, I will use the following flavors of AutoCAD:


AutoCAD Vanilla
AutoCAD Mechanical
CADWorx Plant
CADWorx P&ID
CADWorx Equipment
CADWorx IP


About the second option that you mentioned:
The only variation in my ACADDOC.LSP and ACAD.LSP files is between the AutoCAD Vanilla (used with CADWorx flavors as well ) and the vertical; AutoCAD Mechanical, having its own code in an ACADDOC.LSP file.
Could you explain how this folder structure defines what is and what is not loaded and an example?

I do not want fries with that...

I personally use a version dependent Acad.lsp, and AcadDoc.lsp for each version year, and vertical installed... I just find it so much easier to maintain, which in turn saves me time (and money).

However, if you wanted to account for each in one CONDitional statement, you might try something like this:


(cond ((= (setq profileName (strcase (getvar 'cprofile)))
"AUTOCAD VANILLA"
)
;; setq sfsp for "AUTOCAD VANILLA"
)
((= profileName "AUTOCAD MECHANICAL")
;; setq sfsp for "AUTOCAD MECHANICAL"
)
((= profileName "CADWORX PLANT")
;; setq sfsp for "CADWORX PLANT"
)
((= profileName "CADWORX P&ID")
;; setq sfsp for "CADWORX P&ID"
)
((= profileName "CADWORX EQUIPMENT")
;; setq sfsp for "CADWORX EQUIPMENT"
)
((= profileName "CADWORX IP")
;; setq sfsp for "CADWORX IP"
)
)


[Edit] - Opie beat me to it. *kicks dirt*

CEHill
2013-06-14, 02:56 PM
I thank you for taking time and must determine the exact differences.
Initially, they appear to be their unique AutoCAD Profiles.
These profiles are called out in the desktop icon's field with a /P

Also, I am going to test putting a second copy of my ACADDOC.LSP file in a separate directory and with any additional code required by that particular AutoCAD flavor.

CEHill
2013-06-14, 03:16 PM
Blackbox,

I too would like to lessen my time in maintaining verticals (Mechanical) and add-ons (CADWorx)

I am guessing that I construct a separate folder for each flavor with this folder containing it own unique ACADDOC.LSP file.
QUESTION: Is that the way you do it?

I am trying to better understand how to include code in the desktop icon field to fire each flavor and thereby loading its own ACADDOC.LSP file.
QUESTION: Could you explain how and what is needed i.e., /p or profile name, etc., to start up a particular AutoCAD flavor?

Many thanks to you, Blackbox, for the explicit and detailed CONDitional code if I choose to go that route.

BlackBox
2013-06-14, 03:42 PM
Blackbox,

I too would like to lessen my time in maintaining verticals (Mechanical) and add-ons (CADWorx)

I am guessing that I construct a separate folder for each flavor with this folder containing it own unique ACADDOC.LSP file.
QUESTION: Is that the way you do it?

I am trying to better understand how to include code in the desktop icon field to fire each flavor and thereby loading its own ACADDOC.LSP file.
QUESTION: Could you explain how and what is needed i.e., /p or profile name, etc., to start up a particular AutoCAD flavor?

Many thanks to you, Blackbox, for the explicit and detailed CONDitional code if I choose to go that route.

Couple of things you might want to take into account when planning... And for this to work well, it does require planning... Be sure to make it as simple as possible, easy for others to follow, practical, and above all else, scaleable.



Firstly, there's a difference between version year, and platform (i.e., AutoCAD 2014, and Civil 3D 2014)... Separate is the topic of multiple Profiles within same application.

I do utilize separate folders for each platform, within each version year... But I do also maintain a 'common' folder to minimize non-essential duplication of data. I'm comfortable having so many duplicate Acad.lsp, and AcadDoc.lsp files, and even many duplicate strings within to set _that_ version's SFSP (small data footprint), because I use VLIDE Projects to manage each.

Generally speaking, we produce using one internal Profile for most projects. Outside of that, we only have a handful of client-specific Profiles, for which I have setup a 'client' folder, which mimics this same support structure, which comes with it's own application icon to configure the /p switch, etc. and if I'm bored I'll even change the icon to the client's logo via Gimp (I'm all for visual feedback).



Backing up to the topic of multiple, internal Profiles being maintained from within the same Acad.lsp file, the CONDitional statement I posted would allow you to programmatically set the needed SFSP at session start by matching the current profile (the one configured in your application icon's /p switch). We do not use any cumbersome 3rd party tools, as we mostly work with Civil 3D, and only really require AutoTURN, and Raster Design for most of our work... Other tools. utilities, etc. are there for production value, and efficiency, mostly maintained by me, and loaded either by CUI, MNL, AUTOLOADed by AcadDoc.lsp, Registry loader/Autoloader (for newer versions, via PackageContents.xml)... Most of which is relative-pathed to my 'common' folder.



[Edit] - Autoloader is becoming a big part of the customization work I do these days, especially with attempting to simultaneously launch a website, and publish multiple projects at Autodesk Exchange. Autoloader is proving to have a few kinks (particularly with unnecessary duplicate CUIx copies, etc.), but nothing that would preclude other benefits for 3rd party developers.



I do hope this helps make (more?) sense to you.

Cheers

BlackBox
2013-06-14, 03:53 PM
... Might help if I actually uploaded the screen shot. :Oops:

Image attached above (taken a while ago)... We've since added Civil 3D 2014, and others.

CEHill
2013-06-14, 04:12 PM
1 Picture = 1K Words, Blackbox!

BlackBox
2013-06-14, 04:18 PM
1 Picture = 1K Words, Blackbox!

Happy to help. :beer:

https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTUkstvXsiOPcfQheZOUagrfyiV-g94qoe3WvwqFbHoahr36Ffq

CEHill
2013-06-14, 04:37 PM
One last she-bang on the topic...


Backing up to the topic of multiple, internal Profiles being maintained from within the same Acad.lsp file, the CONDitional statement I posted would allow you to programmatically set the needed SFSP at session start by matching the current profile (the one configured in your application icon's /p switch).

The CONDitional statement looks very promising and I will attempt to make it a successful implementation here. As odd as it sounds at such a large corporation, I am the only full version AutoCAD user here and have admin privilege on my machine and basically support all of the AutoCAD Lite users, do production work only to support company activities as part of an internal engineering support department, and am allowed a portion of my time to develop my seat of full version of AutoCAD.

Also, you mention the ACAD.LSP file instead of the ACADDOC.LSP file. Why? I plan on coding within the ACADDOC.LSP file only.


We do not use any cumbersome 3rd party tools, as we mostly work with Civil 3D, and only really require AutoTURN, and Raster Design for most of our work...

For a 3rd party tool, CADWorx requires only a custom profile for each one of its four applications and an ARX file for only three of them. Intergraph has maintained the simplicity in which is a hallmark of CADWorx.


...Most of which is relative-pathed to my 'common' folder.

In my mind, a 'common' folder would contain subfolders for general items such as title blocks/drawing borders, general LISP routines, temp file folder, plotter support folder, etc. Is that consistent with your usage of the 'common' folder?

BlackBox
2013-06-14, 08:16 PM
The CONDitional statement looks very promising and I will attempt to make it a successful implementation here. As odd as it sounds at such a large corporation, I am the only full version AutoCAD user here and have admin privilege on my machine and basically support all of the AutoCAD Lite users, do production work only to support company activities as part of an internal engineering support department, and am allowed a portion of my time to develop my seat of full version of AutoCAD.


That sounds like a great opportunity (despite the LT usage); I'd love to find a position where I could utilize my proficiencies to serve as a force multiplier for others within the company... Sadly, that is not the case with my current employer... They don't really want anyone with any sort of ambition, they just want basic CAD users, so I keep this, and other talents to myself.

[Edit] - ... And share here on the forums, of course; 'You guys' appreciate the talent, effort, etc., which makes it worth sharing.



Also, you mention the ACAD.LSP file instead of the ACADDOC.LSP file. Why? I plan on coding within the ACADDOC.LSP file only.


Correct.

Acad.lsp and AcadDoc.lsp each serve a different purpose... The former is loaded only once, at session start, by default (see the ACADLSPASDOC (http://docs.autodesk.com/ACD/2014/ENU/files/GUID-E0049DB8-DC45-47A1-A8B7-67012F7AEDB8.htm) System Variable), whereas the latter is loaded each time a Document is opened, or created.

Now, given the task of configuring SFSP based on the ActiveProfile Object's required settings, one need only set the SFSP once for the session to function properly.

That said, the only justification I can stretch to deem worth placing this task's code within AcadDoc.lsp is if you were concerned about a user changing the ActiveProfile mid-session... But even still, there's a lot more than simply AcadDoc.lsp to consider.

For example, you'd need a DocManager (DocumentCollection) Event handler which would detect when a user switches to another open Document (potentially causing a subsequent per-Document data storage mechanism that stores the ActiveProfile value within the ActiveDocument when the DocumentToBeDeactivated Event is raised, etc... A not-so-simple-task better left to the .NET API, if it absolutely had to come to that level of complexity... Again, I think that's a bit overboard, but I've seen stranger requests).

Just train users to use one session for each profile needed, IMO.



For a 3rd party tool, CADWorx requires only a custom profile for each one of its four applications and an ARX file for only three of them. Intergraph has maintained the simplicity in which is a hallmark of CADWorx.


I have no experience with these 3rd party applications.



In my mind, a 'common' folder would contain subfolders for general items such as title blocks/drawing borders, general LISP routines, temp file folder, plotter support folder, etc. Is that consistent with your usage of the 'common' folder?


I've seen, and worked with two different scenarios... The first mimics AutoCAD's default support structure, with little more than a basic ..\Support\ folder and everything (i.e., .ARG, .LSP, .LIN, .PAT, .LAS, .PC3, .PGP, etc.) all dumped in that one folder, and I've seen it where everything is in it's own folder (mostly), logically grouped by content type (i.e., CUIx + Icons, etc.).

The reality is each has trade-offs. I'd like to believe that somewhere in the middle is a highly adaptable position to take... Better organization than the former, yet simpler than the latter... It's lean, it's clean, but has enough complexity that someone unfamiliar can pick up where I left off from (given an advanced user, new CAD lead).

CEHill
2013-06-18, 12:50 PM
That sounds like a great opportunity (despite the LT usage); I'd love to find a position where I could utilize my proficiencies to serve as a force multiplier for others within the company... Sadly, that is not the case with my current employer... They don't really want anyone with any sort of ambition, they just want basic CAD users, so I keep this, and other talents to myself.

WORK ENVIRONMENTS
Two of the three places I have worked appreciated the extra mile I took as a self-taught CAD go to guy. Those two places were in manufacturing engineering support. The one place where my efforts were not appreciated in the least (like your situation) was in engineering consulting which I voluntarily left at the first opportunity; moving back into being overhead only in the drastically different and even pace in mfg. engr. support where training opportunities abound. (Unfortunately for me, at an earlier manufacturing company I didn't recognize the importance of learning to program CAD like I am now ten years later).

PROGRAMMING LANGUAGES
Also, I would like to know which programming languages you use for customizing AutoCAD?
I am learning LISP and VB.NET via Jerry Winters book and experienced a top-notch, online live course taught by Jerry - highly recommended - taken last summer (see www.vb.cad.com).

STARTUP PROGRESS
I hope to post questions as I code and test today. I will use ACAD.LSP to include the COND code. The main dependency will be the /p switch in the desktop icons I wil use; differentiating the flavors of CADWorx and AutoCAD as well.
Things are a bit cloudy as I am getting my head around and developing a plan to incorporate using both the ACAD and ACADDOC.lsp files; deciding which code to include where.
Like I said ACAD.LSP will include the COND and the ACADDOC.LSP will include my LISP routines as well as some variable settings (as I have some examples of others' ACADDOC.LSP file with some nifty custom code).

Does it make sense to organize both files in the way I describe? I am open to ideas and love examples and snippets!!! :p

MECHANICAL FLAVOR
BTW, AutoCAD Mechanical has a default ACADDOC.LSP file with code to load its toolset that a colleague has learned to customize for his company.
I will duplicate his code to load both the standard AutoCAD Mechanical toolset as well as include my custom goodies under a Profile called out in a desktop icon /P switch.

BlackBox
2013-07-10, 01:55 PM
WORK ENVIRONMENTS
Two of the three places I have worked appreciated the extra mile I took as a self-taught CAD go to guy. Those two places were in manufacturing engineering support. The one place where my efforts were not appreciated in the least (like your situation) was in engineering consulting which I voluntarily left at the first opportunity; moving back into being overhead only in the drastically different and even pace in mfg. engr. support where training opportunities abound. (Unfortunately for me, at an earlier manufacturing company I didn't recognize the importance of learning to program CAD like I am now ten years later).


Thanks for sharing; I'm not even after a 100% overhead role honestly, just appreciation for the skills I've earned, and the opportunity to step up. Unfortunately for me, that does not seem to be of any interest here, which is why I've just wrapped up a one-year contract as a part-time developer consultant for an out of state Autodesk developer, working remotely, nights, and weekends from home... And have started to publish some of my work (http://apps.exchange.autodesk.com/ACD/en/Detail/Index?id=appstore.exchange.autodesk.com%3arightclickrenameforautocad%3aen) at Autodesk Exchange.

... Now I just need to find a single opportunity that combines the two. LoL



PROGRAMMING LANGUAGES
Also, I would like to know which programming languages you use for customizing AutoCAD?
I am learning LISP and VB.NET via Jerry Winters book and experienced a top-notch, online live course taught by Jerry - highly recommended - taken last summer (see www.vb.cad.com).


I started out using LISP, skipped VBA, and jumped into .NET... Initially VB for the similar syntax given Visual LISP's ActiveX COM API, but have since completely switched to C# which I find to be a great 'gateway' language for ultimately stepping up into ObjectARX (C++ for AutoCAD), and also cross-platform development for Mac via XCode, etc..

... I'm only scratching the surface of what I can do.



STARTUP PROGRESS
I hope to post questions as I code and test today. I will use ACAD.LSP to include the COND code. The main dependency will be the /p switch in the desktop icons I wil use; differentiating the flavors of CADWorx and AutoCAD as well.
Things are a bit cloudy as I am getting my head around and developing a plan to incorporate using both the ACAD and ACADDOC.lsp files; deciding which code to include where.
Like I said ACAD.LSP will include the COND and the ACADDOC.LSP will include my LISP routines as well as some variable settings (as I have some examples of others' ACADDOC.LSP file with some nifty custom code).

Does it make sense to organize both files in the way I describe? I am open to ideas and love examples and snippets!!! :p


Again, I have no experience with CADWorx, but I use Acad.lsp for tasks being performed at session start, such as loading ARX/NET assemblies, customizing the profile, etc.. I use AcadDoc.lsp for tasks being performed with each Document opened such as loading reactors, setting global/system variables, AUTOLOAD-ing other code files, etc..



MECHANICAL FLAVOR
BTW, AutoCAD Mechanical has a default ACADDOC.LSP file with code to load its toolset that a colleague has learned to customize for his company.
I will duplicate his code to load both the standard AutoCAD Mechanical toolset as well as include my custom goodies under a Profile called out in a desktop icon /P switch.


I've never used Mechanical, but I thought it had an AcadM.lsp for that, instead of commandeering AcadDoc.lsp, no?

CEHill
2013-07-10, 02:14 PM
I've never used Mechanical, but I thought it had an AcadM.lsp for that, instead of commandeering AcadDoc.lsp, no?

Ever since I explored using customizing AutoCAD Mechanical via the acaddoc.lsp file, there has been a Mechanical-specific, acaddoc.lsp file.
There are calls within this acaddoc.lsp file to an independent acadm.lsp file as well as some minor changes to other code in the 2012 version acaddoc.lsp for this flavor.
It has always been necessary to only include custom code after the existing Mechanical-specific code.

--------------------------
I send a hearty note of thanks to you for sharing your varied and in-depth CAD programming experiences.
Hearing your story encourages me to push the envelope by growing my programming skills.
--------------------------

Streamlining via acad.lsp
I will try to implement the acad.lsp concept with the COND statements graciously given.
However as the sole CAD person in the organization, I lost a significant drawing production time while creating and testing my current successful but rather cludgy (maintenance-wise - having no less than five versions of acaddoc.lsp to update) customization in the acaddoc.lsp file(s) that do not rely on the acad.lsp.
I do know the payback is in the automation that was achieved up to this point.

Blackbox: Please monitor this thread from time to time as, starting next week, I will devote some time in developing your excellent suggestions.

BlackBox
2013-07-10, 03:13 PM
Ever since I explored using customizing AutoCAD Mechanical via the acaddoc.lsp file, there has been a Mechanical-specific, acaddoc.lsp file.
Although there is an acadm.lsp file as well and there has been some minor changes in the acaddoc.lsp, any custom code must follow the existing code.


Thanks for clarifying.



Thanks for providing your story and what appears to be is a very colorful and vibrant CAD and programming experience.
Hearing your story encourages me to push the envelope by growing my programming skills.


That is kind of you to say, Clint.



Streamlining via acad.lsp
I will try to implement the acad.lsp concept with the COND statements graciously given.
However as the sole CAD person in the organization, I lost a significant drawing production time while creating and testing my current successful but rather cludgy (maintenance-wise - having no less than five versions of acaddoc.lsp to update) customization in the acaddoc.lsp file(s) that do not rely on the acad.lsp.
I do know the payback is in the automation that was achieved up to this point.

Blackbox: Please monitor this thread from time to time as, starting next week, I will devote some time in developing your excellent suggestions.


FWIW -

I do most of my work-related coding during my lunch break, or after my shift to avoid loss in production.

The multiple Acad*.lsp files may seem complex at first... Keep it simple, setup one, get it working well, and only then replicate as needed, tailoring to suite. I didn't inherit this structure, nor implement it in a day... This is instead the result of small evolution from one methodology to another. Take your time, do what's best for your situation, even if that means a simpler/different methodology altogether.

I'm always here, unless I have a submittal.

Cheers

Cheers