CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] ARKANCE | CONTACT - CZ | SK | EN | DE
Over 1.099.000 registered users (EN+CZ). AutoCAD tips, Inventor tips, Revit tips. Try the new precise Engineering calculator and the updated Barcode generator. New AutoCAD 2026 commands and variables.
Be.Smart Concrete webinar - extend your Revit
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

?
CAD discussions, advices, exchange of experience

CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.
This is a peer-to-peer forum. The forum doesn't replace the official direct technical support provided by ARKANCE for its customers.
How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedLabel Macro Help

 Post Reply Post Reply
Author
kaleden View Drop Down
Newbie
Newbie


Joined: 30.Sep.2008
Status: Offline
Points: 1
Direct Link To This Post Topic: Label Macro Help
    Posted: 30.Sep.2008 at 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:
  1. The user to specifies a point (_id;\)
  2. A variable is set with that point (_setenv;mypoint;$M=$(getvar,lastpoint);
  3. A leader is created with the first point at the location specified in (1) (_qleader;@;)
  4. 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.
Back to Top
saverio View Drop Down
Newbie
Newbie


Joined: 21.Oct.2008
Location: Italy
Using: AutoCAD All versions
Status: Offline
Points: 5
Direct Link To This Post Posted: 21.Oct.2008 at 02:18
All diesel macro are avaluated before executed.
So your getenv is evaluated BEFORE you clic. No way to solve this
Back to Top
Vladimir Michl View Drop Down
Moderator Group
Moderator Group

Arkance Systems CZ

Joined: 26.Jul.2007
Location: Czech Republic
Using: Autodesk software
Status: Offline
Points: 2124
Direct Link To This Post Posted: 21.Oct.2008 at 14:10
In fact there are ways to solve this - e.g. the LT Extension add-on uses a lot of such Diesel macros.
 
Vladimir Michl (moderator)
ARKANCE - https://arkance.world - Autodesk Platinum Partner
Back to Top
Sedlacek View Drop Down
Newbie
Newbie


Joined: 21.Oct.2008
Status: Offline
Points: 1
Direct Link To This Post Posted: 21.Oct.2008 at 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)";;^Z

Edited by Sedlacek - 21.Oct.2008 at 16:35
Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,152 seconds.