mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 05:17:58 +00:00
test_copy_work_schedule - cover ifc2x3 support
This commit is contained in:
@@ -71,10 +71,11 @@ def add_work_plan(
|
|||||||
work_plan.Creators = [user.ThePerson]
|
work_plan.Creators = [user.ThePerson]
|
||||||
work_plan.StartTime = ifcopenshell.api.sequence.add_date_time(file, datetime.now())
|
work_plan.StartTime = ifcopenshell.api.sequence.add_date_time(file, datetime.now())
|
||||||
|
|
||||||
context = file.by_type("IfcContext")[0]
|
if file.schema != "IFC2X3":
|
||||||
ifcopenshell.api.project.assign_declaration(
|
context = file.by_type("IfcContext")[0]
|
||||||
file,
|
ifcopenshell.api.project.assign_declaration(
|
||||||
definitions=[work_plan],
|
file,
|
||||||
relating_context=context,
|
definitions=[work_plan],
|
||||||
)
|
relating_context=context,
|
||||||
|
)
|
||||||
return work_plan
|
return work_plan
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import ifcopenshell.util.date
|
import ifcopenshell.util.date
|
||||||
|
import ifcopenshell.util.element
|
||||||
from math import floor
|
from math import floor
|
||||||
from functools import cache
|
from functools import cache
|
||||||
from typing import Union, Literal, Optional
|
from typing import Union, Literal, Optional
|
||||||
@@ -280,7 +281,7 @@ def get_task_work_schedule(task: ifcopenshell.entity_instance) -> Union[ifcopens
|
|||||||
|
|
||||||
|
|
||||||
def get_nested_tasks(task: ifcopenshell.entity_instance) -> list[ifcopenshell.entity_instance]:
|
def get_nested_tasks(task: ifcopenshell.entity_instance) -> list[ifcopenshell.entity_instance]:
|
||||||
return [object for rel in task.IsNestedBy or [] for object in rel.RelatedObjects if object.is_a("IfcTask")]
|
return [obj for obj in ifcopenshell.util.element.get_components(task) if obj.is_a("IfcTask")]
|
||||||
|
|
||||||
|
|
||||||
def get_parent_task(task: ifcopenshell.entity_instance) -> Union[ifcopenshell.entity_instance, None]:
|
def get_parent_task(task: ifcopenshell.entity_instance) -> Union[ifcopenshell.entity_instance, None]:
|
||||||
|
|||||||
@@ -43,5 +43,9 @@ class TestCopyWorkSchedule(test.bootstrap.IFC4):
|
|||||||
assert len(new_tasks.intersection(old_cost_items)) == 0
|
assert len(new_tasks.intersection(old_cost_items)) == 0
|
||||||
|
|
||||||
|
|
||||||
|
class TestCopyWorkScheduleIFC2X3(test.bootstrap.IFC2X3, TestCopyWorkSchedule):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TestCopyWorkScheduleIFC4X3(test.bootstrap.IFC4X3, TestCopyWorkSchedule):
|
class TestCopyWorkScheduleIFC4X3(test.bootstrap.IFC4X3, TestCopyWorkSchedule):
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user