mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-29 11:46:33 +00:00
black .
This commit is contained in:
@@ -299,7 +299,9 @@ class Raycast(bonsai.core.tool.Raycast):
|
|||||||
if tool.Cad.are_vectors_equal(e1["point"], e2["point"], tolerance=0.1):
|
if tool.Cad.are_vectors_equal(e1["point"], e2["point"], tolerance=0.1):
|
||||||
edge_intersection = tool.Cad.intersect_edges_v2(e1["edge_verts"], e2["edge_verts"])
|
edge_intersection = tool.Cad.intersect_edges_v2(e1["edge_verts"], e2["edge_verts"])
|
||||||
if edge_intersection[1]:
|
if edge_intersection[1]:
|
||||||
mouse_intersection, _ = mathutils.geometry.intersect_point_line(edge_intersection[1], ray_target, loc)
|
mouse_intersection, _ = mathutils.geometry.intersect_point_line(
|
||||||
|
edge_intersection[1], ray_target, loc
|
||||||
|
)
|
||||||
distance = (edge_intersection[1] - mouse_intersection).length
|
distance = (edge_intersection[1] - mouse_intersection).length
|
||||||
if distance < 0.2:
|
if distance < 0.2:
|
||||||
snap_point = {
|
snap_point = {
|
||||||
@@ -309,5 +311,3 @@ class Raycast(bonsai.core.tool.Raycast):
|
|||||||
"distance": distance,
|
"distance": distance,
|
||||||
}
|
}
|
||||||
return snap_point
|
return snap_point
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
valid_intersections = []
|
valid_intersections = []
|
||||||
for i in intersections:
|
for i in intersections:
|
||||||
if i is not None:
|
if i is not None:
|
||||||
distance = (i-last_point).length
|
distance = (i - last_point).length
|
||||||
if not math.isclose(distance, 0.0, abs_tol=1e-4):
|
if not math.isclose(distance, 0.0, abs_tol=1e-4):
|
||||||
valid_intersections.append(i)
|
valid_intersections.append(i)
|
||||||
|
|
||||||
@@ -405,8 +405,8 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
snap_point = {
|
snap_point = {
|
||||||
"type": "Vertex",
|
"type": "Vertex",
|
||||||
"point": obj.location,
|
"point": obj.location,
|
||||||
"distance": 10, # High value so it has low priority
|
"distance": 10, # High value so it has low priority
|
||||||
"object": obj,
|
"object": obj,
|
||||||
"group": "Edge-Vertex",
|
"group": "Edge-Vertex",
|
||||||
}
|
}
|
||||||
detected_snaps.append(snap_point)
|
detected_snaps.append(snap_point)
|
||||||
@@ -423,10 +423,12 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
results.append(cast_rays_and_get_best_object(objs_to_raycast, mouse_pos))
|
results.append(cast_rays_and_get_best_object(objs_to_raycast, mouse_pos))
|
||||||
for result in results:
|
for result in results:
|
||||||
snap_obj = result[0]
|
snap_obj = result[0]
|
||||||
hit = result[1]
|
hit = result[1]
|
||||||
face_index = result[2]
|
face_index = result[2]
|
||||||
if hit is not None:
|
if hit is not None:
|
||||||
snap_points = tool.Raycast.ray_cast_by_proximity(context, event, snap_obj, snap_obj.data.polygons[face_index])
|
snap_points = tool.Raycast.ray_cast_by_proximity(
|
||||||
|
context, event, snap_obj, snap_obj.data.polygons[face_index]
|
||||||
|
)
|
||||||
if snap_points:
|
if snap_points:
|
||||||
for point in snap_points:
|
for point in snap_points:
|
||||||
point["group"] = "Object"
|
point["group"] = "Object"
|
||||||
@@ -487,7 +489,7 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
"point": rot_intersection,
|
"point": rot_intersection,
|
||||||
"object": None,
|
"object": None,
|
||||||
"group": "Axis",
|
"group": "Axis",
|
||||||
"type": "Axis",
|
"type": "Axis",
|
||||||
"axis_start": axis_start,
|
"axis_start": axis_start,
|
||||||
"axis_end": axis_end,
|
"axis_end": axis_end,
|
||||||
"distance": 10, # High value so it has low priority
|
"distance": 10, # High value so it has low priority
|
||||||
@@ -496,9 +498,9 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
|
|
||||||
snap_point = {
|
snap_point = {
|
||||||
"point": intersection,
|
"point": intersection,
|
||||||
"object": None,
|
"object": None,
|
||||||
"group": "Plane",
|
"group": "Plane",
|
||||||
"type": "Plane",
|
"type": "Plane",
|
||||||
"distance": 10, # High value so it has low priority
|
"distance": 10, # High value so it has low priority
|
||||||
}
|
}
|
||||||
detected_snaps.append(snap_point)
|
detected_snaps.append(snap_point)
|
||||||
@@ -565,9 +567,7 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
cls.update_snapping_point(point["point"], point["type"])
|
cls.update_snapping_point(point["point"], point["type"])
|
||||||
return snaps_by_type
|
return snaps_by_type
|
||||||
|
|
||||||
cls.update_snapping_point(
|
cls.update_snapping_point(snaps_by_type[0]["point"], snaps_by_type[0]["type"], snaps_by_type[0]["object"])
|
||||||
snaps_by_type[0]["point"], snaps_by_type[0]["type"], snaps_by_type[0]["object"]
|
|
||||||
)
|
|
||||||
return snaps_by_type
|
return snaps_by_type
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user