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
  • Hi ,
    I would try to create the array in a loop :
    V1 =LOOP/START,ID=YES,NUMBER=10,START=1,SKIP=,
    OFFSET:XAXIS=0,YAXIS=0,ZAXIS=0,ANGLE=0
    ASSIGN/V2="PNTA"+V1
    ASSIGN/V3="PNTB"+V1
    ASSIGN/V4="PNTC"+V1
    ASSIGN/V5[V1]=V2.X
    ASSIGN/V6[V1]=V3.X
    ASSIGN/V7[V1]=V4.X
    LOOP/END


    You could also create 3 feature sets with different points (A, B and C), then create V1=SCNA.HIT[​..SCNA.NUMHITS].X which is directly an array of X values.
Reply
  • Hi ,
    I would try to create the array in a loop :
    V1 =LOOP/START,ID=YES,NUMBER=10,START=1,SKIP=,
    OFFSET:XAXIS=0,YAXIS=0,ZAXIS=0,ANGLE=0
    ASSIGN/V2="PNTA"+V1
    ASSIGN/V3="PNTB"+V1
    ASSIGN/V4="PNTC"+V1
    ASSIGN/V5[V1]=V2.X
    ASSIGN/V6[V1]=V3.X
    ASSIGN/V7[V1]=V4.X
    LOOP/END


    You could also create 3 feature sets with different points (A, B and C), then create V1=SCNA.HIT[​..SCNA.NUMHITS].X which is directly an array of X values.
Children
No Data