Knotpoint distance and creating fixed
Hi. I am new to Maxscript.
I'm trying to write a script that can analyze a spline's knots and create a fixed window in it. I have a spline named "Layy" in scene . This is my code and I can't go forward. Anyone can help?
local cc= for gg in 1 to (numsplines $'Layy') collect gg K11=getknotpoint $'Layy' cc 1 K12=getknotpoint $'Layy' cc 2 A = k11 -k12 p1 = fixed height:160 width:A.x Number_of_Panels_Horizontally:1 name:"P1_0[i]" pos:[-a.x/2,-160,0] p2 = fixed height:160 width:A.x Number_of_Panels_Horizontally:2 name:"P1_0[i]" pos:[-a.x/2,-160,0] p3 = fixed height:160 width:A.x Number_of_Panels_Horizontally:3 name:"P1_0[i]" pos:[-a.x/2,-160,0] p4 = Print "AB" -- for i in 1 to (numsplines $'Layy') do ( case of ( (A <= 120): P1 (A <= 200): p2 (A <= 280): p3 (A > 280): p4 ) ) <code>
Attachment | Size |
---|---|
ice_screenshot_20171222-162757.png | 2.85 KB |
Comments
.
.
Thank you both, miauu and
Thank you both, miauu and jahman. I will work on it.
.
Here's an example.
You'll have to find a way to compare float values because 50.001 isn't equal to 50.000 and window will not be placed as a result.
Thank you Jahman. That is
Thank you Jahman. That is better than mine. I will use it. But still my code doesnt work. And I dont kmow why.
.
This row is not correct:
it should be:
Change it and test your code again.
Tools and Scripts for Autodesk 3dsMax
..
Are you sure that knot 1 & 2 will always be enough to know window dimensions? What if first spline knot will be upper left and the second one lower left.. etc
I'd rather collect all spline knots to know min/max knot position of particular spline.
Then just copy the corresponding window and place it in spline center
windowObject.center = (splineMinPoint3 + splineMaxPoint3)/2.0