Hi all :)
I am here again to ask a question where I can not find solution :D
I created a small script where I find and I select two vertices overlapping (I recognize that it is a bit spartan as it is written the code, but I could not do better; if you know how to improve it you're welcome!!):
Create a spline with any number of knot. Break more knot and run the script (for now, don't move the break knot :D)
rollout d "DD" width:233 height:260
(
Global se = selection[1]
GroupBox gr_spline "Spline knot" pos:[2,2] width:228 height:104
GroupBox gr_find "Find" pos:[8,20] width:216 height:50
spinner sp_tol "% " pos:[72,40] width:144 height:16 fieldWidth:50 range:[-1e5,1e5,0]
button bt_check "Find Double Knot" pos:[16,40] width:120 height:16
spinner sp_weld_val "" pos:[72,80] width:144 height:16 fieldWidth:50 range:[-1e5,1e5,0.1] type:#worldunits scale:0.01
button bt_weld "Weld knot" pos:[16,80] width:120 height:16
on bt_check pressed do
(
try (
--- start code
local arr_knot = #(); arr_knotPoint =#(); arr_Spline =#(); arr1 =#(); arr2 =#()
updateshape se
k = numKnots se
for i = 1 to k do append arr_knot i
spl = numSplines se
for i = 1 to spl do append arr_Spline i
for i = 1 to spl do
(
temp = numKnots se i
for o = 1 to temp do
(
pos_knot = getKnotPoint se i o
append arr_knotPoint pos_knot
)
)
for i in arr_knotPoint.count to 1 by -1 do
(
if findItem arr1 arr_knotPoint[i] == 0 then append arr1 arr_knotPoint[i]
else append arr2 arr_knotPoint[i]
)
for i = 1 to spl do
(
temp = numKnots se i
sel_arr = #()
for o = 1 to temp do
(
pos_knot = getKnotPoint se i o
if findItem arr2 pos_knot != 0 do append sel_arr o
)
setKnotSelection se i sel_arr
)
--- end code
) catch()
)
on bt_weld pressed do
(
try(
weldSpline se sp_weld_val.value
updateshape se
)catch()
bt_check.pressed()
)
)
createdialog d
Now, I've insert a spinner to find the % of tolerance between two knot for check and select it. I tried "distance" (distance knotA knotB) but without result... really do not understand how to act in loop...
Situation in the real world:
With Spinner I determine the % of distance between two knot (0.0 = same location)for check and select it
Any Idea??
By Michele71 · 2015-04-13