mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
Minor tweak
This commit is contained in:
@@ -128,11 +128,9 @@ class AddSummaryCostItem(bpy.types.Operator):
|
|||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
props = context.scene.BIMCostProperties
|
props = context.scene.BIMCostProperties
|
||||||
self.file = IfcStore.get_file()
|
self.file = IfcStore.get_file()
|
||||||
ifcopenshell.api.run("cost.add_cost_item", self.file, **{
|
ifcopenshell.api.run("cost.add_cost_item", self.file, **{"cost_schedule": self.file.by_id(self.cost_schedule)})
|
||||||
"cost_schedule": self.file.by_id(self.cost_schedule)
|
|
||||||
})
|
|
||||||
Data.load(self.file)
|
Data.load(self.file)
|
||||||
bpy.ops.bim.enable_editing_cost_schedule(cost_schedule = self.cost_schedule)
|
bpy.ops.bim.enable_editing_cost_schedule(cost_schedule=self.cost_schedule)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -147,7 +145,7 @@ class AddCostItem(bpy.types.Operator):
|
|||||||
data = {"cost_item": self.file.by_id(self.cost_item)}
|
data = {"cost_item": self.file.by_id(self.cost_item)}
|
||||||
ifcopenshell.api.run("cost.add_cost_item", self.file, **data)
|
ifcopenshell.api.run("cost.add_cost_item", self.file, **data)
|
||||||
Data.load(self.file)
|
Data.load(self.file)
|
||||||
bpy.ops.bim.enable_editing_cost_schedule(cost_schedule = props.active_cost_schedule_id)
|
bpy.ops.bim.enable_editing_cost_schedule(cost_schedule=props.active_cost_schedule_id)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -162,8 +160,7 @@ class ExpandCostItem(bpy.types.Operator):
|
|||||||
contracted_cost_items = json.loads(props.contracted_cost_items)
|
contracted_cost_items = json.loads(props.contracted_cost_items)
|
||||||
contracted_cost_items.remove(self.cost_item)
|
contracted_cost_items.remove(self.cost_item)
|
||||||
props.contracted_cost_items = json.dumps(contracted_cost_items)
|
props.contracted_cost_items = json.dumps(contracted_cost_items)
|
||||||
Data.load(self.file)
|
bpy.ops.bim.enable_editing_cost_schedule(cost_schedule=props.active_cost_schedule_id)
|
||||||
bpy.ops.bim.enable_editing_cost_schedule(cost_schedule = props.active_cost_schedule_id)
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -178,8 +175,7 @@ class ContractCostItem(bpy.types.Operator):
|
|||||||
contracted_cost_items = json.loads(props.contracted_cost_items)
|
contracted_cost_items = json.loads(props.contracted_cost_items)
|
||||||
contracted_cost_items.append(self.cost_item)
|
contracted_cost_items.append(self.cost_item)
|
||||||
props.contracted_cost_items = json.dumps(contracted_cost_items)
|
props.contracted_cost_items = json.dumps(contracted_cost_items)
|
||||||
Data.load(self.file)
|
bpy.ops.bim.enable_editing_cost_schedule(cost_schedule=props.active_cost_schedule_id)
|
||||||
bpy.ops.bim.enable_editing_cost_schedule(cost_schedule = props.active_cost_schedule_id)
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -194,11 +190,12 @@ class RemoveCostItem(bpy.types.Operator):
|
|||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
"cost.remove_cost_item",
|
"cost.remove_cost_item",
|
||||||
self.file,
|
self.file,
|
||||||
cost_item=IfcStore.get_file().by_id(self.cost_item),
|
cost_item=self.file.by_id(self.cost_item),
|
||||||
)
|
)
|
||||||
|
contracted_cost_items = json.loads(props.contracted_cost_items)
|
||||||
|
if props.active_cost_item_index in contracted_cost_items:
|
||||||
|
contracted_cost_items.remove(props.active_cost_item_index)
|
||||||
|
props.contracted_cost_items = json.dumps(contracted_cost_items)
|
||||||
Data.load(self.file)
|
Data.load(self.file)
|
||||||
# contracted_cost_items = json.loads(props.contracted_cost_items)
|
bpy.ops.bim.enable_editing_cost_schedule(cost_schedule=props.active_cost_schedule_id)
|
||||||
# contracted_cost_items.remove(props.active_cost_item_index)
|
|
||||||
# props.contracted_cost_items = json.dumps(contracted_cost_items)
|
|
||||||
bpy.ops.bim.enable_editing_cost_schedule(cost_schedule = props.active_cost_schedule_id)
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|||||||
@@ -176,9 +176,7 @@ class RemoveWorkSchedule(bpy.types.Operator):
|
|||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
self.file = IfcStore.get_file()
|
self.file = IfcStore.get_file()
|
||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
"sequence.remove_work_schedule",
|
"sequence.remove_work_schedule", self.file, work_schedule=self.file.by_id(self.work_schedule)
|
||||||
self.file,
|
|
||||||
work_schedule= self.file.by_id(self.work_schedule)
|
|
||||||
)
|
)
|
||||||
Data.load(self.file)
|
Data.load(self.file)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
@@ -214,7 +212,6 @@ class EnableEditingWorkSchedule(bpy.types.Operator):
|
|||||||
new.enum_items = json.dumps(ifcopenshell.util.attribute.get_enum_items(attribute))
|
new.enum_items = json.dumps(ifcopenshell.util.attribute.get_enum_items(attribute))
|
||||||
if data[attribute.name()]:
|
if data[attribute.name()]:
|
||||||
new.enum_value = data[attribute.name()]
|
new.enum_value = data[attribute.name()]
|
||||||
self.props.active_work_schedule_id = self.work_schedule
|
|
||||||
|
|
||||||
while len(self.props.tasks) > 0:
|
while len(self.props.tasks) > 0:
|
||||||
self.props.tasks.remove(0)
|
self.props.tasks.remove(0)
|
||||||
@@ -236,7 +233,6 @@ class EnableEditingWorkSchedule(bpy.types.Operator):
|
|||||||
if new.is_expanded:
|
if new.is_expanded:
|
||||||
for related_object_id in task["RelatedObjects"]:
|
for related_object_id in task["RelatedObjects"]:
|
||||||
self.create_new_task_li(related_object_id, level_index + 1)
|
self.create_new_task_li(related_object_id, level_index + 1)
|
||||||
# return {"FINISHED"}
|
|
||||||
|
|
||||||
|
|
||||||
class DisableEditingWorkSchedule(bpy.types.Operator):
|
class DisableEditingWorkSchedule(bpy.types.Operator):
|
||||||
@@ -401,11 +397,9 @@ class AddTask(bpy.types.Operator):
|
|||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
props = context.scene.BIMWorkScheduleProperties
|
props = context.scene.BIMWorkScheduleProperties
|
||||||
self.file = IfcStore.get_file()
|
self.file = IfcStore.get_file()
|
||||||
ifcopenshell.api.run("sequence.add_task", self.file, **{
|
ifcopenshell.api.run("sequence.add_task", self.file, **{"parent_task": self.file.by_id(self.task)})
|
||||||
"parent_task": self.file.by_id(self.task)
|
|
||||||
})
|
|
||||||
Data.load(self.file)
|
Data.load(self.file)
|
||||||
bpy.ops.bim.enable_editing_work_schedule(work_schedule = props.active_work_schedule_id)
|
bpy.ops.bim.enable_editing_work_schedule(work_schedule=props.active_work_schedule_id)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -417,11 +411,9 @@ class AddSummaryTask(bpy.types.Operator):
|
|||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
props = context.scene.BIMWorkScheduleProperties
|
props = context.scene.BIMWorkScheduleProperties
|
||||||
self.file = IfcStore.get_file()
|
self.file = IfcStore.get_file()
|
||||||
ifcopenshell.api.run("sequence.add_task", self.file, **{
|
ifcopenshell.api.run("sequence.add_task", self.file, **{"work_schedule": self.file.by_id(self.work_schedule)})
|
||||||
"work_schedule": self.file.by_id(self.work_schedule)
|
|
||||||
})
|
|
||||||
Data.load(self.file)
|
Data.load(self.file)
|
||||||
bpy.ops.bim.enable_editing_work_schedule(work_schedule = props.active_work_schedule_id)
|
bpy.ops.bim.enable_editing_work_schedule(work_schedule=props.active_work_schedule_id)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -437,7 +429,7 @@ class ExpandTask(bpy.types.Operator):
|
|||||||
contracted_tasks.remove(self.task)
|
contracted_tasks.remove(self.task)
|
||||||
props.contracted_tasks = json.dumps(contracted_tasks)
|
props.contracted_tasks = json.dumps(contracted_tasks)
|
||||||
Data.load(self.file)
|
Data.load(self.file)
|
||||||
bpy.ops.bim.enable_editing_work_schedule(work_schedule = props.active_work_schedule_id)
|
bpy.ops.bim.enable_editing_work_schedule(work_schedule=props.active_work_schedule_id)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -453,7 +445,7 @@ class ContractTask(bpy.types.Operator):
|
|||||||
contracted_tasks.append(self.task)
|
contracted_tasks.append(self.task)
|
||||||
props.contracted_tasks = json.dumps(contracted_tasks)
|
props.contracted_tasks = json.dumps(contracted_tasks)
|
||||||
Data.load(self.file)
|
Data.load(self.file)
|
||||||
bpy.ops.bim.enable_editing_work_schedule(work_schedule = props.active_work_schedule_id)
|
bpy.ops.bim.enable_editing_work_schedule(work_schedule=props.active_work_schedule_id)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -471,5 +463,5 @@ class RemoveTask(bpy.types.Operator):
|
|||||||
task=IfcStore.get_file().by_id(self.task),
|
task=IfcStore.get_file().by_id(self.task),
|
||||||
)
|
)
|
||||||
Data.load(self.file)
|
Data.load(self.file)
|
||||||
bpy.ops.bim.enable_editing_work_schedule(work_schedule = props.active_work_schedule_id)
|
bpy.ops.bim.enable_editing_work_schedule(work_schedule=props.active_work_schedule_id)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class Task(PropertyGroup):
|
|||||||
is_expanded: BoolProperty(name="Is Expanded")
|
is_expanded: BoolProperty(name="Is Expanded")
|
||||||
level_index: IntProperty(name="Level Index")
|
level_index: IntProperty(name="Level Index")
|
||||||
|
|
||||||
|
|
||||||
class WorkPlan(PropertyGroup):
|
class WorkPlan(PropertyGroup):
|
||||||
name: StringProperty(name="Name")
|
name: StringProperty(name="Name")
|
||||||
ifc_definition_id: IntProperty(name="IFC Definition ID")
|
ifc_definition_id: IntProperty(name="IFC Definition ID")
|
||||||
@@ -44,7 +45,6 @@ class BIMWorkScheduleProperties(PropertyGroup):
|
|||||||
contracted_tasks: StringProperty(name="Contracted Task Items", default="[]")
|
contracted_tasks: StringProperty(name="Contracted Task Items", default="[]")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class WorkCalendar(PropertyGroup):
|
class WorkCalendar(PropertyGroup):
|
||||||
name: StringProperty(name="Name")
|
name: StringProperty(name="Name")
|
||||||
ifc_definition_id: IntProperty(name="IFC Definition ID")
|
ifc_definition_id: IntProperty(name="IFC Definition ID")
|
||||||
|
|||||||
Reference in New Issue
Block a user