FN g_filter o = superclassof o = geometryclass
FN find_intersection z_node node_to_z =
(
-- The same conditional numbers and computation are faster than strings, so strings are not needed.
Oop = case
(
(Gt_yc_ail.conunt_spn1.value = 1): [0, 0,-1]
(Gt_yc_ail.conunt_spn1.value = 2): [0, 0, 1]
(Gt_yc_ail.conunt_spn1.value = 3): [-1, 0]
(Gt_yc_ail.conunt_spn1.value = 4): [1, 0]
(Gt_yc_ail.conunt_spn1.value = 5): [0,-1, 0]
(Gt_yc_ail.conunt_spn1.value = 6): [0, 1]
-- Default: Reference $ foo
)
Local testray = Ray node_to_z.pos OOP
Local nodemaxz
Case oop
(------ Z axis
([0, 0,-1]) :( nodemaxz = z_node.max.z
Testray. Pos. z = nodemaxz + 0.0001 * ABS nodemaxz
)
([0, 0, 1]) :( nodemaxz = z_node.min.z
Testray. Pos. z = nodemaxz-0.0001 * ABS nodemaxz
)
------- X axis
([-1, 0, 0]): (nodemaxz = z_node.max.x
Testray. Pos. x = nodemaxz + 0.0001 * ABS nodemaxz
)
([1, 0, 0]): (nodemaxz = z_node.min.x
Testray. Pos. x = fig-0.0001 * ABS nodemaxz
)
------- Y axis
([0,-1, 0]): (nodemaxz = z_node.max.y
Testray. Pos. Y = nodemaxz + 0.0001 * ABS nodemaxz
)
([0, 0]): (nodemaxz = z_node.min.y
Testray. Pos. Y = fig-0.0001 * ABS nodemaxz
)
)
-- Testray. Pos. z = nodemaxz + 0.0001 * ABS nodemaxz
Intersectray z_node testray
)
-- On isenabled return selection. Count> 0
On execute do
(
Target_mesh = pickobject message: "Pick target surface:" filter: g_filter --- this method is better. No more display;
If isvalidnode target_mesh then --- this is useful if the node is not deleted.
(
Undo "movetosurface" on
(
For I in selection do
(
Int_point = find_intersection target_mesh I
If int_point! = Undefined then I. Pos = int_point.pos
) -- End I loop
) -- End undo
) -- End if
) -- End Execute