Hello,
I am trying to create a standard PythonPart with a Wall in it and a GeneralOpeningElement related to this Wall. The idea is to configure the Wall through the Palette as well as an Opening for the Wall. The final result of the PythonPart execution is going to return a PythonPart created with PythonPartUtils.
I've managed to create one standard PythonPart (PythonPartUtil) with a Wall in it, some 3D views, and an Opening related to an existing Wall created outside the PythonPart, however, when trying to relate the Opening to the Wall that's being created inside the PythonPartUtil, I get an Exception:
Exception nr C0000005 -access violation is occured at 00007FFA39E675B3, while reading from address 8
Is there any way to achieve what I want? Maybe the Wall must be already created in Allplan to be able to be added to the GeneralOpeningElement as the general element (parent)?
Below is a simplification of the code I am using to do so:
def create_element(build_ele, doc): build_ele.zUnique.value = random.random() * 3600 common_props = AllplanBaseElements.CommonProperties() common_props.GetGlobalProperties() wall = Wall_PP(build_ele.zUnique.value, build_ele.llarg.value, build_ele.ample.value, build_ele.axis_x.value, build_ele.axis_y.value) python_part_util = PythonPartUtil(common_props) cube_element = wall.get_cuboid() python_part_util.add_pythonpart_view_2d3d(cube_element) wall_element = wall.wall_element() python_part_util.add_architecture_elements([wall_element]) opening_prop = AllplanArchElements.GeneralOpeningProperties(AllplanArchElements.OpeningType.eNiche) opening_prop.VisibleInViewSection3D = True opening_prop.Independent2DInteraction = False opening_prop.PlaneReferences = AllplanArchElements.PlaneReferences(doc, wall_element.GetBaseElementAdapter()) opening_prop.PlaneReferences.Height = 1010 opening_prop.PlaneReferences.BottomElevation = 1000 custom_create_opening_geo_properties(opening_prop.GetGeometryProperties()) custom_create_sill_properties(opening_prop.GetSillProperties()) custom_create_opening_symbols_properties(opening_prop.GetOpeningSymbolsProperties()) opening_start_pnt = AllplanGeometry.Point3D(0,0,0) opening_end_pnt = OpeningPointsUtil.OpeningPointsUtil.create_opening_end_point_for_shaped_element(opening_start_pnt.To2D, 500., wall.get_wall_axis()).To3D opening_ele = AllplanArchElements.GeneralOpeningElement(opening_prop, wall_element.GetBaseElementAdapter(), opening_start_pnt.To2D, opening_end_pnt.To2D, build_ele.INPUT_MODE.value == 1) python_part_util.add_architecture_elements([opening_ele]) return CreateElementResult(python_part_util.create_pythonpart(build_ele, type_display_name = "PythonPart with sub objects"))
Thanks