Jump to content

Turning object snap on/off within a macro.


Mirkin

Recommended Posts

Cheers for all the advice.

I think I'll use osmode in my macro for now.

I have a few more questions.

1. Is there a way to switch between osnap and gridsnap while a command is active (move for example)

2. If I load the lisp routine into autocad using appload is it there forever or do I have to load it on each start?

 

Thanks again for the help.

This Macro will do it: 'setvar;gridmode;$M=$(if,$(and,16384,$(getvar,osmode)),0,1);^F

 

 

DIESEL works best for macros. Using lisp in a macro can cause issues if you use them while another lisp is running.

Link to comment
Share on other sites

  • Replies 26
  • Created
  • Last Reply

Top Posters In This Topic

  • Mirkin

    9

  • ReMark

    7

  • tombu

    4

  • YZ

    2

Top Posters In This Topic

Thanks for the reply

I tried what you posted but it doesn't seem to work quite how I would like.

It turns object snap on and off but doesn't toggle grid snap, it just turns the grid on and off.

Maybe I need two commands, one to go one way and one to go the other.

Link to comment
Share on other sites

Thanks for the reply

I tried what you posted but it doesn't seem to work quite how I would like.

It turns object snap on and off but doesn't toggle grid snap, it just turns the grid on and off.

Maybe I need two commands, one to go one way and one to go the other.

A space appears to be in osmode in the macro I posted, you need to remove it. Sorry, I'm not as familiar with posting code on this site. The DIESEL part sets gridmode the same as osmode, then the ^F toggles osmode so when osnaps are on gridmode is off and when osnaps are off gridmode is on.

Link to comment
Share on other sites

Hi Again

Yes I noticed the space and removed it.

As I said it turns grid mode on but doesn't actually turn grid snap on.

It's still a lot better than what I have but the final step would be great if you could manage it, because I'm clueless :)

Link to comment
Share on other sites

Hi Again

Yes I noticed the space and removed it.

As I said it turns grid mode on but doesn't actually turn grid snap on.

It's still a lot better than what I have but the final step would be great if you could manage it, because I'm clueless :)

It only toggles gridmode off/on. You have to already have grid display options set in the drawing. Using ddrmodes I checked 2D model space under Grid style. I've never used grid, but this turns the display off/on. Was it the Snap you wanted on/off?

Link to comment
Share on other sites

Hi Tombu

I never usually use grid mode myself but we have a very old fashioned guy at our place and unfortunately he insists on a lot of the drawings being on a grid. I have no idea why.

This is why I need this command. I want to be able to quickly move things onto the grid when I forget to turn it on lol.

So ideally one click of the button will turn all OSnaps ON then turn gridmode + gridsnap OFF.

Clicking again would turn Osnaps OFF and then gridmode + gridsnap on.

If it's a real pain don't worry about it.

Link to comment
Share on other sites

Try this:

'setvar;gridmode;$M=$(if,$(and,16384,$(getvar,osmode)),0,1);'setvar;snapmode;$M=$(if,$(and,16384,$(getvar,osmode)),0,1);^F

 

 

Gotta take that space out again…

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...