Display full version of the post: Label Macro Help

kaleden
30.09.2008, 00:41
So I'm working with AutoCAD LT and wanted to create a quick macro to label points on my drawing with the XY coordinates.My macro SHOULD look like the following:^C^C_id;\_setenv;mypoint;$M=$(getvar,lastpoint);_qleader;@;\;4;($M=$(rtos,$(index,0,$(getenv,mypoint)),2,1),$M=$(rtos,$(index,1,$(getenv,mypoint)),2,1));;The idea is as follows:The user to specifies a point (_id;\)A variable is set with that point (_setenv;mypoint;$M=$(getvar,lastpoint);A leader is created with the first point at the location specified in (1) (_qleader;@;)The user specifies the final point and the mypoint variable is spit out in the mtext box. (\;4;.... the remainder of the code).The problem I'm having is that "mypoint," though set correctly, isn't being recalled correctly. getenv seems to recall the previous state of "mypoint" only when using $M=$(getvar,lastpoint). If, however, I prompted the user to specify the variable value, getenv would properly pull it out and label the leader.Perplexing.My current workaround involves splitting the macro into two parts:^C^C_id;\_setenv;mypoint;$M=$(getvar,lastpoint);^C^C_qleader;@;\;4;$M=$(rtos,$(index,0,$(getenv,mypoint)),2,1),$M=$(rtos,$(index,1,$(getenv,mypoint)),2,1));;
This works, but I have to hit two shortcuts instead of one.Can anyone help me bring this macro into one? Am I the only one having issues with this macro?Thanks.

saverio
21.10.2008, 02:18
All diesel macro are avaluated before executed.So your getenv is evaluated BEFORE you clic. No way to solve this

Vladimir Michl
21.10.2008, 14:10
In fact there are ways to solve this - e.g. the LT Extension add-on uses a lot of such Diesel macros.
 
See www.xanadu.cz/en/apps/LTextension

Sedlacek
21.10.2008, 16:09
Use quotes.

^C^C_id;\_setenv;mypoint;$M=$(getvar,lastpoint);_qleader;@;\;4;"($M=$(rtos,$(index,0,$(getenv,mypoint)),2,1),$M=$(rtos,$(index,1,$(getenv,mypoint)),2,1))";;

or

^C^C_id;\_setenv;mypoint;$M=$(getvar,lastpoint);_qleader;@;\;4;"$M=$(rtos,$(index,0,$(getenv,mypoint)),2,1),$M=$(rtos,$(index,1,$(getenv,mypoint)),2,1)";;^ZSedlacek2008-10-21 16:35:20