^c^c^c_setenv;osnaps;$m=$(getvar,osmode);setvar "osmode" 32;-la;m;COVERMETER;;.text;mc;M2P;\;XX;layerp;-la;c;GREEN;COVERMETER;;setvar "osmode";$(getenv,"osnaps");
So the gist of it is I get my current snaps and then I change it to only intersection. Then I put some text onto a layer between 2 selected points. All good so far.
The problem is at the end. I want to get my previous snaps back and it doesn't work at all. HOWEVER it does save the correct binary value in the "osnaps" variable.
I've just tried it a few times and it "remembers" the previous setting for the variable and puts that in instead of the "current setting"
Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Solved! Go to Solution.
Solved by Paul_Gander. Go to Solution.
Because I might send it to my fellow worker and her preferred settings might not be the same as mine.
Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Difficult! The problem is that setenv doesn't get written into the variable until after the macro closes, which is why getenv is reading the old value. I would say leave the osnap value alone and use the command modifier 'int' before the pause for user pick points as it will only allow the intersection snap to be selected, but that is also a problem because the modifier 'm2p' only allows for one user pause in a macro but prompts for 2 pick points, the first point will indeed only select 'int' but the second point will accept any snap.
You will need a second nested macro expression enclosed in quotation marks so that the getenv function doesn't get evaluated until after setenv command has been executed. Try this:
^C^C^C_setenv;osnaps;$m=$(getvar,osmode);setvar;osmode;32;-la;m;COVERMETER;;.text;mc;m2p;\;XX;layerp;-la;c;green;COVERMETER;;setvar;osmode;"$m=$(getenv,osnaps)";
or alternatively, use the cal command to determine the mid point between two intersection snaps without the need to modify the current running object snap setting:
^C^C^C-la;m;COVERMETER;;.text;mc;'cal;(int+int)/2;\\\;XX;layerp;-la;c;green;COVERMETER;;
@Paul_Gander Your first solution is the one I needed. Cheers. The reason why I can't use the second one is I don't know which snaps my colleague prefers.
Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
@h_s_walker wrote:
@Paul_Gander Your first solution is the one I needed. Cheers. The reason why I can't use the second one is I don't know which snaps my colleague prefers.
OSNAPCOORD (System Variable) set to 1 may be the answer you need https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2021/ENU/AutoC...
No the person who will be using it knows how to use AutoCAD and it works just how I wanted it to now
Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Can't find what you're looking for? Ask the community or share your knowledge.