PDA

View Full Version : Creating an object with a script.



starbase1
04-25-2004, 10:04 AM
Hi, I hope someone can help, I'm very new to lscripts. I'm trying to build a script with a list of commands that will create an object.

(They started out as a povray mesh, and I have massaged the text to try and make an lscript from them).

main
{

editbegin();
point[1]= addpoint (0.000000,3.2, 0.000000);
point[2]= addpoint (0.555674,3.151385, 0.000000);
point[3]= addpoint (0.547232,3.151385, -0.096492);

polygon = addpolygon (point);
editend();

editbegin();
point[1]= addpoint (0.000000,3.2, 0.000000);
point[2]= addpoint (0.547232,3.151385, -0.096492);
point[3]= addpoint (0.522163,3.151385, -0.190052);

polygon = addpolygon (point);
editend();

.....


more point and polygon commands, then I end it with...


editbegin();
point[1]= addpoint (-7.878462,1.389185, 0.000000);
point[2]= addpoint (-7.600000,0, 0.000000);
point[3]= addpoint (-6.992135,0, 1.232902);

polygon = addpolygon (point);
editend();
}


When I run it, it gets to the end and then just says

“Error in main, line 9804:”

Can anyone see where I am going wrong with this?

Thanks,
Nick

allankiipli
05-19-2004, 08:08 AM
Hello, i experimented a little bit.
You may try this:

polygon = addpolygon (point)|| polygon;

to skip over an erroneus situation.

And maybe you can leave out repetitive editbegins and editends.

Also when you are not using variable polygon elsewhere,
you may write something like this:

addpolygon (point);

starbase1
05-19-2004, 12:19 PM
Thanks for the idea - in the end I did a lashup, and managed to use excel (!) to m ake a .obj file, with a bit of help from MS Word!

Worked fine!

:p

Lynx3d
05-20-2004, 07:00 AM
?Error in main, line 9804:?
that's one long script :eek: :D

Well yea it should be fine doing it in one edit.
And I'd rather create an array with all those point positions and then use a for-loop to add the points and polygon...saves 4 lines of code for each poly :)

btw, which line is 9804 actually?
just noticed that the last two points have a "..., 0, ..." which probably doesn not get recognized as float value, maybe try "..., 0.0, ..."