PDA

View Full Version : selecting points by axis

wingwalker
03-05-2008, 12:51 PM
Hi guys

Im looking for a way to automate a lengthy process.

The only part of it a cant find out how to script (and its critical to the whole thing) is to select all points on eg. the -y axis or the +z axis.

It will always be a - or a +...anything on 0x or 0y wont ever need to be selected.

Does anyone have a clue how to do this?

Thanks
Rob

faulknermano
03-06-2008, 12:34 AM
main
{
selectMode = integer(recall("selectMode",1));
axis = integer(recall("axis",1));
side = integer(recall("side",1));
selmode(GLOBAL);
reqbegin("Select Points on Axis");
c2 = ctlchoice("Axis",axis,@"X","Y","Z"@);
c3 = ctlchoice("Side",side,@"+","-"@);
return if(!reqpost());
selectMode = getvalue(c1);
axis = getvalue(c2);
side = getvalue(c3);

store("selectMode",selectMode);
store("axis",axis);
store("side",side);

reqend();

pc = editbegin(); // point count returned by editbegin()
origPoints = nil;
// go through internal array of points and tag those which fit params
for(i=1;i<=pc;i++)
{

if(axis == 1)
myVal = points[i].x;
if(axis == 2)
myVal = points[i].y;
if(axis == 3)
myVal = points[i].z;

if(side == 1)
if(myVal > 0)
pnt[pnt.size()+1] = points[i];

if(side == 2)
if(myVal < 0)
pnt[pnt.size()+1] = points[i];
}

editend();
selmode(USER);
if(selectMode == 2)
selpoint(CLEAR);
selpoint(SET,POINTID,pnt);

}

wingwalker
03-07-2008, 10:47 AM
superstar....thank you

titane357
03-14-2008, 11:57 AM
hello,
I do not hijack this thread, but if god of scripts could help to optimise this :

--------------------
@warnings
@version 1.2

main
{
a=0;
i=1 ;
reqbegin("YOKO range");
c1 = ctlnumber("Y MAX=",1);
c2 = ctlnumber("Y min=",0);

if(reqpost()) {
YYMAX = getvalue (c1) ;
YYmin = getvalue (c2) ;
} else {
return;
}
reqend();
undogroupbegin();
selmode(USER);
editbegin();
pc = pointcount();

while(i< pc + 1 )

{
xx= pointinfo(points[i]).x ;
yy= pointinfo(points[i]).y ;
zz= pointinfo(points[i]).z ;

if ((yy == min(yy,YYMAX)) && (yy == max(yy,YYmin))) {
a = a+1;

//info (i);
}

i = i+1 ;
}
editend();
}
---------------------

It select vertex in a range of y values.

Thanks :D
(I'm a poooor lscripter, I know, not very elegant....)

faulknermano
03-15-2008, 05:48 AM
hmmm.... good challenge. :D

here's a super-simple solution that i am ashamed that i didnt think of earlier:

main
{
selmode(USER);
reqbegin("YOKO range");
c1 = ctlnumber("Y MAX=",1);
c2 = ctlnumber("Y min=",0);

if(reqpost())
{
YYMAX = getvalue (c1) ;
YYmin = getvalue (c2) ;
}
else
{
return;
}

selpoint(SET,VOLUME,<-1000,YYmin,-1000>,<1000,YYMAX,1000>);

}

the selpoint(SET,VOLUME,lowVec,highVec) could be used for the first script i posted. using points[] array took 8 second to select 11641 points, while it only took less than a second using the "internal" VOLUME select.

the simpler the better, as i seem never to learn. ;)

titane357
03-15-2008, 09:36 AM
yyyyeeessss :thumbsup:
chap 3 - modeler command - p.89 :"VOLUME"
argh ! Thanks you very much master of script !!!
Now we can do all we want !!!! :D

titane357
03-15-2008, 10:43 AM
and must increase min / max ---> 100000 ! (town planning projects)

titane357
03-15-2008, 11:12 AM
my little contribution to this forum.....:boogiedow