mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
#1153 Dimensions can now have custom text
This commit is contained in:
@@ -172,7 +172,6 @@ class BaseDecorator:
|
||||
results = []
|
||||
decoration_presets = (
|
||||
"DIMENSION",
|
||||
"EQUAL_DIMENSION",
|
||||
"TEXT_LEADER",
|
||||
"STAIR_ARROW",
|
||||
"HIDDEN_LINE",
|
||||
@@ -481,29 +480,6 @@ class DimensionDecorator(BaseDecorator):
|
||||
self.draw_label(context, text, p0 + (dir) * 0.5, dir)
|
||||
|
||||
|
||||
class EqualityDecorator(DimensionDecorator):
|
||||
"""Decorator for equality objects
|
||||
- outlines each segment
|
||||
- augments with arrows on both sides
|
||||
- puts 'EQ' label
|
||||
"""
|
||||
|
||||
objecttype = "EQUAL_DIMENSION"
|
||||
|
||||
def draw_labels(self, context, obj, vertices, indices):
|
||||
region = context.region
|
||||
region3d = context.region_data
|
||||
for i0, i1 in indices:
|
||||
v0 = Vector(vertices[i0])
|
||||
v1 = Vector(vertices[i1])
|
||||
p0 = location_3d_to_region_2d(region, region3d, v0)
|
||||
p1 = location_3d_to_region_2d(region, region3d, v1)
|
||||
dir = p1 - p0
|
||||
if dir.length < 1:
|
||||
continue
|
||||
self.draw_label(context, "EQ", p0 + (dir) * 0.5, dir)
|
||||
|
||||
|
||||
class LeaderDecorator(BaseDecorator):
|
||||
"""Decorating text with arrows
|
||||
- head point with arrow
|
||||
@@ -1605,7 +1581,6 @@ class TextDecorator(BaseDecorator):
|
||||
class DecorationsHandler:
|
||||
decorators_classes = [
|
||||
DimensionDecorator,
|
||||
EqualityDecorator,
|
||||
GridDecorator,
|
||||
HiddenDecorator,
|
||||
LeaderDecorator,
|
||||
|
||||
@@ -151,8 +151,6 @@ class SvgWriter:
|
||||
self.draw_leader_annotation(obj)
|
||||
elif element.ObjectType == "STAIR_ARROW":
|
||||
self.draw_stair_annotation(obj)
|
||||
elif element.ObjectType == "EQUAL_DIMENSION":
|
||||
self.draw_dimension_annotations(obj, text_override="EQ")
|
||||
elif element.ObjectType == "DIMENSION":
|
||||
self.draw_dimension_annotations(obj)
|
||||
elif element.ObjectType == "RADIUS":
|
||||
@@ -663,10 +661,12 @@ class SvgWriter:
|
||||
|
||||
self.svg.add(self.svg.text(tag, insert=tuple(text_position), **text_style))
|
||||
|
||||
def draw_dimension_annotations(self, dimension_obj, text_override=None):
|
||||
classes = self.get_attribute_classes(dimension_obj)
|
||||
matrix_world = dimension_obj.matrix_world
|
||||
for spline in dimension_obj.data.splines:
|
||||
def draw_dimension_annotations(self, obj):
|
||||
classes = self.get_attribute_classes(obj)
|
||||
matrix_world = obj.matrix_world
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
text_override = element.Description
|
||||
for spline in obj.data.splines:
|
||||
points = self.get_spline_points(spline)
|
||||
for i, p in enumerate(points):
|
||||
if i + 1 >= len(points):
|
||||
|
||||
@@ -38,7 +38,6 @@ class Drawing(blenderbim.core.tool.Drawing):
|
||||
def create_annotation_object(cls, object_type):
|
||||
data_type = {
|
||||
"DIMENSION": "curve",
|
||||
"EQUAL_DIMENSION": "curve",
|
||||
"RADIUS": "curve",
|
||||
"TEXT": "empty",
|
||||
"TEXT_LEADER": "curve",
|
||||
|
||||
Reference in New Issue
Block a user