Feature I.D. Number / Read Next Feature I.D. Number

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Feature I.D. Number / Read Next Feature I.D. Number

    Is there a way to read what the next feature I.D. number ( i.e. POINT1 ) will be without creating a feature? I was hoping to read a variable that would allow me to set the number of times an IF loop will repeat. I have a program that measures hundreds of vector points, and a loop that sends the results to an Excel spreadsheet. Every time I add more points, I need to manually set the loop counter to correspond to the new number of points. For example, if the last point measured was POINT225, I set the IF statements to "IF/I<226". It's not that big of a deal to change it manually, I was just hoping to put this value into a variable. I have included the program code for my Excel output loop.


    ASSIGN/I=1
    L1 =LABEL/
    IF/I<226 ( WOULD LIKE THIS TO BE A VARIABLE )
    ASSIGN/VAR1="POINT"+I
    ASSIGN/VAR2=DOT(VAR1.XYZ-VAR1.TXYZ,VAR1.TIJK)
    VEXIST1 =FILE/EXISTS,C:\BOB1\DUMPFILE.CSV
    IF/VEXIST1==0
    FPTR =FILE/OPEN,C:\BOB1\DUMPFILE.CSV,WRITE
    FILE/CLOSE,FPTR,KEEP
    END_IF/
    FPTR =FILE/OPEN,C:\BOB1\DUMPFILE.CSV,APPEND
    FILE/WRITE_BLOCK,FPTR,I
    FILE/WRITE_BLOCK,FPTR,,
    FILE/WRITE_BLOCK,FPTR,VAR1.X.THEO
    FILE/WRITE_BLOCK,FPTR,,
    FILE/WRITE_BLOCK,FPTR,VAR1.Y.THEO
    FILE/WRITE_BLOCK,FPTR,,
    FILE/WRITE_BLOCK,FPTR,VAR1.Z.THEO
    FILE/WRITE_BLOCK,FPTR,,
    FILE/WRITE_BLOCK,FPTR,VAR1.X
    FILE/WRITE_BLOCK,FPTR,,
    FILE/WRITE_BLOCK,FPTR,VAR1.Y
    FILE/WRITE_BLOCK,FPTR,,
    FILE/WRITE_BLOCK,FPTR,VAR1.Z
    FILE/WRITE_BLOCK,FPTR,,
    FILE/WRITE_BLOCK,FPTR,VAR2
    FILE/WRITE_BLOCK,FPTR,,
    FILE/WRITE_BLOCK,FPTR,VAR1.I
    FILE/WRITE_BLOCK,FPTR,,
    FILE/WRITE_BLOCK,FPTR,VAR1.J
    FILE/WRITE_BLOCK,FPTR,,
    FILE/WRITE_BLOCK,FPTR,VAR1.K
    FILE/WRITELINE,FPTR,
    FILE/CLOSE,FPTR,KEEP
    ASSIGN/I=I+1
    GOTO/L1
    END_IF/

  • #2
    bob, try this.

    This assumes sequential numbering of points. If you are missing a point, say you deleted point27, it will return null values.

    This checks for 3 different values.
    # of points between 100 & 999
    # of points between 10 & 99
    # of points between 1 & 9

    good luck.

    Code:
    ASSIGN/V1=GETCOMMAND("MEASURED POINT","UP",1)
    ASSIGN/I=1
    ASSIGN/V2=RIGHT(V1,3)
    IF/V2>99 AND V2<1000
    ASSIGN/V3=V2
    DO/
    ASSIGN/VAR1="POINT"+I
    ASSIGN/VAR2=DOT(VAR1.XYZ-VAR1.TXYZ,VAR1.TIJK)
    $$ your code to output to file 
    ASSIGN/I=I+1
    UNTIL/I>V3
    GOTO/L1
    END_IF
    
    
    ASSIGN/I=1
    ASSIGN/V2=RIGHT(V1,3)
    IF/V2>9 AND V2<100
    ASSIGN/V3=V2
    DO/
    ASSIGN/VAR1="POINT"+I
    ASSIGN/VAR2=DOT(VAR1.XYZ-VAR1.TXYZ,VAR1.TIJK)
    $$ your code to output to file 
    ASSIGN/I=I+1
    UNTIL/I>V3
    GOTO/L1
    END_IF
    
    
    ASSIGN/I=1
    ASSIGN/V2=RIGHT(V1,3)
    IF/V2>0 AND V2<10
    ASSIGN/V3=V2
    DO/
    ASSIGN/VAR1="POINT"+I
    ASSIGN/VAR2=DOT(VAR1.XYZ-VAR1.TXYZ,VAR1.TIJK)
    $$ your code to output to file 
    ASSIGN/I=I+1
    UNTIL/I>V3
    GOTO/L1
    END_IF
    
    
    L1=LABEL

    B&S CHAMELEON/PCDMIS CAD++ V2011

    There are no bugs, only "UNDOCUMENTED ENHANCEMENTS!"

    sigpic

    Comment


    • #3
      or this

      Code:
      ASSIGN/PNTREF=GETCOMMAND(602,"UP",1)
      ASSIGN/PNTID=GETTEXT("Id",0,PNTREF)
      ASSIGN/PNTPREFIX="PNT"
      ASSIGN/LENID=LEN(PNTID)
      ASSIGN/LENPREFIX=LEN(PNTPREFIX)
      ASSIGN/NUMLEN=LENID-LENPREFIX
      ASSIGN/INDEXNUM=RIGHT(PNTID,NUMLEN)
      ASSIGN/NEXTINDEXNUM=INDEXNUM+1
      COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
      NEXTINDEXNUM
      GETCOMMAND - gets a reference to a command, 602 is vector point, UP searches back up the program and 1 means it wants the first instance it finds

      I was having problems typing it in, had to use the expression builder for most of this (even though it generated expressions exactly as I'd typed them), shouldn't have had to use GETTEXT to get the ID, but it seemed to need it.

      I then specify a prefix (i.e. the non numerical part of the Feat ID)

      I then use LEN and RIGHT (Text functions) to get the right hand portion of the last ID, then add 1.
      Applications Engineer
      Hexagon UK

      Comment


      • #4
        C1 =COMMENT/INPUT,NO,FULL SCREEN=NO,
        Enter number of times to loop:

        Assign/i=1
        l1 =label/
        if/i<C1.INPUT

        C1.INPUT simply looks in the buffers for the operator's input to the comment.

        Comment


        • #5
          You might try something like this for your vector points.

          You can add any amount of vector points that you need.

          But any added points MUST proceed the construction of the feature set.

          Code:
          $$ NO,***** CONSTRUCT A FEATURE SET OF YOUR VECTOR POINTS
          SCN1       =FEAT/SET,CARTESIAN
                      THEO/<20,0,0>,<0,0,1>
                      ACTL/<19.9931,0.0001,0.0128>,<0,0,1>
                      CONSTR/SET,BASIC,POINT1,POINT2,POINT3,POINT4,POINT5,,
          $$ NO,***** ASSIGN V1 AS A COUNTER ***** 
                      ASSIGN/V1=1
          $$ NO,***** DO/ WHILE FLOW CONTROL *****
                      DO/
                      ASSIGN/T_VAL=DOT(SCN1.HIT[V1].XYZ-SCN1.HIT[V1].TXYZ,SCN1.HIT[V1].TIJK)
          $$ NO,***** 
          $$ NO,***** PLACE YOUR FILE OUTPUT CODE HERE *****
          $$ NO,***** 
          $$ NO,***** INCREASE THE COUNTER *****
                      ASSIGN/V1=V1+1
          $$ NO,***** END WHEN COUNTER IS GREATER THAN NUMBER OF VECTOR POINTS *****
                      UNTIL/V1>SCN1.NUMHITS
          $$ NO,*****

          B&S CHAMELEON/PCDMIS CAD++ V2011

          There are no bugs, only "UNDOCUMENTED ENHANCEMENTS!"

          sigpic

          Comment

          Related Topics

          Collapse

          Working...
          X