From 866362c6edc9a530baf576b19185ad30467ddffa Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Wed, 16 Jul 2025 12:31:03 +0500 Subject: [PATCH] More readable error creating a drawing with underlay but no active style #4870 --- src/bonsai/bonsai/bim/module/drawing/operator.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/bonsai/bonsai/bim/module/drawing/operator.py b/src/bonsai/bonsai/bim/module/drawing/operator.py index 670df8b436..7cf48ddc75 100644 --- a/src/bonsai/bonsai/bim/module/drawing/operator.py +++ b/src/bonsai/bonsai/bim/module/drawing/operator.py @@ -334,7 +334,15 @@ class CreateDrawing(bpy.types.Operator): annotation_svg = None with profile("Generate underlay"): - underlay_svg = self.generate_underlay(context) + if ifcopenshell.util.element.get_pset(self.drawing, "EPset_Drawing", "HasUnderlay"): + drawing_style = self.cprops.get_active_drawing_style() + if not drawing_style: + self.report( + {"ERROR"}, + f"Failed to create drawing '{self.drawing.Name}' - drawing has underlay but there's no active drawing underlay style.", + ) + return {"FINISHED"} + underlay_svg = self.generate_underlay(context) with profile("Generate linework"): if tool.Drawing.is_camera_orthographic():