Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted

Is this part of a much larger routine?

Posted

yes. this part of a much larger routine

and i'm new with the lisp programming

so thanks for the respond and the forum

Posted
(vla-get-length (vlax-ename->vla-object (car (entsel))))

Posted

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

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

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