icon

PythonPart VS - assign layer

Schlagworte:
  • Layer
  • VisualScripting
  • PythonParts

Currently I'm trying to assign each layer ID to elements created in VS. I've already made similar script to assign hatching with ID and it's working, but now I want to check it for layers managment. Here is sample script:

import NemAll_Python_BaseElements as AllplanBaseElements
from TypeCollections.ModelEleList import ModelEleList

def function_to_execute(geometry_obj):

if geometry_obj is None:
return None

model_ele_list = ModelEleList()
model_ele_list.append_geometry_3d(geometry_obj)


for element in model_ele_list:
com_props = element.CommonProperties
com_props.Layer = 65169



return model_ele_list

Any ideas?

Hilfreichste Antwort anzeigen Hilfreichste Antwort verbergen

Hi,

you are creating a local variable with

com_props = element.CommonProperties

You need to add

element.CommonProperties = com_props

or you can set the common properties directly in

com_props = element.CommonProperties
com_props.Layer = 65169

model_ele_list = ModelEleList()
model_ele_list.append_geometry_3d(geometry_obj, com_props)

Best regards
Horst

Hi,

you are creating a local variable with

com_props = element.CommonProperties

You need to add

element.CommonProperties = com_props

or you can set the common properties directly in

com_props = element.CommonProperties
com_props.Layer = 65169

model_ele_list = ModelEleList()
model_ele_list.append_geometry_3d(geometry_obj, com_props)

Best regards
Horst