mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Merge remote-tracking branch 'origin/v0.8.0' into tfk-rocksdb-storage
This commit is contained in:
@@ -53,6 +53,22 @@ pre_listeners: dict[str, dict] = {}
|
||||
post_listeners: dict[str, dict] = {}
|
||||
|
||||
|
||||
def batching_argument_deprecation(
|
||||
usecase_path: str, settings: dict, prev_argument: str, new_argument: str, replace_usecase: Optional[str] = None
|
||||
) -> tuple[str, dict]:
|
||||
if replace_usecase is not None:
|
||||
print(f"WARNING. `{usecase_path}` api method is deprecated and should be replaced with `{replace_usecase}`.")
|
||||
|
||||
if prev_argument in settings:
|
||||
print(
|
||||
f"WARNING. `{prev_argument}` argument is deprecated for API method "
|
||||
f'"{usecase_path}" and should be replaced with `{new_argument}`.'
|
||||
)
|
||||
settings = settings | {new_argument: [settings[prev_argument]]}
|
||||
settings.pop(prev_argument)
|
||||
return (replace_usecase or usecase_path, settings)
|
||||
|
||||
|
||||
def renamed_arguments_deprecation(
|
||||
usecase_path: str, settings: dict, arguments_remapped: dict[str, str]
|
||||
) -> tuple[str, dict]:
|
||||
@@ -71,7 +87,11 @@ def renamed_arguments_deprecation(
|
||||
# "group.add_group": partial(
|
||||
# renamed_arguments_deprecation, arguments_remapped={"Name": "name", "Description": "description"}
|
||||
# ),
|
||||
ARGUMENTS_DEPRECATION: dict[str, Callable[[str, dict[str, Any]], tuple[str, dict[str, Any]]]] = {}
|
||||
ARGUMENTS_DEPRECATION: dict[str, Callable[[str, dict[str, Any]], tuple[str, dict[str, Any]]]] = {
|
||||
"control.assign_control": partial(
|
||||
batching_argument_deprecation, prev_argument="related_object", new_argument="related_objects"
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
CACHED_USECASE_CLASSES: dict[str, Callable] = {}
|
||||
|
||||
@@ -91,43 +91,42 @@ def _add_segment_to_layout(file: ifcopenshell.file, layout: entity_instance, seg
|
||||
|
||||
segment_nest = ifcopenshell.api.alignment.get_alignment_segment_nest(layout)
|
||||
zero_length_segment = segment_nest.RelatedObjects[-1]
|
||||
# DesignParameters.StartPoint for IfcAlignmentHorizontalSegment is automatically updated when the
|
||||
# geometric representation is updated because the semantic and geometric data use the same IfcPoint.
|
||||
# This is not the case of IfcAlignmentVerticalSegment and IfcAlignmentCantSegment. For these
|
||||
# segment types, the design parameters of the zero length segment must be updated explicitly.
|
||||
if zero_length_segment.DesignParameters.is_a(
|
||||
"IfcAlignmentVerticalSegment"
|
||||
) or zero_length_segment.DesignParameters.is_a("IfcAlignmentCantSegment"):
|
||||
# get the geometric representation for the new segment
|
||||
mapped_segments = ifcopenshell.api.alignment.get_mapped_segments(segment)
|
||||
mapped_segment = mapped_segments[0] if mapped_segments[1] == None else mapped_segments[1]
|
||||
mapped_segments = ifcopenshell.api.alignment.get_mapped_segments(segment)
|
||||
mapped_segment = mapped_segments[0] if mapped_segments[1] == None else mapped_segments[1]
|
||||
|
||||
# compute the end point matrix
|
||||
settings = ifcopenshell.geom.settings()
|
||||
segment_fn = ifcopenshell_wrapper.map_shape(settings, mapped_segment.wrapped_data)
|
||||
segment_evaluator = ifcopenshell_wrapper.function_item_evaluator(settings, segment_fn)
|
||||
e = segment_evaluator.evaluate(segment_fn.end())
|
||||
end = np.array(e)
|
||||
# compute the end point matrix
|
||||
settings = ifcopenshell.geom.settings()
|
||||
segment_fn = ifcopenshell_wrapper.map_shape(settings, mapped_segment.wrapped_data)
|
||||
segment_evaluator = ifcopenshell_wrapper.function_item_evaluator(settings, segment_fn)
|
||||
e = segment_evaluator.evaluate(segment_fn.end())
|
||||
end = np.array(e)
|
||||
|
||||
# update the zero length segment semantic representation parameters
|
||||
if zero_length_segment.DesignParameters.is_a("IfcAlignmentVerticalSegment"):
|
||||
y = float(end[1, 3]) / unit_scale
|
||||
zero_length_segment.DesignParameters.StartHeight = y
|
||||
dx = float(end[0, 0])
|
||||
dy = float(end[1, 0])
|
||||
zero_length_segment.DesignParameters.StartGradient = dy / dx
|
||||
zero_length_segment.DesignParameters.EndGradient = zero_length_segment.DesignParameters.StartGradient
|
||||
else:
|
||||
z = float(end[2, 3]) / unit_scale
|
||||
dx = float(end[0, 1])
|
||||
dy = float(end[1, 1])
|
||||
dz = float(end[2, 1])
|
||||
ds = math.sqrt(dx * dx + dy * dy)
|
||||
slope = dz / ds
|
||||
railhead = layout.RailHeadDistance
|
||||
# update the zero length segment semantic representation parameters
|
||||
if zero_length_segment.DesignParameters.is_a("IfcAlignmentHorizontalSegment"):
|
||||
x = float(end[0, 3]) / unit_scale
|
||||
y = float(end[1, 3]) / unit_scale
|
||||
dx = float(end[0, 0])
|
||||
dy = float(end[1, 0])
|
||||
zero_length_segment.DesignParameters.StartPoint.Coordinates = (x,y)
|
||||
zero_length_segment.DesignParameters.StartDirection = dy / dx
|
||||
elif zero_length_segment.DesignParameters.is_a("IfcAlignmentVerticalSegment"):
|
||||
y = float(end[1, 3]) / unit_scale
|
||||
zero_length_segment.DesignParameters.StartHeight = y
|
||||
dx = float(end[0, 0])
|
||||
dy = float(end[1, 0])
|
||||
zero_length_segment.DesignParameters.StartGradient = dy / dx
|
||||
zero_length_segment.DesignParameters.EndGradient = zero_length_segment.DesignParameters.StartGradient
|
||||
else:
|
||||
z = float(end[2, 3]) / unit_scale
|
||||
dx = float(end[0, 1])
|
||||
dy = float(end[1, 1])
|
||||
dz = float(end[2, 1])
|
||||
ds = math.sqrt(dx * dx + dy * dy)
|
||||
slope = dz / ds
|
||||
railhead = layout.RailHeadDistance
|
||||
|
||||
zero_length_segment.DesignParameters.StartCantLeft = z + slope * railhead / 2.0
|
||||
zero_length_segment.DesignParameters.StartCantRight = z - slope * railhead / 2.0
|
||||
zero_length_segment.DesignParameters.StartCantLeft = z + slope * railhead / 2.0
|
||||
zero_length_segment.DesignParameters.StartCantRight = z - slope * railhead / 2.0
|
||||
|
||||
# updated the referent's name because the referent is now at a new station
|
||||
start_dist_along = 0.0
|
||||
|
||||
@@ -57,4 +57,4 @@ def get_mapped_segments(layout_segment: entity_instance) -> Sequence[entity_inst
|
||||
if segment_count == 1:
|
||||
return (curve.Segments[index - segment_count], None)
|
||||
else:
|
||||
return (curve.Segments[index - segment_count], curve.Segment[index])
|
||||
return (curve.Segments[index - segment_count], curve.Segments[index])
|
||||
|
||||
+5
-3
@@ -40,6 +40,8 @@ def layout_horizontal_alignment_by_pi_method(
|
||||
if not (len(hpoints) - 2 == len(radii)):
|
||||
raise ValueError("radii should have two fewer elements that hpoints")
|
||||
|
||||
angle_unit_scale = ifcopenshell.util.unit.calculate_unit_scale(file, "PLANEANGLEUNIT")
|
||||
|
||||
xBT, yBT = hpoints[0]
|
||||
xPI, yPI = hpoints[1]
|
||||
|
||||
@@ -84,7 +86,7 @@ def layout_horizontal_alignment_by_pi_method(
|
||||
StartTag=None,
|
||||
EndTag=None,
|
||||
StartPoint=pt,
|
||||
StartDirection=angleBT,
|
||||
StartDirection=angleBT / angle_unit_scale,
|
||||
StartRadiusOfCurvature=0.0,
|
||||
EndRadiusOfCurvature=0.0,
|
||||
SegmentLength=tangent_run,
|
||||
@@ -102,7 +104,7 @@ def layout_horizontal_alignment_by_pi_method(
|
||||
StartTag=None,
|
||||
EndTag=None,
|
||||
StartPoint=pc,
|
||||
StartDirection=angleBT,
|
||||
StartDirection=angleBT / angle_unit_scale,
|
||||
StartRadiusOfCurvature=float(radius),
|
||||
EndRadiusOfCurvature=float(radius),
|
||||
SegmentLength=lc,
|
||||
@@ -130,7 +132,7 @@ def layout_horizontal_alignment_by_pi_method(
|
||||
StartTag=None,
|
||||
EndTag=None,
|
||||
StartPoint=pt,
|
||||
StartDirection=angleBT,
|
||||
StartDirection=angleBT / angle_unit_scale,
|
||||
StartRadiusOfCurvature=0.0,
|
||||
EndRadiusOfCurvature=0.0,
|
||||
SegmentLength=tangent_run,
|
||||
|
||||
@@ -25,9 +25,9 @@ from typing import Union
|
||||
def assign_control(
|
||||
file: ifcopenshell.file,
|
||||
relating_control: ifcopenshell.entity_instance,
|
||||
related_object: ifcopenshell.entity_instance,
|
||||
related_objects: list[ifcopenshell.entity_instance],
|
||||
) -> Union[ifcopenshell.entity_instance, None]:
|
||||
"""Assigns a planning control or constraint to an object
|
||||
"""Assigns a planning control or constraint to a list of objects.
|
||||
|
||||
IFC can describe concepts that control other objects. For example, a
|
||||
planning calendar controls the availability of working days for
|
||||
@@ -42,7 +42,7 @@ def assign_control(
|
||||
|
||||
:param relating_control: The IfcControl entity that is creating the
|
||||
control or constraint
|
||||
:param related_object: The IfcObjectDefinition that is being controlled
|
||||
:param related_objects: The list of IfcObjectDefinition that is being controlled
|
||||
:return: The newly created IfcRelAssignsToControl. If relationship already
|
||||
existed before and wasn't changed then returns None.
|
||||
|
||||
@@ -59,7 +59,7 @@ def assign_control(
|
||||
# All subtasks will inherit this calendar, so assigning a single
|
||||
# calendar to the root task effectively defines a "default" calendar
|
||||
ifcopenshell.api.control.assign_control(model,
|
||||
relating_control=calendar, related_object=task)
|
||||
relating_control=calendar, related_objects=[task])
|
||||
|
||||
# Another common example might be relating a cost item and a product
|
||||
wall = ifcopenshell.api.root.create_entity(model, ifc_class="IfcWall")
|
||||
@@ -67,22 +67,33 @@ def assign_control(
|
||||
cost_item = ifcopenshell.api.cost.add_cost_item(model,
|
||||
cost_schedule=schedule)
|
||||
ifcopenshell.api.control.assign_control(model,
|
||||
relating_control=cost_item, related_object=wall)
|
||||
relating_control=cost_item, related_objects=[wall])
|
||||
"""
|
||||
if related_object.HasAssignments:
|
||||
for assignment in related_object.HasAssignments:
|
||||
if assignment.is_a("IfcRelAssignsToControl") and assignment.RelatingControl == relating_control:
|
||||
return
|
||||
# Filter out already assigned objects.
|
||||
related_objects_set = set(related_objects)
|
||||
objects_to_assign: set[ifcopenshell.entity_instance] = set()
|
||||
|
||||
control_assignments = set(relating_control.Controls)
|
||||
if control_assignments:
|
||||
for obj in related_objects_set:
|
||||
existing_assignment = next((a for a in obj.HasAssignments if a in control_assignments), None)
|
||||
# Skip objects already assigned to this control.
|
||||
if existing_assignment:
|
||||
continue
|
||||
objects_to_assign.add(obj)
|
||||
else:
|
||||
objects_to_assign = related_objects_set
|
||||
|
||||
if not objects_to_assign:
|
||||
return None
|
||||
|
||||
controls: Union[ifcopenshell.entity_instance, None]
|
||||
controls = next(iter(relating_control.Controls), None)
|
||||
|
||||
if controls:
|
||||
if related_object in controls.RelatedObjects:
|
||||
return
|
||||
related_objects = set(controls.RelatedObjects)
|
||||
related_objects.add(related_object)
|
||||
controls.RelatedObjects = list(related_objects)
|
||||
related_objects_new: list[ifcopenshell.entity_instance] = list(controls.RelatedObjects)
|
||||
related_objects_new.extend(objects_to_assign)
|
||||
controls.RelatedObjects = list(related_objects_new)
|
||||
ifcopenshell.api.owner.update_owner_history(file, element=controls)
|
||||
else:
|
||||
controls = file.create_entity(
|
||||
@@ -90,7 +101,7 @@ def assign_control(
|
||||
**{
|
||||
"GlobalId": ifcopenshell.guid.new(),
|
||||
"OwnerHistory": ifcopenshell.api.owner.create_owner_history(file),
|
||||
"RelatedObjects": [related_object],
|
||||
"RelatedObjects": list(objects_to_assign),
|
||||
"RelatingControl": relating_control,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -19,21 +19,19 @@
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.owner
|
||||
import ifcopenshell.util.element
|
||||
from typing import Union
|
||||
|
||||
|
||||
def unassign_control(
|
||||
file: ifcopenshell.file,
|
||||
relating_control: ifcopenshell.entity_instance,
|
||||
related_object: ifcopenshell.entity_instance,
|
||||
) -> Union[ifcopenshell.entity_instance, None]:
|
||||
related_objects: list[ifcopenshell.entity_instance],
|
||||
) -> None:
|
||||
"""Unassigns a planning control or constraint to an object
|
||||
|
||||
:param relating_control: The IfcControl entity that is creating the
|
||||
control or constraint
|
||||
:param related_object: The IfcObjectDefinition that is being controlled
|
||||
:return: If the control still is related to other objects, the
|
||||
IfcRelAssignsToControl is returned, otherwise None.
|
||||
:param related_objects: The list IfcObjectDefinitions that is being controlled
|
||||
:return: None
|
||||
|
||||
Example:
|
||||
|
||||
@@ -45,23 +43,23 @@ def unassign_control(
|
||||
cost_item = ifcopenshell.api.cost.add_cost_item(model,
|
||||
cost_schedule=schedule)
|
||||
ifcopenshell.api.control.assign_control(model,
|
||||
relating_control=cost_item, related_object=wall)
|
||||
relating_control=cost_item, related_objects=[wall])
|
||||
|
||||
# And now let's change our mind
|
||||
ifcopenshell.api.control.unassign_control(model,
|
||||
relating_control=cost_item, related_object=wall)
|
||||
relating_control=cost_item, related_objects=[wall])
|
||||
"""
|
||||
for rel in related_object.HasAssignments or []:
|
||||
if not rel.is_a("IfcRelAssignsToControl") or rel.RelatingControl != relating_control:
|
||||
continue
|
||||
if len(rel.RelatedObjects) == 1:
|
||||
related_objects_set = set(related_objects)
|
||||
control_assignments = set(relating_control.Controls)
|
||||
rels = set(rel for obj in related_objects_set for rel in obj.HasAssignments if rel in control_assignments)
|
||||
|
||||
for rel in rels:
|
||||
related_objects_new = set(rel.RelatedObjects) - related_objects_set
|
||||
if related_objects_new:
|
||||
rel.RelatedObjects = list(related_objects_new)
|
||||
ifcopenshell.api.owner.update_owner_history(file, element=rel)
|
||||
else:
|
||||
history = rel.OwnerHistory
|
||||
file.remove(rel)
|
||||
if history:
|
||||
ifcopenshell.util.element.remove_deep2(file, history)
|
||||
return
|
||||
related_objects = list(rel.RelatedObjects)
|
||||
related_objects.remove(related_object)
|
||||
rel.RelatedObjects = related_objects
|
||||
ifcopenshell.api.owner.update_owner_history(file, element=rel)
|
||||
return rel
|
||||
|
||||
@@ -59,7 +59,7 @@ def add_cost_item(
|
||||
cost_item_ = ifcopenshell.api.root.create_entity(file, ifc_class="IfcCostItem")
|
||||
|
||||
if cost_schedule:
|
||||
ifcopenshell.api.control.assign_control(file, cost_schedule, cost_item_)
|
||||
ifcopenshell.api.control.assign_control(file, cost_schedule, [cost_item_])
|
||||
elif cost_item:
|
||||
ifcopenshell.api.nest.assign_object(file, related_objects=[cost_item_], relating_object=cost_item)
|
||||
return cost_item_
|
||||
|
||||
@@ -66,7 +66,7 @@ def add_cost_item_quantity(
|
||||
schedule = ifcopenshell.api.cost.add_cost_schedule(model)
|
||||
item = ifcopenshell.api.cost.add_cost_item(model, cost_schedule=schedule)
|
||||
ifcopenshell.api.control.assign_control(model,
|
||||
relating_control=item, related_object=chair)
|
||||
relating_control=item, related_objects=[chair])
|
||||
|
||||
# Let's assume we want to count the amount of chairs to calculate our cost item
|
||||
# Because this is an IfcQuantityCount the count will be automatically set to "1" chair
|
||||
|
||||
@@ -122,7 +122,7 @@ class Usecase:
|
||||
) -> ifcopenshell.entity_instance:
|
||||
return ifcopenshell.api.control.assign_control(
|
||||
self.file,
|
||||
related_object=related_object,
|
||||
related_objects=[related_object],
|
||||
relating_control=cost_item,
|
||||
)
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ def calculate_cost_item_resource_value(file: ifcopenshell.file, cost_item: ifcop
|
||||
concrete = ifcopenshell.api.resource.add_resource(model,
|
||||
ifc_class="IfcConstructionMaterialResource", parent_resource=crew)
|
||||
ifcopenshell.api.control.assign_control(model,
|
||||
relating_control=item, related_object=concrete)
|
||||
relating_control=item, related_objects=[concrete])
|
||||
# ... which has a unit price of 42.0 per m3
|
||||
value = ifcopenshell.api.cost.add_cost_value(model, parent=concrete)
|
||||
ifcopenshell.api.cost.edit_cost_value(model, cost_value=value,
|
||||
@@ -72,7 +72,7 @@ def calculate_cost_item_resource_value(file: ifcopenshell.file, cost_item: ifcop
|
||||
equipment = ifcopenshell.api.resource.add_resource(model,
|
||||
ifc_class="IfcConstructionEquipmentResource", parent_resource=crew)
|
||||
ifcopenshell.api.control.assign_control(model,
|
||||
relating_control=item, related_object=equipment)
|
||||
relating_control=item, related_objects=[equipment])
|
||||
# ... with a fixed price of 50,000
|
||||
value = ifcopenshell.api.cost.add_cost_value(model, parent=concrete)
|
||||
ifcopenshell.api.cost.edit_cost_value(model, cost_value=value,
|
||||
|
||||
@@ -45,5 +45,5 @@ def copy_cost_schedule(
|
||||
if isinstance(duplicated_cost_item, list):
|
||||
# All other nested items are not connected to the cost schedule explicitly.
|
||||
duplicated_cost_item = duplicated_cost_item[0]
|
||||
ifcopenshell.api.control.assign_control(file, new_schedule, duplicated_cost_item)
|
||||
ifcopenshell.api.control.assign_control(file, new_schedule, [duplicated_cost_item])
|
||||
return new_schedule
|
||||
|
||||
@@ -86,7 +86,7 @@ class Usecase:
|
||||
for product in products:
|
||||
ifcopenshell.api.control.unassign_control(
|
||||
self.file,
|
||||
related_object=product,
|
||||
related_objects=[product],
|
||||
relating_control=cost_item,
|
||||
)
|
||||
self.update_cost_item_count(cost_item)
|
||||
|
||||
@@ -22,6 +22,7 @@ import ifcopenshell.api.owner
|
||||
import ifcopenshell.util.unit
|
||||
import ifcopenshell.util.element
|
||||
import ifcopenshell.util.placement
|
||||
from ifcopenshell.util.shape_builder import ShapeBuilder
|
||||
from typing import Optional, Union, Any
|
||||
|
||||
NPArrayOfFloats = npt.NDArray[np.float64]
|
||||
@@ -74,6 +75,7 @@ class Usecase:
|
||||
if not hasattr(self.settings["product"], "ObjectPlacement"):
|
||||
return
|
||||
self.unit_scale = ifcopenshell.util.unit.calculate_unit_scale(self.file)
|
||||
self.builder = ShapeBuilder(self.file)
|
||||
|
||||
if not self.settings["is_si"]:
|
||||
self.convert_matrix_to_si(self.settings["matrix"])
|
||||
@@ -183,25 +185,12 @@ class Usecase:
|
||||
o = np.array((m[0][3], m[1][3], m[2][3]))
|
||||
object_matrix = ifcopenshell.util.placement.a2p(o, z, x)
|
||||
relative_placement_matrix = np.linalg.inv(relating_object_matrix) @ object_matrix
|
||||
return self.create_ifc_axis_2_placement_3d(
|
||||
relative_placement_matrix[:, 3][0:3],
|
||||
return self.builder.create_axis2_placement_3d(
|
||||
self.convert_si_to_unit(relative_placement_matrix[:, 3][0:3]),
|
||||
relative_placement_matrix[:, 2][0:3],
|
||||
relative_placement_matrix[:, 0][0:3],
|
||||
)
|
||||
|
||||
def create_ifc_axis_2_placement_3d(
|
||||
self, point: NPArrayOfFloats, up: NPArrayOfFloats, forward: NPArrayOfFloats
|
||||
) -> ifcopenshell.entity_instance:
|
||||
return self.file.createIfcAxis2Placement3D(
|
||||
self.create_cartesian_point(point),
|
||||
self.file.createIfcDirection(up.tolist()),
|
||||
self.file.createIfcDirection(forward.tolist()),
|
||||
)
|
||||
|
||||
def create_cartesian_point(self, co: NPArrayOfFloats) -> ifcopenshell.entity_instance:
|
||||
co = self.convert_si_to_unit(co)
|
||||
return self.file.createIfcCartesianPoint(co.tolist())
|
||||
|
||||
def convert_si_to_unit(self, co: NPArrayOfFloats) -> NPArrayOfFloats:
|
||||
return co / self.unit_scale
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util.element
|
||||
import ifcopenshell.util.geolocation
|
||||
import ifcopenshell.util.unit
|
||||
import numpy as np
|
||||
from ifcopenshell.util.shape_builder import ShapeBuilder
|
||||
from math import sin, cos, radians
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@ def edit_wcs(
|
||||
ifcopenshell.api.georeference.edit_wcs(model)
|
||||
"""
|
||||
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(file)
|
||||
builder = ShapeBuilder(file)
|
||||
if np.isclose(rotation, 0):
|
||||
xaxis_x = 1.0
|
||||
xaxis_y = 0.0
|
||||
@@ -74,14 +75,10 @@ def edit_wcs(
|
||||
old_wcs = context.WorldCoordinateSystem
|
||||
if context.CoordinateSpaceDimension == 3:
|
||||
if is_si:
|
||||
point = file.createIfcCartesianPoint((x / unit_scale, y / unit_scale, z / unit_scale))
|
||||
xyz = (x / unit_scale, y / unit_scale, z / unit_scale)
|
||||
else:
|
||||
point = file.createIfcCartesianPoint((x, y, z))
|
||||
placement = file.createIfcAxis2Placement3D(
|
||||
point,
|
||||
file.createIfcDirection((0.0, 0.0, 1.0)),
|
||||
file.createIfcDirection((xaxis_x, xaxis_y, 0.0)),
|
||||
)
|
||||
xyz = (x, y, z)
|
||||
placement = builder.create_axis2_placement_3d(xyz, (0.0, 0.0, 1.0), (xaxis_x, xaxis_y, 0.0))
|
||||
elif context.CoordinateSpaceDimension == 2:
|
||||
if is_si:
|
||||
point = file.createIfcCartesianPoint((x / unit_scale, y / unit_scale))
|
||||
|
||||
@@ -138,7 +138,7 @@ def add_task(
|
||||
task.Identification = identification
|
||||
task.IsMilestone = False
|
||||
if work_schedule:
|
||||
ifcopenshell.api.control.assign_control(file, work_schedule, task)
|
||||
ifcopenshell.api.control.assign_control(file, work_schedule, [task])
|
||||
elif parent_task:
|
||||
rel = ifcopenshell.api.nest.assign_object(
|
||||
file,
|
||||
|
||||
@@ -75,7 +75,7 @@ def add_work_calendar(
|
||||
# We associate the calendar with the construction root task. All
|
||||
# subtasks underneath the construction work task will also inherit
|
||||
# this calendar by default (though you can override them).
|
||||
ifcopenshell.api.control.assign_control(model, relating_control=calendar, related_object=task)
|
||||
ifcopenshell.api.control.assign_control(model, relating_control=calendar, related_objects=[task])
|
||||
"""
|
||||
work_calendar = ifcopenshell.api.root.create_entity(
|
||||
file,
|
||||
|
||||
@@ -47,5 +47,5 @@ def copy_work_schedule(
|
||||
duplicated_tasks = ifcopenshell.api.sequence.duplicate_task(file, task)[1]
|
||||
# All other nested items are not connected to the work schedule explicitly.
|
||||
duplicated_task = duplicated_tasks[0]
|
||||
ifcopenshell.api.control.assign_control(file, new_schedule, duplicated_task)
|
||||
ifcopenshell.api.control.assign_control(file, new_schedule, [duplicated_task])
|
||||
return new_schedule
|
||||
|
||||
@@ -79,7 +79,7 @@ class Usecase:
|
||||
assert isinstance(res, list)
|
||||
current, duplicate = res
|
||||
ifcopenshell.api.control.assign_control(
|
||||
self.file, relating_control=baseline_work_schedule, related_object=duplicate[0]
|
||||
self.file, relating_control=baseline_work_schedule, related_objects=[duplicate[0]]
|
||||
)
|
||||
for i, task in enumerate(current):
|
||||
self.create_baseline_reference(task, duplicate[i])
|
||||
|
||||
@@ -54,7 +54,7 @@ def remove_work_calendar(file: ifcopenshell.file, work_calendar: ifcopenshell.en
|
||||
ifcopenshell.api.control.unassign_control(
|
||||
file,
|
||||
relating_control=work_calendar,
|
||||
related_object=related_object,
|
||||
related_objects=[related_object],
|
||||
)
|
||||
|
||||
# Currently in API work times are created already attached
|
||||
|
||||
Reference in New Issue
Block a user