[Otázka] Assign layer to mesh or extrude/sweep bars

Tagy:
  • 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

Show most helpful answer Hide most helpful answer

Citoval 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

Citoval 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