Jump to content

Simple (i think) lisp routine to display a Mass volume value?


Recommended Posts

Posted

Hello lisp guru's

 

I wonder if you can help, can anyone show how to create a lips routine which once invoked, askes to select a 3d object, once the oject is selected the routine then gathers the mass volume number, then does the following formula;

(Mass figure/1000000000) x 2.5 which will then display it on the screen in a small box to be written down?

 

It sounds simple but I havnt got a clue as ive not touched on lisp in over 15 years so ive forgotten everything.

 

Any help would be most appreciated.

 

Many thanks

 

Raj

Posted

Why couldn't you just use the "Write analysis to file?" option in the MASSPROP command and do the math yourself?

Posted

was just trying to add a bit of automation to speed up the process. the info is going into a box on the tittle block you see

Posted

would be nice if it would auto input the info into a text box which can be placed within the desired title block area, but that would be wishing lol

Posted (edited)

Like Remark when you do a Massprop the option is to write to a file, you then just reread that file and pull out the values you want and pick a point to write the answer or simpler use the centroid value. Did this years ago for concrete tilt panels using lisp. I just did it for someone so would have to start from scratch again.

 

super simple use VL the volume is a variable.

 

(defun c:mprop ( / obj vol cenpt)
(setq obj (vlax-ename->vla-object(car(entsel "pick solid"))))
(setq vol (rtos (vla-get-volume obj) 2 1))
(setq cenpt (vla-get-centroid obj))
(setq mspace (vla-get-modelspace 
            (vla-get-activedocument 
            (vlax-get-acad-object))))
(vla-addtext mspace vol cenpt 2.5) 
)

Edited by BIGAL
  • 3 weeks later...
Posted

Cheers a lot al will get that a go

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