hjsolf Posted March 17, 2016 Posted March 17, 2016 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 Quote
RobDraw Posted March 17, 2016 Posted March 17, 2016 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. Quote
hjsolf Posted March 17, 2016 Author Posted March 17, 2016 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. Quote
hjsolf Posted March 17, 2016 Author Posted March 17, 2016 So its better first to draw the polyline and then use a lisp routine to automatically place the text label. Found this one: http://www.lee-mac.com/midlen.html Tried and worked like a charm Quote
RobDraw Posted March 17, 2016 Posted March 17, 2016 I would stick with that. Any more automation might over complicate it. Quote
BIGAL Posted March 17, 2016 Posted March 17, 2016 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) Quote
Recommended Posts
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.