Interface: PolyBoolean

The PolyBoolean Interface is exposed by the ProBoolean class andprovides methods to create and manage ProBoolean Compound Objects.Available in 3ds Max 9 and higher.

   

To access the methods listed below, you can use

ProBoolean.PolyBoolean.methodName() 	 

or simply

ProBoolean.methodName()   

   

Methods:

<void>CreateBooleanObjects <node>boolnode <&node array>nodes <integer>op <integer>addMethod <integer>matMethod 

nodes is In and Out parameter 

Creates a new ProBoolean object with two or more operands using the first argument as operand A and the array of nodes passed as second argument as multiple operands B.

The third argument is an integer controlling the operation to be performed and corresponding to the radio button state in the UI. Possible values are:

0 -Union

1 -Intersection

2 -Subtraction

3 -Merge

The fourth argument is an integer defining the method to add operands B, corresponding to the radio button state in the UI. Possible values are:

0 -Reference

1 -Copy

2 -Move

3 -Instance

The fifth argument is an integer controlling the material mdethod and corresponding to the radio button state in the UI. Possible values are:

0 -Apply Operand Method

1 -Retain Original Material

   

<void>CreateBooleanObject <node>boolnode <node>node <integer>op <integer>addMethod <integer>matMethod 

Creates a new ProBoolean object with two operands using the first argument as operand A the second argument as operand B.

The third argument is an integer controlling the operation to be performed and corresponding to the radio button state in the UI. Possible values are:

0 -Union

1 -Intersection

2 -Subtraction

3 -Merge

The fourth argument is an integer defining the method to add operands B, corresponding to the radio button state in the UI. Possible values are:

0 -Reference

1 -Copy

2 -Move

3 -Instance

The fifth argument is an integer controlling the material mdethod and corresponding to the radio button state in the UI. Possible values are:

0 -Apply Operand Method

1 -Retain Original Material

   

<void>SetOperandA <node>boolnode 

Creates a new ProBoolean object with one operand using the argument as operand A. This method can be used to start the creation of a ProBoolean compound object and then switch settings and add operand B using the methods described below.

   

<void>SetOperandB <node>boolnode <node>node <integer>addMethod <integer>matMethod 

Adds operand B to the ProBoolean compound object. This is equivalent to using the Start Picking button in the UI to add more operands.

   

<boolean>GetOperandSel <node>node <integer>sel 

Returns true if the indexed operand is selected in the UI, false otherwise.

   

<void>SetOperandSel <node>node <integer>sel <boolean>flag 

Sets the selected state of the indexed operand in the given ProBoolean compound object to the specified boolean value.

   

<integer>GetBoolOp <node>node 

Returns the current boolean operation set in the ProBoolean compound object.

   

<void>SetBoolOp <node>node <integer>op 

Sets the current boolean operation in the ProBoolean compound object to the given value corresponding to the 0-based radio button state. Possible values are:

0 -Union

1 -Intersection

2 -Subtraction

3 -Merge

   

<boolean>GetDisplayResult <node>node 

Returns the display result mode. When true, the result will be displayed. When false, the Operands will be displayed.

   

<void>SetDisplayResult <node>node <boolean>flag 

Sets the display result mode. When true, the result will be displayed. When false, the Operands will be displayed.

   

<boolean>GetShowHiddenOps <node>node 

Returns the state of the Show Hidden Operands option.

   

<void>SetShowHiddenOps <node>node <boolean>flag 

Sets the state of the Show Hidden Operands option to the specified value.

   

<integer>GetUpdateMode <node>node 

Returns the update mode. Possible values are:

0 -Always

1 -When Selected

2 -When Rendering

3 -Manually

   

<void>SetUpdateMode <node>node <integer>mode 

Sets the update mode. Possible values are:

0 -Always

1 -When Selected

2 -When Rendering

3 -Manually

   

<boolean>GetOptimize <node>node 

Returns the state of the Optimize option.

   

<void>SetOptimize <node>node <boolean>flag 

Sets the state of the Optimize option to the specified value.

   

<boolean>GetCookieCut <node>node 

Returns true if Cookie cut is enabled, false otherwise.

   

<void>SetCookieCut <node>node <boolean>flag 

Sets the Cookie cut option to the specified state.

   

<boolean>GetImprint <node>node 

Returns true if Imprint option is enabled, false otherwise.

   

<void>SetImprint <node>node <boolean>flag 

Sets the Imprint option to the specified state.

   

<float>GetDecimationPercent <node>node 

Returns the decimation percentage.

   

<void>SetDecimationPercent <node>boolnode <float>percent 

percentValidated by Range: 0 to 1120403456

Sets the decimation percentage.

   

<boolean>GetMakeQuad <node>node 

Returns true if the Make Quadrilaterals option is enabled, false otherwise.

   

<void>SetMakeQuad <node>boolnode <boolean>flag 

Sets the Make Quadrilaterals option to the specified state.

   

<float>GetQuadSizePercent <node>node 

Returns the Quad Size percentage.

   

<void>SetQuadSizePercent <node>boolnode <float>percent 

percentValidated by Range: 0 to 1120403456

Sets the Quad Size percentage.

   

<integer>GetPlanarEdgeRemoval <node>node 

Returns the Planar Edge Removal mode. Possible values are:

0 -Remove All

1 -Remove Only Invisible

2 -No Edge Removal

   

<void>SetPlanarEdgeRemoval <node>node <integer>mode 

Sets the Planar Edge Removal mode. Possible values are:

0 -Remove All

1 -Remove Only Invisible

2 -No Edge Removal

EXAMPLE 1

--Creating a match using two consecutive boolean operations between
--a box, a cone and a sphere:
 
theBox = box height:100 width:10 length:10--create a box
theCone = cone radius1:4 radius2:15 height:110--create a cone
theSphere = sphere radius:6--create a sphere
xf = xform()--create an XForm modifier
addModifier theSphere xf--add the XForm to the sphere
xf.gizmo.scale = [1,1,2]--scale the sphere along Z
 
--create an intersection of the box as operand A and the cone as operand B:
ProBoolean.createBooleanObject theBox theCone 1 0 0
 
--assign materials to the box and to the sphere:
theBox.material = standard diffuse:(color 255 200 100)
theSphere.material = standard diffuse:brown
 
ProBoolean.SetBoolOp theBox 0--set the boolean operation to union
ProBoolean.setOperandB theBox theSphere 0 0--add the sphere asnewoperand B 

EXAMPLE 2

--Creating a Pencil using multiple boolean subtractions
--of a box, two cones and a cylinder:
 
 
--Step 1: create a box and two cones, assign materials:
theBox = box height:50 width:50 length:50 pos:[0,0,-2]
theCone1 = cone radius1:3 radius2:20 height:80 heightsegs:1 pos:[0,0,15]
theCone2 = cone radius1:0 radius2:15 height:80 heightsegs:1
theCone1.material = standard diffuse:(color 255 220 200)
theCone2.material = standard diffuse:black
--Step 2: Subtract both cones from the box
ProBoolean.createBooleanObjects theBox #(theCone2,theCone1) 2 0 0
--Step 3: Create a 6-sided cylinder and assign a material
theCyl = cylinder radius:10 sides:6 height:150 smooth:false pos:[0,0,1]
theCyl.material = standard diffuse:(color 255 200 100)
--Step 4: "sharpen" the cylinder using the box with the conical hole
ProBoolean.createBooleanObject theCyl theBox 2 0 0

See Also