×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Macros & Diesel expressions in AutoCAD
2

Macros & Diesel expressions in AutoCAD

Macros & Diesel expressions in AutoCAD

(OP)
In AutoCAD (2000,2002 & LT) there are switches that turn on & off functions. Example if you go to Tools, Drafting Settings, Snap & Grid tab, there is an option to turn on isometric snap or rectangular snap. Now a short cut to do this is to type in ‘SNAPSTYL’ in the command prompt this gives you an option of 1 or 0 (on or off) that toggles the snap. If you want to create an icon to do this a macro is needed which is ‘^C^C_snapstyl 0 ’ or ‘^C^C_snapstyl 1 ’ However you need an icon to switch to iso view and another to switch to rectangular view (one with 1 & one with 0).
What I want to know is it possible to create a DIESEL expression in the macro that toggles the values of 1 and 0 without the need of two icons (just having the one).

RE: Macros & Diesel expressions in AutoCAD

2
Hi cmberry20,
This sounds like a perfect example of the kinds of things that Autolisp is good at. You can write a simple LISP program that checks the setting and then sets it to the opposite value. Then you can link the LISP program to your "toggle" button and it will work as you want. The only catch is that LT does not recognize LISP.

Let me know if you want the LISP code and I'll send it to you.

Hope this helps,
Paul

RE: Macros & Diesel expressions in AutoCAD

(OP)
yes please could you please post the LISP code. We used AutoCAD 2002 at work (as well as LT on other terminals).

thankyou

RE: Macros & Diesel expressions in AutoCAD

Hi Again,

As requested, here is the code:

(defun C:isosnap ()
  (setq CISO (getvar "SNAPSTYL"))
  (if (= CISO 0)
      (setvar "SNAPSTYL" 1)
      (setvar "SNAPSTYL" 0)
  );ends if
);ends defun

Save this into a Notepad file and "SAVEAS" with a name of "ISOSNAP.LSP".

Next, create the icon that you want and in the command execution section make sure that it reads:

^C^Cisosnap

Also, make sure that you APPLOAD the LISP program before you try to use it. Remember, Autocad LT won't be able to use this program.

Hope this helps,
Paul

RE: Macros & Diesel expressions in AutoCAD

(OP)
Brilliant, worked great. Thankyou for your help.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources