I've been using the forum for some time but this is my first post - so hello to everybody.
I'm stuck with FOR loop in Attribute Wrangle.
I cannot understand what's happening that causes it to produce unwanted results.
Intro:
I got points and I want to rearrange their numbers to fit certain pattern so I can create a curve which shape will match the pattern.
Current state:
Based on pattern definition I created additional point attributes that should be the base for reordering point numbers.
What was supposed to be quick debug check made me stuck for two days now.
1. I want the code to go through all points in the geometry and check value of a specific attribute (“LeftSide”).
2. If the value of the attribute matches certain value new point should be created.
Code:
int ParamValue = 0;
int pointCount = @numpt;
for (int i=0; i<pointCount ;i++)
{
ParamValue = pointattrib(geoself(),"LeftSide",i,1);
printf(itoa(ParamValue));
if(ParamValue == 2)
{
addpoint(0,{0,0,5});
printf("added new point");
}
}
What's weird to me:
Debug results printed to the console seems to be ok. However it looks like the new points were created for all the points - I start with 29 points and finish with 58.
No errors, no warnings and I'm bit lost. I attached screen of the geometry after the code run.
I'd appreciate any advice on finding out what I am doing wrong and/or misunderstood.
Staszek