icon

[Frage] Assign layer to library elements

Schlagworte:
  • PythonParts

In the script im currently using to create precast elements i assign layers to reinforcement bars in the following way, and it works as intended:
com_props=bar.GetCommonProperties()
com_props.Layer = 65101
bar.SetCommonProperties(com_props)
longitudinal_bars.append(bar )
when i place reinforcement meshes or library elements, that part doesent work, and the elements are created on whatever layer is active in Allplan at the moment. I added a line that prints a confermation message when the layer should be assigned and it is in fact printed.
Is there any other way to assign the layer to theese elements? I also have a similar problem with the precast element, but theese dont switch to the active layer but to a fixed allplan layer everytime.

Hi,

We can't assign layer to rebars at the creation but once done you can assign it with:

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

            reinf_ele_list = self.create_rebars()
            for rebar in reinf_ele_list:
                rebar.SetCommonProperties(self.reinf_prop)
            pyp_util.add_reinforcement_elements(reinf_ele_list)

Best regards