# along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ##### END GPL LICENSE BLOCK ##### import bpy from bpyhullgen.hullgen import hull_maker from bpyhullgen.hullgen import chine_helper from bpyhullgen.hullgen import keel_helper from bpyhullgen.hullgen import render_helper from bpyhullgen.bpyutils import bpy_helper performance_timer = bpy_helper.ElapsedTimer() the_hull=hull_maker.hull_maker(width=3,length=7,height=3) the_hull.make_hull_object() new_chine=chine_helper.chine_helper(the_hull, name="side", length=the_hull.hull_length*1.2, width=1, rotation=[180,0,0], offset=[0,-0.35,-0.5]) the_hull.add_chine(new_chine) new_chine=chine_helper.chine_helper(the_hull,
# # ##### END GPL LICENSE BLOCK ##### import bpy from bpyhullgen.hullgen import chine_helper from bpyhullgen.bpyutils import material_helper from bpyhullgen.hullgen import curve_helper from bpyhullgen.hullgen import hull_maker from bpyhullgen.hullgen import geometry_helper from bpyhullgen.hullgen import window_helper from bpyhullgen.hullgen import keel_helper from bpyhullgen.bpyutils import bpy_helper from bpyhullgen.hullgen import render_helper the_hull = hull_maker.hull_maker(length=11.3, width=3.9, height=3.6) the_hull.make_hull_object() new_chine = chine_helper.chine_helper( the_hull, name="side", length=the_hull.hull_length * 1.3, width=1, rotation=[180, 0, 0], offset=[0, 0.06, 0], ) new_longitudinal = chine_helper.longitudinal_definition(z_offset=0.4, width=-0.15, thickness=0.05)
def read_hull(filename): tree = ET.parse(filename) root = tree.getroot() newhull=hull_maker.hull_maker(0,0,0) for elem in root: #================================================================ if elem.tag=="size": newhull.hull_width=parse_float_val(elem,"width",0) newhull.hull_length=parse_float_val(elem,"length",0) newhull.hull_height=parse_float_val(elem,"height",0) #================================================================ if elem.tag=="materials": newhull.structural_thickness=parse_float_val(elem,"structural_thickness",0.1) newhull.slicer_overcut_ratio=parse_float_val(elem,"slicer_overcut_ratio",1.1) newhull.slot_gap=parse_float_val(elem,"slot_gap",0.1) #================================================================ if elem.tag=="generate": newhull.make_bulkheads=parse_int_val(elem,"bulkheads",default=True) newhull.make_keels=parse_int_val(elem,"keels",default=True) newhull.make_longitudinals=parse_int_val(elem,"longitudinals",default=True) newhull.hide_hull=parse_int_val(elem,"hide_hull",default=False) #================================================================ if elem.tag=="bulkheads": for bulkhead_elem in elem: floor_height=parse_float_val(bulkhead_elem,"floor_height",0) watertight=parse_int_val(bulkhead_elem,"watertight",default=True) station=parse_float_val(bulkhead_elem,"station",0) thickness=parse_float_val(bulkhead_elem,"thickness",0) bulkhead_definition=bulkhead.bulkhead_definition( station=station, watertight=watertight, floor_height=floor_height, thickness=thickness) newhull.add_bulkhead_definition(bulkhead_definition) #================================================================ if elem.tag=="modshapes": for modshape_elem in elem: name=parse_str_val(modshape_elem,"name",0) mod_type=parse_str_val(modshape_elem,"mod_type","add") mod_mode=parse_str_val(modshape_elem,"mod_mode","cube") mod_shape=parse_str_val(modshape_elem,"mod_shape","trapezoid") symmetrical=parse_int_val(modshape_elem,"symmetrical",default=True) size=[0,0,0] rotation=[0,0,0] location=[0,0,0] deform=[0,0,0] for subelem in modshape_elem: if subelem.tag=="rotation": rotation[0]=parse_float_val(subelem,"x",0) rotation[1]=parse_float_val(subelem,"y",0) rotation[2]=parse_float_val(subelem,"z",0) if subelem.tag=="location": location[0]=parse_float_val(subelem,"x",0) location[1]=parse_float_val(subelem,"y",0) location[2]=parse_float_val(subelem,"z",0) if subelem.tag=="size": size[0]=parse_float_val(subelem,"x",0) size[1]=parse_float_val(subelem,"y",0) size[2]=parse_float_val(subelem,"z",0) if subelem.tag=="deform": deform[0]=parse_float_val(subelem,"p1",0) deform[1]=parse_float_val(subelem,"p2",0) deform[2]=parse_float_val(subelem,"p3",0) modshape=modshape_helper.modshape( name=name, rotation=rotation, location=location, size=size, mod_mode=mod_mode, deform=deform, mod_shape=mod_shape, symmetrical=symmetrical) newhull.add_modshape(modshape) #================================================================ if elem.tag=="keels": for keel_elem in elem: station_start=parse_float_val(keel_elem,"station_start",0) station_end=parse_float_val(keel_elem,"station_end",0) lateral_offset=parse_float_val(keel_elem,"lateral_offset",0) top_height=parse_float_val(keel_elem,"top_height",0) keel = keel_helper.keel(newhull,lateral_offset,top_height,station_start,station_end) newhull.add_keel(keel) #================================================================ if elem.tag=="chines": for chine_elem in elem: name=parse_str_val(chine_elem,"name") symmetrical=parse_int_val(chine_elem,"symmetrical",default=True) length=11 width=1.2 height=1.2 extrude_width=1.2 offset=[0,0,0] rotation=[0,0,0] asymmetry=[0,0] longitudinal_defs=[] for subelem in chine_elem: if subelem.tag=="curve": length=parse_float_val(subelem,"length",length) width=parse_float_val(subelem,"width",width) height=parse_float_val(subelem,"height",height) extrude_width=parse_float_val(subelem,"extrude_width",extrude_width) if subelem.tag=="asymmetry": asymmetry[0]=parse_float_val(subelem,"a0",0) asymmetry[1]=parse_float_val(subelem,"a1",0) if subelem.tag=="offset": offset[0]=parse_float_val(subelem,"x",0) offset[1]=parse_float_val(subelem,"y",0) offset[2]=parse_float_val(subelem,"z",0) if subelem.tag=="rotation": rotation[0]=parse_float_val(subelem,"x",0) rotation[1]=parse_float_val(subelem,"y",0) rotation[2]=parse_float_val(subelem,"z",0) if subelem.tag=="longitudinals": for longitudinal_elem in subelem: z_offset=0 longitudinal_width=1 x_min=-3 x_max=3 z_offset=parse_float_val(longitudinal_elem,"z_offset",z_offset) longitudinal_width=parse_float_val(longitudinal_elem,"width",width) x_min=parse_float_val(longitudinal_elem,"x_min",x_min) x_max=parse_float_val(longitudinal_elem,"x_max",x_max) longitudinal_definition=chine_helper.longitudinal_definition( width=longitudinal_width,z_offset=z_offset ) longitudinal_definition.set_limit_x_length(x_min,x_max) longitudinal_defs.append(longitudinal_definition) new_chine=chine_helper.chine_helper(newhull, name=name,length=length,width=width, symmetrical=symmetrical, asymmetry=asymmetry) new_chine.curve_height=height new_chine.offset=offset new_chine.rotation=rotation new_chine.extrude_width=extrude_width for ld in longitudinal_defs: new_chine.add_longitudinal_definition(ld) newhull.add_chine(new_chine) return newhull
new_chine.rotation = [72, 0, 0] new_chine.offset = [0, 0, -0.5] new_chine.name = "low" new_chine.make_chine() new_chine.rotation = [90, 0, 0] new_chine.offset = [0, 0, 0.3] new_chine.name = "roof" new_chine.curve_width = -0.4 new_chine.curve_length = 13 new_chine.symmetrical = False new_chine.make_chine() the_hull = hull_maker.hull_maker() the_hull.make_hull_object() make_chines(the_hull) # ========================================= # Make bulkheads edge_offset = 0.18 # can use static station list instead of frange #hull_stations=[ -the_hull.hull_length/2+edge_offset, -1.7, -1.5, 0, 1.5, 1.7, the_hull.hull_length/2-edge_offset] bulkhead_definitions = [] for station_position in bpy_helper.frange( -the_hull.hull_length / 2 + edge_offset,
# along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ##### END GPL LICENSE BLOCK ##### import bpy from bpyhullgen.bpyutils import bpy_helper from bpyhullgen.hullgen import chine_helper from bpyhullgen.bpyutils import material_helper from bpyhullgen.hullgen import curve_helper from bpyhullgen.hullgen import hull_maker from bpyhullgen.hullgen import geometry_helper from bpyhullgen.hullgen import render_helper the_hull = hull_maker.hull_maker(width=4.7) the_hull.make_hull_object() the_hull.bulkhead_count = 0 new_chine = chine_helper.chine_helper(the_hull, name="wall", length=the_hull.hull_length, width=-1, rotation=[75, 0, 0], offset=[0, 0.9, 0.3]) new_longitudinal = chine_helper.longitudinal_definition(z_offset=0, width=0.6, thickness=0.6, slicer_ratio=1)
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ##### END GPL LICENSE BLOCK ##### import bpy from bpyhullgen.hullgen import hull_maker from bpyhullgen.hullgen import chine_helper from bpyhullgen.hullgen import render_helper the_hull = hull_maker.hull_maker(width=1, length=1.95, height=1) the_hull.make_hull_object() def make_chines(): new_chine = chine_helper.chine_helper(the_hull) new_chine.asymmetry[0] = 1 new_chine.curve_width = 0.35 new_chine.longitudal_curve_angle = 40 new_chine.curve_length = the_hull.hull_length * 2 #new_chine.curve_angle=23 new_chine.rotation = [180, 0, 0]
# # ##### END GPL LICENSE BLOCK ##### import bpy from math import radians, degrees from bpyhullgen.hullgen import chine_helper from bpyhullgen.bpyutils import material_helper from bpyhullgen.hullgen import curve_helper from bpyhullgen.hullgen import hull_maker from bpyhullgen.hullgen import bulkhead from bpyhullgen.hullgen import geometry_helper from bpyhullgen.hullgen import render_helper the_hull = hull_maker.hull_maker(length=12, width=1, height=0.8) the_hull.make_hull_object() new_chine = chine_helper.chine_helper(the_hull, name="side1", length=the_hull.hull_length * 1.3, width=1, offset=[0, 0, 0], symmetrical=False) new_longitudinal = chine_helper.longitudinal_definition(z_offset=-0.2, width=-0.4, thickness=0.1) new_longitudinal.set_limit_x_length(-6, 6) new_chine.add_longitudinal_definition(new_longitudinal)
# ##### END GPL LICENSE BLOCK ##### import bpy from math import radians, degrees from bpyhullgen.hullgen import chine_helper from bpyhullgen.hullgen import curve_helper from bpyhullgen.hullgen import hull_maker from bpyhullgen.hullgen import geometry_helper from bpyhullgen.hullgen import window_helper from bpyhullgen.hullgen import render_helper from bpyhullgen.hullgen import keel_helper from bpyhullgen.bpyutils import bpy_helper the_hull=hull_maker.hull_maker(width=5,length=11,height=3) the_hull.hull_output_scale=1/16 the_hull.target_screw_size=4.1 the_hull.bulkhead_count=9 the_hull.bulkhead_start_location=-4 the_hull.make_hull_object() new_chine=chine_helper.chine_helper(the_hull, name="side", length=the_hull.hull_length*1.1, width=1.2, rotation=[180,0,0], offset=[0,-0.27,-0.5])