[Frage] Create PythonPart without polyhedron


Hello forum, as I am learning Allplan PythonPart with the Reinforcement examples, In most of them (Closed Stirrup, Open Stirrup, etc) when you create the PythonPart it always comes with a polyhedron and the reinforcement part.

I want to create a PythonPart with just the reinforcement, but when i tried to change/delete the polyhedron in the code it always results in error or the reinforcement is not selectable after placement. Is there a way to change the example code so that it would return self.create_reinfocement() and handles as a PythonPart?

Many thanks and wish you all a good day!

Hilfreichste Antwort anzeigen Hilfreichste Antwort verbergen

Hi!
What you have to do is construct the BarPlacement object and append it directly to the CreateElementResult object

def create_element(build_ele, doc) -> CreateElementResult:

    ...

    placement = AllplanReinf.BarPlacement(...)

    model_ele_list = []
    model_ele_list.append(placement)

    return CreateElementResult(elements = model_ele_list)

In the examples you are talking about, firstly a PythonPart-container is created, to which the placement is appended. Then the container is appended to the list of the objects to create in the model (model_ele_list). Just append the placement directly to model_ele_list. I attached an example, that does just that (it will be part of Allplan 2024). I am not sure, if you have access to the pre release 2024 version, because I suspect, the example will not work in 2023. That's because the syntax is aligned with python 3.11.4, and in 2023 we still have the python 3.8.8

Anhänge (1)

Typ: application/zip
304-mal heruntergeladen
Größe: 5,68 KiB

Hi!
What you have to do is construct the BarPlacement object and append it directly to the CreateElementResult object

def create_element(build_ele, doc) -> CreateElementResult:

    ...

    placement = AllplanReinf.BarPlacement(...)

    model_ele_list = []
    model_ele_list.append(placement)

    return CreateElementResult(elements = model_ele_list)

In the examples you are talking about, firstly a PythonPart-container is created, to which the placement is appended. Then the container is appended to the list of the objects to create in the model (model_ele_list). Just append the placement directly to model_ele_list. I attached an example, that does just that (it will be part of Allplan 2024). I am not sure, if you have access to the pre release 2024 version, because I suspect, the example will not work in 2023. That's because the syntax is aligned with python 3.11.4, and in 2023 we still have the python 3.8.8

Anhänge (1)

Typ: application/zip
304-mal heruntergeladen
Größe: 5,68 KiB

Zitiert von: llawliet2812
Hello forum, as I am learning Allplan PythonPart with the Reinforcement examples, In most of them (Closed Stirrup, Open Stirrup, etc) when you create the PythonPart it always comes with a polyhedron and the reinforcement part.
I want to create a PythonPart with just the reinforcement, but when i tried to change/delete the polyhedron in the code it always results in error or the reinforcement is not selectable after placement. Is there a way to change the example code so that it would return self.create_reinfocement() and handles as a PythonPart?
Many thanks and wish you all a good day!

Hi,

Please note that we can create a geometry for help building the reinforcement but we don't need to add this geometry to 2d and/or 3d view

I will create soon few new examples for reinforcement but you can look at this (old) one

Best

Anhänge (1)

Typ: application/zip
286-mal heruntergeladen
Größe: 6,34 KiB

Zitiert von: cmaignan35

Quote by llawliet2812Hello forum, as I am learning Allplan PythonPart with the Reinforcement examples, In most of them (Closed Stirrup, Open Stirrup, etc) when you create the PythonPart it always comes with a polyhedron and the reinforcement part.

I want to create a PythonPart with just the reinforcement, but when i tried to change/delete the polyhedron in the code it always results in error or the reinforcement is not selectable after placement. Is there a way to change the example code so that it would return self.create_reinfocement() and handles as a PythonPart?

Many thanks and wish you all a good day!
Hi,
Please note that we can create a geometry for help building the reinforcement but we don't need to add this geometry to 2d and/or 3d view
I will create soon few new examples for reinforcement but you can look at this (old) one
Best

Hi cmaignan35,

I followed your script and the geometry is invisible on the 2D3D view, but I also could not select the reinforcement part to edit the PythonPart. It looks like the whole reinforcement is unselectable. Do you have a workaround for this?

Hi,

Here the update.

To keep a parametric object, I simply add in help construction the footprint of my element to be reinforced.

Please note : this tip also works when you have an element from the library and you want to keep it as a pythonpart (link here)

Best
Christophe

Edit:
As mentioned previously, this is an old example and many things have evolved since it was written (reference point, altimetry, text hook, ...)

I will soon make updated examples

Anhänge (1)

Typ: application/zip
281-mal heruntergeladen
Größe: 6,53 KiB

https://campus.allplan.com/ verwendet Cookies  -  Mehr Informationen

Akzeptieren