Change Enterprise CUI file path

Change Enterprise CUI file path

BrianHailey
Mentor Mentor
647 Views
6 Replies
Message 1 of 7

Change Enterprise CUI file path

BrianHailey
Mentor
Mentor

Well, apparently, I sent out my profile to all my users with the Main Customization File and the Enterprise Customization file paths switch. I would like to switch them back using a lisp but what I'm doing doesn't seem to work.

 

If I use:

(defun c:setpath ()
  (vl-load-com)
  (setq	acadObject  (vlax-get-acad-object)
	prefObject  (vlax-get-property acadobject 'Preferences)
	filesOBject (vlax-get-property prefObject 'Files)
  )
  (vlax-put-property filesObject 'SupportPath "C:\\temp")
)

it sets the support path just fine. However, if I use:

(defun c:setpath ()
  (vl-load-com)
  (setq	acadObject  (vlax-get-acad-object)
	prefObject  (vlax-get-property acadobject 'Preferences)
	filesOBject (vlax-get-property prefObject 'Files)
  )
  (vlax-put-property filesObject 'EnterpriseMenuFile "C:\\temp")
)

I get the following error: error: Automation Error. Error setting preference property
Any idea on what I'm doing wrong?

 

Thanks!

 

Brian J. Hailey, P.E.



GEI Consultants
My Civil 3D Blog

0 Likes
648 Views
6 Replies
Replies (6)
Message 2 of 7

ronjonp
Mentor
Mentor

I think it's readonly ... try this instead: (setenv "EnterpriseMenuFile" "C:\\Temp")

 

Not much for reference...

ronjonp_0-1662740843816.png

 

0 Likes
Message 3 of 7

BrianHailey
Mentor
Mentor

I appreciate the idea but that doesn't seem to work either.

 

I'm brand new to visual lisp, just following some tutorials and saw that "EnterpriseMenuFile" was listed in the VLIDE so I assumed I could change it. Interestingly enough, "(vlax-get-property filesObject 'EnterpriseMenuFile)" works just fine.

 

I tried the (setenv "EnterpriseMenuFile" "C:\\temp") but that doesn't change the path in my profile, but that variable has changed. If I do a (getenv "EnterpriseMenuFile"), it reports back "C:\\temp" but the (vlax-get-property filesObject 'EnterpriseMenuFile) still returns the old value and that's what's being displayed in the options.

 

Any other ideas on how to change this path? My next step is to create a new profile and push that out to all my users but I would really rather avoid that.

Brian J. Hailey, P.E.



GEI Consultants
My Civil 3D Blog

0 Likes
Message 4 of 7

ronjonp
Mentor
Mentor

@BrianHailey 

You might try restarting CAD then check the value. Sometimes that's needed when writing to the registry.

 

I just tried to replicate what you described and cannot .. even without a restart of CAD.

ronjonp_0-1662752440889.png

 

0 Likes
Message 5 of 7

BrianHailey
Mentor
Mentor
I'm a bit embarrassed. In my testing, I was setting the path to a folder, and not to a specific .cuix file. When I chose a file instead of a folder, the vlax-... works. I appreciate your help and I apologize for wasting your time.

Brian J. Hailey, P.E.



GEI Consultants
My Civil 3D Blog

0 Likes
Message 6 of 7

ronjonp
Mentor
Mentor

@BrianHailey wrote:
I'm a bit embarrassed. In my testing, I was setting the path to a folder, and not to a specific .cuix file. When I chose a file instead of a folder, the vlax-... works. I appreciate your help and I apologize for wasting your time.

No worries .. glad you got it sorted.

 

You could probably use something as simple as this:

(if (findfile "C:\\Temp\\file.cuix")
  (setenv "EnterpriseMenuFile" "C:\\Temp\\file.cuix")
  (alert "ENTERPRISE CUIX FILE NOT FOUND!")
)
0 Likes
Message 7 of 7

Sea-Haven
Mentor
Mentor

Not cui but support path.

 

 

(setq *files*  (vla-get-files  (vla-get-preferences (vlax-get-Acad-object))))
(setq paths (vla-get-SupportPath *files*))
(vla-put-SupportPath *files* (strcat "C:\\CAD-TOOLS\\SLIDES;C:\\CAD-TOOLS\\IMAGES;C:\\CAD-TOOLS;" paths))


(if  (> (vl-string-search  "BricsCAD" (getvar 'acadver)) 0)
(princ "Bricscad not found") 
(progn
(setq oldtrust (getvar 'trustedpaths))
(if (wcmatch  oldtrust "*XXX*")
(princ)
(setvar 'trustedpaths (strcat oldtrust ";" "c:\\CAD-TOOLS"))
)
)
)
(command "workspace" "save" "" "y")
(alert "\nSupport and trusted paths added")

 

 

0 Likes