Jump to content

TOTAL LISP IN TABLE by LAYER REQUEST


Loidy

Recommended Posts

Hello, i'm pretty new here and I don't have idea about making lisp.

I would like to request an edit of this lisp file (  LAYLENGTH -Sum Line Length and arrange in table by layer.LSP) I do not own this, and I forgot where did I download it (credits to him/her).

This is what exactly i'm looking, but I also want to get the TOTAL AREA / TOTAL VOLUME / TOTAL COUNT or QUANTITY  by just selecting/dragging all the items at once, and the result will be displayed in TABLE related to LAYERS, just like this LAYLENGTH FILE. I don't mind if they are in separate lisp file. I hope you guys could help me.  Thank you in advance. God Bless, Stay Safe

 

Link to comment
Share on other sites

A 1st step You can add the area after d (vlax-curve

 

Need to add a check is the property area obtainable for the object, as a Line has no area so use a IF

(if (= "AcDbLine" (vla-get-objectname))

(setq area 0.0)

(setq area (vla-get-area  (vlax-ename->vla-object ent)))

)

2nd Step need to probably do a check of layer name in list and do totals writing to table when layer name changes.

 

Lastly a google should find what you want its a common request.

Edited by BIGAL
  • Thanks 1
Link to comment
Share on other sites

@BIGAL (vlax-property-available-p vlaobj 'Area) is a stronger check, so that it would work on all object that you selected having the "Area" property.

Edited by Jonathan Handojo
  • Thanks 1
Link to comment
Share on other sites

sorry sir, I don't have idea in editing. here is my cad 2010 file and I found a LAYAREA.TXT however, it cannot compute the region of an exploded volume (although i tried to add the REGION word inside those lines,plines,circle... I'm getting error. Thank you for reply

LISP REQUEST SAMPLE.dwg LAYAREA.txt

Link to comment
Share on other sites

8 hours ago, Jonathan Handojo said:

@BIGAL (vlax-property-available-p vlaobj 'Area) is a stronger check, so that it would work on all object that you selected having the "Area" property.

I use vlax-curve-getarea since it can cover more object types and it can be passed an ename :)

(defun _getarea	(e / a)
  (if (vl-catch-all-error-p (setq a (vl-catch-all-apply 'vlax-curve-getarea (list e))))
    0.
    a
  )
)
;; (_getarea (car (entsel)))

 

  • Thanks 1
Link to comment
Share on other sites

Ronjonp & Johnathon I just looked at (setq ss (ssget ":L" '((0 . "LINE,POLYLINE,LWPOLYLINE,ARC,CIRCLE,ELLIPSE,SPLINE"))))  in code the line is only one with no area. But for reliability a check for area property is worthwhile.

  • Thanks 1
Link to comment
Share on other sites

I appreciates everyone's feedback, however, I don't know what to do or where should I input those codes/syntax you guys gave me.

I found this SAL.LISP which gives me the area (even the region what I wanted) however, the inputing of scale factor and copying the data into excel, i need to separate each layer and numbers in excel (too many things to do), unlike the automatic table like LAYLENGTH. Thanks again everyone.

 

 

SAL.LISP.txt

Link to comment
Share on other sites

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