DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

Volume of a solid

Started by RDBarthel, December 19, 2012, 08:44:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RDBarthel

I want my macro to determine the volume of a solid.  The Volume command (>VOLUME{}) sets SYS(656) successfully but it displays the Area, Volume, and Precision window which must be replied to.  When the drawing contains 150 solids that's painful.

1.) Is there some other way to set SYS(656) besides the VOLUME command?

2.) Is there some way to suppress the Area, Volume, Precision window?

Here's what I'm doing

FOR i = 1 to SYS(9)   
   ENTITY i
   POINTVAL x, y, z, 2      ' Get a point on the entity avoiding a common point between two solids
   >Pointselect
   {
    <PointXYZ [x, y, z]
   }
   >Volume      
   {
    <PointXYZ [x, y, z]
   }
   volme = SYS(656)
NEXT i

This works but requires a reply to the >Volume command.  Yes, there's a whole lot more going on to select appropriate entities (primarily entity type 31) and avoid duplicates, etc., etc. not relevant to my questions.

I'm using DC 18.2.

Some suggestions?

prl

#1
Suppress (skip) the dialog.  See the sample code, lines in blue.  Works with DC 18.3.


'program: test.d3m

>Box
  {
  <Pointxyz 0, 0, 0
  <Pointrel 10, 10, 10
  }

sys(36) = 2 'suppress dialog
>Volume
  {
  <Pointxyz 0, 0, 0
  }
sys(36) = 0 'reset to normal

'first box volume
volbox1 = SYS(656)

'draw a couple more boxes
>Box
  {
  <Pointxyz 0, 0, 0
  <Pointrel 20, 20, 20
  }

>Box
  {
  <Pointxyz 0, 0, 0
  <Pointrel 30, 30, 30
  }

Message "Volume of small cube is: ", volbox1

End

RDBarthel

PRL,

1.  Thank works just great!  I moved the SYS(36)=2 to just before the FOR loop begins to suppress all the redrawing that results from each solid being selected.  Now I just watch the mouse move from one solid to the next.  The show is not nearly as colorful but it is quicker.  The SYS(36)=0 is located just after the end of the loop.  Through one into the error handler as well to clean things up before aborting.

2.  You work strange hours, posting a reply at 1:55 AM!  But I'm glad you do.

Thanks again.
Bob

prl

Bob, glad to help.  My time local was 4:55 AM . . . I was late getting up . . . got to make the donuts.