Switch profile lisp

Switch profile lisp

Anonymous
Not applicable
1,636 Views
6 Replies
Message 1 of 7

Switch profile lisp

Anonymous
Not applicable

Hi,

 

I am controlling two large sets of toolpalette groups using profiles (ProductA 1 & ProductB 1) for multiple users. I have a button set up to switch between the two profiles, so far so good. I also have a second set to work on in the background for updates (ProductA 2 & ProductB 2), so when i need to roll out the updated palettes i just update the lisp to load the background set of profiles. The problem i'm having is when i swap from ProductA 1 to ProductA 2 the Autocad mechanical shortcut is remembering the default ACADmpp profile or if i set it to ProductA 1 it will remember it. 

 

I have tried setting up a acad.lsp file in the support location to run another lisp saved on the network but i cant get it to work. 

 

Is there a way around this?

 

This is the acad.lsp i tried-

 

(setq lisp_path “\\uk\caddata\CAD Share\AutoDesk\mechanical\Tool_Palettes_2016\SUPPORT_2016”) ; sets the path

(if (findfile (strcat lisp_path "init.lsp")) ;If you can find a file called ‘init.lsp’

(load (strcat lisp_path "init.lsp")) ) ;Load the file called ‘init.lsp’

 

The init.lsp is -

 

;Load Visual Lisp

(vl-load-com)

;Import the admin (PRODUCTA 1 or PRODUCTA 2) Profile from the network

(vl-catch-all-apply 'vla-importprofile (list
(vla-get-profiles (vla-get-preferences (vlax-get-acad-object)))
"PRODUCTA 1"
"\\uk\caddata\CAD Share\AutoDesk\mechanical\Tool_Palettes_2016\SUPPORT_2016\USER PROFILES\PRODUCTA\PRODUCTA 1"
1)
)

;Set "PRODUCTA 1 or PRODUCTA 2" Profile current

(vla-put-ActiveProfile (vla-get-Profiles (vla-get-Preferences (vlax-get-acad-object)))"PRODUCTA 1")

;Set the "modemacro" sysvar to report the latest profile

(SETVAR "modemacro"(STRCAT "PROFILE: $(getvar, cprofile)"))

 

Thanks

 

Danny

0 Likes
1,637 Views
6 Replies
Replies (6)
Message 2 of 7

CodeDing
Advisor
Advisor

@Anonymous ,

 

When creating paths in strings, since the --> \ <-- character is an escape character, you will need to use two of them (or use a forward slash instead --> / ).

Try updating you paths with this implemented, like so:

“\\uk\\caddata\\CAD Share\\AutoDesk\\mechanical\\Tool_Palettes_2016\\SUPPORT_2016\\”

Best,

~DD

0 Likes
Message 3 of 7

Anonymous
Not applicable

I changed the path both ways to test it out but it didn't work, this is how i currently have it -

 

(setq lisp_path “//uk/caddata/CAD Share/AutoDesk/mechanical/Tool_Palettes_2016/SUPPORT_2016/”) ; sets the path

(if (findfile (strcat lisp_path "init.lsp")) ;If you can find a file called ‘init.lsp’

(load (strcat lisp_path "init.lsp")) ) ;Load the file called ‘init.lsp’

 

and the init.lisp file:

 

;Load Visual Lisp

(vl-load-com)

;Import the admin (PRODUCTA 1 or PRODUCTA 2) Profile from the network

(vl-catch-all-apply 'vla-importprofile (list
(vla-get-profiles (vla-get-preferences (vlax-get-acad-object)))
"PRODUCTA 1"
"//uk/caddata/CAD Share/AutoDesk/mechanical/Tool_Palettes_2016/SUPPORT_2016/USER PROFILES/PRODUCTA 1"
1)
)

;Set "PRODUCTA 1 or 2" Profile current

(vla-put-ActiveProfile (vla-get-Profiles (vla-get-Preferences (vlax-get-acad-object)))"PRODUCTA 1")

;Set the "modemacro" sysvar to report the latest profile

(SETVAR "modemacro"(STRCAT "PROFILE: $(getvar, cprofile)"))

 

On start up its still launching the target profile

 

Im not sure if it is the acad.lsp or init.lsp.

 

after start up in the command line it reads:

Customization file loaded successfully. Customization Group: ACAD
Customization file loaded successfully. Customization Group: CUSTOM
Customization file loaded successfully. Customization Group: EXPRESS
Customization file loaded successfully. Customization Group: APPMANAGER
Customization file loaded successfully. Customization Group: FEATUREDAPPS
Customization file loaded successfully. Customization Group: CHRONICLE
Customization file loaded successfully. Customization Group: HAWKER_CUI
c:\program files\autodesk\autocad 2018\acadm\amg3dim.arx cannot find a dll or other file that it needs.
c:\program files\autodesk\autocad 2018\acadm\amg3dim.arx cannot find a dll or other file that it needs.
c:\program files\autodesk\autocad 2018\acadm\amg3dim.arx cannot find a dll or other file that it needs.
c:\program files\autodesk\autocad 2018\acadm\amg3dim.arx cannot find a dll or other file that it needs.
c:\program files\autodesk\autocad 2018\acadm\amg3dim.arx cannot find a dll or other file that it needs.
Regenerating model.
**** System Variable Changed ****
1 of the monitored system variables has changed from the preferred value. Use SYSVARMONITOR command to view changes.
; error: syntax error
AutoCAD menu utilities loaded.*Cancel*
Command: *Cancel*
_RIBBON
*Cancel*
TOOLPALETTES
*Cancel*
COMMANDLINE
Command:

 

Thanks,

 

Danny

 

 

0 Likes
Message 4 of 7

Moshe-A
Mentor
Mentor

Danny,

 

(setq lisp_path “//uk/caddata/CAD Share/AutoDesk/mechanical/Tool_Palettes_2016/SUPPORT_2016/”) ; sets the path

 

notice the extra '/' slash at start

(setq lisp_path “/uk/caddata/CAD Share/AutoDesk/mechanical/Tool_Palettes_2016/SUPPORT_2016/”) 

 

why are you insist in not specifying drive name? it could prevent unexpected errors.

 

moshe

 

0 Likes
Message 5 of 7

Anonymous
Not applicable

I just tried this but it didn't work. The reason there is no drive is because it is on a network for multiple users to access. Would this have anything to do with it?

 

is there a way of troubleshooting this with ACAD to see where it is falling down?

 

Im 99.999% sure i have everything pointing in the right direction, but just to break it down more:

in this location i have the acad.lsp saved-

C:\Users\Danny\AppData\Roaming\Autodesk\AutoCAD Mechanical 2018\R22.0\enu\Support

 

The acad.lsp file has the following in-

(setq lisp_path “//UK/caddata/CAD Share/AutoDesk/mechanical/Tool_Palettes_2016/SUPPORT_2016/”) ; sets the path

(if (findfile (strcat lisp_path "init.lsp")) ;If you can find a file called ‘init.lsp’

(load (strcat lisp_path "init.lsp")) ) ;Load the file called ‘init.lsp’

 

I have the init.lsp file saved in the following location-

\\uk\caddata\CAD Share\AutoDesk\mechanical\Tool_Palettes_2016\SUPPORT_2016

 

The init.lsp has the following in-

;Load Visual Lisp

(vl-load-com)

 

;Import the admin "CAD_USER" Profile from the network

(vl-catch-all-apply 'vla-importprofile (list

(vla-get-profiles (vla-get-preferences (vlax-get-acad-object)))

"CAD_USER"

"//UK/caddata/CAD Share/AutoDesk/mechanical/Tool_Palettes_2016/SUPPORT_2016/USER PROFILES/CAD_USER.arg"

1)

)


;Set "CAD_USER" Profile current

(vla-put-ActiveProfile (vla-get-Profiles (vla-get-Preferences (vlax-get-acad-object)))"CAD_USER")

;Set the "modemacro" sysvar to report the latest profile

(SETVAR "modemacro"(STRCAT "PROFILE: $(getvar, cprofile)"))

 

The CAD_USER.arg is saved in-

\\uk\caddata\CAD Share\AutoDesk\mechanical\Tool_Palettes_2016\SUPPORT_2016\USER PROFILES

 

Thanks,

 

Danny

 

 

 

 

 

0 Likes
Message 6 of 7

Moshe-A
Mentor
Mentor

Danny,

 


@Anonymous wrote:

I just tried this but it didn't work. The reason there is no drive is because it is on a network for multiple users to access. Would this have anything to do with it?

if your library files is on the a shared network folder and this folder appears in the support files search path than you can skip the full path for (findfile) only specify the file name you looking for.

 

is there a way of troubleshooting this with ACAD to see where it is falling down?

yes there is, copy and paste each code line to the command prompt (or in VisualLisp console) and see the responds.

 

Im 99.999% sure i have everything pointing in the right direction, but just to break it down more:

in this location i have the acad.lsp saved-

C:\Users\Danny\AppData\Roaming\Autodesk\AutoCAD Mechanical 2018\R22.0\enu\Support

that's ok

 

The acad.lsp file has the following in-

(setq lisp_path “//UK/caddata/CAD Share/AutoDesk/mechanical/Tool_Palettes_2016/SUPPORT_2016/”)

you need to pay attention to details, you said you fixed it and it still appears double slash.

 

(if (findfile (strcat lisp_path "init.lsp")) ;If you can find a file called ‘init.lsp’

(load (strcat lisp_path "init.lsp")) ) ;Load the file called ‘init.lsp’

if init.lsp is not found than it does and load and the procedure it supposed to run is not done or functions it suppose to bring-in will not be at place.

 

I have the init.lsp file saved in the following location-

\\uk\caddata\CAD Share\AutoDesk\mechanical\Tool_Palettes_2016\SUPPORT_2016

note the path for acad.lsp is in R2018 and init.lsp is in R2016. although from autocad point of view it is ok i recommend to put all library files related to a release under that version (for the good order).

again the path above should appears in the support files search path.

 

The init.lsp has the following in-

;Load Visual Lisp

(vl-load-com)

 

;Import the admin "CAD_USER" Profile from the network

(vl-catch-all-apply 'vla-importprofile (list

(vla-get-profiles (vla-get-preferences (vlax-get-acad-object)))

"CAD_USER"

"//UK/caddata/CAD Share/AutoDesk/mechanical/Tool_Palettes_2016/SUPPORT_2016/USER PROFILES/CAD_USER.arg" ; note the double slash here. this must be full path including the drive otherwise

; the path should be in support files search path and "cad_user.arg" should be put in a (findfile) function.

; as it appears here no doubt it does not work.

1); this param should be 0 cause when it's 1 the windows registry would not be overridden.

)


;Set "CAD_USER" Profile current

(vla-put-ActiveProfile (vla-get-Profiles (vla-get-Preferences (vlax-get-acad-object)))"CAD_USER")

;Set the "modemacro" sysvar to report the latest profile

(SETVAR "modemacro"(STRCAT "PROFILE: $(getvar, cprofile)"))

 

The CAD_USER.arg is saved in-

\\uk\caddata\CAD Share\AutoDesk\mechanical\Tool_Palettes_2016\SUPPORT_2016\USER PROFILES

 

Thanks,

 

Danny

 

 

 

 

 


 

0 Likes
Message 7 of 7

Sea-Haven
Mentor
Mentor

You can copy the desktop icon and just change the startup command you can add /P for profile or change existing to the one you want.

0 Likes