Zitiert von: Diego_Somaini
Hi,
I would like to create a PythonPart within an interactor. This works fine so far, except that I can't control the reference point of the PythonPart.
The PythonPart is created with the following code.
pyp_util.add_pythonpart_view_2d3d(self.model_ele_list)
self.model_ele_list = pyp_util.create_pythonpart(build_ele, AllplanGeo.Matrix3D(), AllplanGeo.Matrix3D())
AllplanBaseElements.CreateElements(self.doc, mat, self.model_ele_list, self.modify_uuid_list, None)
# mat = Matrix3D with Insertion Point
The insertion point of the PythonPart is adopted correctly. However, a "strange" reference point within the PythonPart is adopted. I have tried to control the reference point of the PythonPart adding PythonPartViewData in pyp_util, but this does not work. You can use PythonPartViewData to control the visibility of the layers, but the reference point is not taken over.
Has anyone had similar experiences and a solution for this problem?
Many thanks and best regards
Diego
Hi Diego,
I think we need more information. First, what do you mean "strange reference point"? Is it located not in the lower-left corner of your geometry? If that is the case, the reasons can be pretty complex. E.g. I don't know, what is inside your model_ele_list. I ran this piece of code:
mat = AllplanGeo.Matrix3D()
mat.SetTranslation(AllplanGeo.Vector3D(1000, 1000, 1000))
geo = AllplanGeo.Polyhedron3D.CreateCuboid(AllplanGeo.Point3D(), AllplanGeo.Point3D(1000, 1000, 1000))
model_ele_list = ModelEleList()
model_ele_list.append_geometry_3d(geo)
pyp_util = PythonPartUtil()
pyp_util.add_pythonpart_view_2d3d(model_ele_list)
model_ele_list = pyp_util.create_pythonpart(build_ele, AllplanGeo.Matrix3D(), AllplanGeo.Matrix3D())
AllplanBaseElements.CreateElements(doc, mat, model_ele_list, [], None)
And the reference point is correctly in the lower-left corner of my cube. But as you can see, there is only this simple cube in my model_ele_list. Can you maybe adapt the code step-by-step towards the moment, where you reach the effect you encounter and tell us, what was the step, that induced the problem? Or maybe you encounter the problem right away in your Allplan version (I ran this code in Allplan 2025)? Let us know.
Best,
Bart