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

Help with Text Macro

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
gil.dalton
911 Views, 5 Replies

Help with Text Macro

I am trying to create a little macro that places some boiler plate text next to a polyline that denotes a sewer (see below); the idea is to use the CAL command to get the length of the polyline and then use that in the text. The problem I am having is that the distance is only returned after the -MTEXT command begins and instead of setting the USERR1 variable sets the start point of the MTEXT.

 

How can I make this macro execute in the correct sequence?

 

^C^C_setvar;userr1;'cal;dist(end,end);\\;$M=-mtext;\R;\J;BC;H;0.5;W;0;150%%C PVC PIPE "$M=$(getvar,userr1)"m @ 1:100;;

 

Many thanks in advance.

5 REPLIES 5
Message 2 of 6
steve216586
in reply to: gil.dalton

Please see this forum: http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/bd-p/130

 

 I think it has been explained many times.

"No one can make you feel inferior without your consent. "-Eleanor Roosevelt
Message 3 of 6
gil.dalton
in reply to: steve216586

I did search the forums before posting but unfortunately couldn't find anything that explained the problem I was having; maybe you point me in the direction of just one of the many times you refer to.

Message 4 of 6
gil.dalton
in reply to: gil.dalton

I managed to solve this; the 'CAL command section need another pause(\), three in total, to allow the user to pick the two end points then another to let the returned value to drop into the USERR1 variable.

Message 5 of 6
Kent1Cooper
in reply to: gil.dalton


@Anonymous wrote:

I am trying to create a little macro that places some boiler plate text next to a polyline that denotes a sewer (see below); the idea is to use the CAL command to get the length of the polyline and then use that in the text. ....

 

@^C^C_setvar;userr1;'cal;dist(end,end);\\;$M=-mtext;\R;\J;BC;H;0.5;W;0;150%%C PVC PIPE "$M=$(getvar,userr1)"m @ 1:100;;

....


Here is a routine that you may find interesting, if you're talking about marking lengths of individual line segments of Polylines.  It puts an indicator along every@ segment of a Polyline, all at once.  Because of what was being asked for, it labels line segments only as straight -- "STR" -- but you could replace that text content with "150%%C PVC PIPE <>m @ 1:100" and it will include the length without using 'cal, but as a Dimension with text override that includes the measured length, and with extension and dimension lines suppressed.  That has the great advantage that it will update if you Stretch the Polyline, without your needing to erase or edit or re-do anything.  It has two commands, one to put the indicators on the inside of the Polyline and one on the outside.  You would want to change some of its standards such as the font used, position off the Polyline, etc., but see what you think.

Kent Cooper, AIA
Message 6 of 6
gil.dalton
in reply to: Kent1Cooper

Thanks for the link Kent. The macro has to be used in LT aswell so LISP is out.

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

Post to forums  

Autodesk Design & Make Report

”Boost