mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
you can now edit a structural connection coordinate system
This commit is contained in:
@@ -63,7 +63,6 @@ class Data:
|
||||
cls.products.setdefault(product.id(), []).append(model.id())
|
||||
data = model.get_info()
|
||||
del data["OwnerHistory"]
|
||||
del data["OrientationOf2DPlane"]
|
||||
|
||||
loaded_by = []
|
||||
for load_group in model.LoadedBy or []:
|
||||
@@ -75,6 +74,7 @@ class Data:
|
||||
has_results.append(result_group.id())
|
||||
data["HasResults"] = has_results
|
||||
|
||||
data["OrientationOf2DPlane"] = model.OrientationOf2DPlane.id() if model.OrientationOf2DPlane else None
|
||||
data["SharedPlacement"] = model.SharedPlacement.id() if model.SharedPlacement else None
|
||||
|
||||
cls.structural_analysis_models[model.id()] = data
|
||||
@@ -142,22 +142,31 @@ class Data:
|
||||
|
||||
@classmethod
|
||||
def load_structural_connection(cls, product_id):
|
||||
# cls.connections = {}
|
||||
cls.boundary_conditions = {}
|
||||
cls.connects_structural_members = {}
|
||||
|
||||
connection = cls._file.by_id(product_id)
|
||||
connection_data = {"AppliedCondition": None, "ConnectsStructuralMembers": []}
|
||||
data = connection.get_info()
|
||||
del data["OwnerHistory"]
|
||||
|
||||
data["ObjectPlacement"] = data["ObjectPlacement"].id() if data["ObjectPlacement"] is not None else None
|
||||
data["Representation"] = data["Representation"].id() if data["Representation"] is not None else None
|
||||
if connection.is_a("IfcStructuralCurveConnection"):
|
||||
data["Axis"] = data["Axis"].id() if data["Axis"] is not None else None
|
||||
if connection.is_a("IfcStructuralPointConnection"):
|
||||
data["ConditionCoordinateSystem"] = data["ConditionCoordinateSystem"].id() if data["ConditionCoordinateSystem"] is not None else None
|
||||
|
||||
data["ConnectsStructuralMembers"] = []
|
||||
|
||||
if connection.AppliedCondition:
|
||||
cls.load_boundary_condition(connection.AppliedCondition)
|
||||
connection_data["AppliedCondition"] = connection.AppliedCondition.id()
|
||||
data["AppliedCondition"] = connection.AppliedCondition.id()
|
||||
|
||||
for rel in connection.ConnectsStructuralMembers or []:
|
||||
cls.load_connects_structural_member(rel)
|
||||
connection_data["ConnectsStructuralMembers"].append(rel.id())
|
||||
data["ConnectsStructuralMembers"].append(rel.id())
|
||||
|
||||
cls.connections[connection.id()] = connection_data
|
||||
cls.connections[connection.id()] = data
|
||||
|
||||
@classmethod
|
||||
def load_boundary_condition(cls, boundary_condition):
|
||||
@@ -177,7 +186,7 @@ class Data:
|
||||
del rel_data["ConditionCoordinateSystem"] # TODO: consider orientation
|
||||
|
||||
if rel.is_a("IfcRelConnectsWithEccentricity"):
|
||||
rel_data["ConnectionConstraint"] = rel.ConnectionConstraint # TODO
|
||||
rel_data["ConnectionConstraint"] = rel.ConnectionConstraint.id() # TODO
|
||||
|
||||
if rel.AppliedCondition:
|
||||
cls.load_boundary_condition(rel.AppliedCondition)
|
||||
@@ -187,12 +196,7 @@ class Data:
|
||||
|
||||
@classmethod
|
||||
def load_applied_load(cls, applied_load):
|
||||
data = applied_load.get_info()
|
||||
for key, value in data.items():
|
||||
if not value or key in ["Name", "type", "id"]:
|
||||
continue
|
||||
data[key] = value.wrappedValue
|
||||
cls.applied_loads[applied_load.id()] = data
|
||||
cls.applied_loads[applied_load.id()] = applied_load.get_info()
|
||||
|
||||
@classmethod
|
||||
def load_connects_structural_activity(cls, rel):
|
||||
@@ -210,12 +214,28 @@ class Data:
|
||||
@classmethod
|
||||
def load_structural_member(cls, product_id):
|
||||
cls.connects_structural_activities = {}
|
||||
cls.connects_structural_members = {}
|
||||
|
||||
member = cls._file.by_id(product_id)
|
||||
member_data = {"ConnectsStructuralActivities": []}
|
||||
data = member.get_info()
|
||||
|
||||
del data["OwnerHistory"]
|
||||
|
||||
data["ObjectPlacement"] = data["ObjectPlacement"].id() if data["ObjectPlacement"] is not None else None
|
||||
data["Representation"] = data["Representation"].id() if data["Representation"] is not None else None
|
||||
if member.is_a("IfcStructuralCurveMember"):
|
||||
data["Axis"] = data["Axis"].id() if data["Axis"] is not None else None
|
||||
|
||||
data["ConnectsStructuralActivities"] = []
|
||||
data["ConnectedBy"] = []
|
||||
|
||||
for activity in member.AssignedStructuralActivity or []:
|
||||
cls.load_connects_structural_activity(activity)
|
||||
member_data["ConnectsStructuralActivities"].append(activity.id())
|
||||
data["ConnectsStructuralActivities"].append(activity.id())
|
||||
|
||||
cls.members[member.id()] = member_data
|
||||
for rel in member.ConnectedBy or []:
|
||||
cls.load_connects_structural_member(rel)
|
||||
data["ConnectedBy"].append(rel.id())
|
||||
|
||||
|
||||
cls.members[member.id()] = data
|
||||
@@ -0,0 +1,23 @@
|
||||
class Usecase:
|
||||
def __init__(self, file, **settings):
|
||||
self.file = file
|
||||
self.settings = {"structural_item": None, "axis": [0.0, 0.0, 1.0], "ref_direction": [1.0, 0.0, 0.0]}
|
||||
for key, value in settings.items():
|
||||
self.settings[key] = value
|
||||
|
||||
def execute(self):
|
||||
if self.settings["structural_item"].ConditionCoordinateSystem is None:
|
||||
point = self.file.createIfcCartesianPoint((0.0, 0.0, 0.0))
|
||||
ccs = self.file.createIfcAxis2Placement3D(point, None, None)
|
||||
self.settings["structural_item"].ConditionCoordinateSystem = ccs
|
||||
print(ccs)
|
||||
|
||||
ccs = self.settings["structural_item"].ConditionCoordinateSystem
|
||||
print("use case")
|
||||
print(ccs)
|
||||
if ccs.Axis and len(self.file.get_inverse(ccs.Axis)) == 1:
|
||||
self.file.remove(ccs.Axis)
|
||||
ccs.Axis = self.file.createIfcDirection(self.settings["axis"])
|
||||
if ccs.RefDirection and len(self.file.get_inverse(ccs.RefDirection)) == 1:
|
||||
self.file.remove(ccs.RefDirection)
|
||||
ccs.RefDirection = self.file.createIfcDirection(self.settings["ref_direction"])
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
class Usecase:
|
||||
def __init__(self, file, **settings):
|
||||
self.file = file
|
||||
self.settings = {"structural_item": None, "axis": [0.0, 0.0, 1.0]}
|
||||
for key, value in settings.items():
|
||||
self.settings[key] = value
|
||||
|
||||
def execute(self):
|
||||
return
|
||||
if len(self.file.get_inverse(self.settings["structural_item"].Axis)) == 1:
|
||||
self.file.remove(self.settings["structural_item"].Axis)
|
||||
self.settings["structural_item"].Axis = self.file.createIfcDirection(self.settings["axis"])
|
||||
Reference in New Issue
Block a user