icon

Support Forum

Issue with ConnectToPythonPart API [Gelöst]

Schlagworte:
  • Allplan
  • 2025
  • PythonParts
  • ConnectToPythonPart

Hi,
I want to connect PythonPart A to another PythonPart B to receive geometry change events — that is, when PythonPart B changes its geometry, it should trigger edit mode in PythonPart A. However, my implementation throws an error, the PythonPart after creation is automatically deleted with no error in the trace.
Could you please explain what the pyp_uuid_parameter_name (str) in the API refers to?
What exactly should I input there, and do I need to set up anything in PythonPart B?

I’ve already set the .pyp file and the script — please see the screenshot.

Thank you

Anhänge (2)

Typ: image/png
19-mal heruntergeladen
Größe: 8,87 KiB
Typ: image/png
47-mal heruntergeladen
Größe: 36,94 KiB

Lösung anzeigen Lösung verbergen

Hi,
I cannot tell from the screenshot, what are the types of the objects. E.g.

self.uuid - this should be the GUID, not just a string with UUID. You can convert string to GUID with FromString

Also, I think that what comes in the execute call is not correct. Have a look at this example. After modify_uuid_list you give True, but you should give a ReinforcementRearrange object. And this only if you really want to rearrange something, this argument is optional. In fact, all the arguments after modify_uuid_list are optional. I would suspect, here's where the error may be.

From the screenshot I can tell that the Python language server does not work in your IDE. Otherwise, it would report this error to you immediately, before you even run the script. Please watch the getting started video and go through the chacklist in the point 4 in the getting started article. Although we work with Python, the function you call in the end are calling underlying C++ functions of ALLPLAN application. C++ is a strongly typed language, so the type must also be correct in the python layer of your script. I recommend to turn on the type checking in your IDE.

Cheers,
Bart

Hi,
I cannot tell from the screenshot, what are the types of the objects. E.g.

self.uuid - this should be the GUID, not just a string with UUID. You can convert string to GUID with FromString

Also, I think that what comes in the execute call is not correct. Have a look at this example. After modify_uuid_list you give True, but you should give a ReinforcementRearrange object. And this only if you really want to rearrange something, this argument is optional. In fact, all the arguments after modify_uuid_list are optional. I would suspect, here's where the error may be.

From the screenshot I can tell that the Python language server does not work in your IDE. Otherwise, it would report this error to you immediately, before you even run the script. Please watch the getting started video and go through the chacklist in the point 4 in the getting started article. Although we work with Python, the function you call in the end are calling underlying C++ functions of ALLPLAN application. C++ is a strongly typed language, so the type must also be correct in the python layer of your script. I recommend to turn on the type checking in your IDE.

Cheers,
Bart