User Local CUIX File Deployment

User Local CUIX File Deployment

CNinBC
Advocate Advocate
1,076 Views
10 Replies
Message 1 of 11

User Local CUIX File Deployment

CNinBC
Advocate
Advocate

Base on our current CAD system setup, we have an enterprise menu CUIX file on the CAD server and a pre-defined user local CUIX file to be copied onto the user's local HDD. is there a way in ACADDOC.LSP file includes a function to create the folder on local HDD or OneDrive folder and then copy the local CUIX file from server if the file does not already exist? I hope the ACADDOC.lsp can be loaded and executed before the menu system starts loading.

 

Thanks in advance for any suggestion.

0 Likes
1,077 Views
10 Replies
Replies (10)
Message 2 of 11

Anonymous
Not applicable

We have a pretty similar setup. We have a profile that sets the enterprise cuix to the one on the server and the main cui to the template on the server, then we run the following code to create a local copy of the main cui that the user can then modify to their own personal preferences.

(vl-load-com)
(if (= (substr (getenv "MenuFile") 1 1) "W");if the current cui file is on W drive (progn (vl-mkdir "C:\\CAD");make a cad folder on C drive (vl-file-copy (strcat (getenv "MenuFile") ".cuix") (setq newcui (strcat "C:\\CAD\\" (vl-string-translate "." "-" (getvar "loginname")) ".cuix")));copy the current cui file to the cad folder on P drive (setenv "MenuFile" newcui);change the main cui file path to the new version on C drive ) )

Obviously you'll have to change the W to whatever letter your server drive is mapped to. And you can also change the path for the new cui location if C:\CAD isn't where you want the file saved.

I'd also recommend placing the code in ACAD.lsp instead of ACADDOC.lsp as ACAD.lsp is only run once each time a user opens cad whereas ACADDOC.lsp will be run every time they open a drawing.

Hopefully this at least helps you get in the right direction.

0 Likes
Message 3 of 11

CNinBC
Advocate
Advocate

Thanks @Anonymous , for my case, we only need to run this script once when CAD user first launch their CAD (just for CAD station initial setup), I will need to add an "if" condition before the make folder and the copy command, basically, if the CUIX file already exists in the folder (C:\CAD\Username), then skip the script.

0 Likes
Message 4 of 11

Anonymous
Not applicable

That should already be covered by the if statement that checks if the main cui file is on your server, so if the routine has already been run their main cui will be on their C drive and the routine will skip everything.

0 Likes
Message 5 of 11

dgorsman
Consultant
Consultant

For this type of run-once configuration, I normally use a simple BAT file with calls to mkdir and xcopy.  The user either calls the network located file from a hyperlink in an email, or there's a desktop shortcut which calls the BAT file(s), adds the AutoCAD desktop shortcut, and deletes the BAT shortcut. 

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 6 of 11

Sea-Haven
Mentor
Mentor

Re mkdir see if  it exists 1st

 

; make temp directory
(if (vl-file-directory-p "C:\\Acadtemp\\")
(Princ "Acadtemp exists")
(vl-mkdir "C:\\AcadTEMP\\")
)
0 Likes
Message 7 of 11

dgorsman
Consultant
Consultant

Right.  However, one of the shortfalls of LISP is AutoCAD must be up and running first.  The BAT file or other methods can be run completely independently of the program, including prior to running the secondary installer and importing a new profile from an ARG file (e.g. via startup argument).

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 8 of 11

CNinBC
Advocate
Advocate

Thanks all. I came up with a lisp code with all your help, please see below. next step for me is to incorporate that into ACADDOC.LSP, and test it out. I will have to make sure it runs before the menu system starts loading

 

(defun c:Binnie_CAD_Setup ()
	(vl-load-com)
	(Setq CAD_ROOT "C:\\CAD\\")
	(Setq C3D_Menu "Binnie_DI.CUIX")
	(Setq CAD_Menu "Binnie_CAD.CUIX")
	(setq CAD_User_ID (strcase (getvar "loginname")))
	(Setq CAD_PROF_Folder (strcat CAD_ROOT CAD_User_ID))
	(Setq CAD_Menu_Path (strcat CAD_PROF_Folder "\\" CAD_Menu))
	(Setq C3D_Menu_Path (strcat CAD_PROF_Folder "\\" C3D_Menu))
	(Setq C3D_Menu_Server_Path "S:\\WAN\\C3D 2017\\98-WORKSTATION\\Binnie-DI.cuix")
	(Setq CAD_Menu_Server_Path "S:\\WAN\\C3D 2017\\98-WORKSTATION\\Binnie-CAD.cuix")
	(if (vl-file-directory-p CAD_PROF_Folder)
		(Princ "CAD Profile Folder Exist Already")
		(vl-mkdir CAD_PROF_Folder)
	)
	(if (vl-file-directory-p C3D_Menu_Path)
		(Princ "CUIX Exist Already")
		(progn
			(vl-file-copy C3D_Menu_Server_Path C3D_Menu_Path)
			(vl-file-copy CAD_Menu_Server_Path CAD_Menu_Path)
			(Princ "Binnie Menu Syetem has been Succesfully Setup")
		)
	)
)
0 Likes
Message 9 of 11

CNinBC
Advocate
Advocate

according to the page linked below, the CUIX files are loaded before Lisp files, hmmmmmm......

 

https://www.cadnauseam.com/2008/09/01/what-is-loaded-at-autocad-startup-and-when/

0 Likes
Message 10 of 11

Sea-Haven
Mentor
Mentor

You can copy the desktop icon and change the profile that gets loaded this to me seems a better way to go, run a quick lisp and set everything up on the workstation then save a profile. We had this for one of our guys who used a laptop he just had two icons a local and sever, yes the laptop was also configured with server files so use was transparent.

 

Just look at out of box Autocad has a Imperial and metric icon.

0 Likes
Message 11 of 11

CNinBC
Advocate
Advocate

Thanks @Sea-Haven , we have AutoCAD/Civil 3D profile deployed that way already, however, I need to deploy the local CUIX file onto user's computer, wish that can be user's OneDrive folder so that all the workspace can follow the user.

0 Likes