Jump to content

Change Profile from Command Line / Lisp??


ILoveMadoka

Recommended Posts

I switch back and forth between two profiles all the time

and was wondering in it is possible to do this via lisp?

Wanting to create a shortcut to flip from one profile

to the other and back again as needed.

Something along the lines of Profile1 and Profile2.

 

Is it as simple as a setvar?

 

 

TIA!!

Link to comment
Share on other sites

this is what i use for mt 2D and 3D profile switch

just change the 2D and 3D to your profile names

 

 
(vl-load-com)
(defun c:po (/ cpr)
 (if (= (getvar "cprofile") "3d")
   (setq cpr "2d")
   (setq cpr "3d")
 )
 (if (= cpr nil)
   (setq cpr "2d")
 )
 (vla-put-ActiveProfile
   (vla-get-Profiles
     (vla-get-Preferences (vlax-get-acad-object))
   )
   cpr
 )
) ;_defun

Link to comment
Share on other sites

Untested...

(defun c:PTog (/ lst)
 (setq lst '("Profile1" "Profile2"))

 (vl-catch-all-apply
   (function vla-put-activeprofile)
   (list (vla-get-profiles (vla-get-preferences (vlax-get-acad-object)))
         (if (eq (getvar 'cprofile) (car lst))
           (cadr lst)
           (car lst)
         )
   )
 )
 (princ (strcat "Active Profile: \"" (getvar 'cprofile) "\""))
 (princ)
)

Link to comment
Share on other sites

Awesome guys!!

 

Only thing better than a solution is having multiple solutions...

 

 

Thanks much!

Link to comment
Share on other sites

Awesome guys!!

 

Only thing better than a solution is having multiple solutions...

 

 

Thanks much!

 

Makes life fun. :)

 

You're welcome.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...