Hi!
I would like to know if it's possible to have the total length of different lines by selecting them in a drawing?
Those lines are all separated and it will take forever to do it manually on a calculator 🙂
Thx!
Solved! Go to Solution.
Solved by Kent1Cooper. Go to Solution.
Solved by nestly2. Go to Solution.
@israel.shawEKTNS wrote:
There are some errors with the .lsp. It was able to work well for most of the polylines in my drawing. But for some, it returns a value of 0. The length shows up in the properties panel the same way as the other polylines, but the app doesn't seem to see these ones.
Are any closed Polylines? If so, one way of getting their length with (vlax-curve-...) functions returns zero, but there's another way that doesn't. Which code out of sixty-some Messages and links are you using?
I was using the tlenght by braudpat in message 5. But it turns out the ones that weren't working were 2D polylines. It's an easy conversion, so I'm good now. But it's worth noting the lsp doesn't work for 2D polylines
@israel.shawEKTNS wrote:
I was using the tlenght by braudpat in message 5. But it turns out the ones that weren't working were 2D polylines. It's an easy conversion, so I'm good now. But it's worth noting the lsp doesn't work for 2D polylines
It just left out the term for those. But a lot of them can be combined into the same length determination. You can change this much:
((member (vla-get-objectname ent) '("AcDbLine" "AcDb3dPolyline" "AcDbPolyline"))
(setq di (+ di (vla-get-length ent)))
)
((eq (vla-get-objectname ent) "AcDbArc")
(setq di (+ di (vla-get-arclength ent)))
)
((eq (vla-get-objectname ent) "AcDbCircle")
(setq di (+ di (vla-get-circumference ent)))
)
((member (vla-get-objectname ent) '("AcDbSpline" "AcDbEllipse"))
(setq di (+ di (vlax-curve-getdistatparam ent (vlax-curve-getendparam ent))))
)
to just this:
((member (vla-get-objectname ent)
'("AcDbLine" "AcDb3dPolyline" "AcDb2dPolyline" "AcDbPolyline"
"AcDbArc" "AcDbCircle" "AcDbSpline" "AcDbEllipse"))
(setq di (+ di (vlax-curve-getdistatparam ent (vlax-curve-getendparam ent))))
)
Or:
((wcmatch (substr (vla-get-objectname ent) 5)
"Line,3dPolyline,2dPolyline,Polyline,Arc,Circle,Spline,Ellipse")
(setq di (+ di (vlax-curve-getdistatparam ent (vlax-curve-getendparam ent))))
)
Hello@Kent1Cooper
Thanks for the improvment !
Happy New Year, The Health, Bye, Patrice (The Old French EE Froggy)
Patrice BRAUD
Select the lines and enter DATAEXTRACTION, then window pops up. Select create new data extraction and click next. Enter file name for a new file n save it in your preferred location. Then click save and in next window select object in the current drawing and click the boton on right to it. Select the lines in your drawing. Click next. Click next again. On right in category unchecked all except geometry. In the left side unchecked all except length. Click next. Click next again. Select output data to. Xls. Select location n file name and it will b saved in excel file. Open that excel file n add all the lengths.
Is it possible to resend the link with the lisp? When I tried to use the link it no longer worked.
@CADDVV wrote:
Can you repost the lisp? The link does not work or has been removed.
Thanks!!
Hey there, I just downloaded this and when I run it, it says "The Total Length of the xx objects are : 0.000"
Any tips on why it's not working?
Thanks
Hello @OmniCardoso
Please use this version of the LENGTH routine !
The Health, Bye, Patrice (The Old French EE Froggy)
Patrice BRAUD
This should be bumped up to the #1 solution. I'm not anti LISP routine or anything but I feel like this solution will help people become better CAD users and not just solve a calculation problem.
Can't find what you're looking for? Ask the community or share your knowledge.