Create a new project and name it BooleanSolidExample
Create 5 new designs
BlockOne | (add Block design as a mixin) |
BlockTwo | (add Block design as a mixin) |
BlockThree | (add Block design as a mixin) |
BlockFour | (add Block design as a mixin) |
BooleanSolidOne | (add BooleanSolid design as a mixin) |
Drag and drop the designs just created into BooleanSolidExample.
Your tree should look like this (minus the MyMaterial).
height:
Name: height
Type: number
Flags: cached,parameter
Category: UI Specs
default value: return 12;
length:
Name: length
Type: number
Flags: cached,parameter
Category: UI Specs
default value: return 72;
width:
Name: width
Type: number
Flags: cached,parameter
Category: UI Specs
default value: return 36;
LegHeight:
Name: LegHeight
Type: number
Flags: cached,parameter
Category: UI Specs
default value: return 36;
LegLength:
Name: LegLength
Type: number
Flags: cached,parameter
Category: UI Specs
default value: return 3.5;
LegWidth:
Name: LegHeight
Type: number
Flags: cached,parameter
Category: UI Specs
default value: return 3.5;
ShowToolSolids:
Name: ShowToolSolids
Type: boolean
Flags: cached,parameter
Category: Show?
default value: false;
ShowBowl:
Name: ShowBowl
Type: boolean
Flags: cached,parameter
Category: Show?
default value: false;
height: this.height; |
length: this.length; |
width: this.length; |
show: R.rootModel.ShowToolSolids; |
height: this.height-1.5; |
length: (this.length-3-.75)/3; |
width: this.width-1.5; |
show: R.rootModel.ShowToolSolids; |
color: 'silver' |
height: R.rootModel.BlockTwo.height; |
length: R.rootModel.BlockTwo.length; |
width: R.rootModel.BlockTwo.width; |
show: R.rootModel.ShowToolSolids; |
color: 'gold' |
position: var x = (this.length-0.375)/3; |
return {origin: p(-x+0.25,0,0), xdir: v(1,0,0), ydir: v(0,1,0)}; |
height: R.rootModel.BlockTwo.height; |
length: R.rootModel.BlockTwo.length; |
width: R.rootModel.BlockTwo.width; |
show: R.rootModel.ShowToolSolids; |
color: 'lime' |
position: var x = (this.length-.375)/3; |
return {origin: p(x-.25,0,0), xdir: v(1,0,0), ydir: v(0,1,0)}; |
In the images it shows BlockOne, which will be used as the 'target' and BlockTwo,BlockThree and BlockFour which will be used as the 'tools'
in the BooleanSolidOne. |
operation: 'Difference'; |
target: this.BlockOne; |
tools: var firstArray = [ |
R.rootModel.BlockTwo, |
R.rootModel.BlockThree, |
R.rootModel.BlockFour |
]; |
return firstArray; |
show: true; |
color: 'tan' |
Set the view to Hidden Lines Dashed and you can see the BlockOne has been modified by the 'tools' [BlockTwo,BlockThree,BlockFour]
What remains is a shell 3/4 inch thick and 2 interior support panes, both 3/4 inch thick.
Next we'll make a SideCutout that will use the 'Union' operation. The 'Union' operation will use
2 Cylinders and a Block to combine into one solid model. This SideCutout will later be used in
the 'tools' rule to cutout or 'Difference' the BooleanSolidOne design.
Create 1 new design
SideCutout |
Drag and drop the design just created (SideCutout) into BooleanSolidExample and Name it SideCutout1.
Drag and drop Block from the Project window into SideCutout1.
Drag and drop Cylinder from the Project window into SideCutout1 and Name it Cylinder1.
Drag and drop Cylinder from the Project window into SideCutout1 and Name it Cylinder2.
Drag and drop BooleanSolid from the Project window into SideCutout1 and Name it BooleanSolidSideCutout.
position: { origin: p(0, 0, 0, this.parent.transform ) }; |
color: 'blue' |
height: R.rootModel.BlockOne.height-4; |
length: (R.rootModel.length-8)/3 - child.height; |
width: R.rootModel.BlockOne.width+3; |
show: R.rootModel.ShowToolSolids; |
height: this.height; |
length: this.length; |
width: this.length; |
operation: 'Union' |
target: this.Block; |
tools: [this.Cylinder1,this.Cylinder2]; |
height: var x = this.Block.width; |
return x; |
radius: var x = this.Block.height/2; |
return x; |
position: var x = this.Block.length/2; |
return {origin: p(x,0,0), xdir: v(0,0,1), ydir: v(1,0,0)}; |
height: var x = this.Block.width; |
return x; |
radius: var x = this.Block.height/2; |
return x; |
position: var x = this.Block.length/2; |
return {origin: p(-x,0,0), xdir: v(0,0,1), ydir: v(1,0,0)}; |
Image shows SideCutout1 in blue.
Drag and drop the design already created (SideCutout) into BooleanSolidExample and Name it SideCutout2.
Drag and drop the design already created (SideCutout) into BooleanSolidExample and Name it SideCutout3.
Drag and drop the design already created (SideCutout) into BooleanSolidExample and Name it SideCutout4.
position: var x = (R.rootModel.length-8) /3 + 2 |
return { origin: p(-x, 0, 0, this.parent.transform ) }; |
color: 'Green' |
height: R.rootModel.SideCutout1.height; |
length: R.rootModel.SideCutout1.length; |
width: R.rootModel.SideCutout1.width; |
show: R.rootModel.ShowToolSolids; |
position: var x = (R.rootModel.length-8) /3 + 2 |
return { origin: p(x, 0, 0, this.parent.transform ) }; |
color: 'Orange' |
height: R.rootModel.SideCutout1.height; |
length: R.rootModel.SideCutout1.length; |
width: R.rootModel.SideCutout1.width; |
show: R.rootModel.ShowToolSolids; |
position: {origin: p(0,0,0), xdir: v(0,1,0), ydir: v(1,0,0)} |
color: 'Cyan' |
height: R.rootModel.BlockOne.height-4; |
length: (R.rootModel.BlockOne.width-4) - child.height; |
width: R.rootModel.BlockOne.length+3; |
show: R.rootModel.ShowToolSolids; |
Update the BooleanSolidOne design
operation: 'Difference'; (Same) |
target: this.BlockOne; (Same) |
tools: var firstArray = [ |
R.rootModel.BlockTwo, |
R.rootModel.BlockThree, |
R.rootModel.BlockFour |
]; |
var secondArray = [ |
R.rootModel.BlockTwo, |
R.rootModel.BlockThree, |
R.rootModel.BlockFour, |
R.rootModel.SideCutout1.BooleanSolidSideCutout, |
R.rootModel.SideCutout2.BooleanSolidSideCutout, |
R.rootModel.SideCutout3.BooleanSolidSideCutout, |
R.rootModel.SideCutout4.BooleanSolidSideCutout |
]; |
//return firstArray; |
return secondArray; |
show: true; (Same) |
color: 'tan' (Same) |
Image shows 1 target and 7 tools used with the operation set to 'Difference'.
Next we'll make a LegIntersection that will use the Intersection operation. The Intersection operation will use
1 Cylinder as the 'tools' and 1 Block as the 'target' to make one solid model. Only the areas that Intersects are kept.
Create 1 new design
LegIntersection | (add Block design as a mixin) |
Drag and drop the design just created (LegIntersection) into BooleanSolidExample and set the Quantity to 4.
Drag and drop Block from the Project window into LegIntersection.
Drag and drop Cylinder from the Project window into LegIntersection .
Drag and drop BooleanSolid from the Project window into LegIntersection.
CylinderPosition:
Name: | CylinderPosition |
Type: | any |
Flags: | cached,parameter |
Category: | Position |
default value: | { origin: p(0, 0, 0, this.parent.transform ) } |
height: this.LegHeight; |
length: this.LegLength; |
width: this.LegWidth; |
CylinderPosition: |
var x;
if (child.index === 0){
x = R.rootModel.BlockOne.vertexLBD.x+child.width;
} else if (child.index ==1){
x = R.rootModel.BlockOne.vertexRBD.x-child.width;
} else if (child.index ==2){
x = R.rootModel.BlockOne.vertexLFD.x+child.width;
} else if (child.index ==3){
x = R.rootModel.BlockOne.vertexRFD.x-child.width;
}
var y;
if (child.index === 0){
y = R.rootModel.BlockOne.vertexLBD.y-child.width;
} else if (child.index ==1){
y = R.rootModel.BlockOne.vertexRBD.y-child.width;
} else if (child.index ==2){
y = R.rootModel.BlockOne.vertexLFD.y+child.width;
} else if (child.index ==3){
y = R.rootModel.BlockOne.vertexRFD.y+child.width;
}
var z;
if (child.index === 0){
z = R.rootModel.BlockOne.vertexLBD.z-child.height/2;
} else if (child.index ==1){
z = R.rootModel.BlockOne.vertexRBD.z-child.height/2;
} else if (child.index ==2){
z = R.rootModel.BlockOne.vertexLFD.z-child.height/2;
} else if (child.index ==3){
z = R.rootModel.BlockOne.vertexRFD.z-child.height/2;
}
return { origin: p(x, y, z, this.parent.transform )};
position: |
var x;
if (child.index === 0){
x = R.rootModel.BlockOne.vertexLBD.x+child.width/2;
} else if (child.index ==1){
x = R.rootModel.BlockOne.vertexRBD.x-child.width/2;
} else if (child.index ==2){
x = R.rootModel.BlockOne.vertexLFD.x+child.width/2;
} else if (child.index ==3){
x = R.rootModel.BlockOne.vertexRFD.x-child.width/2;
}
var y;
if (child.index === 0){
y = R.rootModel.BlockOne.vertexLBD.y-child.width/2;
} else if (child.index ==1){
y = R.rootModel.BlockOne.vertexRBD.y-child.width/2;
} else if (child.index ==2){
y = R.rootModel.BlockOne.vertexLFD.y+child.width/2;
} else if (child.index ==3){
y = R.rootModel.BlockOne.vertexRFD.y+child.width/2;
}
var z;
if (child.index === 0){
z = R.rootModel.BlockOne.vertexLBD.z-child.height/2;
} else if (child.index ==1){
z = R.rootModel.BlockOne.vertexRBD.z-child.height/2;
} else if (child.index ==2){
z = R.rootModel.BlockOne.vertexLFD.z-child.height/2;
} else if (child.index ==3){
z = R.rootModel.BlockOne.vertexRFD.z-child.height/2;
}
return { origin: p(x, y, z, this.parent.transform )};
operation: 'Intersection' |
target: this.Block; |
tools: [this.Cylinder]; |
height: this.height; |
radius: this.width; |
position: this.CylinderPosition; |
show: R.rootModel.ShowToolSolids; |
height: this.height; |
length: this.length; |
width: this.width; |
show: R.rootModel.ShowToolSolids; |
Set the LegIntersection design to a Quantity of 4.
If the BooleanSolidOne rule 'show' was set to false to build the LegIntersection, set 'show' to true to display the bench top.
All three operations were used to create this workbench.
Difference |
Union |
Intersection |