[Frage] [PythonParts] Set Origin using PythonPartTransaction [Gelöst]


Hi,

I'm working on Interactor PythonPart scripts who need to keep PythonPart Object.

So, I'm looking on PythonPartTransaction with the following code :

    def create_pythonpart(self):
        """
        Create the PythonPart
        """
        pyp_util = PythonPartUtil()
        pyp_util.add_pythonpart_view_2d3d(self.model_ele_list)
        pyp_transaction = PythonPartTransaction(self.coord_input.GetInputViewDocument())

        pyp_transaction.execute(Geometry.Matrix3D(),
                                self.coord_input.GetViewWorldProjection(),
                                pyp_util.create_pythonpart(self.build_ele),
                                self.modify_uuid_list
                                )

It's working great but the PythonPart's origin is still at (0, 0, 0).

How can I fix it ?

Best

Anhänge (1)

Typ: image/jpeg
13-mal heruntergeladen
Größe: 29,29 KiB

Lösung anzeigen Lösung verbergen

Hi,

you need to set the correct placement matrix (first parameter). The placement matrix includes the placement point and rotation if your PythonPart is created locally to the placement point.

Best regards
Horst

Hi,

you need to set the correct placement matrix (first parameter). The placement matrix includes the placement point and rotation if your PythonPart is created locally to the placement point.

Best regards
Horst

Thanks for your quick answer

Here the updated code :

    def create_pythonpart(self):
        """
        Create the PythonPart
        """
        build_ele = self.build_ele_list[0]
        pyp_matrix = Geometry.Matrix3D()
        pyp_matrix.SetTranslation(Geometry.Vector3D(self.selected_pnts[0]))
        pyp_util  = PythonPartUtil()
        pyp_util.add_pythonpart_view_2d3d(self.model_ele_list)
        pyp_transaction = PythonPartTransaction(self.coord_input.GetInputViewDocument())

        pyp_transaction.execute(pyp_matrix,
                                self.coord_input.GetViewWorldProjection(),
                                pyp_util.create_pythonpart(build_ele),
                                []
                                )

Best

Verwendung von Cookies:
Um die Webseite optimal gestalten und fortlaufend verbessern zu können, verwendet Allplan Cookies.
Durch die weitere Nutzung der Webseite erklären Sie sich mit der Verwendung von Cookies einverstanden.  -  Mehr Informationen

Schließen