def create_geometry(self): ''' Create the element geometries 构建元素几何图形函数 return 图形list ''' #point rectangle = self.shape_cuboid(self.Length, self.Width, self.Height) cutter = self.shape_cuboid(self.CutLength, self.Width, self.Height, sX=self.CutPosition) slot_head = self.shape_cuboid(self.SlotLength, self.Width - 2 * self.SlotSide, self.Height - self.SlotBottom, sY=self.SlotSide, sZ=self.SlotBottom) slot_tail = self.shape_cuboid(self.SlotLength, self.Width - 2 * self.SlotSide, self.Height - self.SlotBottom, sX=self.Length - self.SlotLength, sY=self.SlotSide, sZ=self.SlotBottom) key_slot_1 = self.shape_keyslot(self.KeyslotThick, self.Width - 2 * self.KeyslotSide, self.KeyslotHeight, self.KeyslotEdge, False, self.SlotLength, self.KeyslotSide, self.KeyslotBottom) key_slot_2 = self.shape_keyslot(self.KeyslotThick, self.Width - 2 * self.KeyslotSide, self.KeyslotHeight, self.KeyslotEdge, True, self.CutPosition - self.KeyslotThick, self.KeyslotSide, self.KeyslotBottom) key_slot_3 = self.shape_keyslot(self.KeyslotThick, self.Width - 2 * self.KeyslotSide, self.KeyslotHeight, self.KeyslotEdge, False, self.CutPosition + self.CutLength, self.KeyslotSide, self.KeyslotBottom) key_slot_4 = self.shape_keyslot( self.KeyslotThick, self.Width - 2 * self.KeyslotSide, self.KeyslotHeight, self.KeyslotEdge, True, self.Length - self.SlotLength - self.KeyslotThick, self.KeyslotSide, self.KeyslotBottom) err, rectangle = AllplanGeo.MakeSubtraction(rectangle, cutter) err, rectangle = AllplanGeo.MakeSubtraction(rectangle, slot_head) err, rectangle = AllplanGeo.MakeSubtraction(rectangle, slot_tail) err, rectangle = AllplanGeo.MakeSubtraction(rectangle, key_slot_1) err, rectangle = AllplanGeo.MakeSubtraction(rectangle, key_slot_2) err, rectangle = AllplanGeo.MakeSubtraction(rectangle, key_slot_3) err, rectangle = AllplanGeo.MakeSubtraction(rectangle, key_slot_4) approximation = AllplanGeo.ApproximationSettings( AllplanGeo.eApproximationSettingsType.ASET_BREP_TESSELATION, 1) err, rectangle = AllplanGeo.CreatePolyhedron(rectangle, approximation) return [ AllplanBasisElements.ModelElement3D(self.com_prop, self.texturedef, rectangle) ]
def create_geometry(self, build_ele): """ Create the element geometries Args: build_ele: the building element. """ #----------------- Extract palette parameter values wall_length = build_ele.Length1_1.value wall_width = build_ele.Width1_1.value wall_thickness = build_ele.Thickness1_1.value void_active = build_ele.chkb_win.value door_active = build_ele.chkb_door.value join1_type_added = build_ele.join1_type_active.value join1_type_select = build_ele.join1_type.value join2_type_added = build_ele.join2_type_active.value join2_type_select = build_ele.join2_type.value #------------------------------------ Create wall------------------------------------------# wall = AllplanGeo.Polyhedron3D.CreateCuboid(wall_length, wall_thickness, wall_width) trans_to_ref_point_1 = AllplanGeo.Matrix3D() trans_to_ref_point_1.Translate(AllplanGeo.Vector3D(0, 0, 0)) wall = AllplanGeo.Transform(wall, trans_to_ref_point_1) #----------------------------Create Component Property--------------------------------------# com_prop_base_bodies = AllplanBaseElements.CommonProperties() com_prop_base_bodies.GetGlobalProperties() com_prop_base_bodies.Color = 1 com_prop_stroke = AllplanBaseElements.CommonProperties() com_prop_stroke.GetGlobalProperties() com_prop_stroke.Stroke = 9 # dots com_prop_stroke.HelpConstruction = True self.model_ele_list.append( AllplanBasisElements.ModelElement3D(com_prop_stroke, wall)) #------------------ Append Element to Wall -------------------------------------------------# if (void_active): void = self.add_windows(build_ele, com_prop_stroke, wall_length, wall_width, wall_thickness) err, wall = AllplanGeo.MakeSubtraction(wall, void) if (door_active): door = self.add_door(build_ele, com_prop_stroke, wall_length, wall_width, wall_thickness) err, wall = AllplanGeo.MakeSubtraction(wall, door) if (join1_type_added): join1 = self.add_joins_left(build_ele, com_prop_stroke, type=join1_type_select) err, wall = AllplanGeo.MakeSubtraction(wall, join1) if (join2_type_added): join2 = self.add_joins_right(build_ele, com_prop_stroke, type=join2_type_select) err, wall = AllplanGeo.MakeSubtraction(wall, join2) #---------------------------------------Add Wall Element----------------------------------------# self.model_ele_list.append( AllplanBasisElements.ModelElement3D(com_prop_base_bodies, wall)) #-----------------------------------------------------------------------------------------------# #-----------------------------------------wall handle-------------------------------------------# #-----------------------------------------------------------------------------------------------# origin = AllplanGeo.Point3D(0, 0, 0) wall_plength = AllplanGeo.Point3D(wall_length, 0, 0) wall_pwidth = AllplanGeo.Point3D(0, 0, wall_width) wall_pthickness = AllplanGeo.Point3D(0, wall_thickness, 0) handle_walllength = HandleProperties( "WallMoveLength", wall_plength, origin, [("Length1_1", HandleDirection.x_dir)], HandleDirection.x_dir, True) self.handle_list.append(handle_walllength) handle_wallwidth = HandleProperties( "WallMoveWidth", wall_pwidth, origin, [("Width1_1", HandleDirection.z_dir)], HandleDirection.z_dir, True) self.handle_list.append(handle_wallwidth) handle_wallthickness = HandleProperties( "WallMoveThickness", wall_pthickness, origin, [("Thickness1_1", HandleDirection.y_dir)], HandleDirection.y_dir, True) self.handle_list.append(handle_wallthickness)