mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-16 02:24:30 +00:00
Pdf ifc cost schedule export improvements (#6884)
* Export_IfcCostSchedule_to_PDF_improvements * IfcCostSchedule CSV export: Added ItemIsASum column New column in the ifc export that tracks if IfcCostItem is a sum, also added a new static method to the IfcDataGetter class. * IfcCostSchedule CSV export: Added cost quantities column Cost quantities are a serialsed list containing the name of the quantity and the quantity value. * IfcCostScheduel PDF export: add options to fine tune export New options include nested_structure_depth, should_print_cover, should_print_description, should_print_rates, should_print_summary, should_print_cost_ids. Also pass project currency to typst (still not used). Added footer with "proudly created with IfcOpenShell". Updated Cover with formatting and IfcCostSchedule Description
This commit is contained in:
@@ -871,11 +871,82 @@ class ExportCostSchedulesToPDF(bpy.types.Operator, ExportHelper):
|
||||
items=get_cost_schedules_enum_items,
|
||||
)
|
||||
|
||||
nested_structure_depth: bpy.props.IntProperty(
|
||||
name="Nested structure depth: ",
|
||||
description="Define till which level of the structure the parent cost items are displayed.\n0: display the full structure.",
|
||||
default=0,
|
||||
min=0,
|
||||
max=9,
|
||||
)
|
||||
parent_to_new_page_up_to_depth: bpy.props.IntProperty(
|
||||
name="Parents to new page up to depth: ",
|
||||
description="Define till which level of the structure the parent is printed to a new page.\n0: no parent is split to a new page.",
|
||||
default=0,
|
||||
min=0,
|
||||
max=9,
|
||||
)
|
||||
show_only_parents: bpy.props.BoolProperty(
|
||||
name="Show only parent cost items",
|
||||
description="Hide cost items and show only container costs",
|
||||
default=False,
|
||||
)
|
||||
should_print_cover: bpy.props.BoolProperty(
|
||||
name="Cover page",
|
||||
description="Create a cover page with project data",
|
||||
default=False,
|
||||
)
|
||||
should_print_description: bpy.props.BoolProperty(
|
||||
name="Full Cost Items Description",
|
||||
description="Export the full description if present",
|
||||
default=True,
|
||||
)
|
||||
should_print_cost_ids: bpy.props.BoolProperty(
|
||||
name="Print Cost Identification",
|
||||
description="Print Cost Identification under Cost Name if present",
|
||||
default=True,
|
||||
)
|
||||
should_print_each_quantity: bpy.props.BoolProperty(
|
||||
name="Show each quantity",
|
||||
description="Export the full list of quantities",
|
||||
default=False,
|
||||
)
|
||||
should_print_each_cost_value: bpy.props.BoolProperty(
|
||||
name="Show each cost value",
|
||||
description="Export the full list of cost values\nassociated with each cost item\nin the schedule of rates",
|
||||
default=False,
|
||||
)
|
||||
should_print_rates: bpy.props.BoolProperty(
|
||||
name="Rates and totals",
|
||||
description="Print rates and totals for each voice",
|
||||
default=True,
|
||||
)
|
||||
should_print_summary: bpy.props.BoolProperty(
|
||||
name="Should print summary",
|
||||
name="Final Summary",
|
||||
description="Print summary at the end of the document",
|
||||
default=True,
|
||||
)
|
||||
force_schedule_type: bpy.props.EnumProperty(
|
||||
name="Force output type",
|
||||
description="Force the output to this type\nalso if it is not coincident with the cost schedule Predefined Type",
|
||||
items=[
|
||||
(
|
||||
"OFF",
|
||||
"Off",
|
||||
"Uses Cost Schedule Predefined Type",
|
||||
),
|
||||
(
|
||||
"PRICEDBILLOFQUANTITIES",
|
||||
"Priced Bill of Quantities",
|
||||
"Forces the output as a priced bill of quantities",
|
||||
),
|
||||
(
|
||||
"SCHEDULEOFRATES",
|
||||
"Schedule of Rates",
|
||||
"Forces the output as a schedule of rates",
|
||||
),
|
||||
],
|
||||
default="OFF",
|
||||
)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@@ -884,8 +955,18 @@ class ExportCostSchedulesToPDF(bpy.types.Operator, ExportHelper):
|
||||
box.prop(self, "cost_schedules_enum", text="")
|
||||
layout.separator()
|
||||
box = layout.box()
|
||||
box.label(text="Export properties:")
|
||||
box.label(text="Nested cost structure:")
|
||||
box.prop(self, "nested_structure_depth")
|
||||
layout.separator()
|
||||
box = layout.box()
|
||||
box.label(text="PDF Document properties:")
|
||||
box.prop(self, "should_print_cover")
|
||||
box.prop(self, "should_print_cost_ids")
|
||||
box.prop(self, "should_print_description")
|
||||
box.prop(self, "should_print_each_quantity")
|
||||
box.prop(self, "should_print_rates")
|
||||
box.prop(self, "should_print_summary")
|
||||
box.prop(self, "force_schedule_type")
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
@@ -920,9 +1001,25 @@ class ExportCostSchedulesToPDF(bpy.types.Operator, ExportHelper):
|
||||
file = tool.Ifc.get()
|
||||
self.props = tool.Cost.get_cost_props()
|
||||
cost_schedule = file.by_id(int(self.cost_schedules_enum))
|
||||
options = {"should_print_summary": self.should_print_summary}
|
||||
options = {
|
||||
"nested_structure_depth": self.nested_structure_depth,
|
||||
"parent_to_new_page_up_to_depth": self.parent_to_new_page_up_to_depth,
|
||||
"show_only_parents": self.show_only_parents,
|
||||
"should_print_cover": self.should_print_cover,
|
||||
"should_print_cost_ids": self.should_print_cost_ids,
|
||||
"should_print_description": self.should_print_description,
|
||||
"should_print_each_quantity": self.should_print_each_quantity,
|
||||
"should_print_each_cost_value": self.should_print_each_cost_value,
|
||||
"should_print_rates": self.should_print_rates,
|
||||
"should_print_summary": self.should_print_summary,
|
||||
}
|
||||
|
||||
core.export_cost_schedules_to_pdf(
|
||||
tool.Cost, filepath=self.filepath, cost_schedule=cost_schedule, options=options
|
||||
tool.Cost,
|
||||
filepath=self.filepath,
|
||||
cost_schedule=cost_schedule,
|
||||
options=options,
|
||||
force_schedule_type=self.force_schedule_type,
|
||||
)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -404,10 +404,14 @@ def export_cost_schedules(
|
||||
|
||||
|
||||
def export_cost_schedules_to_pdf(
|
||||
cost: type[tool.Cost], filepath: str, cost_schedule: ifcopenshell.entity_instance, options: dict
|
||||
cost: type[tool.Cost],
|
||||
filepath: str,
|
||||
cost_schedule: ifcopenshell.entity_instance,
|
||||
options: dict,
|
||||
force_schedule_type: str = "",
|
||||
):
|
||||
cost.play_sound()
|
||||
return cost.export_cost_schedules_to_pdf(filepath, cost_schedule, options)
|
||||
return cost.export_cost_schedules_to_pdf(filepath, cost_schedule, options, force_schedule_type)
|
||||
|
||||
|
||||
def clear_cost_item_assignments(
|
||||
|
||||
@@ -846,10 +846,18 @@ class Cost(bonsai.core.tool.Cost):
|
||||
return "Could not open file location"
|
||||
|
||||
@classmethod
|
||||
def export_cost_schedules_to_pdf(cls, filepath: str, cost_schedule: ifcopenshell.entity_instance, options: dict):
|
||||
def export_cost_schedules_to_pdf(
|
||||
cls, filepath: str, cost_schedule: ifcopenshell.entity_instance, options: dict, force_schedule_type: str = ""
|
||||
):
|
||||
from ifc5d.ifc5Dspreadsheet import Ifc5DPdfWriter
|
||||
|
||||
writer = Ifc5DPdfWriter(file=tool.Ifc.get(), output=filepath, cost_schedule=cost_schedule, options=options)
|
||||
writer = Ifc5DPdfWriter(
|
||||
file=tool.Ifc.get(),
|
||||
output=filepath,
|
||||
cost_schedule=cost_schedule,
|
||||
options=options,
|
||||
force_schedule_type=force_schedule_type,
|
||||
)
|
||||
writer.write()
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user