PDA

View Full Version : how to get two or more point coordinate on spline at the same time


su37
04-23-2009, 04:21 PM
how to get two or more point coordinate on spline at the same time ?

Thanks Help!

ZeBoxx2
04-23-2009, 06:52 PM
have a peek at pathInterp and lengthInterp; not sure what you mean by "at the same time", though..


Shape Common Properties, Operators, and MethodspathInterp <shape> [ <curve_num> ] <parameter>

Return a point3 coordinate on the numbered curve (defaults to 1) corresponding to the parameter value (0.0 to 1.0) that matches the 3ds Max Path controller percentage (vertex-based) interpolation.



lengthInterp <shape> [ <curve_num> ] <parameter> [ steps:<integer> ]

Return a point3 coordinate on the numbered curve (defaults to 1) corresponding to the parameter value (0.0 to 1.0) that is that fraction along the curve's total length.

su37
04-24-2009, 01:34 AM
Hi, ZeBoxx2

The script only get one point coordinate ,If i want to get two point coordinate,How to do
I would like a long time, but no results.

if $ != undefined and subobjectlevel == 1 do
(
UpdateShape $
spline_int = #(0)

for i=1 to numsplines $ do
(
test = getKnotSelection $ i
if test[1] != undefined then spline_int = #(i)
)
knot_index_int = getKnotSelection $ spline_int[1]
knot_point = getKnotPoint $ spline_int[1] knot_index_int[1]
)

ZeBoxx2
04-24-2009, 05:35 AM
err.. not entirely sure what your code is supposed to do - but I'm going to guess you want an array of the positions of the currently selected knots?


fn getSelectedKnots = (
local mySelectedKnotsPositions = #()
if (((getCurrentSelection()).count == 1) AND (subObjectLevel == 1)) do (
for i = 1 to (numSplines $) do (
for knotIndex in (getKnotSelection $ i) do (
append mySelectedKnotsPositions (getKnotPoint $ i knotIndex)
)
)
)
mySelectedKnotsPositions
)
getSelectedKnots()

su37
04-24-2009, 06:48 AM
I mean is get coordinate of the currently selected knots,
your fn back results:

#([-64.2512,-3.77987e-006,86.4734], [-61.3527,-4.43449e-007,10.1449])

I want to get, like this:

[-64.2512,-3.77987e-006,86.4734]
[-61.3527,-4.43449e-007,10.1449]
--------------------------------------------------------
I modify that script but sometimes it can't correctly run
(
if $ != undefined and subobjectlevel == 1 do
(
UpdateShape $
spline_int = #(0)

for i=1 to numsplines $ do
(
test = getKnotSelection $ i
if test[1] != undefined then spline_int = #(i)
)
knot_index_int = getKnotSelection $ spline_int[1]
knot_point = getKnotPoint $ spline_int[1] knot_index_int[1]
)
)

(
if $ != undefined and subobjectlevel == 1 do
(
UpdateShape $
spline_int2 = #(0)

for k=1 to numsplines $ do
(
test2 = getKnotSelection $ k
if test2[2] != undefined then spline_int2 = #(k)
)
knot_index_int2 = getKnotSelection $ spline_int2[1]
knot_point2 = getKnotPoint $ spline_int2[1] knot_index_int2[2]
)
)

su37
04-24-2009, 09:35 AM
Hi ZeBoxx2

Thank you very much! I understand !
Use your code


mySelectedKnotsPositions = #()
if (((getCurrentSelection()).count == 1) AND (subObjectLevel == 1)) do (
for i = 1 to (numSplines $) do (
for knotIndex in (getKnotSelection $ i) do (
append mySelectedKnotsPositions (getKnotPoint $ i knotIndex)
)
)
)
mySelectedKnotsPositions
v1 = mySelectedKnotsPositions[1]
v2 = mySelectedKnotsPositions[2]


Thank you once again

ZeBoxx2
04-24-2009, 05:50 PM
Yep - correct :)

Good luck with your script!

CGTalk Moderation
04-24-2009, 05:50 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.