Set CUI Path via acad.lsp

Set CUI Path via acad.lsp

SkipBurns
Advocate Advocate
1,619 Views
18 Replies
Message 1 of 19

Set CUI Path via acad.lsp

SkipBurns
Advocate
Advocate

If I run (setenv "MenuFile" "C:\\Box\\Resources - Technical\\CAD\\_C3D Standards\\2020\\cui\\MNS") at the command line it works perfectly, but in my acad.lsp I cannot get it to work.

 

Full ACAD.lsp:

 

(vl-load-com)

(setq *acad* (vlax-get-acad-object))

(setq *prefs* (vla-get-preferences *acad*)
	  *files* (vla-get-files *prefs*))



;; Set Variables
(setvar "FILEDIA" 0)				; display dialog boxes
(setvar "CONSTRAINTINFER" 0)		; turn off inferred constraints
(setvar "OBJECTISOLATIONMODE" 0)	; turn isolated objects back on
(setvar "XREFTYPE" 1)				; default to "overlay" xrefs

;; Set Environment Variables
(setenv "HideSystemPrinters" "1")	; hide system printers
(setenv "ShowTabs" "1")				; show layout tabs
(setenv "ShowFullPathInTitle" "1")	; show full path in title bar

;; Set CUI paths
(setenv "MenuFile" "C:\\Box\\Resources - Technical\\CAD\\_C3D Standards\\2020\\cui\\MNS")
;;(setenv "EnterpriseMenuFile" *files* "C:\\Box\\Resources - Technical\\CAD\\_C3D Standards\\2020\\cui\\MNS.cuix")

;; Set standard support file search paths
(vla-put-SupportPath
	*files*
	(strcat
		"C:\\Box\\Resources - Technical\\CAD\\_C3D Standards\\2020\\LISP;"
		(getvar "RoamableRootPrefix")"Support;"
		"C:\\Program Files\\Autodesk\\AutoCAD 2020\\support\\en-US;"
		"C:\\Program Files\\Autodesk\\AutoCAD 2020\\fonts;"
		"C:\\Program Files\\Autodesk\\AutoCAD 2020\\help;"
		"C:\\Program Files\\Autodesk\\AutoCAD 2020\\Express;"
		"C:\\Program Files\\Autodesk\\AutoCAD 2020\\support\\color;"
		"C:\\Program Files\\Autodesk\\AutoCAD 2020\\C3D;"
		"C:\\Program Files\\Autodesk\\AutoCAD 2020\\ACA;"
		"C:\\ProgramData\\Autodesk\\C3D 2020\\enu\\Data\\Symbols\\MVBlocks;"
		"C:\\Program Files\\Autodesk\\AutoCAD 2020\\Map;"
		"C:\\Program Files\\Autodesk\\AutoCAD 2020\\Map\\bin\\fdo;"
		"C:\\Program Files\\Autodesk\\AutoCAD 2020\\Map\\en-US;"
		"C:\\Program Files\\Autodesk\\AutoCAD 2020\\Map\\Support;"
		"C:\\Program Files\\Autodesk\\AutoCAD 2020\\Map\\Support\\en-US;"
		"C:\\program files\\autodesk\\autocad 2020\\map\\bin\\gisplatform;"
		"C:\\program files\\autodesk\\autocad 2020\\map\agol;"
	) ; end of strcat
) ; end of vla-put-SupportPath

;; Set Autosave location
;;(vla-put-AutoSavePath "c:\\autosaves")	
	
;; Print support file paths
(setenv "PrinterConfigDir" "C:\\Box\\Resources - Technical\\CAD\\_C3D Standards\\2020\\plotters")
(setenv "PrinterDescDir" "C:\\Box\\Resources - Technical\\CAD\\_C3D Standards\\2020\\plotters\PMP")
(setenv "PrinterStyleSheetDir" "C:\\Box\\Resources - Technical\\CAD\\_C3D Standards\\2020\\plot styles")

0 Likes
1,620 Views
18 Replies
Replies (18)
Message 2 of 19

ronjonp
Mentor
Mentor

Have you tried something like this?

(if (vl-file-directory-p
      (setq f (vla-put-menufile
		*files*
		"C:\\Box\\Resources - Technical\\CAD\\_C3D Standards\\2020\\cui\\MNS"
	      )
      )
    )
  (vla-put-menufile *files* f)
)

 ( I don't know why it works from the command line and not via acad.lsp ) 

 

You could also use (setenv "ACAD" ...) to set your support paths if you'd like to get away from vla since that is the only place you're using it.

0 Likes
Message 3 of 19

ronjonp
Mentor
Mentor

You also might want to check this one .. could drive some people a bit crazy! 😉

(setvar "FILEDIA" 0)				; display dialog boxes
Message 4 of 19

SkipBurns
Advocate
Advocate

Nope.. I want everyone typing the full path perfectly to open a file LOLOLOLOL.. Thanks for that.

 

I figured out my issue was that I had an old copy of my acad.lsp in a support path.  duh.. holiday brain 😄

 

Thanks for the help.

0 Likes
Message 5 of 19

ronjonp
Mentor
Mentor

Hahaha 🙂 .. one question, why are you setting these paths .. they should be set OOTB.

	  "C:\\Program Files\\Autodesk\\AutoCAD 2020\\fonts;"
	  "C:\\Program Files\\Autodesk\\AutoCAD 2020\\help;"
	  "C:\\Program Files\\Autodesk\\AutoCAD 2020\\Express;"

You could do something like this assuming you're adding these 3 paths.

(vla-put-supportpath
  *files*
  (strcat "C:\\Box\\Resources - Technical\\CAD\\_C3D Standards\\2020\\LISP;"
	  (getvar "RoamableRootPrefix")
	  ";"
	  (getenv "ACAD")
	  "C:\\ProgramData\\Autodesk\\C3D 2020\\enu\\Data\\Symbols\\MVBlocks;"
  )					; end of strcat
)
0 Likes
Message 6 of 19

JamesMaeding
Advisor
Advisor

@SkipBurns 

When I see people setting the main menu in acad.lsp, I wonder a bit.

If you are controlling that, it means you have some desired company setup.

Switching the main menu is a major deal to autocad, and generally thrashes pulldowns and several things leaving the user with correct menu, but a mess.

If you do have a company setup, consider making a standard profile, export it to .arg, then use that in a company icon with /p "full path to profile.arg".

That way you can configure many things that do not work well with startup lisp.

In addition, I do still have stuff like yours in the startup lisp, but a bit fancier for things like support paths where I allow users to add their own paths at the end. Some things work great in startup, and some should never be there IMO. If you are asking users to set a support path to your acad.lsp folder, then restart acad, that is pretty fragile.

I don't know if you are new at this, but switching the main menu is on par with adding -purge statement for regapps.

Its like when the problem happens (wrong main menu or excess regapps) the exact wrong solution is the startup lisp. thx

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 7 of 19

SkipBurns
Advocate
Advocate

I'm not actually setting the main cui to be that.. i was just testing.  That will be the enterprise and i'm setting the main cui for each user to be the "Custom" cui found in the roaming adesk support folder.  Profiles are too inflexible for managing many users.

 

This is basically the "bootstrap" technique.  IT installs a basic acad.lsp in the root support directory that points to the company standard lisp (which is what this will become).  This method combined with the enterprise cui allows me to manage users consistently and easily while still allowing them the flexibility to manager their workspaces and whatnot.  The users have to do nothing to get this setup.

0 Likes
Message 8 of 19

JamesMaeding
Advisor
Advisor

@ronjonp 

Big assumptions there. This whole tread is about control with startup, which implies company control.

In my shop, we do not point to profile folder for much, as I want control of many things.

If I need to add a font, I do it in company fonts folder (actually a local folder updated on login with robocopy).

Same for many things.

I leave the OOTB folders alone so a generic profile can run without company contamination for troubleshooting reasons.

Anyway, it will be common if supporting lots of people to explicitly set stuff you might think is normally OOTB.

thx


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 9 of 19

ronjonp
Mentor
Mentor

@JamesMaeding wrote:

@ronjonp 

Big assumptions there. This whole tread is about control with startup, which implies company control.

In my shop, we do not point to profile folder for much, as I want control of many things.

If I need to add a font, I do it in company fonts folder (actually a local folder updated on login with robocopy).

Same for many things.

I leave the OOTB folders alone so a generic profile can run without company contamination for troubleshooting reasons.

Anyway, it will be common if supporting lots of people to explicitly set stuff you might think is normally OOTB.

thx


I'm just guessing, waiting for the OP to respond about why he's overwriting the original paths set by AutoCAD.

 

My example is quite contrary to "I leave the OOTB folders alone so a generic profile can run without company contamination for troubleshooting reasons." that is why (getenv "ACAD") is part of the paths added. Did I miss something?

 

I have a similar setup as you although most of my stuff is set with my *.mnl and same update procedure locally with Windows login script. 🍻

0 Likes
Message 10 of 19

ronjonp
Mentor
Mentor

@JamesMaeding wrote:

@SkipBurns 

I don't know if you are new at this, but switching the main menu is on par with adding -purge statement for regapps.

 


Can you elaborate on this?

0 Likes
Message 11 of 19

JamesMaeding
Advisor
Advisor

@SkipBurns 

I get it, you are growing your files into the acad OOTB setup via startup lisp.

Through the years that approach has taught me only very good troubleshooters can handle that if things go wrong.

Part of the problem is other things try to do the same, and you end up with a mix of your stuff and others.

Just saying to have complete separate folders for fonts, lisps, whatever gives some advantages you may want someday.

You have a clue, so anything can work. The problem is places that don't and someone sets things up and is not there to help when the users hack away. I prefer an active system that controls the whole folder, not just copies in a few files.

anyway, just offering ideas, thx


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 12 of 19

JamesMaeding
Advisor
Advisor

@ronjonp 

The idea of overwriting all OOTB paths is common in my experience.

The person generally wants no assumptions. If the user reorders paths or deletes, the cad manager puts them back.

I do that too, and my paths are a combination of company and prog files/profile folders, in a rather specific order.

That's all I meant. Sounds like you have a good setup too so thx for participating.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 13 of 19

lroyal
Explorer
Explorer

I appreciate the feedback.  I've done the .arg approach for many many years.  I'm over it 😄 I'm the only one with full control here, so i have more flexibility to setup a system how i want.

 

@ronjonp I'm going to switch i think to your approach of just appending the company support folders.  i was just replacing all support folders wholesale because i've seen some go missing in the past.

0 Likes
Message 14 of 19

SkipBurns
Advocate
Advocate
lroyal post was from me. dumb autodesk changes my login when i login to the manage.autodesk.com site LOL
0 Likes
Message 15 of 19

JamesMaeding
Advisor
Advisor

@ronjonp 

"Can you elaborate on this?"

Sure. I'll start with regapp example. If you have the excess regapp issue, that means in practical terms you have more than 5000 unused regapps bulking the drawing. Actually 30k is more like when you care about purging them.

Regapps infect drawing to drawing through xrefs, so if you discover your sheet has 30k regapps, its because an xref does also. It makes no sense to -purge the current drawing, as they will come right back next open. You must instead use a tool to clean current file and any xrefs before reopening. Look up my free purgeids tool... To try to always clean on startup is asking for lockups and long delays for no benefit, though it sounded good to Autodesk. They knew better and threw us a band aid when we needed a tourniquet.

Same goes for switching main menu. If you have a wrong main menu, it implies you are far from company standard land. Switching to a company main menu in startup is going to thrash the pulldowns and everything. Its kind of a side issue as the OP (forget who it was now...) was only testing with that. They were going to use it on enterprise menu which is rather harmless. Got me all going, then bluffed. I fell for it..


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 16 of 19

ronjonp
Mentor
Mentor

@JamesMaeding wrote:

@ronjonp 

"Can you elaborate on this?"

Sure. I'll start with regapp example. If you have the excess regapp issue, that means in practical terms you have more than 5000 unused regapps bulking the drawing. Actually 30k is more like when you care about purging them.

Regapps infect drawing to drawing through xrefs, so if you discover your sheet has 30k regapps, its because an xref does also. It makes no sense to -purge the current drawing, as they will come right back next open. You must instead use a tool to clean current file and any xrefs before reopening. Look up my free purgeids tool... To try to always clean on startup is asking for lockups and long delays for no benefit, though it sounded good to Autodesk.


Agreed. Registered applications are a virus 🤧. I use the regapp cleanup tool for a few clients when bases come in the door and have had an order of millions removed. 

 

I believe at some point Autodesk stated that the xref propagation problem had been fixed but I'm on 2020 and it still persists.

 

Happy New Years! 🍻

0 Likes
Message 17 of 19

ronjonp
Mentor
Mentor

@JamesMaeding  Do you have an updated link for your PurgeID's tool? I don't have access to THIS one.

0 Likes
Message 18 of 19

JamesMaeding
Advisor
Advisor

@ronjonp 

sure, use this, thx:

PurgeIDs 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 19 of 19

ronjonp
Mentor
Mentor

Thanks (y).

0 Likes