mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 20:50:02 +00:00
small refactor
This commit is contained in:
@@ -130,46 +130,37 @@ class FilledOpeningGenerator:
|
|||||||
|
|
||||||
existing_opening_occurrence = self.get_existing_opening_occurrence_if_any(filling)
|
existing_opening_occurrence = self.get_existing_opening_occurrence_if_any(filling)
|
||||||
|
|
||||||
if existing_opening_occurrence:
|
opening = ifcopenshell.api.run(
|
||||||
opening = ifcopenshell.api.run(
|
"root.create_entity",
|
||||||
"root.create_entity",
|
tool.Ifc.get(),
|
||||||
tool.Ifc.get(),
|
ifc_class="IfcOpeningElement",
|
||||||
ifc_class="IfcOpeningElement",
|
predefined_type="OPENING",
|
||||||
predefined_type="OPENING",
|
name="Opening",
|
||||||
name="Opening",
|
)
|
||||||
)
|
ifcopenshell.api.run(
|
||||||
ifcopenshell.api.run(
|
"geometry.edit_object_placement",
|
||||||
"geometry.edit_object_placement", tool.Ifc.get(), product=opening, matrix=filling_obj.matrix_world
|
tool.Ifc.get(),
|
||||||
)
|
product=opening,
|
||||||
|
matrix=np.array(filling_obj.matrix_world),
|
||||||
|
is_si=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
if existing_opening_occurrence:
|
||||||
representation = ifcopenshell.util.representation.get_representation(
|
representation = ifcopenshell.util.representation.get_representation(
|
||||||
existing_opening_occurrence, "Model", "Body", "MODEL_VIEW"
|
existing_opening_occurrence, "Model", "Body", "MODEL_VIEW"
|
||||||
)
|
)
|
||||||
representation = ifcopenshell.util.representation.resolve_representation(representation)
|
representation = ifcopenshell.util.representation.resolve_representation(representation)
|
||||||
mapped_representation = ifcopenshell.api.run(
|
|
||||||
"geometry.map_representation", tool.Ifc.get(), representation=representation
|
|
||||||
)
|
|
||||||
ifcopenshell.api.run(
|
|
||||||
"geometry.assign_representation", tool.Ifc.get(), product=opening, representation=mapped_representation
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
representation = self.generate_opening_from_filling(
|
representation = self.generate_opening_from_filling(
|
||||||
filling, filling_obj, opening_thickness_si=opening_thickness_si
|
filling, filling_obj, opening_thickness_si=opening_thickness_si
|
||||||
)
|
)
|
||||||
opening = ifcopenshell.api.run(
|
|
||||||
"root.create_entity", tool.Ifc.get(), ifc_class="IfcOpeningElement", predefined_type="OPENING"
|
|
||||||
)
|
|
||||||
|
|
||||||
matrix = np.array(filling_obj.matrix_world)
|
mapped_representation = ifcopenshell.api.run(
|
||||||
ifcopenshell.api.run(
|
"geometry.map_representation", tool.Ifc.get(), representation=representation
|
||||||
"geometry.edit_object_placement", tool.Ifc.get(), product=opening, matrix=matrix, is_si=True
|
)
|
||||||
)
|
ifcopenshell.api.run(
|
||||||
mapped_representation = ifcopenshell.api.run(
|
"geometry.assign_representation", tool.Ifc.get(), product=opening, representation=mapped_representation
|
||||||
"geometry.map_representation", tool.Ifc.get(), representation=representation
|
)
|
||||||
)
|
|
||||||
ifcopenshell.api.run(
|
|
||||||
"geometry.assign_representation", tool.Ifc.get(), product=opening, representation=mapped_representation
|
|
||||||
)
|
|
||||||
|
|
||||||
ifcopenshell.api.run("void.add_opening", tool.Ifc.get(), opening=opening, element=element)
|
ifcopenshell.api.run("void.add_opening", tool.Ifc.get(), opening=opening, element=element)
|
||||||
ifcopenshell.api.run("void.add_filling", tool.Ifc.get(), opening=opening, element=filling)
|
ifcopenshell.api.run("void.add_filling", tool.Ifc.get(), opening=opening, element=filling)
|
||||||
|
|||||||
Reference in New Issue
Block a user