This commit is contained in:
Andrej730
2025-02-18 15:18:23 +05:00
parent 83a351b1c7
commit 17642ca4e9
117 changed files with 683 additions and 1005 deletions
@@ -28,14 +28,8 @@ def edit_structural_analysis_model(
IfcStructuralAnalysisModel, consult the IFC documentation.
:param structural_analysis_model: The IfcStructuralAnalysisModel entity you want to edit
:type structural_analysis_model: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
:type attributes: dict
:return: None
:rtype: None
"""
settings = {"structural_analysis_model": structural_analysis_model, "attributes": attributes or {}}
for name, value in settings["attributes"].items():
setattr(settings["structural_analysis_model"], name, value)
return settings["structural_analysis_model"]
for name, value in attributes.items():
setattr(structural_analysis_model, name, value)
@@ -28,19 +28,14 @@ def edit_structural_boundary_condition(
IfcBoundaryCondition, consult the IFC documentation.
:param condition: The IfcBoundaryCondition entity you want to edit
:type condition: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
:type attributes: dict
:return: None
:rtype: None
"""
settings = {"condition": condition, "attributes": attributes}
for name, data in settings["attributes"].items():
for name, data in attributes.items():
if data["type"] == "string" or data["type"] == "null":
value = data["value"]
elif data["type"] == "IfcBoolean":
value = file.createIfcBoolean(data["value"])
else:
value = file.create_entity(data["type"], data["value"])
setattr(settings["condition"], name, value)
setattr(condition, name, value)
@@ -16,25 +16,21 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell
from ifcopenshell.util.shape_builder import VectorType, ifc_safe_vector_type
def edit_structural_item_axis(
file: ifcopenshell.file,
structural_item: ifcopenshell.entity_instance,
axis: tuple[float, float, float] = (0.0, 0.0, 1.0),
axis: VectorType = (0.0, 0.0, 1.0),
) -> None:
"""Edits the coordinate system of a structural connection
:param structural_item: The IfcStructuralItem you want to modify.
:type structural_item: ifcopenshell.entity_instance
:param axis: The unit Z axis vector defined as a list of 3 floats.
Defaults to (0., 0., 1.).
:type axis: tuple[float, float, float]
:return: None
:rtype: None
"""
settings = {"structural_item": structural_item, "axis": axis}
if len(file.get_inverse(settings["structural_item"].Axis)) == 1:
file.remove(settings["structural_item"].Axis)
settings["structural_item"].Axis = file.createIfcDirection(settings["axis"])
if len(file.get_inverse(axis_dir := structural_item.Axis)) == 1:
file.remove(axis_dir)
structural_item.Axis = file.create_entity("IfcDirection", ifc_safe_vector_type(axis))
@@ -28,13 +28,8 @@ def edit_structural_load(
IfcStructuralLoad, consult the IFC documentation.
:param structural_load: The IfcStructuralLoad entity you want to edit
:type structural_load: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
:type attributes: dict
:return: None
:rtype: None
"""
settings = {"structural_load": structural_load, "attributes": attributes or {}}
for name, value in settings["attributes"].items():
setattr(settings["structural_load"], name, value)
for name, value in attributes.items():
setattr(structural_load, name, value)
@@ -28,13 +28,8 @@ def edit_structural_load_case(
IfcStructuralLoadCase, consult the IFC documentation.
:param load_case: The IfcStructuralLoadCase entity you want to edit
:type load_case: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
:type attributes: dict
:return: None
:rtype: None
"""
settings = {"load_case": load_case, "attributes": attributes or {}}
for name, value in settings["attributes"].items():
setattr(settings["load_case"], name, value)
for name, value in attributes.items():
setattr(load_case, name, value)