diff --git a/src/blenderbim/blenderbim/bim/import_ifc.py b/src/blenderbim/blenderbim/bim/import_ifc.py index 86ecede481..e5aaaf3636 100644 --- a/src/blenderbim/blenderbim/bim/import_ifc.py +++ b/src/blenderbim/blenderbim/bim/import_ifc.py @@ -1321,10 +1321,11 @@ class IfcImporter: return element.ObjectType in [ "DIMENSION", "EQUAL_DIMENSION", - "LEVEL", + "MISC", + "PLAN_LEVEL", + "SECTION_LEVEL", "STAIR_ARROW", "TEXT_LEADER", - "MISC", ] def is_drawing_annotation(self, element): @@ -1335,8 +1336,9 @@ class IfcImporter: "EQUAL_DIMENSION", "GRID", "HIDDEN_LINE", - "LEVEL", "MISC", + "PLAN_LEVEL", + "SECTION_LEVEL", "STAIR_ARROW", "TEXT", "TEXT_LEADER", diff --git a/src/blenderbim/blenderbim/bim/module/drawing/decoration.py b/src/blenderbim/blenderbim/bim/module/drawing/decoration.py index a3d9a3df38..7e0270d5e8 100644 --- a/src/blenderbim/blenderbim/bim/module/drawing/decoration.py +++ b/src/blenderbim/blenderbim/bim/module/drawing/decoration.py @@ -340,6 +340,9 @@ class BaseDecorator: blf.rotation(font_id, ang) blf.color(font_id, *color) + #blf.enable(font_id, blf.SHADOW) + #blf.shadow(font_id, 5, 0, 0, 0, 1) + #blf.shadow_offset(font_id, 1, -1) blf.draw(font_id, text) blf.disable(font_id, blf.ROTATION) @@ -577,7 +580,7 @@ class StairDecorator(BaseDecorator): DEF_GLSL = ( BaseDecorator.DEF_GLSL + """ - #define CIRCLE_SIZE 8.0 + #define CIRCLE_SIZE 6.0 #define ARROW_ANGLE PI / 3.0 #define ARROW_SIZE 24.0 """ @@ -607,7 +610,7 @@ class StairDecorator(BaseDecorator): // start edge circle for first segment if (t0 == 1u) { vec4 head[CIRCLE_SEGS]; - circle_head(CIRCLE_SIZE, head); + circle_head(viewportDrawingScale * CIRCLE_SIZE, head); for(int i=0; i projected_points[-1].x: - text_anchor = "end" - else: - text_anchor = "start" - self.svg.add( - self.svg.text( - "RL +{}".format(rl), - insert=tuple(text_position), - **{ - "font-size": annotation.Annotator.get_svg_text_size(2.5), - "font-family": "OpenGost Type B TT", - "text-anchor": text_anchor, - "alignment-baseline": "baseline", - "dominant-baseline": "baseline", - }, - ) - ) + for obj in self.annotations.get("plan_level_objs", []): + self.draw_plan_level_annotation(obj) if self.annotations.get("section_level_obj"): matrix_world = self.annotations["section_level_obj"].matrix_world @@ -577,6 +535,54 @@ class SvgWriter: d = "M{}".format(d[1:]) path = self.svg.add(self.svg.path(d=d, class_=" ".join(["breakline"]))) + def draw_plan_level_annotation(self, obj): + x_offset = self.raw_width / 2 + y_offset = self.raw_height / 2 + matrix_world = obj.matrix_world + for spline in obj.data.splines: + classes = ["annotation", "plan-level"] + points = self.get_spline_points(spline) + projected_points = [self.project_point_onto_camera(matrix_world @ p.co.xyz) for p in points] + d = " ".join( + [ + "L {} {}".format((x_offset + p.x) * self.scale, (y_offset - p.y) * self.scale) + for p in projected_points + ] + ) + d = "M{}".format(d[1:]) + path = self.svg.add(self.svg.path(d=d, class_=" ".join(classes))) + path["marker-end"] = "url(#plan-level-marker)" + text_position = Vector( + ( + (x_offset + projected_points[0].x) * self.scale, + ((y_offset - projected_points[0].y) * self.scale) - 2.5, + ) + ) + # TODO: allow metric to be configurable + rl = ((matrix_world @ points[0].co).xyz + obj.location).z + if bpy.context.scene.unit_settings.system == "IMPERIAL": + rl = helper.format_distance(rl) + else: + rl = "{:.3f}m".format(rl) + if projected_points[0].x > projected_points[-1].x: + text_anchor = "end" + else: + text_anchor = "start" + self.svg.add( + self.svg.text( + "RL +{}".format(rl), + insert=tuple(text_position), + **{ + "font-size": annotation.Annotator.get_svg_text_size(2.5), + "font-family": "OpenGost Type B TT", + "text-anchor": text_anchor, + "alignment-baseline": "baseline", + "dominant-baseline": "baseline", + }, + ) + ) + + def draw_dimension_annotations(self, dimension_obj, text_override=None): matrix_world = dimension_obj.matrix_world for spline in dimension_obj.data.splines: