Support Forum

Materialattribut setzen [Gelöst]


Guten Tag zusammen,

ich würde gern das Materialattribut in einem PythonPart setzen. Es handelt sich um eine Elementgruppe.

Das Attribut Bezeichnung kann ich setzen mit:

prop = AllplanBasisElements.ElementGroupProperties()
prop.Name = 'AnkoGroup'

https://pythonparts.allplan.com/2020-0/2020-0/NemAll_Python_BasisElements.html#ElementGroupProperties

Da findet sich aber nichts über weitere Attribute wie das Materialattribut

die formatattribute bekomme ich mit:

com_prop = AllplanBaseElements.CommonProperties()
com_prop.GetGlobalProperties()
print(com_prop)

CommonProperties(
   Color                       (7)
   Layer                       (35058)
   Stroke                      (1)
   Pen                         (3)
   ColorByLayer                (1)
   PenByLayer                  (1)
   StrokeByLayer               (1)
   HelpConstruction            (0))

da ist leider das material auch nicht dabei.

gruss bernd

BIM, BAM, BOOM
BIM-Modelle Tragwerksplaner --> http://www.bimstatik.ch/
My Allplan PythonParts --> https://github.com/BIMStatik/AllplanPythonParts
LinkedIN --> https://ch.linkedin.com/in/bernd-hahnebach-269b855a

Lösung anzeigen Lösung verbergen

Hallo Bernd,

es gibt das Beispiel "PythonParts->BasisExamples->Attributes"

Im zugrunde liegenden Script "Attributes.py" ist das grundsätzlich Vorgehen zu sehen:

# Define attributes for elements
attr_list = []
# Material attribute
attr_list.append(AllplanBaseElements.AttributeString(508, "Stahlbeton"))

# Extract all parameters from building element and add them as attribute to Allplan element
param_dict = self.building_element.get_parameter_dict()
if param_dict is not None:
  attr_list.append(AllplanBaseElements.AttributeString(38, repr(param_dict)))

# add to attribute set
attr_set_list = []
attr_set_list.append(AllplanBaseElements.AttributeSet(attr_list))
# add to attributes
attributes = AllplanBaseElements.Attributes(attr_set_list)
...
#add attributes to element
self.elems[-1].SetAttributes(attributes)

Hallo Bernd,

es gibt das Beispiel "PythonParts->BasisExamples->Attributes"

Im zugrunde liegenden Script "Attributes.py" ist das grundsätzlich Vorgehen zu sehen:

# Define attributes for elements
attr_list = []
# Material attribute
attr_list.append(AllplanBaseElements.AttributeString(508, "Stahlbeton"))

# Extract all parameters from building element and add them as attribute to Allplan element
param_dict = self.building_element.get_parameter_dict()
if param_dict is not None:
  attr_list.append(AllplanBaseElements.AttributeString(38, repr(param_dict)))

# add to attribute set
attr_set_list = []
attr_set_list.append(AllplanBaseElements.AttributeSet(attr_list))
# add to attributes
attributes = AllplanBaseElements.Attributes(attr_set_list)
...
#add attributes to element
self.elems[-1].SetAttributes(attributes)

funtkioniert super, vielen dank.

gruss bernd

BIM, BAM, BOOM
BIM-Modelle Tragwerksplaner --> http://www.bimstatik.ch/
My Allplan PythonParts --> https://github.com/BIMStatik/AllplanPythonParts
LinkedIN --> https://ch.linkedin.com/in/bernd-hahnebach-269b855a


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

Akzeptieren