Automate SETNETWORKCATALOG value for multiple client standards for Civil 3D
Does anyone know if it's possible (lisp, .Net) to automate the location and values of SETNETWORKCATALOG variable for Civil 3D?
This might be second post\thread, but does anyone know or recommend any resources to easily setup multiple CAD Standards for Civil 3D?
Outside of the normal Civil 3D template files and profile (*.arg) I was looking for a way to put some sort of ini file in the project working folder and have code read through that and set paths for certain support files. (Pipe Catalog location, plotter, symbols, other support files) I have 4 Client's standards (Civil 3D) that all need to be implemented in the next 4 weeks. Thought I could do something with acaddoc.lsp or acad.lsp but Pipe catalog location, among other settings, are not configurable here.
Re: Automate SETNETWORKCATALOG value for multiple client standards for Civil 3D
#1 - See https://forums.autodesk.com/t5/civil...g/td-p/5523188
#2 - Yes, in general, you set up an "acad.lsp" (for things needed set once per *session*) and "acaddoc.lsp" (for things needed set once per *drawing*), in a central location.
* Then you plant a "seed" "acad.lsp" in the default support folder. For example: C:\Program Files\Autodesk\AutoCAD 2019\Support.
* Then when any user fires up C3D/ACAD - it will load this "seed" "acad.lsp", which does nothing but in turn load your network version, which does all of the work.
* Your network "Acad.lsp" should also set the support paths, making its own location at the top of the paths.
* Then all future launches will skip the "seed" "Acad.lsp" and simply load and execute the network "Acad.lsp".
* and from that point on, you can centrally control what happens on all PCs by editing those two files.
P.S. - yes, you can set the pipe catalog location in the network "acad.lsp"
and yes you can do multiple standards with some creative thinking. For example, you could have an IF statement in your "acad.lsp" that says (pseudo code) If user = Joe, then do this. If user = Kim, then do this, and so on. You could make changes based on the drawing folder, or any number of things.
Re: Automate SETNETWORKCATALOG value for multiple client standards for Civil 3D
Steve's code was very helpful; thanks for the link, RK. :beer:
Here's a simplified adaptation, that makes it easy to quickly switch between & setup new client standards:
Code:
(vl-load-com)
(defun c:SetClient1Catalog (/ folder)
(setq folder "X:\\Client1\\Pipes Catalog")
(_SetNetworkCatalog
(list
;; imperial pipes
(cons
"16C49365-B844-484b-92CE-9A8ACE681B57" ;<-- this guid could change in future versions
(strcat folder
"\\US Imperial Structures\\US Imperial Pipes.apc"
)
)
;; imperial structures
(cons
"DCE203A2-D381-466f-A23E-08A9D9F8FDBD" ;<-- this guid could change in future versions
(strcat
folder
"\\US Imperial Structures\\US Imperial Structures.apc"
)
)
;; metric pipes
(cons
"F670B5B9-DA12-476d-B461-4FB5C5650A82" ;<-- this guid could change in future versions
(strcat folder "\\Metric Pipes\\Metric Pipes.apc")
)
;; metric structures
(cons
"F1FEBE2D-D589-4f85-BF8E-650ED06A5EA5" ;<-- this guid could change in future versions
(strcat
folder
"\\Metric Structures.apc\\Metric Structures.apc"
)
)
;; shared content
(cons
"SharedContentPath"
(strcat folder "\\Aecc Shared Content")
)
)
)
(princ)
)
;;;--------------------------------------------------------------------;
(defun c:SetDefaultCatalog (/ folder)
(setq folder "C:\\ProgramData\\Autodesk\\C3D 2019\\enu\\Pipes Catalog")
(_SetNetworkCatalog
(list
;; imperial pipes
(cons
"16C49365-B844-484b-92CE-9A8ACE681B57" ;<-- this guid could change in future versions
(strcat folder
"\\US Imperial Structures\\US Imperial Pipes.apc"
)
)
;; imperial structures
(cons
"DCE203A2-D381-466f-A23E-08A9D9F8FDBD" ;<-- this guid could change in future versions
(strcat
folder
"\\US Imperial Structures\\US Imperial Structures.apc"
)
)
;; metric pipes
(cons
"F670B5B9-DA12-476d-B461-4FB5C5650A82" ;<-- this guid could change in future versions
(strcat folder "\\Metric Pipes\\Metric Pipes.apc")
)
;; metric structures
(cons
"F1FEBE2D-D589-4f85-BF8E-650ED06A5EA5" ;<-- this guid could change in future versions
(strcat
folder
"\\Metric Structures.apc\\Metric Structures.apc"
)
)
;; shared content
(cons
"SharedContentPath"
(strcat folder "\\Aecc Shared Content")
)
)
)
(princ)
)
;;;--------------------------------------------------------------------;
(defun _SetNetworkCatalog (catalog / reg key val)
(foreach x (vl-registry-descendents
(setq reg
(strcat
"HKEY_CURRENT_USER\\"
(if vlax-user-product-key ; If 2013+
(vlax-user-product-key) ; Use 2013 function
(vlax-product-key) ; Use legacy function
)
"\\Profiles\\"
(getvar 'cprofile)
"\\Preferences"
)
)
)
(if (vl-string-search "AeccUiNetwork" x)
(foreach item catalog
(setq val (car item))
(if (vl-registry-read (setq key (strcat reg "\\" x)) val)
(vl-registry-write key val (cdr item))
)
)
)
)
)
(princ)
Cheers