Tyke Posted July 4, 2013 Posted July 4, 2013 I have been asked how to determine the length of a multiline. With a polyline if you click on it, it's length is displayed in the properties palette, but that doesn't work for a multiline as no length property shows up in the properties palette. I've searched but not come up with a solution. Does anybody have any ideas or am I going to have to it programmatically? Quote
PotGuy Posted July 4, 2013 Posted July 4, 2013 You could run 'distance' for the length of it and put each length into a calculator? Quote
Tyke Posted July 4, 2013 Author Posted July 4, 2013 You could run 'distance' for the length of it and put each length into a calculator? Very true. These multilines represent sleeves for cables and they and have mutiple nodes. I need to very quickly determine the total length. Quote
PotGuy Posted July 4, 2013 Posted July 4, 2013 How many lines are there? I can't really think of another solution, par from tracing w/ a polyline and getting the distance that way. Quote
Tyke Posted July 4, 2013 Author Posted July 4, 2013 It depends on the job. This particular one has two such multilines one is around 10 m long with 9 control points and the other around 120 m in length with 23 control points. The sleeves need to be labelled with type, length, diameter and material. Up until now we have always traced over them with a polyline, extracted the length of the polyline from the properties and then erased the polyline. For sleeves with many control points, regardless of their length, it is a time consuming task. I'm looking at saving time and hence my question. I think I will write something that will get the length of the multiline and cobble together the other informatio for the label and automativcallc place it on the sleeve. Quote
PotGuy Posted July 4, 2013 Posted July 4, 2013 Sorry Tyke, but I'm not sure how to best approach it, but it sounds like you do! Quote
Tyke Posted July 4, 2013 Author Posted July 4, 2013 It looked so simple at first and I found it difficult to believe that in AutoCAD I could find no way of determining the length. It looks like its going to be a very large hammer to crack a very small nut. Quote
PotGuy Posted July 4, 2013 Posted July 4, 2013 Plus side is that the hammer is going to be fun to use. Just don't break the glass that the nut's on! Quote
ReMark Posted July 4, 2013 Posted July 4, 2013 Well there is one alternative and that is to abandon the use of multilines in favor of polylines. Or.... Use the lisp routine that appears in the next to last post of this thread found in the AutoCAD Discussion Group. http://forums.autodesk.com/t5/AutoCAD-2004-2005-2006-DWG/Multiline-Lengths/td-p/1864693 Quote
ReMark Posted July 4, 2013 Posted July 4, 2013 There's gold in them there hills! Gold I say! FYI - I did not bother to download and test the routine. That's up to someone else. I hope it works. Quote
Tyke Posted July 4, 2013 Author Posted July 4, 2013 Mark you are a millionaire! It works extremely well. Many thanks for the tip. All I have to do now is to translate it into German for the guys here. But I'm still going to get that big hammer out B Quote
Tyke Posted July 4, 2013 Author Posted July 4, 2013 The guys are delighted with the LISP routine and have already used it several times. Thanks again ReMark. Quote
ReMark Posted July 4, 2013 Posted July 4, 2013 I'm glad to hear that it actually worked. Most times I'll test a lisp routine before posting a link to it but I was not on my CAD computer when I ran across that one. The feedback is appreciated. You're entirely welcomed. BTW...will that million be cash or check? Quote
TB_75GNH Posted May 20 Posted May 20 Does anyone have a working link to the lisp provided above? Or a copy of the lisp? The link below (that was provided) keeps getting redirected from the forum archive. http://forums.autodesk.com/t5/AutoCAD-2004-2005-2006-DWG/Multiline-Lengths/td-p/1864693 Quote
SLW210 Posted May 20 Posted May 20 Yes, Autodesk is bad about redoing their website and killing old links. I just do a new search and get the same thread or similar that solves the problem sometimes, but I see you found another thread on Autodesk forums to ask. This might do what you need... Lisp for total length of multilines with different scales - AutoLISP, Visual LISP & DCL - AutoCAD Forums Quote
BIGAL Posted May 21 Posted May 21 Use something like this, can be used in your code. (setq lst (vlax-get (vlax-ename->vla-object (car (entsel "Pick mline "))) 'coordinates)) (setq len 0.0) (setq x 0) (setq pt1 (list (nth x lst)(nth (1+ x) lst))) (setq x 3) (repeat (- (/ (length lst) 3) -1) (setq pt2 (list (nth x lst)(nth (1+ x) lst))) (setq len (+ len (distance pt1 pt2))) (setq pt1 pt2) (setq x (+ x 3)) ) (princ len) Quote
SLW210 Posted May 21 Posted May 21 Alternatively, @Lee Mac has some LISPs that I would recommend over MultiLines. Creates Multiline with polylines, much better IMO... Multi-Polyline | Lee Mac Programming Some updates to the original here. To convert Multiline to Polylines... Multilines to Polylines | Lee Mac Programming 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.