Hello,
I would like to read the name and position of objects in the current selection. I have created the objects in a namespace LOC , so that I can select them easily with:
CODE
select "LOC:*";
And then the trouble starts. I would like to read the name and position of every selected object and write it in a file, but i have no Idea, how to work with a selection of more then one object.
I tried to write the selection in an arrayCODE
$bla[] = sets -q
, but it is still empty afterwords.
Maybe it is a very simple problem, but I don't see the solution in the docs.
thank you for your help ![]()
Andreas
easy dude! :]
if you'd like all objects with the name LOC:* you even don't need to select them:
you can pack them into an array with:
CODE
{
string $LOCArray[] = ls "LOC:*";
print $LOCArray;
}
browsing them is easy with the for-in loop:
CODE
{
string $LOCArray[] = ls "LOC:*";
for ($item in $LOCArray)
{
print ("$item: " + $item + "\n");
}
}
But if you want to put them all to a file you could easily sort the array to a string and write that. Hava look at the fprint-example in the docs. The string you could do with:
CODE
{
string $LOCArray[] = ls -type transform "LOC:*";
string $yourString = stringArrayToString($LOCArray,"\n");
print ("$yourString:\n" + $yourString + "\n");
}
I even put the -type transform to the ls command, you might get rid of the shapes.. I dunno...
eRiC
Yes!
thank you a lot. That was exactly the point.
good luck