Hi,
How can I assign object attributes like IfcObjectType to an element in my script ?
Best Regards,
Christophe
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.
Melden Sie sich jetzt an und diskutieren Sie mit!
Hi,
How can I assign object attributes like IfcObjectType to an element in my script ?
Best Regards,
Christophe
Hi Christophe,
i've not used attributes by myself but there is a general example in /BasisExamples/Attributes.py.
Maybe you saw that before...
Regards Marcus
VG
Marcus
Hi,
Thanks for your reply.
My question wasn't precise enough...
I'm trying to apply the examples found in "Attributes.py" to the volume created in "OpenStrirrup" but without success ...
The polyhedre is defined as this :
def create_stirrup(self, build_ele):
"""
Create the geometry
Args:
build_ele: the building element.
"""
polyhedron = self.create_geometry()
reinforcement = self.create_reinforcement()
#----------------- Create PythonPart view
views = [View2D3D ([AllplanBasisElements.ModelElement3D(self.com_prop, self.texturedef, polyhedron)])]
#----------------- Create PythonPart
pythonpart = PythonPart ("Stirrup",
parameter_list = build_ele.get_params_list(),
hash_value = build_ele.get_hash(),
python_file = build_ele.pyp_file_name,
views = views,
reinforcement = reinforcement,
common_props = self.com_prop)
self.model_ele_list = pythonpart.create()
def create_geometry(self):
"""
Create the geometry
Returns: created poylhedron
"""
corner1 = AllplanGeo.Point3D(0, 0, 0)
corner2 = AllplanGeo.Point3D(self.width, self.placement_length, self.height)
if not self.horizontal_placement:
corner2 = AllplanGeo.Point3D(self.width, self.height, self.placement_length)
polyhed = AllplanGeo.Polyhedron3D.CreateCuboid(corner1, corner2)
return polyhed
but I don't know how to apply an attribute in this case.
Best,
Christophe
Hi,
EDIT : new code
I found the solution to my problem: I was trying to apply the attribute to my polyhedre while it should simply be applied to the pythonpart like this :
...
pythonpart = PythonPart("Reinforcement",
build_ele.get_params_list(),
self._hash_value,
self._python_file,
views,
AllplanGeo.Matrix3D(),
com_prop,
self.create_reinforcement(),
self.create_attribute_list()
)
self.model_ele_list = pythonpart.create()
def create_attribute_list(self):
"""
Create the attributes
Returns:
AllplanBaseElements.Attributes object filled with attributes
"""
# Define attributes for elements
attr_list = []
# Designation => @507@
attr_list.append(AllplanBaseElements.AttributeString(507, "Text")
return attr_list