MASSPROP COMMAND

MASSPROP COMMAND

Anonymous
Not applicable
1,779 Views
10 Replies
Message 1 of 11

MASSPROP COMMAND

Anonymous
Not applicable

Sorry, I have one question if somebody can help me!
Do you exist some lisp or comand who can show volume like MASSPROP but who would show volume of several separate. So if I have 15 different continent a body want my impressions of each volume without manual queries for each one?

0 Likes
1,780 Views
10 Replies
Replies (10)
Message 2 of 11

leeminardi
Mentor
Mentor

If the objects are solid you could temporarily union them together then use MASSPROP to get the total and then undo.

 

lee.minardi
Message 3 of 11

Anonymous
Not applicable

So are you saying that it is not possible get volume any solid work in particular? if I cut out the body height at every 10 cm to get the volume of each part automatically without manual calculations?

0 Likes
Message 4 of 11

dieters
Autodesk
Autodesk

dejanmirkovic91,

 

The answer that lminardigmail provided is good, but to understand your follow-up question, could you post an image to help us understand? I'd suggest creating a simplified representation of what you're working on by using only boxes, cylinders, and perhaps simple extruded profiles with some labels: A, B, C, etc.

 

Thanks,

Dieter

Dieter Schlaepfer
Principal Learning Experience Designer
Autodesk, Inc.
San Rafael, California
0 Likes
Message 5 of 11

Anonymous
Not applicable

Off course. Like this. In this case volume is the same for each segment, but of course I'd like to get a list volume of each segment.

0 Likes
Message 6 of 11

leeminardi
Mentor
Mentor

I think I understand now that what you would like to do is give one command and then select a bunch of solid objects and have a list of mass properties displayed rather than give the massprop command a bunch of times.  Yes?  

 

Would the list of mass properties need to identify which mass properties applies to which object? if so, how would you want that to be achieved? 

lee.minardi
0 Likes
Message 7 of 11

Anonymous
Not applicable

Yes. Yes. 🙂 

it does not matter: notepad text, .txt or anything else.

 

Thank you very much!

0 Likes
Message 8 of 11

leeminardi
Mentor
Mentor

Here's a quick and dirty program I wrote that to output the volume of selected solids.  It has limited testing.

 

(defun c:vols (/ s i n e ee v )
  (vl-load-com)
  (if (setq s (ssget))
    (progn
      (setq i 0
	    n (sslength s)
      )
      (while (< i n)
	(setq e	 (ssname s i)
	      ee (vlax-ename->vla-object e)
	)
	(if
	  (= (vla-get-ObjectName ee) "AcDb3dSolid")
	   (setq v (vlax-get ee 'Volume)
	   )
	   (princ "\nUnvalid Entity.")
	)				; end if
	(setq i (1+ i))
	(print v)
      )					; end while
    )					; end progn true
  )					; end if
  (princ)
)
lee.minardi
Message 9 of 11

Anonymous
Not applicable

This is great and thank you very much! 

 

But I would like to ask you one more question. I'd like to get a volume order from the bottom up or the top down does not matter, for now I'm getting mixed up. For example, if I cut my box at 20 parts of Volume I will list the first to third, and fifth but first while eighth etc. For example

 

Thanks again

0 Likes
Message 10 of 11

leeminardi
Mentor
Mentor

Here's a new version that outputs the volume and the solid's centroid location.  It displays the values on the screen and creates a space-delimited txt file you can open in Excel and sort the data as you wish.

 

Lee

 

(defun c:vols (/ fname s i n v c cx cy cz )
; lrm version 2.0 9/12/2017
; creates a space delimited file of selected solid object's
; volume, and x y z centroid coordinates
;  
  (vl-load-com)
    (setq fname (getfiled "Filename" "" "txt" 1))
    (setq fname (open fname "w"))
    (write-line "Volume centroid-x centroid-y centroid-z" fname)

  (if (setq s (ssget))
    (progn
      (setq i 0
	    n (sslength s)
      )
      (while (< i n)
	(setq e	 (ssname s i)
	      ee (vlax-ename->vla-object e)
	)
	(if
	  (= (vla-get-ObjectName ee) "AcDb3dSolid")

	   (progn

	     (setq v (rtos (vlax-get ee 'Volume))
		   c (vlax-get ee 'Centroid)
		   cx (rtos (nth 0 c))
		   cy (rtos (nth 1 c))
		   cz (rtos (nth 2 c))
	     )

	     (write-line (strcat v " " cx " " cy " " cz) fname)

	     (princ "\n") (princ v) (princ " ") (princ cx)(princ " ") (princ cy)(princ " ") (princ cz)
	   )
	   (princ "\nInvalid Entity.")
	)				; end if
	(setq i (1+ i))
      )					; end while
    )					; end progn true
  )					; end if
  (princ)
)

 

lee.minardi
Message 11 of 11

Anonymous
Not applicable

work excelent!

Thank you.

0 Likes