Jump to content

Material & Weight


Recommended Posts

Hello everyone,


I’ve dove head first into the overwhelming world of Autolisp… and needless to say I’m in way over my head.


I’ve been trying to put together a program for AutoCAD 14 with a dialog box that will allow the user to pick from a drop down list of standard materials/click a “select objects” button… apply selected material to 3D solids and have it display the weight based on the volume of the solid/s.


Furthermore, I have added two radio buttons: one for imperial measurement and one for metric measurement.


There is also another “select objects” Total button to calculate and display the combined weight of the entire 3D solid assembly.


I used a program called ObjectDCL to design the dialog box (ODC file and image attached). But that’s really as far as I got.


I found these links as a starting point but couldn’t figure out how to tie it all together:







I have the list of materials ready to insert along with the densities in lbs/in^3


I’m hoping one of you programming geniuses could please put it together to get it working as it is intended. I’m also hoping that I could then study that code and get some clue as to how it all works.


I'm intrigued by the potential of this programming language and would love to be introduced to it by one of the many experts on this forum. Thanks in advance and please let me know if I missed anything.




Link to comment
Share on other sites

I guess something like this should be used:

; (GetMass (vlax-ename->vla-object (car (entsel))) '(("ByLayer" 0) ("ByBlock" 0) ("Glass" 5) ("Concrete" 20)("Global" 1)))
(defun GetMass ( o L )
 (if (and (eq 'VLA-OBJECT (type o)) (vlax-property-available-p o 'Material)(vlax-property-available-p o 'Volume))
   (* (cond ( (cadr (assoc (vla-get-Material o) L)) ) (0)) (vla-get-Volume o))
); defun GetMass


Although you must learn some visual lisp and DCL (or just use LM:ListBox - if you are satisfied just with a user prompt).

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.

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