MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / parse_element

Method parse_element

src/ifc2ca/ifc2ca.py:382–419  ·  view source on GitHub ↗
(self, element: ios.entity_instance)

Source from the content-addressed store, hash-verified

380 }
381
382 def parse_element(self, element: ios.entity_instance):
383 data = {k: v for k, v in element.get_info().items() if k in self.member_keys}
384
385 data["ObjectType"] = ifcopenshell.util.element.get_predefined_type(element)
386 data["ref_id"] = self.get_ref_id(element)
387 representation = ifcopenshell.util.representation.get_representation(element, self.get_context())
388 repr_item = representation.Items[0]
389 data["geometry_type"] = representation.RepresentationType
390 data["geometry"] = self.parse_representation(representation)
391
392 if element.is_a("IfcStructuralCurveMember"):
393 placement = ifcopenshell.util.placement.a2p(
394 data["geometry"][0],
395 element.Axis.DirectionRatios,
396 [c2 - c1 for c1, c2 in zip(data["geometry"][0], data["geometry"][1])],
397 )
398
399 elif element.is_a("IfcStructuralSurfaceMember"):
400 placement = ifcopenshell.util.placement.get_axis2placement(repr_item.FaceSurface.Position)
401
402 origin, orientation = self.parse_transformation_matrix(placement)
403 data["origin"] = origin
404 data["orientation"] = orientation
405 if element.is_a("IfcStructuralSurfaceMember") and not repr_item.SameSense:
406 data["orientation"] *= -1
407
408 materialset = ifcopenshell.util.element.get_material(element, should_skip_usage=True)
409 if element.is_a() == "IfcStructuralCurveMember":
410 data["material"] = materialset.MaterialProfiles[0].Material
411 data["profile"] = materialset.MaterialProfiles[0].Profile
412 # data["profile"] = ifcopenshell.util.shape.get_profiles(element)[0]
413 elif element.is_a() == "IfcStructuralSurfaceMember":
414 if materialset.is_a() == "IfcMaterial":
415 data["material"] = materialset
416 else:
417 data["material"] = materialset.MaterialLayers[0].Material
418
419 return data
420
421 def parse_connection(self, connection: ios.entity_instance):
422 data = {k: v for k, v in connection.get_info().items() if k in self.connection_keys}

Callers 1

parse_modelMethod · 0.95

Calls 10

get_ref_idMethod · 0.95
get_contextMethod · 0.95
parse_representationMethod · 0.95
get_predefined_typeMethod · 0.80
itemsMethod · 0.45
get_infoMethod · 0.45
get_representationMethod · 0.45
is_aMethod · 0.45
get_materialMethod · 0.45

Tested by

no test coverage detected