mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-28 19:27:10 +00:00
You can now add / remove cost schedules
This commit is contained in:
@@ -25,6 +25,7 @@ if bpy is not None:
|
||||
"geometry": None,
|
||||
"cobie": None,
|
||||
"sequence": None,
|
||||
"cost": None,
|
||||
"group": None,
|
||||
"structural": None,
|
||||
"material": None,
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import bpy
|
||||
from . import ui, operator
|
||||
|
||||
classes = (
|
||||
operator.AddCostSchedule,
|
||||
operator.RemoveCostSchedule,
|
||||
ui.BIM_PT_cost_schedules,
|
||||
)
|
||||
|
||||
|
||||
def register():
|
||||
pass
|
||||
|
||||
|
||||
def unregister():
|
||||
pass
|
||||
@@ -0,0 +1,29 @@
|
||||
import bpy
|
||||
import ifcopenshell.api
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from ifcopenshell.api.cost.data import Data
|
||||
|
||||
|
||||
class AddCostSchedule(bpy.types.Operator):
|
||||
bl_idname = "bim.add_cost_schedule"
|
||||
bl_label = "Add Cost Schedule"
|
||||
|
||||
def execute(self, context):
|
||||
ifcopenshell.api.run("cost.add_cost_schedule", IfcStore.get_file())
|
||||
Data.load(IfcStore.get_file())
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class RemoveCostSchedule(bpy.types.Operator):
|
||||
bl_idname = "bim.remove_cost_schedule"
|
||||
bl_label = "Remove Cost Schedule"
|
||||
cost_schedule: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
ifcopenshell.api.run(
|
||||
"cost.remove_cost_schedule",
|
||||
IfcStore.get_file(),
|
||||
cost_schedule=IfcStore.get_file().by_id(self.cost_schedule),
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
return {"FINISHED"}
|
||||
@@ -0,0 +1,29 @@
|
||||
from bpy.types import Panel, UIList
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from ifcopenshell.api.cost.data import Data
|
||||
|
||||
|
||||
class BIM_PT_cost_schedules(Panel):
|
||||
bl_label = "IFC Cost Schedules"
|
||||
bl_idname = "BIM_PT_cost_schedules"
|
||||
bl_options = {"DEFAULT_CLOSED"}
|
||||
bl_space_type = "PROPERTIES"
|
||||
bl_region_type = "WINDOW"
|
||||
bl_context = "scene"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return IfcStore.get_file()
|
||||
|
||||
def draw(self, context):
|
||||
if not Data.is_loaded:
|
||||
Data.load(IfcStore.get_file())
|
||||
|
||||
row = self.layout.row()
|
||||
row.operator("bim.add_cost_schedule", icon="ADD")
|
||||
|
||||
for cost_schedule_id, cost_schedule in Data.cost_schedules.items():
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text=cost_schedule["Name"] or "Unnamed", icon="LINENUMBERS_ON")
|
||||
row.operator("bim.add_cost_schedule", text="", icon="GREASEPENCIL")
|
||||
row.operator("bim.remove_cost_schedule", text="", icon="X").cost_schedule = cost_schedule_id
|
||||
Reference in New Issue
Block a user