def combination( self, name, is_region=False, tree=None, inherit=False, shader=None, material=None, rgb_color=None, temperature=0, region_id=0, air_code=0, gift_material=0, line_of_sight=0, is_fastgen=libwdb.REGION_NON_FASTGEN, ): if not tree: raise ValueError("Empty tree for combination: {0}".format(name)) tree = primitives.wrap_tree(tree) new_comb = cta.brlcad_new(libwdb.struct_rt_comb_internal) new_comb.magic = libwdb.RT_COMB_MAGIC new_comb.tree = tree.build_tree() new_comb.region_flag = cta.bool_to_char(is_region) new_comb.is_fastgen = cta.int_to_char(is_fastgen) new_comb.region_id = region_id new_comb.aircode = air_code new_comb.GIFTmater = gift_material new_comb.los = line_of_sight new_comb.rgb_valid = cta.bool_to_char(rgb_color) new_comb.rgb = cta.rgb(rgb_color) new_comb.temperature = temperature new_comb.shader = cta.str_to_vls(shader) new_comb.material = cta.str_to_vls(material) new_comb.inherit = cta.bool_to_char(inherit) libwdb.wdb_export(self.db_fp, name, libwdb.byref(new_comb), libwdb.ID_COMBINATION, 1)
def combination(self, name, is_region=False, tree=None, inherit=False, shader=None, material=None, rgb_color=None, temperature=0, region_id=0, air_code=0, gift_material=0, line_of_sight=0, is_fastgen=libwdb.REGION_NON_FASTGEN): if not tree: raise ValueError("Empty tree for combination: {0}".format(name)) tree = primitives.wrap_tree(tree) new_comb = cta.brlcad_new(libwdb.struct_rt_comb_internal) new_comb.magic = libwdb.RT_COMB_MAGIC new_comb.tree = tree.build_tree() new_comb.region_flag = cta.bool_to_char(is_region) new_comb.is_fastgen = cta.int_to_char(is_fastgen) new_comb.region_id = region_id new_comb.aircode = air_code new_comb.GIFTmater = gift_material new_comb.los = line_of_sight new_comb.rgb_valid = cta.bool_to_char(rgb_color) new_comb.rgb = cta.rgb(rgb_color) new_comb.temperature = temperature new_comb.shader = cta.str_to_vls(shader) new_comb.material = cta.str_to_vls(material) new_comb.inherit = cta.bool_to_char(inherit) libwdb.wdb_export(self.db_fp, name, libwdb.byref(new_comb), libwdb.ID_COMBINATION, 1)
def dsp(self, name, dsp_name, data_src=1, width=142, length=150, interpolation=False, cut_direction=1, cell_size=1, unit_elevation=0.005): d = cta.brlcad_new(libwdb.struct_rt_dsp_internal, calloc=True) d.magic = libwdb.RT_DSP_INTERNAL_MAGIC d.dsp_name = cta.str_to_vls(dsp_name) if data_src == 1: d.dsp_datasrc = libwdb.RT_DSP_SRC_FILE elif data_src == 2: d.dsp_datasrc = libwdb.RT_DSP_SRC_OBJ d.dsp_xcnt = width d.dsp_ycnt = length if interpolation: d.dsp_smooth = 1 else: d.dsp_smooth = 0 if cut_direction == 1: d.dsp_cuttype = ord(libwdb.DSP_CUT_DIR_ADAPT) elif cut_direction == 2: d.dsp_cuttype = ord(libwdb.DSP_CUT_DIR_llUR) elif cut_direction == 3: d.dsp_cuttype = ord(libwdb.DSP_CUT_DIR_ULlr) cta.MAT_IDN(d.dsp_stom) d.dsp_stom[0] = d.dsp_stom[5] = cell_size d.dsp_stom[10] = unit_elevation libbn.bn_mat_inv(d.dsp_mtos, d.dsp_stom) libwdb.wdb_export(self.db_fp, name, libwdb.byref(d), libwdb.ID_DSP, 1)
def revolve(self, name, sketch=None, revolve_center=None, revolve_axis=None, radius=None, angle=None): ri = cta.brlcad_new(libwdb.struct_rt_revolve_internal) ri.magic = libwdb.RT_REVOLVE_INTERNAL_MAGIC ri.v3d = cta.point((0, 0, 0) if revolve_center is None else revolve_center) ri.axis3d = cta.point((0, 0, 1) if revolve_axis is None else revolve_axis) ri.r = cta.point((1, 0, 0) if radius is None else radius) ri.ang = 180 if angle is None else angle ri.sketch_name = cta.str_to_vls(sketch.name) libwdb.wdb_export(self.db_fp, name, libwdb.byref(ri), libwdb.ID_REVOLVE, 1)