icon

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

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

PLANlos am BIMmeln

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

PLANlos am BIMmeln