Das Wissen aller Anwender nutzen

Im Allplan Connect Forum tauschen sich Anwender aus, geben wertvolle Tipps oder beraten sich bei ganz konkreten Aufgabenstellungen − auch international.
Und damit wirklich keine Frage unbeantwortet bleibt, unterstützen die Mitarbeiter des Technischen Supports ebenfalls aktiv das Forum.

Es erwarten Sie:

  • Foren-Vielfalt aus CAD Architektur, CAD Ingenieurbau uvm.
  • Tipps von User für User
  • international: Deutsch, Englisch, Italienisch, Französisch und Tschechisch

Melden Sie sich jetzt an und diskutieren Sie mit!

Zur Registrierung

[Frage] Assign layer to mesh or extrude/sweep bars

Schlagworte:
  • Pythonpart
  • Layer
  • Mesh
  • Extrude
  • Sweep

Hello,

In my PythonPart I'm trying to assign a layer to reinforcement created as mesh or sweep/extrude bars.
There is no problem with Breps/simple reabrs but only with those mentioned above.

Shortly:
- for sweep/extrude bars i use sth like:

placement.SetCommonProperties(reinf_prop)

where I have defined colour/layer etc. If I will check the console with:

print(placement.GetCommonProperties())

I get for eg.:

CommonProperties(
Color (11)
Layer (3864)...)

Which looks OK, but In Allplan model space, mesh or sweep/extrude bars (inside PythonPart) always gets Layer as Defaulf...
Have you tried to assign Layer to those entities? Is it possible?

Thank you in advance

Karol

Hilfreichste Antwort anzeigen Hilfreichste Antwort verbergen

Zitiert von: bmarciniec
The only solution, that is coming to my mind might be modifying the elements after their creation. The problem is, that we can only modify the layer, but not all common properties (it is just not implemented yet)

Hi, here an example to assign the correct layer after rebars creations :

        
reinf_prop       = BaseElements.CommonProperties()
reinf_prop.Layer = build_ele.ReinfLayerProperties.value


reinf_ele_list = .......

        for rebar in reinf_ele_list:
            rebar.SetCommonProperties(reinf_prop)

pyp_util.add_reinforcement_elements(reinf_ele_list)

more info on this page

Best regards
Christophe

Hi Karol,

if it works on one kind of element, but not on the other, then it means you are doing it right, but the functionality is not implemented.

Regarding SweepBarPlacement it might be the case, that API tries to assign the CommonProperties not on the individual rebars, but on the placement itself. I am however not sure, why it does not work with meshes.

The only solution, that is coming to my mind might be modifying the elements after their creation. The problem is, that we can only modify the layer, but not all common properties (it is just not implemented yet). If that would be enough for your use-case, you would till have to build your PythonPart as an interactor and use the ElementsLayerService after the placements are created, so after using PythonPartTransaction. This might be however too much effort.

Best,
Bart

Thank you very much for this information.

Greetings

Zitiert von: bmarciniec
The only solution, that is coming to my mind might be modifying the elements after their creation. The problem is, that we can only modify the layer, but not all common properties (it is just not implemented yet)

Hi, here an example to assign the correct layer after rebars creations :

        
reinf_prop       = BaseElements.CommonProperties()
reinf_prop.Layer = build_ele.ReinfLayerProperties.value


reinf_ele_list = .......

        for rebar in reinf_ele_list:
            rebar.SetCommonProperties(reinf_prop)

pyp_util.add_reinforcement_elements(reinf_ele_list)

more info on this page

Best regards
Christophe