Jump to content

LISP for summing object lengths by type - need help to modify

Recommended Posts


BOMLengths 2019.lsp


I've been using this LISP over the last year (attached) and it works great for summing lengths of objects by type.  But would like to modify the LISP to include a layer option from the menu similar to the one used in the thread below.. Is this possible?


I would also like to modify this LISP to give you a total length in decimal feet rounded to 4 decimal places instead of feet/inches.


Because of the nature of our multi-year contract we are required to estimate using a specific 3rd party vendor website.  The quantity they require is almost always a decimal length in feet.  Which means every line item I have to convert either manually or in excel from what the existing lisp gives me for the total.


the LISP operation is pretty straightforward.

command "BOM" will set it in motion - from there you specify the object types you want to sum, you then specify the selection set and hit enter to get the total in feet/inches for that object type.



Share this post

Link to post
Share on other sites

The feet inches bit may be able to be changed by changing the rtos function (rtos %1 2 2) is decimal with 2 decimal places. It is using current unit settings like feet. (getvar "lunits")


The code needs to be double looped so it processes a list of layers and the objects in the (setq sset (ssget ssfilter)) where the filter is objects plus a layer. 


If you dont have splines and ellipses can be simplified using vl-get-length and circumference of a obj. 


Will try to find time but others jump in.



Share this post

Link to post
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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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