Tutorial 2 – Unions

INTERFACE CHANGES

Since the last tutorial the interface has had a significant update. You will now find that the editor and the main viewing area are all on the same page. You will see the interface now has two save buttons and that the editor button has been removed. The save button in the tool panel saves changes made to model through the visual interface. The save button in the editor saves changes made in the editor.

new_interface
UNIONS

The computational solids boolean operations in the Makertron support the following results of intersection subtraction and union.

booleanops

The type can be either “intersection” , “subtraction” , “union”. You may select only one root object.  Each boolean operation represents the application of one boolean statement on one root object. The boolean operation that is applied to the root object can have multiple children specified in the object field.

The resultant of the boolean operation will take the name in the name field.  If you wish to update an existing object you can specify that name in the name field and the previous state of that object will be over written.

In the example json script shown below both the ‘teapot_spout’ and the ‘teapot_handle’ are being unified with another object t named ‘clip_top’. The result of this operation will produce a new object named ‘unified_teapot’.

{
"type": "union",
"name": "unified_teapot",
"root": "clip_top",
"objects": "teapot_spout,teapot_handle",
"state": "teapot_body_enable"
}

For the teapot body in the body.jsn we have created two spheres. One named ‘teapot_body_outside’ and one named ‘teapot_body_inside’.

{
"type": "sphere",
"name": "teapot_body_outside",
"radius": "teapot_body_size",
"pos": "[0,0,0]",
"scale": "[1,1,1]",
"color": "teapot_body_color",
"resolution": "teapot_body_resolution",
"state": "1",
"group": "1"
}

{
"type": "sphere",
"name": "teapot_body_inside",
"radius": "teapot_body_size-teapot_body_thickness",
"pos": "[0,0,0]",
"scale": "[1,teapot_body_scale_y,1]",
"color": "teapot_body_color",
"resolution": "teapot_body_resolution",
"state": "1",
"group": "1"
}

For the radius of the inside sphere we set a a size that is the size of the outside sphere minus some thickness. It is important when doing boolean operations to consider what the results might be of your geometrical interactions.

The state of both these spheres could be true or  or false at this point. Once we have completed our operation with them they will be set to false. The state controls which objects will ultimately be included in our final scene for export. Note however that even if we set these objects to a state of false we can still act on them in the scene.   Likewise when we  get a new object as a result of our boolean operation we can set the state of that to. If the state of that boolean operation is set to true then this new object that is a result of the operation will be visible in the scene and exportable .  If it is set to false it will become invisible but we could still use this object as an invisible proxy to perform other operations on objects that were visible. For state you can enter true or false or 1 and 0 respectively. 1 being true and zero being false. Using an integer value for true or false is useful if you wish to set the state of something via a variable.

Now we will apply a boolean operation. This will result in a new object named ‘hollow_sphere’.

{
"type": "subtract",
"name": "hollow_sphere",
"root": "teapot_body_outside",
"objects": "teapot_body_inside",
"state": "1"
}

Next we will want to cut the top off the new object ‘hollow_sphere’ with another boolean operation.  To do this we will create a cube called ‘lid_line’.  This cube can be moved up and down on the y-axis to change how much of it will ultimately be subtracted from the ‘hollow_sphere’.

{
"type": "cube",
"name": "lid_line",
"radius": "[teapot_body_size*2,teapot_body_size*2,teapot_body_size*2]",
"pos": "[0,clip_height,0]",
"color": "teapot_body_color",
"state": "1",
"group": "1"
}

Then we will apply a subtraction between this cube called ‘lid_line’  and the ‘hollow_sphere’ object we made in the previous boolean operation. We are using the cube ‘lid_line’ as a proxy to alter our ‘hollow_sphere’ geometry. Note once again that it does not matter if it is invisible or visible in this context because after our boolean operation it will be set to false.

{
"type": "subtract",
"name": "clip_top",
"root": "hollow_sphere",
"objects": "lid_line",
"state": "1"
}

The result of this operation will be a new object named clip_top with the top sliced off that will be set to visible in our scene and exportable. This is the body of our teapot.

hollow_sphere

In the next tutorial I will cover Making the handle and the spout and the Bezier tool.