Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Toggle button for workspace

5 REPLIES 5
Reply
Message 1 of 6
biscuits
184 Views, 5 Replies

Toggle button for workspace

I'm looking to write a macro for a button which will toggle between one of two workspaces (2D and 3D).....

somewhat similar in concept to the following macro to toggle iso on and off:

^C^C(setvar "snapstyl" (- 1 (getvar "snapstyl")))

anyone have any ideas?
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: biscuits

Try using this ... (command "wscurrent" "MODELSPACE")

--

Gilbert L. "Chip" Harper

AutoDesk Discussion Group Facilitator
Web: http://www.hot4cad.com
Message 3 of 6
Anonymous
in reply to: biscuits

Try this:

(defun c:TW ()
(if (and (= (getvar "WSCURRENT") "yourWspace1"))
(COMMAND "WSCURRENT" "yourWspace2")
(COMMAND "WSCURRENT" "yourWspace1")
)
(princ)
)
Message 4 of 6
Anonymous
in reply to: biscuits

Your supposed to let them try on their own before you give them the entire
answer 😉

--

Gilbert L. "Chip" Harper

AutoDesk Discussion Group Facilitator
Web: http://www.hot4cad.com
Message 5 of 6
Anonymous
in reply to: biscuits

Oh, you're right. Thought I was in the AutoCAD NG.
here's a hint:

(getvar "WSCURRENT"); returns your current workspace
(setvar "WSCURRENT" "workspace_1"); sets workspace_1 current.
Use the "if" "and" statement to toggle.

Probably should of use setvar instead of command.
Message 6 of 6
biscuits
in reply to: biscuits

Thanks I "figured it out".

Works like a champ.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost