mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-19 19:54:07 +00:00
black .
This commit is contained in:
@@ -449,5 +449,3 @@ def add_newline_between_words(text, newline_at):
|
|||||||
start = space_index + 1 # Skip the space itself
|
start = space_index + 1 # Skip the space itself
|
||||||
|
|
||||||
return "\n".join(result)
|
return "\n".join(result)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -401,7 +401,7 @@ class DocProperties(PropertyGroup):
|
|||||||
drawing_font: StringProperty(default="OpenGost Type B TT.ttf", name="Drawing Font")
|
drawing_font: StringProperty(default="OpenGost Type B TT.ttf", name="Drawing Font")
|
||||||
magic_font_scale: bpy.props.FloatProperty(default=0.004118616, name="Font Scale Factor")
|
magic_font_scale: bpy.props.FloatProperty(default=0.004118616, name="Font Scale Factor")
|
||||||
imperial_precision: StringProperty(default="1/32", name="Imperial Precision")
|
imperial_precision: StringProperty(default="1/32", name="Imperial Precision")
|
||||||
tolerance: bpy.props.FloatProperty(default=0.00001, name="A tolerance used when selecting objects")
|
tolerance: bpy.props.FloatProperty(default=0.00001, name="A tolerance used when selecting objects")
|
||||||
|
|
||||||
|
|
||||||
class BIMCameraProperties(PropertyGroup):
|
class BIMCameraProperties(PropertyGroup):
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class GeoreferenceDecorator:
|
|||||||
|
|
||||||
def draw_batch(self, shader_type, content_pos, color, indices=None):
|
def draw_batch(self, shader_type, content_pos, color, indices=None):
|
||||||
self.scale = bpy.context.scene.BIMGeoreferenceProperties.visualization_scale
|
self.scale = bpy.context.scene.BIMGeoreferenceProperties.visualization_scale
|
||||||
content_pos = [v * self.scale for v in content_pos]
|
content_pos = [v * self.scale for v in content_pos]
|
||||||
shader = self.line_shader if shader_type == "LINES" else self.shader
|
shader = self.line_shader if shader_type == "LINES" else self.shader
|
||||||
batch = batch_for_shader(shader, shader_type, {"pos": content_pos}, indices=indices)
|
batch = batch_for_shader(shader, shader_type, {"pos": content_pos}, indices=indices)
|
||||||
shader.uniform_float("color", color)
|
shader.uniform_float("color", color)
|
||||||
@@ -75,7 +75,7 @@ class GeoreferenceDecorator:
|
|||||||
self.addon_prefs = tool.Blender.get_addon_preferences()
|
self.addon_prefs = tool.Blender.get_addon_preferences()
|
||||||
|
|
||||||
self.font_id = 0
|
self.font_id = 0
|
||||||
font_size = tool.Blender.scale_font_size(12 + (self.scale/8))
|
font_size = tool.Blender.scale_font_size(12 + (self.scale / 8))
|
||||||
blf.size(self.font_id, font_size)
|
blf.size(self.font_id, font_size)
|
||||||
color = self.addon_prefs.decorations_colour
|
color = self.addon_prefs.decorations_colour
|
||||||
blf.color(self.font_id, *color)
|
blf.color(self.font_id, *color)
|
||||||
|
|||||||
@@ -205,7 +205,9 @@ class BIMGeoreferenceProperties(PropertyGroup):
|
|||||||
default=False,
|
default=False,
|
||||||
update=update_should_visualise,
|
update=update_should_visualise,
|
||||||
)
|
)
|
||||||
visualization_scale: IntProperty(name="Visualization Scale", description="Affects the georeference decorator size", default=1, min=1, max=20)
|
visualization_scale: IntProperty(
|
||||||
|
name="Visualization Scale", description="Affects the georeference decorator size", default=1, min=1, max=20
|
||||||
|
)
|
||||||
grid_north_angle: StringProperty(name="Grid North Angle", update=update_grid_north_angle)
|
grid_north_angle: StringProperty(name="Grid North Angle", update=update_grid_north_angle)
|
||||||
x_axis_abscissa: StringProperty(name="X Axis Abscissa", update=update_grid_north_vector)
|
x_axis_abscissa: StringProperty(name="X Axis Abscissa", update=update_grid_north_vector)
|
||||||
x_axis_ordinate: StringProperty(name="X Axis Ordinate", update=update_grid_north_vector)
|
x_axis_ordinate: StringProperty(name="X Axis Ordinate", update=update_grid_north_vector)
|
||||||
|
|||||||
@@ -637,7 +637,7 @@ class PolylineDecorator:
|
|||||||
default_container_elevation = tool.Ifc.get_object(tool.Root.get_default_container()).location.z
|
default_container_elevation = tool.Ifc.get_object(tool.Root.get_default_container()).location.z
|
||||||
projection_point = []
|
projection_point = []
|
||||||
if not self.tool_state:
|
if not self.tool_state:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if self.tool_state.plane_method:
|
if self.tool_state.plane_method:
|
||||||
plane_origin = self.tool_state.plane_origin
|
plane_origin = self.tool_state.plane_origin
|
||||||
|
|||||||
@@ -719,10 +719,9 @@ class SelectSimilar(Operator, tool.Ifc.Operator):
|
|||||||
value = ifcopenshell.util.selector.get_element_value(element, key)
|
value = ifcopenshell.util.selector.get_element_value(element, key)
|
||||||
tolerance = bpy.context.scene.DocProperties.tolerance
|
tolerance = bpy.context.scene.DocProperties.tolerance
|
||||||
|
|
||||||
|
|
||||||
# Determine the number of decimal places based on the magnitude of the rounding value
|
# Determine the number of decimal places based on the magnitude of the rounding value
|
||||||
if tolerance < 1:
|
if tolerance < 1:
|
||||||
decimal_places = max(0, -int(f"{tolerance:.1e}".split('e')[-1])) # Exponent in scientific notation
|
decimal_places = max(0, -int(f"{tolerance:.1e}".split("e")[-1])) # Exponent in scientific notation
|
||||||
formatted_tolerance = f"{tolerance:.{decimal_places}f}"
|
formatted_tolerance = f"{tolerance:.{decimal_places}f}"
|
||||||
else:
|
else:
|
||||||
formatted_tolerance = f"{tolerance:.1f}" # For values >= 1, one decimal place is enough
|
formatted_tolerance = f"{tolerance:.1f}" # For values >= 1, one decimal place is enough
|
||||||
@@ -752,7 +751,10 @@ class SelectSimilar(Operator, tool.Ifc.Operator):
|
|||||||
obj.select_set(True)
|
obj.select_set(True)
|
||||||
elif obj_value == value:
|
elif obj_value == value:
|
||||||
obj.select_set(True)
|
obj.select_set(True)
|
||||||
if isinstance(value, (int, float)):
|
if isinstance(value, (int, float)):
|
||||||
self.report({"INFO"}, f"Selected all objects that share the same ({key}) value--within a ({formatted_tolerance}) tolerance.")
|
self.report(
|
||||||
|
{"INFO"},
|
||||||
|
f"Selected all objects that share the same ({key}) value--within a ({formatted_tolerance}) tolerance.",
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
self.report({"INFO"}, f"Selected all objects that share the same ({key}) value")
|
self.report({"INFO"}, f"Selected all objects that share the same ({key}) value")
|
||||||
|
|||||||
@@ -383,6 +383,7 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
|
|||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
row.prop(context.scene.DocProperties, "tolerance")
|
row.prop(context.scene.DocProperties, "tolerance")
|
||||||
|
|
||||||
|
|
||||||
# Scene panel groups
|
# Scene panel groups
|
||||||
class BIM_PT_tabs(Panel):
|
class BIM_PT_tabs(Panel):
|
||||||
bl_label = "Bonsai"
|
bl_label = "Bonsai"
|
||||||
|
|||||||
@@ -927,7 +927,7 @@ class Drawing(bonsai.core.tool.Drawing):
|
|||||||
|
|
||||||
text_data = DecoratorData.get_ifc_text_data(obj)
|
text_data = DecoratorData.get_ifc_text_data(obj)
|
||||||
props.font_size = str(text_data["FontSize"])
|
props.font_size = str(text_data["FontSize"])
|
||||||
props.newline_at = text_data['Newline_At']
|
props.newline_at = text_data["Newline_At"]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def import_assigned_product(cls, obj: bpy.types.Object) -> None:
|
def import_assigned_product(cls, obj: bpy.types.Object) -> None:
|
||||||
@@ -1715,7 +1715,6 @@ class Drawing(bonsai.core.tool.Drawing):
|
|||||||
newline_at = ifcopenshell.util.element.get_pset(element, "EPset_Annotation", "Newline_At")
|
newline_at = ifcopenshell.util.element.get_pset(element, "EPset_Annotation", "Newline_At")
|
||||||
return newline_at
|
return newline_at
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def has_linework(cls, drawing: ifcopenshell.entity_instance) -> bool:
|
def has_linework(cls, drawing: ifcopenshell.entity_instance) -> bool:
|
||||||
return ifcopenshell.util.element.get_psets(drawing).get("EPset_Drawing", {}).get("HasLinework", False)
|
return ifcopenshell.util.element.get_psets(drawing).get("EPset_Drawing", {}).get("HasLinework", False)
|
||||||
|
|||||||
Reference in New Issue
Block a user