mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-28 15:53:00 +00:00
black .
This commit is contained in:
@@ -502,7 +502,13 @@ class BaseDecorator:
|
|||||||
precision = drawing_pset_data.get("ImperialPrecision", None)
|
precision = drawing_pset_data.get("ImperialPrecision", None)
|
||||||
|
|
||||||
decimal_places = drawing_pset_data.get("DecimalPlaces", None)
|
decimal_places = drawing_pset_data.get("DecimalPlaces", None)
|
||||||
return format_distance(value, precision=precision, decimal_places=decimal_places, suppress_zero_inches=True, custom_unit=custom_unit)
|
return format_distance(
|
||||||
|
value,
|
||||||
|
precision=precision,
|
||||||
|
decimal_places=decimal_places,
|
||||||
|
suppress_zero_inches=True,
|
||||||
|
custom_unit=custom_unit,
|
||||||
|
)
|
||||||
|
|
||||||
def draw_asterisk(self, context: bpy.types.Context, pos: Vector, rotation: float = 0.0, scale: float = 1.0) -> None:
|
def draw_asterisk(self, context: bpy.types.Context, pos: Vector, rotation: float = 0.0, scale: float = 1.0) -> None:
|
||||||
"""`pos` is a world space position\n
|
"""`pos` is a world space position\n
|
||||||
|
|||||||
@@ -164,15 +164,15 @@ def format_distance(
|
|||||||
# Custom Unit Settings
|
# Custom Unit Settings
|
||||||
if custom_unit:
|
if custom_unit:
|
||||||
unit_mapping = {
|
unit_mapping = {
|
||||||
"Feet and Inches - Fractional": ("IMPERIAL", "FEET", True),
|
"Feet and Inches - Fractional": ("IMPERIAL", "FEET", True),
|
||||||
"Feet - Decimal": ("IMPERIAL", "FEET", False),
|
"Feet - Decimal": ("IMPERIAL", "FEET", False),
|
||||||
"Inches - Fractional": ("IMPERIAL", "INCHES", True),
|
"Inches - Fractional": ("IMPERIAL", "INCHES", True),
|
||||||
"Inches - Decimal": ("IMPERIAL", "INCHES", False),
|
"Inches - Decimal": ("IMPERIAL", "INCHES", False),
|
||||||
"Meters": ("METRIC", "METERS", False),
|
"Meters": ("METRIC", "METERS", False),
|
||||||
"Decimeters": ("METRIC", "DECIMETERS", False),
|
"Decimeters": ("METRIC", "DECIMETERS", False),
|
||||||
"Centimeters": ("METRIC", "CENTIMETERS", False),
|
"Centimeters": ("METRIC", "CENTIMETERS", False),
|
||||||
"Millimeters": ("METRIC", "MILLIMETERS", False),
|
"Millimeters": ("METRIC", "MILLIMETERS", False),
|
||||||
}
|
}
|
||||||
if custom_unit in unit_mapping:
|
if custom_unit in unit_mapping:
|
||||||
unit_system, unit_length, unit_fraction = unit_mapping[custom_unit]
|
unit_system, unit_length, unit_fraction = unit_mapping[custom_unit]
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ def format_distance(
|
|||||||
|
|
||||||
# Separate ft and inches
|
# Separate ft and inches
|
||||||
# Unless Inches are the specified Length Unit or unit_fraction is False
|
# Unless Inches are the specified Length Unit or unit_fraction is False
|
||||||
if (unit_length == "FEET" and not unit_fraction):
|
if unit_length == "FEET" and not unit_fraction:
|
||||||
feet = round(decInches / inPerFoot, 3) # keep decimal
|
feet = round(decInches / inPerFoot, 3) # keep decimal
|
||||||
decInches = 0
|
decInches = 0
|
||||||
elif unit_length != "INCHES":
|
elif unit_length != "INCHES":
|
||||||
|
|||||||
@@ -1128,7 +1128,12 @@ class SvgWriter:
|
|||||||
|
|
||||||
def get_text():
|
def get_text():
|
||||||
radius = (points[-1].co - points[-2].co).length
|
radius = (points[-1].co - points[-2].co).length
|
||||||
radius = helper.format_distance(radius, precision=self.precision, decimal_places=self.decimal_places, custom_unit=dimension_data["custom_unit"])
|
radius = helper.format_distance(
|
||||||
|
radius,
|
||||||
|
precision=self.precision,
|
||||||
|
decimal_places=self.decimal_places,
|
||||||
|
custom_unit=dimension_data["custom_unit"],
|
||||||
|
)
|
||||||
text = f"R{radius}"
|
text = f"R{radius}"
|
||||||
return text
|
return text
|
||||||
|
|
||||||
@@ -1256,7 +1261,7 @@ class SvgWriter:
|
|||||||
text_prefix=dimension_data["text_prefix"],
|
text_prefix=dimension_data["text_prefix"],
|
||||||
text_suffix=dimension_data["text_suffix"],
|
text_suffix=dimension_data["text_suffix"],
|
||||||
fill_bg=dimension_data["fill_bg"],
|
fill_bg=dimension_data["fill_bg"],
|
||||||
custom_unit=dimension_data["custom_unit"]
|
custom_unit=dimension_data["custom_unit"],
|
||||||
)
|
)
|
||||||
|
|
||||||
def draw_dimension_annotations(self, obj):
|
def draw_dimension_annotations(self, obj):
|
||||||
|
|||||||
@@ -809,7 +809,9 @@ class PolylineOperator:
|
|||||||
if len(polyline_points) > 2:
|
if len(polyline_points) > 2:
|
||||||
first_point = polyline_points[0]
|
first_point = polyline_points[0]
|
||||||
last_point = polyline_points[-1]
|
last_point = polyline_points[-1]
|
||||||
if not (first_point.x == last_point.x and first_point.y == last_point.y and first_point.z == last_point.z):
|
if not (
|
||||||
|
first_point.x == last_point.x and first_point.y == last_point.y and first_point.z == last_point.z
|
||||||
|
):
|
||||||
self.input_ui.set_value("X", first_point.x)
|
self.input_ui.set_value("X", first_point.x)
|
||||||
self.input_ui.set_value("Y", first_point.y)
|
self.input_ui.set_value("Y", first_point.y)
|
||||||
if self.input_ui.get_number_value("Z") is not None:
|
if self.input_ui.get_number_value("Z") is not None:
|
||||||
|
|||||||
@@ -64,9 +64,7 @@ class Debug(bonsai.core.tool.Debug):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def debug_bmesh(
|
def debug_bmesh(cls, bm: bpy.types.BMesh, name: str = "Debug") -> bpy.types.Object:
|
||||||
cls, bm: bpy.types.BMesh, name: str = "Debug"
|
|
||||||
) -> bpy.types.Object:
|
|
||||||
mesh = bpy.data.meshes.new("Debug")
|
mesh = bpy.data.meshes.new("Debug")
|
||||||
bm.to_mesh(mesh)
|
bm.to_mesh(mesh)
|
||||||
obj = bpy.data.objects.new(name, mesh)
|
obj = bpy.data.objects.new(name, mesh)
|
||||||
|
|||||||
@@ -130,7 +130,6 @@ class Polyline(bonsai.core.tool.Polyline):
|
|||||||
else:
|
else:
|
||||||
default_container_elevation = 0
|
default_container_elevation = 0
|
||||||
|
|
||||||
|
|
||||||
mouse_point = context.scene.BIMPolylineProperties.snap_mouse_point[0]
|
mouse_point = context.scene.BIMPolylineProperties.snap_mouse_point[0]
|
||||||
|
|
||||||
if last_point_data:
|
if last_point_data:
|
||||||
@@ -273,7 +272,7 @@ class Polyline(bonsai.core.tool.Polyline):
|
|||||||
else:
|
else:
|
||||||
polyline_points = []
|
polyline_points = []
|
||||||
last_point = Vector((0, 0, 0))
|
last_point = Vector((0, 0, 0))
|
||||||
|
|
||||||
if tool.Ifc.get():
|
if tool.Ifc.get():
|
||||||
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
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -377,9 +377,9 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
for obj, bbox_2d in objs_2d_bbox:
|
for obj, bbox_2d in objs_2d_bbox:
|
||||||
if obj.type in {"MESH", "EMPTY", "CURVE"} and bbox_2d:
|
if obj.type in {"MESH", "EMPTY", "CURVE"} and bbox_2d:
|
||||||
if tool.Raycast.intersect_mouse_2d_bounding_box(mouse_pos, bbox_2d, offset):
|
if tool.Raycast.intersect_mouse_2d_bounding_box(mouse_pos, bbox_2d, offset):
|
||||||
if obj.visible_in_viewport_get(
|
if (
|
||||||
context.space_data
|
obj.visible_in_viewport_get(context.space_data) or obj.library
|
||||||
) or obj.library: # Check for local view and local collections for this viewport and object
|
): # Check for local view and local collections for this viewport and object
|
||||||
objs_to_raycast.append(obj)
|
objs_to_raycast.append(obj)
|
||||||
|
|
||||||
# Polyline
|
# Polyline
|
||||||
|
|||||||
Reference in New Issue
Block a user