Jump to content

Recommended Posts

Posted

Hello.

 

I'm looking for a way to draw a polyline, where i enter the points with mouse clicking and when i click the final point and enter button, it writes in text the total lenght of polyline.

 

I know that i can go to the properties and see the total lenght of the polyline and then i can use mtext to write that value near my polyline, but because i have to do that more than 1000s times, i was wondering if there is a faster way or a lisp routine.

 

All ideas are welcome.

P.S. I'm using Autocad 2009 and i'm beginner/medium user.

 

Thank you

Posted

There are plenty of LISPs to get the length or even total length of multiple polylines and/or lines. Additional code would be needed to add text. It won't be dynamic though. Any time the length changed, you would have to run the code again. For that reason, you would probably want something that you do after the lines are drawn and not a part of the actual drawing process.

Posted

Thanks. I did a google search and found these lisps:

 

MIDLEN - http://www.lee-mac.com/midlen.html

LPL - http://www.kimprojects.com/sum-polyline-length-autocad-lisp/

ADDLINES - https://sites.google.com/site/cadkits/home/addlines

 

Not exactly what i'm looking because i would like to that with only one command, but its better than before, because now i only have to do first the pline command and after i use one of those lisp to automatically place the text with the lenght.

Posted

I would stick with that. Any more automation might over complicate it.

Posted

You can certainly change lee's code to recognise the last object created by amending the code to check if the variable SEL exists something like this but I have not changed lee's code, it would be better if he could do that, so a strange version doesn't exist, you could put the ssget part outside of the C:midline defun and pass it the SEL (defun c:midlen (SEL / *error* ......

 

lee's Code has some nice stuff in it like readability

 

; create pline by picking points press enter when finished
(command "_pline")
(while (= (getvar "cmdactive") 1 ) (command pause)
)

(setq sel (ssget "l"))
(if (not c:midlen) (load "MidLenV1-1.lsp"))
(c:midlen Sel)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...