acad.lsp and Support file search path help needed

acad.lsp and Support file search path help needed

Anonymous
Not applicable
1,778 Views
8 Replies
Message 1 of 9

acad.lsp and Support file search path help needed

Anonymous
Not applicable

I need some assistance with a custom acad.lsp file that a prior employee set up and was using to control the SFSP.  We are using AutoCAD Architecture (2018 currently).  The issue with the lsp that has been implemented is that it seems to overwrite the SFSP entries with the ones in the lsp file.  Thus many of the ACA paths are now missing when ACA is loaded.  I want to update the custom paths, but I don't want to lose all the default Acad and ACA paths that need to be there.  In my searches, every post I find seems to do this a different way.

 

A specific example of one missing path is the SFSP to the ACA hatch patterns located at:

C:\Users\%username%\AppData\Roaming\Autodesk\ACA 2018\enu\Support\pats

 

I have tried adding it to the acadloc lines, but it always goes to:

C:\Program Files\Autodesk\AutoCAD 2018\pats

 

Here is the current code:

(vl-load-com)
(setq acadloc
   (vl-registry-read
      (strcat "HKEY_LOCAL_MACHINE\\" (vlax-product-key))
   "ACADLOCATION")
)
(setq *files* (vla-get-files
   (vla-get-preferences (vlax-get-acad-object))
))

(setq sfsp
       (strcat
  "O:\\autodesk\\autolisp;"
  "O:\\autodesk\\autolisp\\bitmap;"
  "O:\\autodesk\\autolisp\\blocks;"
  "O:\\autodesk\\autolisp\\script;"
  "O:\\autodesk\\autolisp\\simpson\\menu;"
  "O:\\autodesk\\standards & templates;"
  "O:\\autodesk\\hatch-line types;"
  "O:\\fonts;"
  "O:\\Autodesk\\Standards & Templates\\Tool Catalogs;"
  "O:\\Autodesk\\Standards & Templates\\Styles;"
  (getvar "ROAMABLEROOTPREFIX") "SUPPORT;"
  (getvar "LOCALROOTPREFIX") "SUPPORT;"
  acadloc "\\support;"
  acadloc "\\pats;"
  acadloc "\\support\\en-US;"
  acadloc "\\EXPRESS;"
  acadloc "\\help;"
  acadloc "\\support\\Color;"
  acadloc "\\ACA;"
  acadloc "\\ApplicationPlugins\\AcWorkflow.bundle\\Contents\\Win64;"
  acadloc "\\ApplicationPlugins\SBD.bundle\Contents\AALSBin;"
       )
)

(vla-put-SupportPath *files* sfsp)

(vla-put-TemplateDwgPath *files* "O:\\autodesk\\standards & templates")
(vla-put-PrinterStyleSheetPath *files* "C:\\ProgramData\\Autodesk\\ACA 2019\\enu\\Plotters\\Plot Styles")
(vla-put-QnewTemplateFile *files* "O:\\autodesk\\standards & templates\\dkc-modelspace.dwt")
(vla-put-EnterpriseMenuFile *files* "O:\\autodesk\\standards & templates\\dkc-cui.cuix")


(vlax-release-object *files*)

So my goal is to modify or replace this code with something that will keep the default ACA and ACAD paths, wile allowing me to ADD the custom paths that I need in SFSP and the various Plotter paths.

 

I'm also trying to find any documentation on this if anyone knows where to point me, it would be appreciated.

 

Thank you for your help.

 

 

0 Likes
1,779 Views
8 Replies
Replies (8)
Message 2 of 9

rkmcswain
Mentor
Mentor

Hmmmm.... that looks familiar....   yes that code overwrites whatever is present for the SFSP, so you do have to know what the stock OOTB paths for a particular product are.  We use a (cond) statement in the startup lisp and push the stock and extra paths to each product, based on the product and version.

R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 3 of 9

Anonymous
Not applicable

Perhaps they used your code as a base.   So with this code I have to input all the default support paths?  How does it distinguish between ACA and ACAD in the acadloc lines?

SFSP Results of current ACAD.lspSFSP Results of current ACAD.lspWSFSP results of current ACAD.lspWSFSP results of current ACAD.lspDefault Paths (SFSP)Default Paths (SFSP)Default Paths (WSFSP)Default Paths (WSFSP)

0 Likes
Message 4 of 9

scot-65
Advisor
Advisor
Take a look at these snippets.
It searches for the string and if not found, appends.
The same can be had for the other support path areas
(except trusted locations - you have to build the key for this).

(setq a (strcase (getenv "ACAD")))
(if (not (wcmatch a (strcase (strcat "*" sfsp "\\Acad Blocks*"))))
(setenv "ACAD" (strcat (getenv "ACAD") (chr 59) sfsp "\\Acad Blocks")))

Repeat for each path you wish to add.

(setq a (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Profiles\\" (getvar "CPROFILE") "\\Variables"))
(if (not (wcmatch (strcase (setq b (vl-registry-read a "TRUSTEDPATHS"))) (strcase (strcat "*" trlo "*"))))
(vl-registry-write a "TRUSTEDPATHS" (if (> (strlen b) 0) (strcat trlo (chr 59) b) trlo)))

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 5 of 9

rkmcswain
Mentor
Mentor
@Anonymous wrote:

So with this code I have to input all the default support paths?  How does it distinguish between ACA and ACAD in the acadloc lines?

You can do it however you want. I'm just telling you how I do it, and yes I grab the stock paths from whatever product/version I need, then plug those into the code. Then I query the registry at runtime to figure out what product and version is currently running and apply those stock paths, plus any custom paths, as desired.

 

As an example, if you query:

(vl-registry-read
	   (strcat "HKEY_LOCAL_MACHINE\\" (vlax-machine-product-key))
	   "ProductName"
	 )

...for AutoCAD 2019, it will return "AutoCAD 2019 - English"

...for Civil 3D 2019, it will return "AutoCAD Civil 3D 2019 - English"

...for Civil 3D 2014, it returns "Autodesk AutoCAD Civil 3D 2014 - English"....

and so on.  

 

I do not grab the existing set of paths and add on to it. We do not want users injecting their own paths into the mix, since we provide a location where users can dump their own custom files. Same goes for plotter paths, template paths, etc., but you could do it that way if that fits your needs.

R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 6 of 9

Sea-Haven
Mentor
Mentor

Undocumented but the paths can be set to look downward eg O:\autodesk..  note the double .. means go down path. compare O:\Autodesk\programs\lisp\current etc and repeated for every location, only need 1 line in pathing.

0 Likes
Message 7 of 9

Anonymous
Not applicable

@rkmcswain wrote:
@Anonymous wrote:

So with this code I have to input all the default support paths?  How does it distinguish between ACA and ACAD in the acadloc lines?

You can do it however you want. I'm just telling you how I do it, and yes I grab the stock paths from whatever product/version I need, then plug those into the code. Then I query the registry at runtime to figure out what product and version is currently running and apply those stock paths, plus any custom paths, as desired.

 

As an example, if you query:

(vl-registry-read
	   (strcat "HKEY_LOCAL_MACHINE\\" (vlax-machine-product-key))
	   "ProductName"
	 )

...for AutoCAD 2019, it will return "AutoCAD 2019 - English"

...for Civil 3D 2019, it will return "AutoCAD Civil 3D 2019 - English"

...for Civil 3D 2014, it returns "Autodesk AutoCAD Civil 3D 2014 - English"....

and so on.  

 

I do not grab the existing set of paths and add on to it. We do not want users injecting their own paths into the mix, since we provide a location where users can dump their own custom files. Same goes for plotter paths, template paths, etc., but you could do it that way if that fits your needs.


I should have noted previously.  I'm not that great at lisp or vb so this is difficult for me to understand (But I want to learn so that I can understand it).  I get that you can query to get the product name, but how does it know to place the default paths?

 

One of the issues I have with the code in the existing acad.lsp, it omits the path to the default ACA hatch patterns.  This was causing all content from the detail component db to come in with the same ANSI31 hatch pattern instead of any specific patterns set in the detail component.  For the moment, I copied the patterns from the default local location to a location on my network and added that path to the lsp.  My thinking being that use the default paths to the default content and only add my custom content as needed.  That's what I am trying to accomplish but I just don't understand the code enough to get there.  

 

And I agree, you wouldn't want to grab any existing paths that a user may have input.  I just want to make sure that the default out of the box sfsp paths are maintained along with my custom additions.

0 Likes
Message 8 of 9

Anonymous
Not applicable

@Sea-Haven wrote:

Undocumented but the paths can be set to look downward eg O:\autodesk..  note the double .. means go down path. compare O:\Autodesk\programs\lisp\current etc and repeated for every location, only need 1 line in pathing.


I'm not sure what you mean by this, can you elaborate?

0 Likes
Message 9 of 9

Sea-Haven
Mentor
Mentor

2 questions

How do you know support paths, you actually provide the details of the directory location ie type them in.

 

The undocumented is using a double period on the directory name this implies also search downwards, remember your directory is a tree structure and can be very deep. So O:\\Autodesk.. says search all of the tree 0:\\Autodesk

 

Were I worked we had a sever so pathing was easy.

0 Likes