icon

Support Forum

Fixed values in PythonPart without reading from the Palette [Gelöst]

Schlagworte:
  • Allplan 2024

Hi, When I hardcode the value, the preview is correct. But when I create a PythonPart as shown in the example, the geometry changes back to the default values.
I want to ask how to set the value directly in the code so that it doesn't need to read from the palette in Standard Pythonpart creation. Thank you!

Update:
Maybe I found a bug. Please check the video where I create a standard PythonPart around a separate drawing

Anhänge (2)

Typ: video/mp4
140-mal heruntergeladen
Größe: 1,41 MiB
Typ: video/mp4
131-mal heruntergeladen
Größe: 6,25 MiB

Lösung anzeigen Lösung verbergen

Hi,

the phenomenon you are encountering is the result of how the data of PythonPart elements is saved in an ALLPLAN drawing file. More on that in this article

Basically, a PythonPart element is saved in DF with two entries:

  • definition - contains geometry
  • placement - contains location

So when you have 100 identical PythonPart elements in a drawing file, their geometry is saved once. This saves a lot of disk space.

ALLPLAN needs to know, what PythonPart elements are identical and it is done with the help of a hash which is saved in the definition. The hash is generated solely based on parameter values.

What happens here:

  • You created a PythonPart element with a hash XYZ
  • You changed a hard coded value in the script (you didn't change any parameter -> hash stays the same)
  • You placed the PythonPart element again. It has new geometry, but the same hash
  • ALLPLAN finds the first PythonPart element and notices, the hash is the same, so it uses the definition of this PythonPart. It doesn't matter, that the definition contains different geometry. What matters is the hash

I hope that explains the phenomenon to you.

NOTE: creating a new PythonPart element creates placement and definition, but deleting it deletes only placement. It may happen, that there are definitions in the database, but no placements referring to it. Pressing CTRL+F5 removes unreferenced definitions.

Cheers,
Bart

Hi,

the phenomenon you are encountering is the result of how the data of PythonPart elements is saved in an ALLPLAN drawing file. More on that in this article

Basically, a PythonPart element is saved in DF with two entries:

  • definition - contains geometry
  • placement - contains location

So when you have 100 identical PythonPart elements in a drawing file, their geometry is saved once. This saves a lot of disk space.

ALLPLAN needs to know, what PythonPart elements are identical and it is done with the help of a hash which is saved in the definition. The hash is generated solely based on parameter values.

What happens here:

  • You created a PythonPart element with a hash XYZ
  • You changed a hard coded value in the script (you didn't change any parameter -> hash stays the same)
  • You placed the PythonPart element again. It has new geometry, but the same hash
  • ALLPLAN finds the first PythonPart element and notices, the hash is the same, so it uses the definition of this PythonPart. It doesn't matter, that the definition contains different geometry. What matters is the hash

I hope that explains the phenomenon to you.

NOTE: creating a new PythonPart element creates placement and definition, but deleting it deletes only placement. It may happen, that there are definitions in the database, but no placements referring to it. Pressing CTRL+F5 removes unreferenced definitions.

Cheers,
Bart