def add_pilot_house(): bpy.ops.mesh.primitive_cube_add(size=1.0, location=(0, 0, 0.27)) bpy.ops.transform.resize(value=(1, 0.9, 1)) bpy.ops.object.transform_apply(scale=True, location=False) ob = bpy.context.active_object ob.name = "Pilot House" bpy.ops.object.mode_set(mode='EDIT') bpy.ops.mesh.select_all(action='DESELECT') bpy.ops.object.mode_set(mode='OBJECT') for face in ob.data.polygons: face.select = geometry_helper.GoingUp(face.normal) bpy.ops.object.mode_set(mode='EDIT') bpy.ops.transform.resize(value=(1, 0.6, 1)) bpy.ops.transform.translate(value=(-0.4, 0, 0)) bpy.ops.mesh.bevel(offset=0.1) bpy.ops.object.mode_set(mode='OBJECT') bool_new = the_hull.hull_object.modifiers.new(type="BOOLEAN", name="hull_join") bool_new.object = ob bool_new.operation = 'UNION' bpy_helper.hide_object(ob)
def offline2(): # ================ Add Rudder bpy.ops.mesh.primitive_cube_add(size=1.0, location=(-5.3, 0, -1.25)) rudder_object = bpy.context.active_object rudder_object.name = "Rudder" bpy.ops.transform.resize(value=(0.7, 0.05, 0.8)) bpy.ops.object.transform_apply(scale=True, location=False) bool_new = the_hull.hull_object.modifiers.new(type="BOOLEAN", name="hull_join") bool_new.object = rudder_object bool_new.operation = 'UNION' bpy_helper.hide_object(rudder_object) # ================ Add Keel bpy.ops.mesh.primitive_cube_add(size=1.0, location=(-1.2, 0, -1.25)) ob = bpy.context.active_object ob.name = "Keel" bpy.ops.transform.resize(value=(7, 0.05, 0.8)) bpy.ops.object.transform_apply(scale=True, location=False) bool_new = the_hull.hull_object.modifiers.new(type="BOOLEAN", name="hull_join") bool_new.object = ob bool_new.operation = 'UNION' bpy_helper.hide_object(ob) # ================ Add Pilot House bpy.ops.mesh.primitive_cube_add(size=2.0, location=(-0.4, 0, -0.3)) bpy.ops.transform.resize(value=(1, 1, 1)) bpy.ops.object.transform_apply(scale=True, location=False) ob = bpy.context.active_object ob.name = "Pilot House" bpy.ops.object.mode_set(mode='EDIT') bpy.ops.mesh.select_all(action='DESELECT') bpy.ops.object.mode_set(mode='OBJECT') for face in ob.data.polygons: face.select = geometry_helper.GoingUp(face.normal) bpy.ops.object.mode_set(mode='EDIT') bpy.ops.transform.resize(value=(1, 0.6, 1)) bpy.ops.transform.translate(value=(-0.4, 0, 0)) bpy.ops.mesh.bevel(offset=0.1) bpy.ops.object.mode_set(mode='OBJECT') bool_new = the_hull.hull_object.modifiers.new(type="BOOLEAN", name="hull_join") bool_new.object = ob bool_new.operation = 'UNION' bpy_helper.hide_object(ob)
bpy.ops.mesh.primitive_cube_add(size=2.0, location=(-0.4, 0, -0.3)) bpy.ops.transform.resize(value=(1, 1, 1)) bpy.ops.object.transform_apply(scale=True, location=False) ob = bpy.context.active_object ob.name = "Pilot House" bpy.ops.object.mode_set(mode='EDIT') bpy.ops.mesh.select_all(action='DESELECT') bpy.ops.object.mode_set(mode='OBJECT') for face in ob.data.polygons: face.select = geometry_helper.GoingUp(face.normal) bpy.ops.object.mode_set(mode='EDIT') bpy.ops.transform.resize(value=(1, 0.6, 1)) bpy.ops.transform.translate(value=(-0.4, 0, 0)) bpy.ops.mesh.bevel(offset=0.1) bpy.ops.object.mode_set(mode='OBJECT') bool_new = the_hull.hull_object.modifiers.new(type="BOOLEAN", name="hull_join") bool_new.object = ob bool_new.operation = 'UNION'