icon

Support Forum

[Frage] Pythonparts, Simple PythonPart, Lession 2

Schlagworte:
  • Simple
  • PythonParts
  • Lession
  • 2

Hello Support Forum

I've installed the Python SDK and am currently working through the "Simple PythonPart" tutorial, Lesson 2.
I'm stuck on the last step, where I'm supposed to link the length, width, and height variables from the PYP file to the PY file. Visual Studio Coder throws an error as soon as I enter the first variable, "build_ele.Length.value," instead of 3000 for the length.
The error message is "Variable not recognized." As long as I leave all the fixed values ​​in the PY file, I can use and place the Python part in Allplan.
The three dialog boxes for length, width, and height appear in the input palette, and I can change the values ​​there.
Correctly, these changes don't yet affect the cuboid dimensions.
So, the two files themselves are working correctly. Only the passing of the variable names seems to be failing.
Can anyone help me with this?
Attached are two screenshots from Microsoft Visual Coder, and the ZIP file contains the files from the USR/Local folder.
Is this information sufficient, or do you need any further details to assist you?

Thank you for your support.

Kind regards,
Remo

Anhänge (3)

Typ: image/jpeg
18-mal heruntergeladen
Größe: 136,12 KiB
Typ: image/jpeg
8-mal heruntergeladen
Größe: 94,17 KiB
Typ: application/zip
22-mal heruntergeladen
Größe: 4,11 KiB

Hi,

There is no direct link between the pyp file and the py script.
Therefore, it's possible that VS Code will issue a warning but this won't necessarily prevent the script from running correctly.

To work around this, the PythonPartTools plugin can be used, but it requires some adjustments.

Please note:
I highly recommend not using Standard PythonParts but rather ScriptObjects, which will allow you to easily add interactions with the ALLPLAN environment.

Best

Anhänge (2)

Typ: image/png
2-mal heruntergeladen
Größe: 27,39 KiB
Typ: application/zip
2-mal heruntergeladen
Größe: 1,54 KiB