Turn fill modes (shapely / svgfill) into a dropdown to prevent selecting both and crashing

This commit is contained in:
Dion Moult
2024-08-30 20:31:59 +10:00
parent e8d6dd333c
commit a11c7535d8
3 changed files with 8 additions and 9 deletions
@@ -17,7 +17,6 @@
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import os
import re
import bpy
import json
import time
@@ -43,8 +42,6 @@ import bonsai.core.drawing as core
import bonsai.bim.module.drawing.svgwriter as svgwriter
import bonsai.bim.module.drawing.annotation as annotation
import bonsai.bim.module.drawing.sheeter as sheeter
import bonsai.bim.module.drawing.scheduler as scheduler
import bonsai.bim.module.drawing.helper as helper
import bonsai.bim.export_ifc
from bonsai.bim.module.drawing.decoration import CutDecorator
from bonsai.bim.module.drawing.data import DecoratorData, DrawingsData
@@ -635,7 +632,7 @@ class CreateDrawing(bpy.types.Operator):
self.move_projection_to_bottom(root)
self.merge_linework_and_add_metadata(root)
if self.camera.data.BIMCameraProperties.calculate_shapely_surfaces:
if self.camera.data.BIMCameraProperties.fill_mode == "SHAPELY":
# shapely variant
group = root.find("{http://www.w3.org/2000/svg}g")
nm = group.attrib["{http://www.ifcopenshell.org/ns}name"]
@@ -720,7 +717,7 @@ class CreateDrawing(bpy.types.Operator):
path.set("class", " ".join(list(classes)))
group.insert(0, path)
if self.camera.data.BIMCameraProperties.calculate_svgfill_surfaces:
if self.camera.data.BIMCameraProperties.fill_mode == "SVGFILL":
results = etree.tostring(root).decode("utf8")
svg_data_1 = results
from xml.dom.minidom import parseString
+5 -2
View File
@@ -390,8 +390,11 @@ class DocProperties(PropertyGroup):
class BIMCameraProperties(PropertyGroup):
calculate_shapely_surfaces: BoolProperty(name="Calculate Shapely Surfaces", default=False)
calculate_svgfill_surfaces: BoolProperty(name="Calculate SVGFill Surfaces", default=False)
fill_mode: EnumProperty(
items=[("NONE", "None", ""), ("SHAPELY", "Shapely", ""), ("SVGFILL", "SVGFill", "")],
default="NONE",
name="Fill Mode",
)
has_underlay: BoolProperty(name="Underlay", default=False, update=update_has_underlay)
has_linework: BoolProperty(name="Linework", default=True, update=update_has_linework)
has_annotation: BoolProperty(name="Annotation", default=True, update=update_has_annotation)
+1 -2
View File
@@ -64,9 +64,8 @@ class BIM_PT_camera(Panel):
row.prop(dprops, "should_use_annotation_cache", text="", icon="FILE_REFRESH")
row = self.layout.row()
row.prop(props, "calculate_shapely_surfaces")
row.prop(props, "fill_mode")
row = self.layout.row()
row.prop(props, "calculate_svgfill_surfaces")
row = self.layout.row()
row.prop(props, "width")