Minor fix.

This commit is contained in:
Dion Moult
2021-10-25 19:32:37 +11:00
parent 58ee049a8f
commit 818e8010a4
4 changed files with 38 additions and 11 deletions
@@ -71,7 +71,8 @@ class ObjectPsetsData(Data):
if element.is_a("IfcTypeObject"):
return
element_type = ifcopenshell.util.element.get_type(element)
return cls.psetqtos(element_type)
if element_type:
return cls.psetqtos(element_type)
class ObjectQtosData(Data):
@@ -656,13 +656,13 @@ class CopyTaskAttribute(bpy.types.Operator):
bl_idname = "bim.copy_task_attribute"
bl_label = "Copy Task Attribute"
bl_options = {"REGISTER", "UNDO"}
data: bpy.props.StringProperty()
name: bpy.props.StringProperty()
def execute(self, context):
return IfcStore.execute_ifc_operator(self, context)
def _execute(self, context):
data = json.loads(self.data)
value = context.scene.BIMWorkScheduleProperties.task_attributes.get(self.name).get_value()
self.file = IfcStore.get_file()
props = context.scene.BIMTaskTreeProperties
for task in props.tasks:
@@ -670,10 +670,8 @@ class CopyTaskAttribute(bpy.types.Operator):
ifcopenshell.api.run(
"sequence.edit_task",
self.file,
**{
"task": self.file.by_id(task.ifc_definition_id),
"attributes": {data["name"]: None if data["is_null"] else data["value"]},
},
task=self.file.by_id(task.ifc_definition_id),
attributes={self.name: value},
)
Data.load(IfcStore.get_file())
bpy.ops.bim.load_task_properties()
@@ -1,6 +1,34 @@
@sequence
Feature: Sequence
Covers Visualising Work Schedule Date Range.
Scenario: Add work plan
Given an empty IFC project
When I press "bim.add_work_plan"
Then nothing happens
Scenario: Enable editing task
Given an empty IFC project
And I press "bim.add_work_schedule"
And the variable "work_schedule" is "IfcStore.get_file().by_type('IfcWorkSchedule')[0].id()"
And I press "bim.enable_editing_tasks(work_schedule={work_schedule})"
And I press "bim.add_summary_task(work_schedule={work_schedule})"
And the variable "task" is "IfcStore.get_file().by_type('IfcTask')[0].id()"
When I press "bim.enable_editing_task(task={task})"
Then nothing happens
Scenario: Copy task attribute
Given an empty IFC project
And I press "bim.add_work_schedule"
And the variable "work_schedule" is "IfcStore.get_file().by_type('IfcWorkSchedule')[0].id()"
And I press "bim.enable_editing_tasks(work_schedule={work_schedule})"
And I press "bim.add_summary_task(work_schedule={work_schedule})"
And I press "bim.add_summary_task(work_schedule={work_schedule})"
And the variable "task" is "IfcStore.get_file().by_type('IfcTask')[0].id()"
And I press "bim.enable_editing_task(task={task})"
And I set "scene.BIMWorkScheduleProperties.task_attributes[2].string_value" to "Foo"
When I set "scene.BIMTaskTreeProperties.tasks[1].is_selected" to "True"
And I press "bim.copy_task_attribute(name='Description')"
Then nothing happens
Scenario: See the current frame date as text
Given an empty IFC project
@@ -19,9 +19,9 @@ class Usecase:
name=self.settings["name"],
)
work_plan.CreationDate = ifcopenshell.util.date.datetime2ifc(datetime.now(), "IfcDateTime")
person = ifcopenshell.api.owner.settings.get_person(self.file)
if person:
work_plan.Creators = [person]
user = ifcopenshell.api.owner.settings.get_user(self.file)
if user:
work_plan.Creators = [user.ThePerson]
work_plan.StartTime = ifcopenshell.util.date.datetime2ifc(self.settings["start_time"], "IfcDateTime")
context = self.file.by_type("IfcContext")[0]