hexagon logo

Arrays' programming

Hello all,

The help file although nice does not cover my questions. Apologies in advance if that has been discussed before but I would like a new post for array questions (I mean forums are about discussing ^^)

I was trying yesterday an array of this type:

assign: V1=ARRAY(PNTA1.X,PNTA2.X...)

As I wanted to change A to B to C etc.. for a second/third list of points I thought I could use assignments and c/p the command with only changing the 1 character. Ex:

assign: CHAR="A"
assign: V1=ARRAY("PNT"+CHAR+"1.X" etc...)

This returned the string and not the value. I tried with pointer brackets {} also and it was not correct. Maybe assigning separately each input:

assign: CHAR="A"
assign: Input1= :{"PNT"+CHAR+"1.X"}
assign: Input2= :{"PNT"+CHAR+"2.X"}
assign: V1=ARRAY(input1, input2, etc...)

This will take also time and logic says there is a faster way to do it if someone knows...

Also it is a bit strange that we cannot populate arrays with ARRAY(1..10) command. Or ARRAY(PNTA[1..10].x) for a point created through looping. Or can we and I do not know how? :P

(Version 2017 R2 btw)
Parents
  • Thanks for the solutions, I know one outcome can be lead to by different paths but it seems a lot of work either way (loops seem to stall the machine significantly too). In any case I rly liked the idea of scanned feature that does answer also the "Or ARRAY(PNTA[1..10].x) for a point created through looping." question. I suppose I can V1=SCNA.HIT[1..10].X and like that get the array!
Reply
  • Thanks for the solutions, I know one outcome can be lead to by different paths but it seems a lot of work either way (loops seem to stall the machine significantly too). In any case I rly liked the idea of scanned feature that does answer also the "Or ARRAY(PNTA[1..10].x) for a point created through looping." question. I suppose I can V1=SCNA.HIT[1..10].X and like that get the array!
Children
No Data