Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why doesn't this macro work every time?

11 REPLIES 11
Reply
Message 1 of 12
ChrisMackayOpticad
387 Views, 11 Replies

Why doesn't this macro work every time?

Ok all you clever people.  This one has got me stumped.  I hope I am posting this in the correct place;

 

I'm trying to write a macro that draws a closed polyline on a layer named "capping".  This will then be used as the profile for the sweep command.  Here is the macro;

 

^C^C_-layer;s;capping;;pline;-12.5,0;-12.5,40;7.5,50;67.5,50;87.5,40;87.5,0;c;   (the 'capping' layer will always exist in the drawing template)

 

It works great 80% of the time but every so often the macro will miss a point, sometime two, and the polyline will end up the wrong shape.  I've tested this with a couple of users on different workstations.

 

Any ideas?

 

 

 

 

11 REPLIES 11
Message 2 of 12

i am close to 100% that  "osnap" are your problem

 

( so i get the beer ? )

 

cw

If my post answers your question, please mark it as an Accepted Solution, so that others can find answers quickly!
Message 3 of 12

I did consider that, and tested with all status toggles off.  I'm pretty sure that didn't help.  I'll need to check this again now to reconfirm, but I don't believe it is the problem.

 

I'll get back to you on the beer front...

Message 4 of 12

I can't get it to fail in AutoCAD or LT: but I do not have Osnaps running either (add that code to your macro to turn it off and back one afterwards).
Message 5 of 12

Yep.  I think I will do that.  By far the most common error is the third point being place right on top of the second.  That would strengthen the osnaps argument.  I did actually considered an osnaps problem before posting here.  I thought i'd ruled it out however, but it would seem my ad-hoc testing methods leave a lot to be desired!

 

Thanks for your help.

 

Might even post the rest of the macro that does the 3d bit because there was a few funny things going on with that too.

 

Chris

Message 6 of 12

Turning osnaps on an off isn't actually all that simple...  here's why... please correct me if i'm wrong,

 

I can't us ^f to turn osnaps off because the might already be off before the macro is launched.  This would turn them on, somewhat defeating the purpose.  I could write -osnap;off; into the macro.  That would turn them of if they were on and keep them off if they were not.  Great.  But then if I use ^f to toggle them back onthe osnaps dialog box will lauch because all the osnaps had been turned off permanently at the start of the macro.

 

The only alternative I would see would be to use -osnaps; at the end of the macro to turn on a pre-defined ste of osnaps..  it's not perfect because this will overide users prefered snaps, but it would seem to be the best solution.

 

Is that about right?

Message 7 of 12

osmode

grap it , store it , turn it to 0 and if you ready turn it back

 

thats the way it shoud work

 

cw

 

If my post answers your question, please mark it as an Accepted Solution, so that others can find answers quickly!
Message 8 of 12

of course!  Great. thanks!

Message 9 of 12

Time to upgrade with a little LISP code my friend: simply read and store OSMODE setting, turn it to zero, run the macro, reset OSMODE as suggested above.
Message 10 of 12

It is the Osnaps, that cause the problem you can use the temporary overide "non" within your macro which is an easy way to stop the problem,

^C^Cpline;non;-12.5,0;non;-12.5,40;non;7.5,50;non;67.5,50;non;87.5,40;non;87.5,0;c;

 

Message 11 of 12

I had considered that.  using the osmode variable seems to be the most 'elegant' solution

Message 12 of 12
cadwomen
in reply to: steven-g

In your routine, do:
(setq old_osmode (getvar "OSMODE"))
(setvar "OSMODE" 0)
...
... do stuff
...
(setvar "OSMODE" old_osmode); reset old values on exit.

 

or use

 

OSNAPCOORD it will be better if you have a crash  use F1 for help

 

cu cw

If my post answers your question, please mark it as an Accepted Solution, so that others can find answers quickly!

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

Post to forums  

Autodesk Design & Make Report

”Boost