mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
black .
This commit is contained in:
@@ -322,7 +322,7 @@ class DecoratorData:
|
|||||||
symbol = tool.Drawing.get_annotation_symbol(element)
|
symbol = tool.Drawing.get_annotation_symbol(element)
|
||||||
|
|
||||||
# get newline_at
|
# get newline_at
|
||||||
newline_at = pset_data.get('Newline_At', 0)
|
newline_at = pset_data.get("Newline_At", 0)
|
||||||
|
|
||||||
# other attributes
|
# other attributes
|
||||||
props_literals = props.literals
|
props_literals = props.literals
|
||||||
|
|||||||
@@ -609,7 +609,7 @@ class BaseDecorator:
|
|||||||
text = literal_data["CurrentValue"]
|
text = literal_data["CurrentValue"]
|
||||||
|
|
||||||
if newline_at != 0:
|
if newline_at != 0:
|
||||||
text = helper.add_newline_between_words (text, newline_at)
|
text = helper.add_newline_between_words(text, newline_at)
|
||||||
|
|
||||||
multiple_lines = text.split("\n")
|
multiple_lines = text.split("\n")
|
||||||
|
|
||||||
@@ -629,8 +629,6 @@ class BaseDecorator:
|
|||||||
line_i += 1 if not reverse_lines_order else -1
|
line_i += 1 if not reverse_lines_order else -1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DimensionDecorator(BaseDecorator):
|
class DimensionDecorator(BaseDecorator):
|
||||||
"""Decorator for dimension objects
|
"""Decorator for dimension objects
|
||||||
- each edge of a segment with arrow
|
- each edge of a segment with arrow
|
||||||
|
|||||||
@@ -428,9 +428,9 @@ def add_newline_between_words(text, newline_at):
|
|||||||
break
|
break
|
||||||
|
|
||||||
# Look for the nearest space around the newline_at limit
|
# Look for the nearest space around the newline_at limit
|
||||||
space_index = text.rfind(' ', start, end) # Try to break before newline_at
|
space_index = text.rfind(" ", start, end) # Try to break before newline_at
|
||||||
if space_index == -1: # No space found, force a break at newline_at
|
if space_index == -1: # No space found, force a break at newline_at
|
||||||
space_index = text.find(' ', end) # Try to break after newline_at
|
space_index = text.find(" ", end) # Try to break after newline_at
|
||||||
|
|
||||||
if space_index == -1: # If there's still no space, take the rest of the text
|
if space_index == -1: # If there's still no space, take the rest of the text
|
||||||
result.append(text[start:])
|
result.append(text[start:])
|
||||||
@@ -440,4 +440,4 @@ def add_newline_between_words(text, newline_at):
|
|||||||
result.append(text[start:space_index])
|
result.append(text[start:space_index])
|
||||||
start = space_index + 1 # Skip the space itself
|
start = space_index + 1 # Skip the space itself
|
||||||
|
|
||||||
return '\n'.join(result)
|
return "\n".join(result)
|
||||||
|
|||||||
@@ -1341,7 +1341,7 @@ class CreateDrawing(bpy.types.Operator):
|
|||||||
group = root.find("{http://www.w3.org/2000/svg}g")
|
group = root.find("{http://www.w3.org/2000/svg}g")
|
||||||
|
|
||||||
# TODO: Make this an assignable preference
|
# TODO: Make this an assignable preference
|
||||||
classes_to_move = ['IfcColumn', 'IfcBeam', 'EPsetStatusStatus-NEW']
|
classes_to_move = ["IfcColumn", "IfcBeam", "EPsetStatusStatus-NEW"]
|
||||||
|
|
||||||
# Iterate through classes in order of preference
|
# Iterate through classes in order of preference
|
||||||
for class_name in classes_to_move:
|
for class_name in classes_to_move:
|
||||||
|
|||||||
@@ -852,7 +852,7 @@ class SvgWriter:
|
|||||||
classes_str,
|
classes_str,
|
||||||
fill_bg=fill_bg,
|
fill_bg=fill_bg,
|
||||||
line_number_start=line_number,
|
line_number_start=line_number,
|
||||||
newline_at = newline_at,
|
newline_at=newline_at,
|
||||||
)
|
)
|
||||||
for tag in text_tags:
|
for tag in text_tags:
|
||||||
self.svg.add(tag)
|
self.svg.add(tag)
|
||||||
@@ -1406,7 +1406,7 @@ class SvgWriter:
|
|||||||
text_tag = self.svg.text("", **text_kwargs, **base_text_attrs)
|
text_tag = self.svg.text("", **text_kwargs, **base_text_attrs)
|
||||||
text_tags.append(text_tag)
|
text_tags.append(text_tag)
|
||||||
if newline_at != 0:
|
if newline_at != 0:
|
||||||
text = helper.add_newline_between_words (text, newline_at)
|
text = helper.add_newline_between_words(text, newline_at)
|
||||||
text_lines = text.replace("\\n", "\n").split("\n")
|
text_lines = text.replace("\\n", "\n").split("\n")
|
||||||
text_lines = text_lines if multiline_to_bottom else text_lines[::-1]
|
text_lines = text_lines if multiline_to_bottom else text_lines[::-1]
|
||||||
|
|
||||||
|
|||||||
@@ -1044,6 +1044,7 @@ class Drawing(bonsai.core.tool.Drawing):
|
|||||||
pset=pset,
|
pset=pset,
|
||||||
properties={"Newline_At": newline_at},
|
properties={"Newline_At": newline_at},
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO below this point is highly experimental prototype code with no tests
|
# TODO below this point is highly experimental prototype code with no tests
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user