mousho Posted October 4, 2016 Posted October 4, 2016 I'm trying to get the length of pline in a lisp and wonder if there is a fast way. i try to change a lisp of area but there isnt getvar for lengthen. area lisp: (Command "area" "e" ent "text" "m" pause (* (GetVar "DimScale") S) pause (StrCat "S=" (Rtos (GetVar "area")) 2 2))) length lisp: (Command "LENGTHEN" "L" "" "text" "m" p333 4.8 "0" (StrCat "S=" (Rtos (GetVar "LENGTHEN") 2 2))) ill be glad if someone would help me with this Quote
ReMark Posted October 4, 2016 Posted October 4, 2016 Are you trying to get the length of just one pline or are you trying to get the total length of several plines? Here is a lisp you might be interested in... https://ravikumarvemana.wordpress.com/2011/10/17/to-get-the-length-of-selected-linesplinelwpolypolylines/ Quote
mousho Posted October 4, 2016 Author Posted October 4, 2016 i'm trying to get the length of just one pline. i change the line to: (Command "LENGTHEN" "L" "" "text" "m" p333 4.8 "0" (StrCat "S=" (Rtos (GetVar "Perimeter") 2 2))) for now it's work for me. Quote
mousho Posted October 4, 2016 Author Posted October 4, 2016 yes. this part of a much larger routine and i'm new with the lisp programming so thanks for the respond and the forum Quote
alanjt Posted October 4, 2016 Posted October 4, 2016 (vla-get-length (vlax-ename->vla-object (car (entsel)))) Quote
Lee Mac Posted October 4, 2016 Posted October 4, 2016 Another: (defun getlength ( ent / par ) (if (not (vl-catch-all-error-p (setq par (vl-catch-all-apply 'vlax-curve-getendparam (list ent))))) (vlax-curve-getdistatparam ent par) ) ) (getlength (car (entsel))) Quote
alanjt Posted October 4, 2016 Posted October 4, 2016 Another:(defun getlength ( ent / par ) (if (not (vl-catch-all-error-p (setq par (vl-catch-all-apply 'vlax-curve-getendparam (list ent))))) (vlax-curve-getdistatparam ent par) ) ) (getlength (car (entsel))) Also, this method will work on lines, circle, arc, lwpolylines, 2d polylines, 3d polylines, etc. 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.