Jump to content

Length Label Lisp


errorist

Recommended Posts

Hi, I have Lee-Mac's Area Label lisp and I modified it to give lengths of the lines selected by simply replacing "areas"s in code with "length"s :D 

 

 However it doesn't work with open lines. I guess the reason for that the code was designed to retreive areas of the selected objects must be closed (of course). So I looked up in the code to delete that option but I was not able to find anything about objects being closed except:

(vlax-curve-isclosed x)

but it can not be about this since it is about a curve, right? So anyone can help me about it please?

 

 

 

Link to comment
Share on other sites

A line can be considered as a curve without curvature if that makes sense. Vlax-curve functions work on lines, polylines, arc etc; they don't have to curves. I don't think it is possible to adapt the code to work with open polylines. It would be better to find a seperate lisp that just reports the length of open polylines. Try this simple lisp . There is no testing to exclude non line entities or infinite line entities. If you wish to expand on it, be my guest.

 

(defun c:LL ( / )
  (setq ent (car (entsel "\nSelect Line Entity : ")))
  (setq len (vlax-curve-getdistatparam ent (vlax-curve-getendparam ent)))
  (alert (strcat "Length is : " (rtos len 2 3)))
)  

 

Link to comment
Share on other sites

An alternative is to look at object then retrieve the length using the correct variable value, then use a simple Cond 

 

ARC = arclength

Line,pline = length

Circle = circumference

 

vla-get-length

 

Also lee-mac totallength.lsp

Edited by BIGAL
Link to comment
Share on other sites

  • 2 years later...

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