[Closed] Knots to Vert_array
Happy NewYear!!
I like to link Knots of a spline to the verts of the mesh which goes around the splines. The splines can go smaller or bigger by offset.
This is the script for just 2 splines. In future there will be 10 or 11 splines.
select Spline01
a = #(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32)
setKnotSelection $ 1 a
X=0
Y=0
Z=0
for i=1 to a.count do
(
X = X + a[i].pos.x
Y = Y + a[i].pos.y
Z = Z + a[i].pos.z
)
vert_array = #()
face_array = #()
v1_count = 0
v1= [X/a.count,Y/a.count,Z/a.count]
append vert_array v1
select Spline02
b = #(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32)
setKnotSelection $ 1 b
X=0
Y=0
Z=0
for i=1 to b.count do
(
X = X + b[i].pos.x
Y = Y + b[i].pos.y
Z = Z + b[i].pos.z
)
v2_count = 0
v2= [X/b.count,Y/b.count,Z/b.count]
append vert_array v2
append face_array [v1_count+1,v1_count+2,v2_count+1]
append face_array [v2_count+1,v2_count+2,v1_count+1]
v1_count += 2
v2_count += 2
m = mesh vertices:vert_array faces:face_array
problem is that no mesh is drawed nor errors occurred.
Or has somebody some other thoughts about this? I guess the thing I want to do is comparable with lofting modeling, although lofting is not done in MXS.
Thanx
–Davy
can you please tell us the intented use for this? It might help us to help you find the answer you’re looking for.
You appear to be trying to make your own version of Loft but i’m not sure why. What is wrong with the built in Loft ?
In the picture above[hopefully] you see the different splines. Those splines are slices of a model i made by polymodelling, but for my thesis I have to do it parametrically.
So the intent of the script is to create a simple object plug-in. A primitive, a parametric design of a glass.
The idea was to use the Knots of those splines to make the vert_array of my object_mesh.
So when i afterwards parametrisize the splines [by a slider that makes offsets of that splines] i can make different kind of glasses, even bottles.
Thanks in advance!
First i tried this by making a orthogonal trimesh, which vertsi want align to the spline. Not the resultat i had in mind. below piece the old code.
u=80
v=80
w=80
vert_array = #()
face_array = #()
vert_array[1]= [-u/2, v/2, 0]
vert_array[2]= [-3*u/8, v/2, 0]
vert_array[3]= [-u/4, v/2, 0]
vert_array[4]= [-u/8, v/2, 0]
vert_array[5]= [0, v/2, 0]
vert_array[6]= [u/8, v/2, 0]
vert_array[7]= [u/4, v/2, 0]
vert_array[8]= [3*u/8, v/2, 0]
vert_array[9]= [u/2, v/2, 0]
vert_array[10]= [-u/2, 3*v/8, 0]
vert_array[11]= [-3*u/8, 3*v/8, 0]
vert_array[12]= [-u/4, 3*v/8, 0]
vert_array[13]= [-u/8, 3*v/8, 0]
vert_array[14]= [0, 3*v/8, 0]
vert_array[15]= [u/8, 3*v/8, 0]
vert_array[16]= [u/4, 3*v/8, 0]
vert_array[17]= [3*u/8, 3*v/8, 0]
vert_array[18]= [u/2, 3*v/8, 0]
vert_array[37]= [-u/2, 0, 0]
vert_array[38]= [-3*u/8, 0, 0]
vert_array[39]= [-u/4, 0, 0]
vert_array[40]= [-u/8, 0, 0]
vert_array[41]= [0, 0, 0]
vert_array[42]= [u/8, 0, 0]
vert_array[43]= [u/4, 0, 0]
vert_array[44]= [3*u/8, 0, 0]
vert_array[45]= [u/2, 0, 0]
vert_array[46]= [-u/2, -v/8, 0]
vert_array[47]= [-3*u/8, -v/8, 0]
vert_array[48]= [-u/4, -v/8, 0]
vert_array[49]= [-u/8, -v/8, 0]
vert_array[50]= [0, -v/8, 0]
vert_array[51]= [u/8, -v/8, 0]
vert_array[52]= [u/4, -v/8, 0]
vert_array[53]= [3*u/8, -v/8, 0]
vert_array[54]= [u/2, -v/8, 0]
vert_array[55]= [-u/2, -v/4, 0]
vert_array[56]= [-3*u/8, -v/4, 0]
vert_array[57]= [-u/4, -v/4, 0]
vert_array[58]= [-u/8, -v/4, 0]
vert_array[59]= [0, -v/4, 0]
vert_array[60]= [u/8, -v/4, 0]
vert_array[61]= [u/4, -v/4, 0]
vert_array[62]= [3*u/8, -v/4, 0]
vert_array[63]= [u/2, -v/4, 0]
vert_array[64]= [-u/2, -3*v/8, 0]
vert_array[65]= [-3*u/8, -3*v/8, 0]
vert_array[66]= [-u/4, -3*v/8, 0]
vert_array[67]= [-u/8, -3*v/8, 0]
vert_array[68]= [0, -3*v/8, 0]
vert_array[69]= [u/8, -3*v/8, 0]
vert_array[70]= [u/4, -3*v/8, 0]
vert_array[71]= [3*u/8, -3*v/8, 0]
vert_array[72]= [u/2, -3*v/8, 0]
vert_array[73]= [-u/2, -v/2, 0]
vert_array[74]= [-3*u/8, -v/2, 0]
vert_array[75]= [-u/4, -v/2, 0]
vert_array[76]= [-u/8, -v/2, 0]
vert_array[77]= [0, -v/2, 0]
vert_array[78]= [u/8, -v/2, 0]
vert_array[79]= [u/4, -v/2, 0]
vert_array[80]= [3*u/8, -v/2, 0]
vert_array[81]= [u/2, -v/2, 0]
vert_array[82]= [-10*u/2, 10*v/2, w/10]
vert_array[83]= [-30*u/8, 10*v/2, w/10]
vert_array[84]= [-10*u/4, 10*v/2, w/10]
vert_array[85]= [-10*u/8, 10*v/2, w/10]
vert_array[86]= [10, 10*v/2, w/10]
vert_array[87]= [10*u/8, 10*v/2, w/10]
vert_array[88]= [10*u/4, 10*v/2, w/10]
vert_array[89]= [30*u/8, 10*v/2, w/10]
vert_array[90]= [10*u/2, 10*v/2, w/10]
vert_array[106]= [-10*u/2, -10*v/2, w/10]
vert_array[105]= [-30*u/8, -10*v/2, w/10]
vert_array[104]= [-10*u/4, -10*v/2, w/10]
vert_array[103]= [-10*u/8, -10*v/2, w/10]
vert_array[102]= [10, -10*v/2, w/10]
vert_array[101]= [10*u/8, -10*v/2, w/10]
vert_array[100]= [10*u/4, -10*v/2, w/10]
vert_array[99]= [30*u/8, -10*v/2, w/10]
vert_array[98]= [10*u/2, -10*v/2, w/10]
vert_array[113]= [-10*u/2, 30*v/8, w/10]
vert_array[112]= [-10*u/2, 10*v/4, w/10]
vert_array[111]= [-10*u/2, 10*v/8, w/10]
vert_array[110]= [-10*u/2, 10, w/10]
vert_array[109]= [-10*u/2, -10*v/8, w/10]
vert_array[108]= [-10*u/2, -10*v/4, w/10]
vert_array[107]= [-10*u/2, -30*v/8, w/10]
--
vert_array[91]= [10*u/2, 30*v/8, w/10]
vert_array[92]= [10*u/2, 10*v/4, w/10]
vert_array[93]= [10*u/2, 10*v/8, w/10]
vert_array[94]= [10*u/2, 10, w/10]
vert_array[95]= [10*u/2, -10*v/8, w/10]
vert_array[96]= [10*u/2, -10*v/4, w/10]
vert_array[97]= [10*u/2, -30*v/8, w/10]
-- build faces
-- upper faces
append face_array[1,2,10]
append face_array[2,11,10]
append face_array[2,3,12]
append face_array[2,11,12]
append face_array[3,4,12]
append face_array[4,13,12]
append face_array[4,5,14]
append face_array[4,13,14]
append face_array[5,6,14]
append face_array[6,14,15]
append face_array[6,7,16]
append face_array[7,8,16]
append face_array[8,17,16]
append face_array[6,15,16]
append face_array[8,17,18]
append face_array[8,9,18]
append face_array[10,19,20]
append face_array[10,11,20]
append face_array[11,12,20]
append face_array[12,21,20]
append face_array[12,21,22]
append face_array[12,13,22]
append face_array[13,14,22]
append face_array[14,23,22]
append face_array[14,24,23]
append face_array[14,15,24]
append face_array[15,16,24]
append face_array[16,25,24]
append face_array[16,17,26]
append face_array[16,26,23]
append face_array[17,18,26]
append face_array[18,27,26]
append face_array[19,20,28]
append face_array[20,29,28]
append face_array[20,30,29]
append face_array[20,21,30]
append face_array[21,22,30]
append face_array[22,30,31]
append face_array[22,32,31]
... and so on
-- HIGHT W= W/10
append face_array[1,2,82]
append face_array[2,82,83]
append face_array[2,3,83]
append face_array[3,83,84]
append face_array[3,4,84]
append face_array[4,84,85]
append face_array[4,5,85]
append face_array[5,86,85]
append face_array[5,6 ,86]
append face_array[6,86,87]
append face_array[6,7,87]
append face_array[7,88,87]
append face_array[7,8,88]
append face_array[8,89,88]
append face_array[8,9,89]
append face_array[9,90,89]
append face_array[9,18,90]
append face_array[18,91,90]
append face_array[18,27,91]
append face_array[27,92,91]
append face_array[27,36,92]
append face_array[36,93,92]
append face_array[36,45,93]
append face_array[45,94,93]
append face_array[45,54,94]
append face_array[54,95,94]
append face_array[54,63,95]
append face_array[63,96,95]
append face_array[63,72,96]
append face_array[72,97,96]
append face_array[72,81,97]
append face_array[81,98,97]
append face_array[81,80,98]
append face_array[80,99,98]
append face_array[80,79,99]
append face_array[79,100,99]
append face_array[79,78,100]
append face_array[78,101,100]
append face_array[78,77,101]
append face_array[77,102,101]
append face_array[77,76,102]
append face_array[76,103,102]
append face_array[76,75,103]
append face_array[75,104,103]
append face_array[75,74,104]
append face_array[74,105,104]
append face_array[74,73,105]
append face_array[73,106,105]
append face_array[73,64,106]
append face_array[64,107,106]
append face_array[64,55,107]
append face_array[55,108,107]
append face_array[55,46,108]
append face_array[46,109,108]
append face_array[46,37,109]
append face_array[37,110,109]
append face_array[37,28,110]
append face_array[28,111,110]
append face_array[28,19,111]
append face_array[19,112,111]
append face_array[19,10,112]
append face_array[10,113,112]
append face_array[10,1,113]
append face_array[1,113,82]
-- finished building faces
-- create mesh with all these vertices and faces
m = mesh vertices:vert_array faces:face_array
-- make splines
fn createLus01Shape =
(
ln = line();
splIdx = addNewSpline ln;
addKnot ln splIdx #bezier #curve [1.25,37.6452,-1.22664e-005] [-1.4797,37.6452,-1.22664e-005] [3.9797,37.6452,-1.22664e-005];
addKnot ln splIdx #bezier #curve [9.43911,37.6452,-1.22664e-005] [6.73828,38.0413,-1.23954e-005] [13.8607,36.9969,-1.20551e-005];
addKnot ln splIdx #bezier #curve [22.4792,34.5325,-1.12521e-005] [18.285,36.0749,-1.17547e-005] [25.583,33.3912,-1.08802e-005];
addKnot ln splIdx #bezier #curve [31.1267,29.6699,-9.6677e-006] [28.3395,31.4496,-1.02476e-005] [33.4845,28.1645,-9.17716e-006];
addKnot ln splIdx #bezier #curve [37.8856,24.6954,-8.0468e-006] [35.6839,26.4211,-8.6091e-006] [39.1997,23.6654,-7.71118e-006];
addKnot ln splIdx #bezier #curve [41.6659,21.4092,-6.976e-006] [40.5344,22.637,-7.37607e-006] [42.658,20.3326,-6.6252e-006];
addKnot ln splIdx #bezier #curve [44.2121,17.8305,-5.80991e-006] [43.7031,19.2032,-6.25719e-006] [45.4814,14.4071,-4.69444e-006];
addKnot ln splIdx #bezier #curve [46.9273,7.21911,-2.35228e-006] [46.4386,10.8373,-3.53125e-006] [47.3454,4.12457,-1.34395e-006];
addKnot ln splIdx #bezier #curve [46.9109,-2.14882,7.00173e-007] [47.2377,0.956679,-3.11726e-007] [46.5911,-5.18721,1.69021e-006];
addKnot ln splIdx #bezier #curve [44.998,-11.1125,3.62092e-006] [46.0333,-8.23811,2.68432e-006] [43.7873,-14.474,4.71622e-006];
addKnot ln splIdx #bezier #curve [40.2256,-20.7099,6.74815e-006] [41.8331,-17.5191,5.70845e-006] [39.2625,-22.6218,7.37113e-006];
addKnot ln splIdx #bezier #curve [37.2865,-26.4204,8.60885e-006] [38.6643,-24.7818,8.07494e-006] [35.7962,-28.1927,9.18634e-006];
addKnot ln splIdx #bezier #curve [31.8196,-30.7067,1.00055e-005] [33.7996,-29.5059,9.61424e-006] [29.3584,-32.1995,1.04919e-005];
addKnot ln splIdx #bezier #curve [24.0397,-34.4546,1.12267e-005] [26.7857,-33.5911,1.09454e-005] [20.3431,-35.617,1.16055e-005];
addKnot ln splIdx #bezier #curve [12.6409,-36.7376,1.19706e-005] [16.4172,-35.8681,1.16873e-005] [9.809,-37.3896,1.21831e-005];
addKnot ln splIdx #bezier #curve [4.22605,-39.0166,1.27132e-005] [7.07521,-38.4446,1.25269e-005] [3.25344,-39.2119,1.27769e-005];
addKnot ln splIdx #bezier #curve [1.25,-39.0244,1.27158e-005] [2.24202,-39.0244,1.27158e-005] [0.257979,-39.0244,1.27158e-005];
addKnot ln splIdx #bezier #curve [-1.72605,-39.0166,1.27132e-005] [-0.753438,-39.2119,1.27769e-005] [-4.57521,-38.4446,1.25269e-005];
addKnot ln splIdx #bezier #curve [-10.1409,-36.7376,1.19706e-005] [-7.309,-37.3896,1.21831e-005] [-13.9172,-35.8681,1.16873e-005];
addKnot ln splIdx #bezier #curve [-21.5397,-34.4546,1.12267e-005] [-17.8431,-35.617,1.16055e-005] [-24.2857,-33.5911,1.09454e-005];
addKnot ln splIdx #bezier #curve [-29.3197,-30.7067,1.00055e-005] [-26.8584,-32.1995,1.04919e-005] [-31.2996,-29.5059,9.61424e-006];
addKnot ln splIdx #bezier #curve [-34.7865,-26.4204,8.60885e-006] [-33.2962,-28.1927,9.18634e-006] [-36.1642,-24.7818,8.07494e-006];
addKnot ln splIdx #bezier #curve [-37.7256,-20.7099,6.74815e-006] [-36.7625,-22.6218,7.37113e-006] [-39.3331,-17.5191,5.70845e-006];
addKnot ln splIdx #bezier #curve [-42.498,-11.1125,3.62092e-006] [-41.2873,-14.474,4.71622e-006] [-43.5333,-8.23811,2.68432e-006];
addKnot ln splIdx #bezier #curve [-44.4109,-2.14882,7.00173e-007] [-44.0911,-5.18721,1.69021e-006] [-44.7377,0.956679,-3.11726e-007];
addKnot ln splIdx #bezier #curve [-44.4273,7.21911,-2.35228e-006] [-44.8453,4.12457,-1.34395e-006] [-43.9386,10.8373,-3.53125e-006];
addKnot ln splIdx #bezier #curve [-41.7121,17.8305,-5.80991e-006] [-42.9814,14.4071,-4.69444e-006] [-41.2031,19.2032,-6.25719e-006];
addKnot ln splIdx #bezier #curve [-39.1659,21.4092,-6.976e-006] [-40.158,20.3326,-6.6252e-006] [-38.0344,22.637,-7.37607e-006];
addKnot ln splIdx #bezier #curve [-35.3856,24.6954,-8.0468e-006] [-36.6997,23.6654,-7.71118e-006] [-33.1839,26.4211,-8.6091e-006];
addKnot ln splIdx #bezier #curve [-28.6267,29.6699,-9.6677e-006] [-30.9845,28.1645,-9.17716e-006] [-25.8395,31.4496,-1.02476e-005];
addKnot ln splIdx #bezier #curve [-19.9792,34.5325,-1.12521e-005] [-23.083,33.3912,-1.08802e-005] [-15.785,36.0749,-1.17547e-005];
addKnot ln splIdx #bezier #curve [-6.93911,37.6452,-1.22664e-005] [-11.3607,36.9969,-1.20551e-005] [-4.23828,38.0413,-1.23954e-005];
close ln splIdx;
updateShape ln;
convertToSplineShape ln;
ln.wireColor = (color 28 149 177);
ln.name = uniqueName "Lus01";
select ln;
return ln;
)
createLus01Shape()
fn createLus02Shape =
(
ln = line();
splIdx = addNewSpline ln;
addKnot ln splIdx #bezier #curve [21.0298,82.1023,10] [26.7423,81.1116,-2.67029e-005] [14.5272,83.23,-2.67029e-005];
addKnot ln splIdx #bezier #curve [1.25,83.0159,10] [7.85069,83.0159,-2.67029e-005] [-5.35069,83.0159,-2.67029e-005];
addKnot ln splIdx #bezier #curve [-18.5298,82.1023,10] [-12.0272,83.23,-2.67029e-005] [-24.2423,81.1116,-2.67029e-005];
addKnot ln splIdx #bezier #curve [-35.0658,76.7179,10] [-30.0369,79.5856,-2.28882e-005] [-41.1931,73.2239,-2.28882e-005];
addKnot ln splIdx #bezier #curve [-51.4192,63.3475,10] [-45.636,67.4052,-1.90735e-005] [-58.4477,58.4159,-1.90735e-005];
addKnot ln splIdx #bezier #curve [-73.3354,49.8663,10] [-66.4945,55.0547,-1.52588e-005] [-77.465,46.7342,-1.52588e-005];
addKnot ln splIdx #bezier #curve [-84.0395,38.6066,10] [-80.938,42.7534,-1.14441e-005] [-87.2981,34.2498,-1.14441e-005];
addKnot ln splIdx #bezier #curve [-92.29,24.524,10] [-90.0562,29.4893,-7.62939e-006] [-94.4935,19.6259,-3.8147e-006];
addKnot ln splIdx #bezier #curve [-97.2705,9.19592,10] [-96.3887,14.4954,-3.8147e-006] [-97.9509,5.10668,0];
addKnot ln splIdx #bezier #curve [-96.9089,-3.23522,10] [-97.5426,0.861521,0] [-96.1809,-7.94154,3.8147e-006];
addKnot ln splIdx #bezier #curve [-93.2127,-17.0357,10] [-94.6995,-12.5115,3.8147e-006] [-91.6819,-21.6941,7.62939e-006];
addKnot ln splIdx #bezier #curve [-87.8696,-30.7414,10] [-90.1894,-26.4216,1.14441e-005] [-85.2446,-35.6298,1.14441e-005];
addKnot ln splIdx #bezier #curve [-78.4744,-44.4812,10] [-82.0536,-40.2483,1.52588e-005] [-74.7029,-48.9416,1.90735e-005];
addKnot ln splIdx #bezier #curve [-65.9364,-56.6804,10] [-71.01,-53.786,1.90735e-005] [-58.514,-60.9148,2.28882e-005];
addKnot ln splIdx #bezier #curve [-41.8083,-65.3986,10] [-49.9448,-62.7609,2.28882e-005] [-35.2746,-67.5167,2.28882e-005];
addKnot ln splIdx #bezier #curve [-21.9593,-70.937,10] [-28.5877,-69.1346,2.28882e-005] [-17.3379,-72.1936,2.28882e-005];
addKnot ln splIdx #bezier #curve [-8.06011,-74.5755,10] [-12.7622,-73.6663,2.67029e-005] [-5.00053,-75.1671,2.67029e-005];
addKnot ln splIdx #bezier #curve [1.25,-75.4246,10] [-1.86625,-75.4246,2.67029e-005] [4.36625,-75.4246,2.67029e-005];
addKnot ln splIdx #bezier #curve [10.5601,-74.5755,10] [7.50053,-75.1671,2.67029e-005] [15.2622,-73.6663,2.67029e-005];
addKnot ln splIdx #bezier #curve [24.4593,-70.937,10] [19.8379,-72.1936,2.28882e-005] [31.0877,-69.1346,2.28882e-005];
addKnot ln splIdx #bezier #curve [44.3083,-65.3986,10] [37.7746,-67.5167,2.28882e-005] [52.4448,-62.7609,2.28882e-005];
addKnot ln splIdx #bezier #curve [68.4364,-56.6804,10] [61.014,-60.9148,2.28882e-005] [73.51,-53.786,1.90735e-005];
addKnot ln splIdx #bezier #curve [80.9744,-44.4812,10] [77.2029,-48.9416,1.90735e-005] [84.5536,-40.2483,1.52588e-005];
addKnot ln splIdx #bezier #curve [90.3696,-30.7414,10] [87.7446,-35.6298,1.14441e-005] [92.6894,-26.4216,1.14441e-005];
addKnot ln splIdx #bezier #curve [95.7127,-17.0357,10] [94.1819,-21.6941,7.62939e-006] [97.1995,-12.5115,3.8147e-006];
addKnot ln splIdx #bezier #curve [99.4089,-3.23522,10] [98.6809,-7.94154,3.8147e-006] [100.043,0.861522,0];
addKnot ln splIdx #bezier #curve [99.7705,9.19592,10] [100.451,5.10667,0] [98.8887,14.4954,-3.8147e-006];
addKnot ln splIdx #bezier #curve [94.7899,24.524,10] [96.9934,19.6259,-3.8147e-006] [92.5562,29.4893,-7.62939e-006];
addKnot ln splIdx #bezier #curve [86.5395,38.6066,10] [89.7981,34.2498,-1.14441e-005] [83.438,42.7534,-1.14441e-005];
addKnot ln splIdx #bezier #curve [75.8354,49.8663,10] [79.965,46.7342,-1.52588e-005] [68.9945,55.0547,-1.52588e-005];
addKnot ln splIdx #bezier #curve [53.9192,63.3475,10] [60.9477,58.4159,-1.90735e-005] [48.136,67.4052,-1.90735e-005];
addKnot ln splIdx #bezier #curve [37.5658,76.7179,10] [43.6931,73.2239,-2.28882e-005] [32.5369,79.5856,-2.28882e-005];
close ln splIdx;
updateShape ln;
convertToSplineShape ln;
ln.wireColor = (color 225 87 143);
ln.name = uniqueName "Lus02";
select ln;
return ln;
)
createLus02Shape()
select $Object01
obj1 = $Object01
$.EditablePoly.SetSelection #Vertex #{5..6, 18..19, 27..28, 36..37, 45..46, 54..55, 63..64, 72..81, 114, 116, 118, 121..122, 125, 128, 138..207, 213, 218..219, 222..225, 227..240, 271..274, 279, 281..282, 313..314}
p = for i=1 to obj1.selectedverts.count collect obj1.selectedverts[i].index
Motif = $Lus01
for i in p do
(
polyop.setvert obj1 i (lengthInterp Motif (nearestPathParam Motif (polyop.getvert obj1 i)))
subobjectlevel = 1
)
X=0
Y=0
Z=0
for i=1 to p.count do
(
X = X + p[i].pos.x
Y = Y + p[i].pos.y
Z = Z + p[i].pos.Z
)
AvPos = [X/p.count,Y/p.count,Z/p.count]
Motif.pos = AvPos
delete obj
So know, the new idea was to use those knots [addKnot Point3] to make the verts of the mesh.
I got really stuck in this mess.
Thanks in advance!
D.
[img] http://bp2.blogger.com/_j-U8Ysiortk/R33z15vU3aI/AAAAAAAAAAc/8iHSTVHpqYc/s1600-h/RP_01_materiaal+ABS.JPG [/img]
Sorry guys
Please…But is there nobody on this forum who can help me?
I thought it was possible to use the knots of the splines [ various sections of the form I want to become] to make all the vertices [vert_array] of the mesh.
That mesh, i want to put in a Bounding box, which I’ll parameterize by length, width, height.
But the problem I got stuck in the transformations of the knots to the verts of the mesh.
Of is there an other manner to make a parameterized bottle [off course with that form]
Thanks for your time!!
If you set the premise that all splines have the same knot count, you can then easily draw from the consecutive splines using the right hand rule and build your faces from those knot values… Actually it’s faster to just copy and convert the splines to meshes and attach in a linear fashion. Since the knot count will be the same as the vert count of the resulting mesh. Then reassign the vertices of the faces based on the number of verts in the spline…
Ex:
You have 5 closed splines of 10 knots each arranged at different z heights. Copy and Collapse to meshs, and attach. You then need to set the face count to ( 5 * 10 * 2 ) as you need two faces per poly.
Looping through the mesh you reassign the face vert indices two at a time…
f=1
for x=1 to 5 do
for y = 1 to 10 do
setface mesh f [x,(10+x), (10+x+1)]
setface mesh f+1 [(10+x+1), (x+1),x]
f = f+2
Hope this helps…
Meshing with non equal spline knot values is considerably more difficult…
good luck.
Thank you Keith!
Sorry for late answer, but in meantime I had to deal with some annoying exams
Fast test of the script on some circles didn’t work out.
Very likely I made some stupid mistakes. Does somebody see them?
[font="][/font]
for i = 1 to 3 do
for i in $Circle* do
convertToMesh i
f=1
for x = 1 to 3 do
for x in $Circle* do
for y = 1 to 28 do
for y in $Circle03.baseObject.verts[#{y}]
setFace mesh f [x,(10+x),(10+x+1)]
setFace mesh f+1 [(10+x+1),(x+1),x]
f=f+2
)
Thanks in advance!
Yep, you are mixing variables:
read through your script and answer those question, line, by line:
What is i ?
for i = 1 to 3 do – here i is a number from 1 to 3
for i in $Circle* do – now i represents a circle
convertToMesh i
same thing for x and y …
for x = 1 to 3 do – x is an number from 1 to 3
for x in $Circle* do – now x is a circle
for y = 1 to 28 do – y is a number from 1 to 28
for y in $Circle03.baseObject.verts[#{y}] – now, y is a circle
setFace mesh f [x,(10+x),(10+x+1)] – here x is still a circle
setFace mesh f+1 [(10+x+1),(x+1),x] – here x is still a circle