Jump to content

Recommended Posts

Posted

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?

Posted

You could run 'distance' for the length of it and put each length into a calculator?

Posted
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.

Posted

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.

Posted

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.

Posted

Sorry Tyke, but I'm not sure how to best approach it, but it sounds like you do!

Posted

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.

Posted

Plus side is that the hammer is going to be fun to use.

 

Just don't break the glass that the nut's on!

Posted

There's gold in them there hills! Gold I say!:shock:

 

FYI - I did not bother to download and test the routine. That's up to someone else. I hope it works.

Posted

Mark you are a millionaire! :celebrate:

 

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 :danger:

 

B

Posted

The guys are delighted with the LISP routine and have already used it several times. Thanks again ReMark.

Posted

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?:lol:

  • 11 years later...
Posted

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)

 

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...