General Category > ASL Scripts

Help

<< < (2/4) > >>

tiodiego:
Thanks again Claude!, didn't noticed it, but I changed that and made some minor adjustments to the script and it didn't work neither  :-\ , so I made it again xD! and now it works  ;) here it is:


--- Quote ---/* Cube Primitive Plugin by TioDiego */

#plugin("object", "mesh", "cube");
#parameter("side", float, 10, 1, 999, scale);
#return($cube);
#button(32, 32, 2,
0x0000000000, 0x0000000000, 0x0000000000, 0x0000000000,
0x0000000000, 0x00000fffe0, 0x0000100060, 0x00002800a0,
0x0000400120, 0x0000880220, 0x0001000420, 0x0003fff820,
0x0002000820, 0x0002080820, 0x0002000820, 0x0002080820,
0x0002000820, 0x0002080820, 0x0002000820, 0x00020aaaa0,
0x0002100840, 0x0002200880, 0x0002400900, 0x0002800a00,
0x0003000c00, 0x0003fff800, 0x0000000000, 0x0000000000,
0x0000000000, 0x0000000000, 0x0000000000, 0x0000000000);

shape $cube;
float $a;
int $in[8];
point3 $p;

$a = parameter("side")/2;
$cube.Open();

$cube.OpenFace(0,0);
$p.x=$a;
$p.y=$a;
$p.z=-$a;
$in[0]=$cube.AddPoint($p);
$cube.VertexN($in[0]);
$p.x=$a;
$p.y=$a;
$p.z=$a;
$in[1]=$cube.AddPoint($p);
$cube.VertexN($in[1]);
$p.x=-$a;
$p.y=$a;
$p.z=$a;
$in[2]=$cube.AddPoint($p);
$cube.VertexN($in[2]);
$p.x=-$a;
$p.y=$a;
$p.z=-$a;
$in[3]=$cube.AddPoint($p);
$cube.VertexN($in[3]);
$cube.CloseFace();


$cube.OpenFace(0,0);
$p.x=$a;
$p.y=-$a;
$p.z=-$a;
$in[4]=$cube.AddPoint($p);
$cube.VertexN($in[4]);
$p.x=$a;
$p.y=-$a;
$p.z=$a;
$in[5]=$cube.AddPoint($p);
$cube.VertexN($in[5]);
$p.x=-$a;
$p.y=-$a;
$p.z=$a;
$in[6]=$cube.AddPoint($p);
$cube.VertexN($in[6]);
$p.x=-$a;
$p.y=-$a;
$p.z=-$a;
$in[7]=$cube.AddPoint($p);
$cube.VertexN($in[7]);
$cube.CloseFace();

$cube.OpenFace(0,0);
$cube.VertexN($in[0]);
$cube.VertexN($in[1]);
$cube.VertexN($in[5]);
$cube.VertexN($in[4]);
$cube.CloseFace();

$cube.OpenFace(0,0);
$cube.VertexN($in[1]);
$cube.VertexN($in[2]);
$cube.VertexN($in[6]);
$cube.VertexN($in[5]);
$cube.CloseFace();

$cube.OpenFace(0,0);
$cube.VertexN($in[2]);
$cube.VertexN($in[3]);
$cube.VertexN($in[7]);
$cube.VertexN($in[6]);
$cube.CloseFace();

$cube.OpenFace(0,0);
$cube.VertexN($in[3]);
$cube.VertexN($in[0]);
$cube.VertexN($in[4]);
$cube.VertexN($in[7]);
$cube.CloseFace();

$cube.Close();
--- End quote ---
I attached a simple paint drawing that explains the order the script works, if someone needs it  :)

( I still would like to know what was wrong with the old version, so I attached it in case someone has the time  ::) )

Claude:
Still a small problem with your mesh.
Your top face normal is correct.
The 5 other face normals are reversed.
They are facing toward the centre of the cube.
Easy to fix by changing the winding,the order you
use the points.
When you look at the top,you're going
clockwise.Do the same for the other faces.

tiodiego:
now it is ready  ;D


--- Quote ---/* Cube Primitive Plugin by TioDiego */

#plugin("object", "mesh", "cube");
#parameter("side", float, 10, 1, 999, scale);
#return($cube);
#button(32, 32, 2,
0x0000000000, 0x0000000000, 0x0000000000, 0x0000000000,
0x0000000000, 0x00000fffe0, 0x0000100060, 0x00002800a0,
0x0000400120, 0x0000880220, 0x0001000420, 0x0003fff820,
0x0002000820, 0x0002080820, 0x0002000820, 0x0002080820,
0x0002000820, 0x0002080820, 0x0002000820, 0x00020aaaa0,
0x0002100840, 0x0002200880, 0x0002400900, 0x0002800a00,
0x0003000c00, 0x0003fff800, 0x0000000000, 0x0000000000,
0x0000000000, 0x0000000000, 0x0000000000, 0x0000000000);

shape $cube;
float $a;
int $in[8];
point3 $p;

$a = parameter("side")/2;
$cube.Open();

$cube.OpenFace(0,0);
$p.x=$a;
$p.y=$a;
$p.z=-$a;
$in[0]=$cube.AddPoint($p);
$cube.VertexN($in[0]);
$p.x=$a;
$p.y=$a;
$p.z=$a;
$in[1]=$cube.AddPoint($p);
$cube.VertexN($in[1]);
$p.x=-$a;
$p.y=$a;
$p.z=$a;
$in[2]=$cube.AddPoint($p);
$cube.VertexN($in[2]);
$p.x=-$a;
$p.y=$a;
$p.z=-$a;
$in[3]=$cube.AddPoint($p);
$cube.VertexN($in[3]);
$cube.CloseFace();


$cube.OpenFace(0,0);
$p.x=$a;
$p.y=-$a;
$p.z=-$a;
$in[4]=$cube.AddPoint($p);
$cube.VertexN($in[4]);
$p.x=-$a;
$p.y=-$a;
$p.z=-$a;
$in[5]=$cube.AddPoint($p);
$cube.VertexN($in[5]);
$p.x=-$a;
$p.y=-$a;
$p.z=$a;
$in[6]=$cube.AddPoint($p);
$cube.VertexN($in[6]);
$p.x=$a;
$p.y=-$a;
$p.z=$a;
$in[7]=$cube.AddPoint($p);
$cube.VertexN($in[7]);
$cube.CloseFace();

$cube.OpenFace(0,0);
$cube.VertexN($in[1]);
$cube.VertexN($in[0]);
$cube.VertexN($in[4]);
$cube.VertexN($in[7]);
$cube.CloseFace();

$cube.OpenFace(0,0);
$cube.VertexN($in[2]);
$cube.VertexN($in[1]);
$cube.VertexN($in[7]);
$cube.VertexN($in[6]);
$cube.CloseFace();

$cube.OpenFace(0,0);
$cube.VertexN($in[3]);
$cube.VertexN($in[2]);
$cube.VertexN($in[6]);
$cube.VertexN($in[5]);
$cube.CloseFace();

$cube.OpenFace(0,0);
$cube.VertexN($in[0]);
$cube.VertexN($in[3]);
$cube.VertexN($in[5]);
$cube.VertexN($in[4]);
$cube.CloseFace();

$cube.Close();
--- End quote ---

thanks AGAIN Claude xD!

Claude:
Great.
For your other request.
Problem is here:
/* points /*
Should have been:
/* points */
All your point creation code was seen as a long comment
until the next */ on this line:
/* faces */
Result was illegal point index use in VertexN statement.

Bye
Claude

tiodiego:
OMG!!!!! D:>
I search the error for hours xdddddddddddddd
and it was that simple little super detail  :o
cant believe it  :P
thanks for taking your time Claude xD!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version