mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 21:38:51 +00:00
ifcopenshell.api.run to use explicit kwargs instead of unpacking
This commit is contained in:
@@ -848,10 +848,8 @@ class ReorderCostItem(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
ifcopenshell.api.nest.reorder_nesting(
|
ifcopenshell.api.nest.reorder_nesting(
|
||||||
tool.Ifc.get(),
|
tool.Ifc.get(),
|
||||||
**{
|
item=tool.Ifc.get().by_id(self.cost_item),
|
||||||
"item": tool.Ifc.get().by_id(self.cost_item),
|
new_index=self.new_index,
|
||||||
"new_index": self.new_index,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
tool.Cost.load_cost_schedule_tree()
|
tool.Cost.load_cost_schedule_tree()
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ class RemoveGroup(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
self.file = tool.Ifc.get()
|
self.file = tool.Ifc.get()
|
||||||
ifcopenshell.api.group.remove_group(self.file, **{"group": self.file.by_id(self.group)})
|
ifcopenshell.api.group.remove_group(self.file, group=self.file.by_id(self.group))
|
||||||
bpy.ops.bim.load_groups()
|
bpy.ops.bim.load_groups()
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|||||||
@@ -122,11 +122,12 @@ class AssignParameterizedProfile(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
self.file = tool.Ifc.get()
|
self.file = tool.Ifc.get()
|
||||||
profile = ifcopenshell.api.profile.add_parameterized_profile(
|
profile = ifcopenshell.api.profile.add_parameterized_profile(
|
||||||
self.file,
|
self.file,
|
||||||
**{"ifc_class": self.ifc_class},
|
ifc_class=self.ifc_class,
|
||||||
)
|
)
|
||||||
ifcopenshell.api.material.assign_profile(
|
ifcopenshell.api.material.assign_profile(
|
||||||
self.file,
|
self.file,
|
||||||
**{"material_profile": self.file.by_id(self.material_profile), "profile": profile},
|
material_profile=self.file.by_id(self.material_profile),
|
||||||
|
profile=profile,
|
||||||
)
|
)
|
||||||
bpy.ops.bim.enable_editing_material_set_item(obj=obj.name, material_set_item=self.material_profile)
|
bpy.ops.bim.enable_editing_material_set_item(obj=obj.name, material_set_item=self.material_profile)
|
||||||
|
|
||||||
@@ -471,10 +472,8 @@ class RemoveListItem(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
self.file = tool.Ifc.get()
|
self.file = tool.Ifc.get()
|
||||||
ifcopenshell.api.material.remove_list_item(
|
ifcopenshell.api.material.remove_list_item(
|
||||||
self.file,
|
self.file,
|
||||||
**{
|
material_list=self.file.by_id(self.list_item_set),
|
||||||
"material_list": self.file.by_id(self.list_item_set),
|
material_index=self.list_item_index,
|
||||||
"material_index": self.list_item_index,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -691,7 +691,8 @@ def generate_box(usecase_path: str, ifc_file: ifcopenshell.file, settings: dict[
|
|||||||
ifcopenshell.api.geometry.assign_representation(
|
ifcopenshell.api.geometry.assign_representation(
|
||||||
ifc_file,
|
ifc_file,
|
||||||
should_run_listeners=False,
|
should_run_listeners=False,
|
||||||
**{"product": product, "representation": new_box},
|
product=product,
|
||||||
|
representation=new_box,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -924,7 +924,8 @@ class DrawPolylineSlab(bpy.types.Operator, PolylineOperator, tool.Ifc.Operator):
|
|||||||
attributes = {"OffsetFromReferenceLine": offset, "DirectionSense": direction_sense}
|
attributes = {"OffsetFromReferenceLine": offset, "DirectionSense": direction_sense}
|
||||||
ifcopenshell.api.material.edit_layer_usage(
|
ifcopenshell.api.material.edit_layer_usage(
|
||||||
model,
|
model,
|
||||||
**{"usage": material_set_usage, "attributes": attributes},
|
usage=material_set_usage,
|
||||||
|
attributes=attributes,
|
||||||
)
|
)
|
||||||
DumbSlabPlaner().regenerate_from_occurence(element, material_set_usage)
|
DumbSlabPlaner().regenerate_from_occurence(element, material_set_usage)
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class RemovePsetTemplate(bpy.types.Operator, tool.PsetTemplate.PsetTemplateOpera
|
|||||||
bpy.ops.bim.disable_editing_pset_template()
|
bpy.ops.bim.disable_editing_pset_template()
|
||||||
ifcopenshell.api.pset_template.remove_pset_template(
|
ifcopenshell.api.pset_template.remove_pset_template(
|
||||||
self.template_file,
|
self.template_file,
|
||||||
**{"pset_template": self.template_file.by_id(current_pset_template_id)},
|
pset_template=self.template_file.by_id(current_pset_template_id),
|
||||||
)
|
)
|
||||||
self.template_file.write(IfcStore.pset_template_path)
|
self.template_file.write(IfcStore.pset_template_path)
|
||||||
bonsai.bim.handler.refresh_ui_data()
|
bonsai.bim.handler.refresh_ui_data()
|
||||||
@@ -170,14 +170,12 @@ class EditPsetTemplate(bpy.types.Operator, tool.PsetTemplate.PsetTemplateOperato
|
|||||||
props = tool.PsetTemplate.get_pset_template_props()
|
props = tool.PsetTemplate.get_pset_template_props()
|
||||||
ifcopenshell.api.pset_template.edit_pset_template(
|
ifcopenshell.api.pset_template.edit_pset_template(
|
||||||
IfcStore.pset_template_file,
|
IfcStore.pset_template_file,
|
||||||
**{
|
pset_template=IfcStore.pset_template_file.by_id(props.active_pset_template_id),
|
||||||
"pset_template": IfcStore.pset_template_file.by_id(props.active_pset_template_id),
|
attributes={
|
||||||
"attributes": {
|
"Name": props.active_pset_template.name,
|
||||||
"Name": props.active_pset_template.name,
|
"Description": props.active_pset_template.description,
|
||||||
"Description": props.active_pset_template.description,
|
"TemplateType": props.active_pset_template.template_type,
|
||||||
"TemplateType": props.active_pset_template.template_type,
|
"ApplicableEntity": props.active_pset_template.applicable_entity,
|
||||||
"ApplicableEntity": props.active_pset_template.applicable_entity,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
bpy.ops.bim.disable_editing_pset_template()
|
bpy.ops.bim.disable_editing_pset_template()
|
||||||
@@ -250,7 +248,7 @@ class RemovePropTemplate(bpy.types.Operator, tool.PsetTemplate.PsetTemplateOpera
|
|||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
ifcopenshell.api.pset_template.remove_prop_template(
|
ifcopenshell.api.pset_template.remove_prop_template(
|
||||||
IfcStore.pset_template_file,
|
IfcStore.pset_template_file,
|
||||||
**{"prop_template": IfcStore.pset_template_file.by_id(self.prop_template)},
|
prop_template=IfcStore.pset_template_file.by_id(self.prop_template),
|
||||||
)
|
)
|
||||||
IfcStore.pset_template_file.write(IfcStore.pset_template_path)
|
IfcStore.pset_template_file.write(IfcStore.pset_template_path)
|
||||||
bonsai.bim.handler.refresh_ui_data()
|
bonsai.bim.handler.refresh_ui_data()
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ class RemoveStructuralConnectionCondition(bpy.types.Operator, tool.Ifc.Operator)
|
|||||||
file = tool.Ifc.get()
|
file = tool.Ifc.get()
|
||||||
relation = file.by_id(self.connects_structural_member)
|
relation = file.by_id(self.connects_structural_member)
|
||||||
connection = relation.RelatedStructuralConnection
|
connection = relation.RelatedStructuralConnection
|
||||||
ifcopenshell.api.structural.remove_structural_connection_condition(file, **{"relation": relation})
|
ifcopenshell.api.structural.remove_structural_connection_condition(file, relation=relation)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ class AddStructuralBoundaryCondition(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
file = tool.Ifc.get()
|
file = tool.Ifc.get()
|
||||||
connection = file.by_id(self.connection)
|
connection = file.by_id(self.connection)
|
||||||
ifcopenshell.api.structural.add_structural_boundary_condition(file, **{"connection": connection})
|
ifcopenshell.api.structural.add_structural_boundary_condition(file, connection=connection)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ class RemoveStructuralBoundaryCondition(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
file = tool.Ifc.get()
|
file = tool.Ifc.get()
|
||||||
connection = file.by_id(self.connection)
|
connection = file.by_id(self.connection)
|
||||||
ifcopenshell.api.structural.remove_structural_boundary_condition(file, **{"connection": connection})
|
ifcopenshell.api.structural.remove_structural_boundary_condition(file, connection=connection)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -234,9 +234,7 @@ class EditStructuralBoundaryCondition(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
else:
|
else:
|
||||||
attributes[attribute.name] = {"value": attribute.float_value, "type": attribute.enum_value}
|
attributes[attribute.name] = {"value": attribute.float_value, "type": attribute.enum_value}
|
||||||
|
|
||||||
ifcopenshell.api.structural.edit_structural_boundary_condition(
|
ifcopenshell.api.structural.edit_structural_boundary_condition(file, condition=condition, attributes=attributes)
|
||||||
file, **{"condition": condition, "attributes": attributes}
|
|
||||||
)
|
|
||||||
bpy.ops.bim.disable_editing_structural_boundary_condition()
|
bpy.ops.bim.disable_editing_structural_boundary_condition()
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
@@ -538,10 +536,8 @@ class AssignStructuralLoadCase(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
self.file = tool.Ifc.get()
|
self.file = tool.Ifc.get()
|
||||||
ifcopenshell.api.aggregate.assign_object(
|
ifcopenshell.api.aggregate.assign_object(
|
||||||
self.file,
|
self.file,
|
||||||
**{
|
relating_object=self.file.by_id(self.work_plan),
|
||||||
"relating_object": self.file.by_id(self.work_plan),
|
products=[self.file.by_id(self.load_case)],
|
||||||
"products": [self.file.by_id(self.load_case)],
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|||||||
@@ -39,10 +39,8 @@ def assign_structural_analysis_model(
|
|||||||
) -> None:
|
) -> None:
|
||||||
ifc.run(
|
ifc.run(
|
||||||
"structural.assign_structural_analysis_model",
|
"structural.assign_structural_analysis_model",
|
||||||
**{
|
products=products,
|
||||||
"products": products,
|
structural_analysis_model=structural_analysis_model,
|
||||||
"structural_analysis_model": structural_analysis_model,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -58,10 +56,8 @@ def edit_structural_analysis_model(ifc: tool.Ifc, structural: tool.Structural) -
|
|||||||
attributes = structural.get_structural_analysis_model_attributes()
|
attributes = structural.get_structural_analysis_model_attributes()
|
||||||
ifc.run(
|
ifc.run(
|
||||||
"structural.edit_structural_analysis_model",
|
"structural.edit_structural_analysis_model",
|
||||||
**{
|
structural_analysis_model=structural.get_active_structural_analysis_model(),
|
||||||
"structural_analysis_model": structural.get_active_structural_analysis_model(),
|
attributes=attributes,
|
||||||
"attributes": attributes,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
structural.load_structural_analysis_models()
|
structural.load_structural_analysis_models()
|
||||||
structural.disable_editing_structural_analysis_model()
|
structural.disable_editing_structural_analysis_model()
|
||||||
@@ -91,7 +87,7 @@ def load_structural_analysis_models(structural: tool.Structural) -> None:
|
|||||||
def remove_structural_analysis_model(ifc: tool.Ifc, structural: tool.Structural, model: int) -> None:
|
def remove_structural_analysis_model(ifc: tool.Ifc, structural: tool.Structural, model: int) -> None:
|
||||||
ifc.run(
|
ifc.run(
|
||||||
"structural.remove_structural_analysis_model",
|
"structural.remove_structural_analysis_model",
|
||||||
**{"structural_analysis_model": ifc.get().by_id(model)},
|
structural_analysis_model=ifc.get().by_id(model),
|
||||||
)
|
)
|
||||||
structural.load_structural_analysis_models()
|
structural.load_structural_analysis_models()
|
||||||
|
|
||||||
@@ -103,8 +99,6 @@ def unassign_structural_analysis_model(
|
|||||||
) -> None:
|
) -> None:
|
||||||
ifc.run(
|
ifc.run(
|
||||||
"structural.unassign_structural_analysis_model",
|
"structural.unassign_structural_analysis_model",
|
||||||
**{
|
products=products,
|
||||||
"products": products,
|
structural_analysis_model=structural_analysis_model,
|
||||||
"structural_analysis_model": structural_analysis_model,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -282,10 +282,8 @@ class ScheduleIfcGenerator:
|
|||||||
# Seems intermittently crashy - can we investigate for larger files?
|
# Seems intermittently crashy - can we investigate for larger files?
|
||||||
ifcopenshell.api.control.assign_control(
|
ifcopenshell.api.control.assign_control(
|
||||||
self.file,
|
self.file,
|
||||||
**{
|
relating_control=calendar["ifc"],
|
||||||
"relating_control": calendar["ifc"],
|
related_object=activity["ifc"],
|
||||||
"related_object": activity["ifc"],
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
ifcopenshell.api.sequence.edit_task_time(
|
ifcopenshell.api.sequence.edit_task_time(
|
||||||
self.file,
|
self.file,
|
||||||
@@ -339,20 +337,19 @@ class ScheduleIfcGenerator:
|
|||||||
if not parent.get("ifc"):
|
if not parent.get("ifc"):
|
||||||
parent["ifc"] = ifcopenshell.api.resource.add_resource(
|
parent["ifc"] = ifcopenshell.api.resource.add_resource(
|
||||||
self.file,
|
self.file,
|
||||||
**{"ifc_class": "IfcCrewResource", "name": parent["Name"]},
|
ifc_class="IfcCrewResource",
|
||||||
|
name=parent["Name"],
|
||||||
)
|
)
|
||||||
if parent:
|
if parent:
|
||||||
resource["ifc"] = ifcopenshell.api.resource.add_resource(
|
resource["ifc"] = ifcopenshell.api.resource.add_resource(
|
||||||
self.file,
|
self.file,
|
||||||
**{
|
parent_resource=parent["ifc"] if parent else None,
|
||||||
"parent_resource": parent["ifc"] if parent else None,
|
ifc_class="IfcCrewResource",
|
||||||
"ifc_class": "IfcCrewResource",
|
name=resource["Name"],
|
||||||
"name": resource["Name"],
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
resource["ifc"] = ifcopenshell.api.resource.add_resource(
|
resource["ifc"] = ifcopenshell.api.resource.add_resource(
|
||||||
self.file, **{"ifc_class": "IfcCrewResource", "name": resource["Name"]}
|
self.file, ifc_class="IfcCrewResource", name=resource["Name"]
|
||||||
)
|
)
|
||||||
|
|
||||||
def create_boilerplate_ifc(self) -> None:
|
def create_boilerplate_ifc(self) -> None:
|
||||||
|
|||||||
@@ -262,10 +262,8 @@ class MSP2Ifc:
|
|||||||
if calendar:
|
if calendar:
|
||||||
ifcopenshell.api.control.assign_control(
|
ifcopenshell.api.control.assign_control(
|
||||||
self.file,
|
self.file,
|
||||||
**{
|
relating_control=calendar,
|
||||||
"relating_control": calendar,
|
related_object=task["ifc"],
|
||||||
"related_object": task["ifc"],
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
ifcopenshell.api.sequence.edit_task(
|
ifcopenshell.api.sequence.edit_task(
|
||||||
|
|||||||
@@ -174,13 +174,12 @@ class Cityjson2ifc:
|
|||||||
self.IFC_model = ifcopenshell.api.project.create_file()
|
self.IFC_model = ifcopenshell.api.project.create_file()
|
||||||
self.IFC_project = ifcopenshell.api.root.create_entity(
|
self.IFC_project = ifcopenshell.api.root.create_entity(
|
||||||
self.IFC_model,
|
self.IFC_model,
|
||||||
**{"ifc_class": "IfcProject", "name": self.properties.get("name_project", "My Project")},
|
ifc_class="IfcProject",
|
||||||
|
name=self.properties.get("name_project", "My Project"),
|
||||||
)
|
)
|
||||||
ifcopenshell.api.unit.assign_unit(self.IFC_model, length={"is_metric": True, "raw": "METERS"})
|
ifcopenshell.api.unit.assign_unit(self.IFC_model, length={"is_metric": True, "raw": "METERS"})
|
||||||
self.properties["owner_history"] = self.create_owner_history()
|
self.properties["owner_history"] = self.create_owner_history()
|
||||||
self.IFC_representation_context = ifcopenshell.api.context.add_context(
|
self.IFC_representation_context = ifcopenshell.api.context.add_context(self.IFC_model, context_type="Model")
|
||||||
self.IFC_model, **{"context_type": "Model"}
|
|
||||||
)
|
|
||||||
|
|
||||||
if not self.city_model.has_metadata() or "presentLoDs" not in self.city_model.j["metadata"]:
|
if not self.city_model.has_metadata() or "presentLoDs" not in self.city_model.j["metadata"]:
|
||||||
self.city_model.update_metadata()
|
self.city_model.update_metadata()
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ def assign_object(
|
|||||||
related_objects = set(decomposes.RelatedObjects) - products_set
|
related_objects = set(decomposes.RelatedObjects) - products_set
|
||||||
if related_objects:
|
if related_objects:
|
||||||
decomposes.RelatedObjects = list(related_objects)
|
decomposes.RelatedObjects = list(related_objects)
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": decomposes})
|
ifcopenshell.api.owner.update_owner_history(file, element=decomposes)
|
||||||
else:
|
else:
|
||||||
history = decomposes.OwnerHistory
|
history = decomposes.OwnerHistory
|
||||||
file.remove(decomposes)
|
file.remove(decomposes)
|
||||||
@@ -133,7 +133,7 @@ def assign_object(
|
|||||||
# assign elements to a new aggregate
|
# assign elements to a new aggregate
|
||||||
if is_decomposed_by:
|
if is_decomposed_by:
|
||||||
is_decomposed_by.RelatedObjects = list(set(is_decomposed_by.RelatedObjects) | products_set)
|
is_decomposed_by.RelatedObjects = list(set(is_decomposed_by.RelatedObjects) | products_set)
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": is_decomposed_by})
|
ifcopenshell.api.owner.update_owner_history(file, element=is_decomposed_by)
|
||||||
else:
|
else:
|
||||||
is_decomposed_by = file.create_entity(
|
is_decomposed_by = file.create_entity(
|
||||||
"IfcRelAggregates",
|
"IfcRelAggregates",
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ def unassign_object(file: ifcopenshell.file, products: list[ifcopenshell.entity_
|
|||||||
related_objects = set(rel.RelatedObjects) - products
|
related_objects = set(rel.RelatedObjects) - products
|
||||||
if related_objects:
|
if related_objects:
|
||||||
rel.RelatedObjects = list(related_objects)
|
rel.RelatedObjects = list(related_objects)
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(file, element=rel)
|
||||||
else:
|
else:
|
||||||
history = rel.OwnerHistory
|
history = rel.OwnerHistory
|
||||||
file.remove(rel)
|
file.remove(rel)
|
||||||
|
|||||||
@@ -86,4 +86,4 @@ def edit_attributes(file: ifcopenshell.file, product: ifcopenshell.entity_instan
|
|||||||
product.PredefinedType = "USERDEFINED"
|
product.PredefinedType = "USERDEFINED"
|
||||||
|
|
||||||
if hasattr(product, "OwnerHistory"):
|
if hasattr(product, "OwnerHistory"):
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": product})
|
ifcopenshell.api.owner.update_owner_history(file, element=product)
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ class Usecase:
|
|||||||
if root_rel:
|
if root_rel:
|
||||||
related_objects = set(root_rel.RelatedObjects) | self.rooted_products
|
related_objects = set(root_rel.RelatedObjects) | self.rooted_products
|
||||||
root_rel.RelatedObjects = list(related_objects)
|
root_rel.RelatedObjects = list(related_objects)
|
||||||
ifcopenshell.api.owner.update_owner_history(self.file, **{"element": root_rel})
|
ifcopenshell.api.owner.update_owner_history(self.file, element=root_rel)
|
||||||
else:
|
else:
|
||||||
self.file.create_entity(
|
self.file.create_entity(
|
||||||
"IfcRelAssociatesClassification",
|
"IfcRelAssociatesClassification",
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ def remove_reference(
|
|||||||
related_objects = set(rel.RelatedObjects) - rooted_products
|
related_objects = set(rel.RelatedObjects) - rooted_products
|
||||||
if related_objects:
|
if related_objects:
|
||||||
rel.RelatedObjects = list(related_objects)
|
rel.RelatedObjects = list(related_objects)
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(file, element=rel)
|
||||||
else:
|
else:
|
||||||
history = rel.OwnerHistory
|
history = rel.OwnerHistory
|
||||||
file.remove(rel)
|
file.remove(rel)
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class Usecase:
|
|||||||
if rel:
|
if rel:
|
||||||
related_objects = set(rel.RelatedObjects) | products_to_assign
|
related_objects = set(rel.RelatedObjects) | products_to_assign
|
||||||
rel.RelatedObjects = list(related_objects)
|
rel.RelatedObjects = list(related_objects)
|
||||||
ifcopenshell.api.owner.update_owner_history(self.file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(self.file, element=rel)
|
||||||
return rel
|
return rel
|
||||||
|
|
||||||
return self.file.create_entity(
|
return self.file.create_entity(
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class Usecase:
|
|||||||
related_objects -= products_set
|
related_objects -= products_set
|
||||||
if related_objects:
|
if related_objects:
|
||||||
rel.RelatedObjects = list(related_objects)
|
rel.RelatedObjects = list(related_objects)
|
||||||
ifcopenshell.api.owner.update_owner_history(self.file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(self.file, element=rel)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
history = rel.OwnerHistory
|
history = rel.OwnerHistory
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ def assign_control(
|
|||||||
related_objects = set(controls.RelatedObjects)
|
related_objects = set(controls.RelatedObjects)
|
||||||
related_objects.add(related_object)
|
related_objects.add(related_object)
|
||||||
controls.RelatedObjects = list(related_objects)
|
controls.RelatedObjects = list(related_objects)
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": controls})
|
ifcopenshell.api.owner.update_owner_history(file, element=controls)
|
||||||
else:
|
else:
|
||||||
controls = file.create_entity(
|
controls = file.create_entity(
|
||||||
"IfcRelAssignsToControl",
|
"IfcRelAssignsToControl",
|
||||||
|
|||||||
@@ -63,5 +63,5 @@ def unassign_control(
|
|||||||
related_objects = list(rel.RelatedObjects)
|
related_objects = list(rel.RelatedObjects)
|
||||||
related_objects.remove(related_object)
|
related_objects.remove(related_object)
|
||||||
rel.RelatedObjects = related_objects
|
rel.RelatedObjects = related_objects
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(file, element=rel)
|
||||||
return rel
|
return rel
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ def unassign_document(
|
|||||||
related_objects = set(rel.RelatedObjects) - products_set
|
related_objects = set(rel.RelatedObjects) - products_set
|
||||||
if related_objects:
|
if related_objects:
|
||||||
rel.RelatedObjects = list(related_objects)
|
rel.RelatedObjects = list(related_objects)
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(file, element=rel)
|
||||||
else:
|
else:
|
||||||
history = rel.OwnerHistory
|
history = rel.OwnerHistory
|
||||||
file.remove(rel)
|
file.remove(rel)
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class Usecase:
|
|||||||
self.file, representation=self.settings["representation"]
|
self.file, representation=self.settings["representation"]
|
||||||
)
|
)
|
||||||
self.assign_product_representation(element, mapped_representation)
|
self.assign_product_representation(element, mapped_representation)
|
||||||
ifcopenshell.api.owner.update_owner_history(self.file, **{"element": self.settings["product"]})
|
ifcopenshell.api.owner.update_owner_history(self.file, element=self.settings["product"])
|
||||||
|
|
||||||
def assign_product_representation(
|
def assign_product_representation(
|
||||||
self, product: ifcopenshell.entity_instance, representation: ifcopenshell.entity_instance
|
self, product: ifcopenshell.entity_instance, representation: ifcopenshell.entity_instance
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ class Usecase:
|
|||||||
new_placement.PlacementRelTo = placement_rel_to
|
new_placement.PlacementRelTo = placement_rel_to
|
||||||
self.settings["product"].ObjectPlacement = new_placement
|
self.settings["product"].ObjectPlacement = new_placement
|
||||||
|
|
||||||
ifcopenshell.api.owner.update_owner_history(self.file, **{"element": self.settings["product"]})
|
ifcopenshell.api.owner.update_owner_history(self.file, element=self.settings["product"])
|
||||||
|
|
||||||
for settings in children_settings:
|
for settings in children_settings:
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
|
|||||||
@@ -63,5 +63,5 @@ def assign_group(
|
|||||||
if products_set.issubset(related_objects):
|
if products_set.issubset(related_objects):
|
||||||
return rel
|
return rel
|
||||||
rel.RelatedObjects = list(related_objects | products_set)
|
rel.RelatedObjects = list(related_objects | products_set)
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(file, element=rel)
|
||||||
return rel
|
return rel
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ def unassign_group(
|
|||||||
related_objects -= products_set
|
related_objects -= products_set
|
||||||
if related_objects:
|
if related_objects:
|
||||||
rel.RelatedObjects = list(related_objects)
|
rel.RelatedObjects = list(related_objects)
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(file, element=rel)
|
||||||
else:
|
else:
|
||||||
history = rel.OwnerHistory
|
history = rel.OwnerHistory
|
||||||
file.remove(rel)
|
file.remove(rel)
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ def unassign_reference(
|
|||||||
related_objects = set(rel.RelatedObjects) - products_set
|
related_objects = set(rel.RelatedObjects) - products_set
|
||||||
if related_objects:
|
if related_objects:
|
||||||
rel.RelatedObjects = list(related_objects)
|
rel.RelatedObjects = list(related_objects)
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(file, element=rel)
|
||||||
else:
|
else:
|
||||||
history = rel.OwnerHistory
|
history = rel.OwnerHistory
|
||||||
file.remove(rel)
|
file.remove(rel)
|
||||||
|
|||||||
@@ -328,7 +328,7 @@ class Usecase:
|
|||||||
return self.create_material_association(material)
|
return self.create_material_association(material)
|
||||||
previous_related_objects = set(rel.RelatedObjects)
|
previous_related_objects = set(rel.RelatedObjects)
|
||||||
rel.RelatedObjects = list(previous_related_objects | self.products)
|
rel.RelatedObjects = list(previous_related_objects | self.products)
|
||||||
ifcopenshell.api.owner.update_owner_history(self.file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(self.file, element=rel)
|
||||||
return rel
|
return rel
|
||||||
|
|
||||||
def create_material_association(
|
def create_material_association(
|
||||||
|
|||||||
@@ -132,4 +132,4 @@ class Usecase:
|
|||||||
ifcopenshell.util.element.remove_deep2(self.file, history)
|
ifcopenshell.util.element.remove_deep2(self.file, history)
|
||||||
continue
|
continue
|
||||||
rel.RelatedObjects = list(related_objects)
|
rel.RelatedObjects = list(related_objects)
|
||||||
ifcopenshell.api.owner.update_owner_history(self.file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(self.file, element=rel)
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ def assign_object(
|
|||||||
cur_related_objects = [o for o in nests.RelatedObjects if o not in related_objects_set]
|
cur_related_objects = [o for o in nests.RelatedObjects if o not in related_objects_set]
|
||||||
if cur_related_objects:
|
if cur_related_objects:
|
||||||
nests.RelatedObjects = list(cur_related_objects)
|
nests.RelatedObjects = list(cur_related_objects)
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": nests})
|
ifcopenshell.api.owner.update_owner_history(file, element=nests)
|
||||||
else:
|
else:
|
||||||
history = nests.OwnerHistory
|
history = nests.OwnerHistory
|
||||||
file.remove(nests)
|
file.remove(nests)
|
||||||
@@ -160,7 +160,7 @@ def assign_object(
|
|||||||
is_nested_by.RelatedObjects = cur_related_objects + [
|
is_nested_by.RelatedObjects = cur_related_objects + [
|
||||||
o for o in related_objects if o not in cur_related_objects_set
|
o for o in related_objects if o not in cur_related_objects_set
|
||||||
]
|
]
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": is_nested_by})
|
ifcopenshell.api.owner.update_owner_history(file, element=is_nested_by)
|
||||||
else:
|
else:
|
||||||
is_nested_by = file.create_entity(
|
is_nested_by = file.create_entity(
|
||||||
"IfcRelNests",
|
"IfcRelNests",
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ def change_nest(
|
|||||||
related_objects.remove(item)
|
related_objects.remove(item)
|
||||||
if related_objects:
|
if related_objects:
|
||||||
nests.RelatedObjects = related_objects
|
nests.RelatedObjects = related_objects
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": nests})
|
ifcopenshell.api.owner.update_owner_history(file, element=nests)
|
||||||
else:
|
else:
|
||||||
history = nests.OwnerHistory
|
history = nests.OwnerHistory
|
||||||
file.remove(nests)
|
file.remove(nests)
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ def unassign_object(file: ifcopenshell.file, related_objects: list[ifcopenshell.
|
|||||||
cur_related_objects = [o for o in rel.RelatedObjects if o not in related_objects_set]
|
cur_related_objects = [o for o in rel.RelatedObjects if o not in related_objects_set]
|
||||||
if cur_related_objects:
|
if cur_related_objects:
|
||||||
rel.RelatedObjects = cur_related_objects
|
rel.RelatedObjects = cur_related_objects
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(file, element=rel)
|
||||||
else:
|
else:
|
||||||
history = rel.OwnerHistory
|
history = rel.OwnerHistory
|
||||||
file.remove(rel)
|
file.remove(rel)
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ def assign_actor(
|
|||||||
related_objects = list(rel.RelatedObjects)
|
related_objects = list(rel.RelatedObjects)
|
||||||
related_objects.append(related_object)
|
related_objects.append(related_object)
|
||||||
rel.RelatedObjects = related_objects
|
rel.RelatedObjects = related_objects
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(file, element=rel)
|
||||||
else:
|
else:
|
||||||
rel = file.create_entity(
|
rel = file.create_entity(
|
||||||
"IfcRelAssignsToActor",
|
"IfcRelAssignsToActor",
|
||||||
|
|||||||
@@ -64,4 +64,4 @@ def unassign_actor(
|
|||||||
related_objects = list(rel.RelatedObjects)
|
related_objects = list(rel.RelatedObjects)
|
||||||
related_objects.remove(related_object)
|
related_objects.remove(related_object)
|
||||||
rel.RelatedObjects = related_objects
|
rel.RelatedObjects = related_objects
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(file, element=rel)
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ def assign_declaration(
|
|||||||
related_definitions = set(has_context.RelatedDefinitions) - set(objects_with_contexts)
|
related_definitions = set(has_context.RelatedDefinitions) - set(objects_with_contexts)
|
||||||
if related_definitions:
|
if related_definitions:
|
||||||
has_context.RelatedDefinitions = list(related_definitions)
|
has_context.RelatedDefinitions = list(related_definitions)
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": has_context})
|
ifcopenshell.api.owner.update_owner_history(file, element=has_context)
|
||||||
else:
|
else:
|
||||||
history = has_context.OwnerHistory
|
history = has_context.OwnerHistory
|
||||||
file.remove(has_context)
|
file.remove(has_context)
|
||||||
@@ -133,7 +133,7 @@ def assign_declaration(
|
|||||||
declares = next(iter(all_declares), None)
|
declares = next(iter(all_declares), None)
|
||||||
if declares:
|
if declares:
|
||||||
declares.RelatedDefinitions = list(set(declares.RelatedDefinitions) | set(objects_to_change))
|
declares.RelatedDefinitions = list(set(declares.RelatedDefinitions) | set(objects_to_change))
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": declares})
|
ifcopenshell.api.owner.update_owner_history(file, element=declares)
|
||||||
else:
|
else:
|
||||||
declares = file.create_entity(
|
declares = file.create_entity(
|
||||||
"IfcRelDeclares",
|
"IfcRelDeclares",
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ def unassign_declaration(
|
|||||||
related_definitions = set(rel.RelatedDefinitions) - definitions
|
related_definitions = set(rel.RelatedDefinitions) - definitions
|
||||||
if related_definitions:
|
if related_definitions:
|
||||||
rel.RelatedDefinitions = list(related_definitions)
|
rel.RelatedDefinitions = list(related_definitions)
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(file, element=rel)
|
||||||
else:
|
else:
|
||||||
history = rel.OwnerHistory
|
history = rel.OwnerHistory
|
||||||
file.remove(rel)
|
file.remove(rel)
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ def assign_resource(
|
|||||||
related_objects = list(resource_of.RelatedObjects)
|
related_objects = list(resource_of.RelatedObjects)
|
||||||
related_objects.append(related_object)
|
related_objects.append(related_object)
|
||||||
resource_of.RelatedObjects = related_objects
|
resource_of.RelatedObjects = related_objects
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": resource_of})
|
ifcopenshell.api.owner.update_owner_history(file, element=resource_of)
|
||||||
else:
|
else:
|
||||||
resource_of = file.create_entity(
|
resource_of = file.create_entity(
|
||||||
"IfcRelAssignsToResource",
|
"IfcRelAssignsToResource",
|
||||||
|
|||||||
@@ -69,4 +69,4 @@ def unassign_resource(
|
|||||||
related_objects = list(rel.RelatedObjects)
|
related_objects = list(rel.RelatedObjects)
|
||||||
related_objects.remove(related_object)
|
related_objects.remove(related_object)
|
||||||
rel.RelatedObjects = related_objects
|
rel.RelatedObjects = related_objects
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(file, element=rel)
|
||||||
|
|||||||
@@ -100,10 +100,8 @@ def add_work_schedule(
|
|||||||
if work_plan:
|
if work_plan:
|
||||||
ifcopenshell.api.aggregate.assign_object(
|
ifcopenshell.api.aggregate.assign_object(
|
||||||
file,
|
file,
|
||||||
**{
|
products=[work_schedule],
|
||||||
"products": [work_schedule],
|
relating_object=work_plan,
|
||||||
"relating_object": work_plan,
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
elif file.schema != "IFC2X3":
|
elif file.schema != "IFC2X3":
|
||||||
# TODO: this is an ambiguity by buildingSMART
|
# TODO: this is an ambiguity by buildingSMART
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ def assign_process(
|
|||||||
related_objects = list(operates_on.RelatedObjects)
|
related_objects = list(operates_on.RelatedObjects)
|
||||||
related_objects.append(related_object)
|
related_objects.append(related_object)
|
||||||
operates_on.RelatedObjects = related_objects
|
operates_on.RelatedObjects = related_objects
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": operates_on})
|
ifcopenshell.api.owner.update_owner_history(file, element=operates_on)
|
||||||
else:
|
else:
|
||||||
operates_on = file.create_entity(
|
operates_on = file.create_entity(
|
||||||
"IfcRelAssignsToProcess",
|
"IfcRelAssignsToProcess",
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ def assign_product(
|
|||||||
related_objects = list(referenced_by.RelatedObjects)
|
related_objects = list(referenced_by.RelatedObjects)
|
||||||
related_objects.append(related_object)
|
related_objects.append(related_object)
|
||||||
referenced_by.RelatedObjects = related_objects
|
referenced_by.RelatedObjects = related_objects
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": referenced_by})
|
ifcopenshell.api.owner.update_owner_history(file, element=referenced_by)
|
||||||
else:
|
else:
|
||||||
referenced_by = file.create_entity(
|
referenced_by = file.create_entity(
|
||||||
"IfcRelAssignsToProduct",
|
"IfcRelAssignsToProduct",
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class Usecase:
|
|||||||
related_objects = list(referenced_by.RelatedObjects)
|
related_objects = list(referenced_by.RelatedObjects)
|
||||||
related_objects.append(related_object)
|
related_objects.append(related_object)
|
||||||
referenced_by.RelatedObjects = related_objects
|
referenced_by.RelatedObjects = related_objects
|
||||||
ifcopenshell.api.owner.update_owner_history(self.file, **{"element": referenced_by})
|
ifcopenshell.api.owner.update_owner_history(self.file, element=referenced_by)
|
||||||
else:
|
else:
|
||||||
referenced_by = self.file.create_entity(
|
referenced_by = self.file.create_entity(
|
||||||
"IfcRelDefinesByObject",
|
"IfcRelDefinesByObject",
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ class Usecase:
|
|||||||
related_objects = list(referenced_by.RelatedObjects)
|
related_objects = list(referenced_by.RelatedObjects)
|
||||||
related_objects.append(related_object)
|
related_objects.append(related_object)
|
||||||
referenced_by.RelatedObjects = related_objects
|
referenced_by.RelatedObjects = related_objects
|
||||||
ifcopenshell.api.owner.update_owner_history(self.file, **{"element": referenced_by})
|
ifcopenshell.api.owner.update_owner_history(self.file, element=referenced_by)
|
||||||
else:
|
else:
|
||||||
referenced_by = self.file.create_entity(
|
referenced_by = self.file.create_entity(
|
||||||
"IfcRelDefinesByObject",
|
"IfcRelDefinesByObject",
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ def assign_container(
|
|||||||
related_elements = set(rel.RelatedElements) - products_set
|
related_elements = set(rel.RelatedElements) - products_set
|
||||||
if related_elements:
|
if related_elements:
|
||||||
rel.RelatedElements = list(related_elements)
|
rel.RelatedElements = list(related_elements)
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(file, element=rel)
|
||||||
else:
|
else:
|
||||||
history = rel.OwnerHistory
|
history = rel.OwnerHistory
|
||||||
file.remove(rel)
|
file.remove(rel)
|
||||||
@@ -149,7 +149,7 @@ def assign_container(
|
|||||||
# assign elements to a new container
|
# assign elements to a new container
|
||||||
if structure_rel:
|
if structure_rel:
|
||||||
structure_rel.RelatedElements = list(set(structure_rel.RelatedElements) | products_set)
|
structure_rel.RelatedElements = list(set(structure_rel.RelatedElements) | products_set)
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": structure_rel})
|
ifcopenshell.api.owner.update_owner_history(file, element=structure_rel)
|
||||||
else:
|
else:
|
||||||
structure_rel = file.create_entity(
|
structure_rel = file.create_entity(
|
||||||
"IfcRelContainedInSpatialStructure",
|
"IfcRelContainedInSpatialStructure",
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ def dereference_structure(
|
|||||||
related_elements = related_elements - products_set
|
related_elements = related_elements - products_set
|
||||||
if related_elements:
|
if related_elements:
|
||||||
rel.RelatedElements = list(related_elements)
|
rel.RelatedElements = list(related_elements)
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(file, element=rel)
|
||||||
else:
|
else:
|
||||||
history = rel.OwnerHistory
|
history = rel.OwnerHistory
|
||||||
file.remove(rel)
|
file.remove(rel)
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ def assign_flow_control(
|
|||||||
related_flow_controls = set(assignment.RelatedControlElements)
|
related_flow_controls = set(assignment.RelatedControlElements)
|
||||||
related_flow_controls.add(related_flow_control)
|
related_flow_controls.add(related_flow_control)
|
||||||
assignment.RelatedControlElements = list(related_flow_controls)
|
assignment.RelatedControlElements = list(related_flow_controls)
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": assignment})
|
ifcopenshell.api.owner.update_owner_history(file, element=assignment)
|
||||||
return assignment
|
return assignment
|
||||||
|
|
||||||
assignment = file.create_entity(
|
assignment = file.create_entity(
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ class Usecase:
|
|||||||
related_objects = set(rel.RelatedObjects) or set()
|
related_objects = set(rel.RelatedObjects) or set()
|
||||||
related_objects.add(self.port)
|
related_objects.add(self.port)
|
||||||
rel.RelatedObjects = list(related_objects)
|
rel.RelatedObjects = list(related_objects)
|
||||||
ifcopenshell.api.owner.update_owner_history(self.file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(self.file, element=rel)
|
||||||
else:
|
else:
|
||||||
rel = self.file.create_entity(
|
rel = self.file.create_entity(
|
||||||
"IfcRelNests",
|
"IfcRelNests",
|
||||||
|
|||||||
@@ -64,4 +64,4 @@ def unassign_flow_control(
|
|||||||
related_flow_controls = list(assignment.RelatedControlElements)
|
related_flow_controls = list(assignment.RelatedControlElements)
|
||||||
related_flow_controls.remove(related_flow_control)
|
related_flow_controls.remove(related_flow_control)
|
||||||
assignment.RelatedControlElements = related_flow_controls
|
assignment.RelatedControlElements = related_flow_controls
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": assignment})
|
ifcopenshell.api.owner.update_owner_history(file, element=assignment)
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class Usecase:
|
|||||||
related_objects = set(rel.RelatedObjects) or set()
|
related_objects = set(rel.RelatedObjects) or set()
|
||||||
related_objects.remove(port)
|
related_objects.remove(port)
|
||||||
rel.RelatedObjects = list(related_objects)
|
rel.RelatedObjects = list(related_objects)
|
||||||
ifcopenshell.api.owner.update_owner_history(self.file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(self.file, element=rel)
|
||||||
|
|
||||||
def execute_ifc2x3(self) -> None:
|
def execute_ifc2x3(self) -> None:
|
||||||
for rel in self.element.HasPorts or []:
|
for rel in self.element.HasPorts or []:
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ class Usecase:
|
|||||||
cur_related_objects = set(is_typed_by.RelatedObjects) - related_objects_set
|
cur_related_objects = set(is_typed_by.RelatedObjects) - related_objects_set
|
||||||
if cur_related_objects:
|
if cur_related_objects:
|
||||||
is_typed_by.RelatedObjects = list(cur_related_objects)
|
is_typed_by.RelatedObjects = list(cur_related_objects)
|
||||||
ifcopenshell.api.owner.update_owner_history(self.file, **{"element": is_typed_by})
|
ifcopenshell.api.owner.update_owner_history(self.file, element=is_typed_by)
|
||||||
else:
|
else:
|
||||||
history = is_typed_by.OwnerHistory
|
history = is_typed_by.OwnerHistory
|
||||||
self.file.remove(is_typed_by)
|
self.file.remove(is_typed_by)
|
||||||
@@ -238,7 +238,7 @@ class Usecase:
|
|||||||
# assign objects to a new type
|
# assign objects to a new type
|
||||||
if types:
|
if types:
|
||||||
types.RelatedObjects = list(set(types.RelatedObjects) | related_objects_set)
|
types.RelatedObjects = list(set(types.RelatedObjects) | related_objects_set)
|
||||||
ifcopenshell.api.owner.update_owner_history(self.file, **{"element": types})
|
ifcopenshell.api.owner.update_owner_history(self.file, element=types)
|
||||||
else:
|
else:
|
||||||
types = self.file.create_entity(
|
types = self.file.create_entity(
|
||||||
"IfcRelDefinesByType",
|
"IfcRelDefinesByType",
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ def unassign_type(file: ifcopenshell.file, related_objects: list[ifcopenshell.en
|
|||||||
related_objects_set = set(rel.RelatedObjects) - related_objects_set
|
related_objects_set = set(rel.RelatedObjects) - related_objects_set
|
||||||
if related_objects_set:
|
if related_objects_set:
|
||||||
rel.RelatedObjects = list(related_objects_set)
|
rel.RelatedObjects = list(related_objects_set)
|
||||||
ifcopenshell.api.owner.update_owner_history(file, **{"element": rel})
|
ifcopenshell.api.owner.update_owner_history(file, element=rel)
|
||||||
else:
|
else:
|
||||||
history = rel.OwnerHistory
|
history = rel.OwnerHistory
|
||||||
file.remove(rel)
|
file.remove(rel)
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ class BCFDB(MyDB):
|
|||||||
"reference": reference,
|
"reference": reference,
|
||||||
}
|
}
|
||||||
project_file_information = ProjectFileInformation(
|
project_file_information = ProjectFileInformation(
|
||||||
**{"display_information": display_information_list, "file": file_get_json}
|
display_information=display_information_list, file=file_get_json
|
||||||
)
|
)
|
||||||
project_file_informations.append(project_file_information)
|
project_file_informations.append(project_file_information)
|
||||||
return project_file_informations
|
return project_file_informations
|
||||||
|
|||||||
@@ -248,14 +248,12 @@ class DOCDB(MyDB):
|
|||||||
raise HTTPException(status_code=400, detail="Document node was not created.")
|
raise HTTPException(status_code=400, detail="Document node was not created.")
|
||||||
|
|
||||||
session_init = DocumentUploadSessionInitialization(
|
session_init = DocumentUploadSessionInitialization(
|
||||||
**{
|
upload_ui_url=os.environ["KONTROLL_BASE_URL"]
|
||||||
"upload_ui_url": os.environ["KONTROLL_BASE_URL"]
|
+ "documents/1.0/"
|
||||||
+ "documents/1.0/"
|
+ "document-upload?upload_session="
|
||||||
+ "document-upload?upload_session="
|
+ session_uuid,
|
||||||
+ session_uuid,
|
expires_in=os.environ["SESSION_URL_VALIDITY_SECONDS"],
|
||||||
"expires_in": os.environ["SESSION_URL_VALIDITY_SECONDS"],
|
max_size_in_bytes=os.environ["SESSION_MAX_FILE_SIZE_BYTES"],
|
||||||
"max_size_in_bytes": os.environ["SESSION_MAX_FILE_SIZE_BYTES"],
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return session_init
|
return session_init
|
||||||
@@ -407,15 +405,13 @@ class DOCDB(MyDB):
|
|||||||
upload_session_url = "?upload_session=" + upload_session
|
upload_session_url = "?upload_session=" + upload_session
|
||||||
upload_complete_url = base_url + "upload-completion" + upload_session_url
|
upload_complete_url = base_url + "upload-completion" + upload_session_url
|
||||||
upload_cancellation_url = base_url + "upload-cancellation" + upload_session_url
|
upload_cancellation_url = base_url + "upload-cancellation" + upload_session_url
|
||||||
upload_completion = LinkData(**{"url": upload_complete_url})
|
upload_completion = LinkData(url=upload_complete_url)
|
||||||
upload_cancellation = LinkData(**{"url": upload_cancellation_url})
|
upload_cancellation = LinkData(url=upload_cancellation_url)
|
||||||
document_to_upload_model = DocumentToUpload(
|
document_to_upload_model = DocumentToUpload(
|
||||||
**{
|
session_file_id=document.session_file_id,
|
||||||
"session_file_id": document.session_file_id,
|
upload_file_parts=list(),
|
||||||
"upload_file_parts": list(),
|
upload_completion=upload_completion,
|
||||||
"upload_completion": upload_completion,
|
upload_cancellation=upload_cancellation,
|
||||||
"upload_cancellation": upload_cancellation,
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def add_part_work(tx) -> UUID:
|
def add_part_work(tx) -> UUID:
|
||||||
@@ -461,14 +457,12 @@ class DOCDB(MyDB):
|
|||||||
upload_part_url = "upload-part/" + str(upload_part_uuid)
|
upload_part_url = "upload-part/" + str(upload_part_uuid)
|
||||||
additional_headers = {"values": [{"name": "Content-Length", "value": content_length}]}
|
additional_headers = {"values": [{"name": "Content-Length", "value": content_length}]}
|
||||||
part_instruction = UploadFilePartInstruction(
|
part_instruction = UploadFilePartInstruction(
|
||||||
**{
|
url=base_url + upload_part_url,
|
||||||
"url": base_url + upload_part_url,
|
http_method="POST",
|
||||||
"http_method": "POST",
|
additional_headers=additional_headers,
|
||||||
"additional_headers": additional_headers,
|
include_authorization=True,
|
||||||
"include_authorization": True,
|
content_range_start=content_range_start,
|
||||||
"content_range_start": content_range_start,
|
content_range_end=content_range_end,
|
||||||
"content_range_end": content_range_end,
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
with self.driver.session() as session:
|
with self.driver.session() as session:
|
||||||
@@ -800,7 +794,7 @@ class DOCDB(MyDB):
|
|||||||
MERGE (ss)-[r5:SELECTED]->(d)
|
MERGE (ss)-[r5:SELECTED]->(d)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
selected_documents_model = DocumentsMarkedAsSelected(**{"documents": list()})
|
selected_documents_model = DocumentsMarkedAsSelected(documents=list())
|
||||||
|
|
||||||
for document in all_documents:
|
for document in all_documents:
|
||||||
result = tx.run(cypher, selection_session=str(selection_session), document_id=str(document))
|
result = tx.run(cypher, selection_session=str(selection_session), document_id=str(document))
|
||||||
@@ -823,13 +817,11 @@ class DOCDB(MyDB):
|
|||||||
os.environ["KONTROLL_BASE_URL"] + "documents/1.0/document/" + document_id + "/version/" + str(version_index)
|
os.environ["KONTROLL_BASE_URL"] + "documents/1.0/document/" + document_id + "/version/" + str(version_index)
|
||||||
)
|
)
|
||||||
return DocumentVersionLinks(
|
return DocumentVersionLinks(
|
||||||
**{
|
document_version=LinkData(url=base),
|
||||||
"document_version": LinkData(**{"url": base}),
|
document_version_metadata=LinkData(url=base + "/metadata"),
|
||||||
"document_version_metadata": LinkData(**{"url": base + "/metadata"}),
|
document_version_download=LinkData(url=base + "/download"),
|
||||||
"document_version_download": LinkData(**{"url": base + "/download"}),
|
document_versions=LinkData(url=base + "/versions"),
|
||||||
"document_versions": LinkData(**{"url": base + "/versions"}),
|
document_details=LinkData(url=base + "/details"),
|
||||||
"document_details": LinkData(**{"url": base + "/details"}),
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_download_instructions(self, session_id: UUID, server_context: str, current_user: User) -> SelectedDocuments:
|
def get_download_instructions(self, session_id: UUID, server_context: str, current_user: User) -> SelectedDocuments:
|
||||||
@@ -847,7 +839,7 @@ class DOCDB(MyDB):
|
|||||||
document_model = self.document_node_to_model(document_node)
|
document_model = self.document_node_to_model(document_node)
|
||||||
document_list.append(document_model)
|
document_list.append(document_model)
|
||||||
|
|
||||||
selected_documents = SelectedDocuments(**{"server_context": server_context, "documents": document_list})
|
selected_documents = SelectedDocuments(server_context=server_context, documents=document_list)
|
||||||
return selected_documents
|
return selected_documents
|
||||||
|
|
||||||
with self.driver.session() as session:
|
with self.driver.session() as session:
|
||||||
@@ -975,7 +967,7 @@ class DOCDB(MyDB):
|
|||||||
"data_type": DataType.string,
|
"data_type": DataType.string,
|
||||||
}
|
}
|
||||||
entries.append(entry)
|
entries.append(entry)
|
||||||
return DocumentMetadataEntries(**{"metadata": entries})
|
return DocumentMetadataEntries(metadata=entries)
|
||||||
|
|
||||||
with self.driver.session() as session:
|
with self.driver.session() as session:
|
||||||
return session.execute_read(get_document_version_metadata_work)
|
return session.execute_read(get_document_version_metadata_work)
|
||||||
|
|||||||
Reference in New Issue
Block a user