""" Script for the usage of the CreatePolyhedron function """ import NemAll_Python_Geometry as AllplanGeo import NemAll_Python_BaseElements as AllplanBaseElements import NemAll_Python_BasisElements as AllplanBasisElements import GeometryValidate as GeometryValidate import math print('Load forum_3D_polygon.py') def check_allplan_version(build_ele, version): """ Check the current Allplan version Args: build_ele: the building element. version: the current Allplan version Returns: True/False if version is supported by this script """ # Delete unused arguments del build_ele del version # Support all versions return True def create_element(build_ele, doc): """ Creation of element Args: build_ele: the building element. doc: input document """ element = Poly(doc) return element.create(build_ele) class Poly(): def __init__(self,doc): self.model_ele_list = [] self.handle_list = [] self.document = doc def create(self, build_ele): self.model_ele_list.append(self.brep_path3d(build_ele)) return (self.model_ele_list, self.handle_list) def brep_path3d(self, build_ele): base_path = AllplanGeo.Path3D() base_path += AllplanGeo.Line3D(AllplanGeo.Point3D(0,0,0), AllplanGeo.Point3D(100,0,0)) base_path += AllplanGeo.Line3D(AllplanGeo.Point3D(100,0,0), AllplanGeo.Point3D(100,100,0)) base_path += AllplanGeo.Line3D(AllplanGeo.Point3D(100,100,0), AllplanGeo.Point3D(0,100,0)) base_path += AllplanGeo.Line3D(AllplanGeo.Point3D(0,100,0), AllplanGeo.Point3D(0,0,0)) axis = AllplanGeo.Vector3D(0,0,100) path = AllplanGeo.Path3D() path += AllplanGeo.Line3D(AllplanGeo.Point3D(0,0,0), AllplanGeo.Point3D(0,0,100)) railrotation = False closegaps = False #profiles = [base_path] #print(profiles) #brep = AllplanGeo.CreateSweptBRep3D(profiles, path, closegaps, railrotation, axis, 1) brep = AllplanGeo.CreateSweptBRep3D(base_path, path, railrotation, axis) print(brep) com_prop = AllplanBaseElements.CommonProperties() com_prop.GetGlobalProperties() return AllplanBasisElements.ModelElement3D(com_prop, brep)