PDA

View Full Version : Star primitive script: grab it



jeric_synergy
09-29-2014, 01:01 PM
Hi guys:

Using iaian_r's CREATE LSCRIPT script (aka "Make Arbitrary Primitive Scripts" script), here's a script that will create a roughly 1 meter 5 pointed y-facing star with one click of a button:


@version 2.8
@warnings
@script modeler
@name "Star-Y-facing"

main
{
verts[1] = <-9.18614e-013,0,-0.18>;
verts[2] = <0.293893,0,-0.404509>;
verts[3] = <0.17119,0,-0.0556231>;
verts[4] = <0.475528,0,0.154509>;
verts[5] = <0.105801,0,0.145623>;
verts[6] = <2.55171e-012,0,0.5>;
verts[7] = <-0.105801,0,0.145623>;
verts[8] = <-0.475528,0,0.154509>;
verts[9] = <-0.17119,0,-0.0556231>;
verts[10] = <-0.293893,0,-0.404509>;

pol_11 = "1";
pol_12 = "2";
pol_13 = "3";
pol_14 = "4";
pol_15 = "5";
pol_16 = "6";
pol_17 = "7";
pol_18 = "8";
pol_19 = "9";
pol_110 = "10";

pnts_1 = "10";


maxpoints = 10;
t_verts = sizeof(verts);
t_pols = 1;
t_patch = 0;

info("Building object, please be patient .....");
moninit(t_pols);
for(i = 1; i <= t_pols; i++){
for(k = 1; k <= pnts_`i; k++){
editbegin();
pol = pol_`i`k;
t[k] = number(pol);
p = verts[t[k]];
pt[k] = addpoint(p);
}
polygon = addpolygon(pt);
if(monstep()){
editend(ABORT);
return;
}
editend();
for(m = 1; m <=maxpoints; m++){
t[m] = nil;
p[m] = nil;
pt[m] = nil;
}
t.pack();
p.pack();
pt.pack();
t.trunc();
p.trunc();
pt.trunc();
}
monend();
mergepoints();
if( t_patch > 0){
for(i = 1; i <= t_patch; i++){
editbegin();
pnum = ptch_`i;
mp = number(pnum);
mpols[i] = polygons[mp];
editend();
}
selmode(USER);
selpolygon(SET, POLYID, mpols);
togglepatches();
selpolygon(CLEAR);
}
info("");
}