Variable not populating Cast Point during run.

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

  • Variable not populating Cast Point during run.

    Ok, so I'm trying to make a high point plane from 2 surfaces using 3 points, and forcing the 2 highest points to be on different surfaces and forcing the 3rd point to be neither of those 2 points (thanks JEFMAN ), but I have a problem. The If/then, If/Else variable isn't populating the Cast Point after a run. It comes up with 0,0,0 for the Actual. When I refresh the point by retyping the variable name into the point, it updates as expected. Any idea what could be wrong with it, or if there is a different way to go about generating the 3rd point?

    Code:
    DAT_A1     =FEAT/CONTACT/VECTOR POINT/DEFAULT,CARTESIAN
                THEO/<2340.244,245.186,634.04>,<0,-0.5735764,-0.819152>
                ACTL/<2340.381,244.453,634.074>,<-0.0002777,-0.5739187,-0.8189123>
                TARG/<2340.244,245.186,634.04>,<0,-0.5735764,-0.819152>
                SNAP=NO
                SHOW FEATURE PARAMETERS=NO
                SHOW CONTACT PARAMETERS=YES
                  AVOIDANCE MOVE=BOTH,DISTANCE=3
                SHOW HITS=NO
    
    ........removed
    
    DAT_A12    =FEAT/CONTACT/VECTOR POINT/DEFAULT,CARTESIAN
                THEO/<2340.236,219.428,652.076>,<0,-0.5735764,-0.819152>
                ACTL/<2340.654,218.696,652.11>,<-0.0002777,-0.5739187,-0.8189123>
                TARG/<2340.236,219.428,652.076>,<0,-0.5735764,-0.819152>
                SNAP=NO
                SHOW FEATURE PARAMETERS=NO
                SHOW CONTACT PARAMETERS=YES
                  AVOIDANCE MOVE=BOTH,DISTANCE=3
                SHOW HITS=NO
    
    ........removed
    
    ALN1       =ALIGNMENT/START,RECALL:ALN0,LIST=YES
                  ALIGNMENT/ITERATE
                    PNT TARGET RAD=0.25,START LABEL=,FIXTURE TOL=0.15,ERROR LABEL=
                    MEAS ALL FEAT=ALWAYS,MAX ITERATIONS=3,LEVEL AXIS=ZAXIS,ROTATE AXIS=YAXIS,ORIGIN AXIS=XAXIS
                  LEVEL=DAT_A1,DAT_A2,DAT_A3,DAT_A4,DAT_A5,DAT_A6,DAT_A7,DAT_A8,
                        DAT_A9,DAT_A10,DAT_A11,DAT_A12,,
                  ROTATE=PB1,PB2,,
                  ORIGIN=PC1,,
                ALIGNMENT/END
    SCN1       =FEAT/SET,CARTESIAN
                THEO/<2346.72,242.128,636.182>,<0,0,1>
                ACTL/<2346.72,242.127,636.18>,<0,0,1>
                CONSTR/SET,BASIC,DAT_A1,DAT_A2,DAT_A3,DAT_A4,DAT_A5,DAT_A6,,
    SCN2       =FEAT/SET,CARTESIAN
                THEO/<2346.702,222.465,649.949>,<0,0,1>
                ACTL/<2346.702,222.466,649.95>,<0,0,1>
                CONSTR/SET,BASIC,DAT_A7,DAT_A8,DAT_A9,DAT_A10,DAT_A11,DAT_A12,,
                ASSIGN/D1=DOT(SCN1.HIT[1..SCN1.NUMHITS].XYZ-SCN1.HIT[1..SCN1.NUMHITS].TXYZ,SCN1.HIT[1..SCN1.NUMHITS].TIJK)
                ASSIGN/D2=DOT(SCN2.HIT[1..SCN2.NUMHITS].XYZ-SCN2.HIT[1..SCN2.NUMHITS].TXYZ,SCN2.HIT[1..SCN2.NUMHITS].TIJK)
                ASSIGN/DP1=MAXINDICES(D1)
                ASSIGN/DP2=MAXINDICES(D2)
                ASSIGN/P1=ELEMENT(DP1[1], ",", "DAT_A1,DAT_A2,DAT_A3,DAT_A4,DAT_A5,DAT_A6")
                ASSIGN/P2=ELEMENT(DP2[1], ",", "DAT_A7,DAT_A8,DAT_A9,DAT_A10,DAT_A11,DAT_A12")
                ASSIGN/PP1=ELEMENT(DP1[2], ",", "DAT_A1,DAT_A2,DAT_A3,DAT_A4,DAT_A5,DAT_A6")
                ASSIGN/PP2=ELEMENT(DP2[2], ",", "DAT_A7,DAT_A8,DAT_A9,DAT_A10,DAT_A11,DAT_A12")
    IF/D1[2]>D2[2]
                  ASSIGN/P3=PP1[2]
                END_IF/
                ELSE_IF/D2[2]>D1[2]
                  ASSIGN/P3=PP2[2]
                END_ELSEIF/
    PNT_A1     =FEAT/POINT,CARTESIAN,NO
                THEO/<2340.236,239.08,638.316>,<0,-0.5735764,-0.819152>
                ACTL/<2340.236,239.057,638.283>,<0,-0.5735764,-0.819152>
                CONSTR/POINT,CAST,P1
    PNT_A2     =FEAT/POINT,CARTESIAN,NO
                THEO/<2350.274,225.522,647.809>,<0,-0.5735764,-0.819152>
                ACTL/<2350.274,225.512,647.794>,<0,-0.5735764,-0.819152>
                CONSTR/POINT,CAST,P2
    PNT_A3     =FEAT/POINT,CARTESIAN,NO
                THEO/<2340.243,225.527,647.805>,<0,-0.5735764,-0.819152>
               ACTL/<0,0,0>,<0,0,1>
                CONSTR/POINT,CAST,P3
    
    ......removed
    
    ALN2       =ALIGNMENT/START,RECALL:ALN1,LIST=YES
                  ALIGNMENT/BF3D,LEAST_SQR,CREATE WEIGHTS=NO,ROTANDTRANS,USE SCALING=NO,278.351,-360.478,-521.555,5.409,-14.452,-16.523
                  ITERATEANDREPIERCECAD=NO
                  Deviation Threshold=0.01
                  SHOWALLINPUTS=NO,SHOWALLPARAMS=NO
                ALIGNMENT/END
    
    .......removed
    
    DIM LOC1= LOCATION OF POINT DAT_A1  UNITS=MM ,$
    GRAPH=OFF  TEXT=OFF  MULT=1.00  OUTPUT=BOTH  HALF ANGLE=NO
    AX       MEAS    NOMINAL       +TOL       -TOL        DEV     OUTTOL
    T      -14.291      0.000      0.150      0.150    -14.291     14.141
    END OF DIMENSION LOC1
    Last edited by VinniUSMC; 12-02-2019, 09:52 AM.
    "This is my word... and as such is beyond contestation."

  • #2
    After refreshing P3 in the PNT_A3 Cast Point.

    Code:
    PNT_A3     =FEAT/POINT,CARTESIAN,NO
                THEO/<2340.243,225.527,647.805>,<0,-0.5735764,-0.819152>
                ACTL/<2340.243,225.518,647.792>,<0,-0.5735764,-0.819152>
                CONSTR/POINT,CAST,P3
    
    ...
    
    DIM LOC1= LOCATION OF POINT DAT_A1  UNITS=MM ,$
    GRAPH=OFF  TEXT=OFF  MULT=1.00  OUTPUT=BOTH  HALF ANGLE=NO
    AX       MEAS    NOMINAL       +TOL       -TOL        DEV     OUTTOL
    T       -0.078      0.000      0.150      0.150     -0.078      0.000
    END OF DIMENSION LOC1
    "This is my word... and as such is beyond contestation."

    Comment


    • #3
      Hi Vinni,
      In your code, you compare D1[2] to D2[2] without sorting them, so you compare the T value of the 2nd point of each feature set. (It's easier to read here than in the other window !)
      So I would sortdown D1 and D2, then compare which is the biggest second value.
      Then I would use an array of names, and select this which correspond to the right value.

      Code:
      ASSIGN/D1=DOT(SCN1.HIT[1..SCN1.NUMHITS].XYZ-SCN1.HIT[1..SCN1.NUMHITS].TXYZ,SCN1.HIT[1..SCN1.NUMHITS].TIJK)
      ASSIGN/D2=DOT(SCN2.HIT[1..SCN2.NUMHITS].XYZ-SCN2.HIT[1..SCN2.NUMHITS].TXYZ,SCN2.HIT[1..SCN2.NUMHITS].TIJK)
      
      ASSIGN/TS1=SORTDOWN(D1)
      ASSIGN/TS2=SORTDOWN(D2)
      
      ASSIGN/DP1=MAXINDICES(D1)
      ASSIGN/DP2=MAXINDICES(D2)
      
      ASSIGN/ARRAY1=ARRAY("DAT_A1","DAT_A2","DAT_A3","DAT_A4","DAT_A5","DAT_A6")
      ASSIGN/ARRAY2=ARRAY("DAT_A7","DAT_A8","DAT_A9","DAT_A10","DAT_A11","DAT_A12")
      
      IF TS1[2]>TS2[2]
      ASSIGN/V1=DP1[2]
      ASSIGN/P3=ARRAY1[V1]
      END IF
      
      IF TS2[2]>TS1[2]
      ASSIGN/V1=DP2[2]
      ASSIGN/P3=ARRAY2[V1]
      END IF
      
      
      PNT_A3     =FEAT/POINT,CARTESIAN,NO
                  THEO/<2340.243,225.527,647.805>,<0,-0.5735764,-0.819152>
                  ACTL/<2340.243,225.518,647.792>,<0,-0.5735764,-0.819152>
                  CONSTR/POINT,CAST,P3

      Comment


      • JEFMAN
        JEFMAN commented
        Editing a comment
        Ok, it doesn't explain why it works when it has the time... !

      • VinniUSMC
        VinniUSMC commented
        Editing a comment
        I'm already doing the ASSIGN V1 and ASSIGN P3 in the If statements with "Assign=Element"

    • #4
      Maxindices sorts them high to low. So [2] is the 2nd highest. It picks the right features (I verified this), it just doesn't populate PNT_A3 when I run it. It shouldn't tell me PNT_A3 is at 0,0,0, and then when I retype "P3" in the Cast Point, the numbers are fixed and everything is good.
      "This is my word... and as such is beyond contestation."

      Comment


      • #5
        Originally posted by VinniUSMC View Post
        Maxindices sorts them high to low. So [2] is the 2nd highest. It picks the right features (I verified this), it just doesn't populate PNT_A3 when I run it. It shouldn't tell me PNT_A3 is at 0,0,0, and then when I retype "P3" in the Cast Point, the numbers are fixed and everything is good.
        I don't understand why it works... !
        You're right, MAXINDICES sort down, but D1 and D2 are not sorted, so D1[2] can be the 2nd highest value, but only due to the hazard...
        In your code, it should be :

        Code:
        IF/D1[DP1[2]]>D2[DP2[2]]
                      ASSIGN/P3=PP1[2]
                    END_IF/
                    ELSE_IF/D2[DP2[2]]>D1[DP1[2]]
                      ASSIGN/P3=PP2[2]
                    END_ELSEIF/
        And I don't understand why it works when you type P3 !!!!!!
        Or does PC-DMIS uses the last value of P3 in the code above ? So the point could be a bad one (not this that you're looking for ?)

        This software is very surprising !
        Last edited by JEFMAN; 12-02-2019, 11:09 AM.

        Comment


        • VinniUSMC
          VinniUSMC commented
          Editing a comment
          Ohhh, right. D1 and D2 are prior to sorting. Hmm, somehow it still seems to pick the right points. I'll have to fix that to make sure it can't be wrong.

      • #6
        Wouldn't you want to reference the sorted array values to pick up 3rd highest point within the if statement?
        Code:
        IF/D1[2]>D2[2]  
                       ASSIGN/P3=PP1[2]
                    END_IF/
                    ELSE_IF/D2[2]>D1[2]
                      ASSIGN/P3=PP2[2]
                    END_ELSEIF/
        Change to DP1 and DP2
        Code:
         IF/DP1[2]>DP2[2]
                      ASSIGN/P3=PP1[2]
                    END_IF/
                    ELSE_IF/DP2[2]>DP1[2]
                      ASSIGN/P3=PP2[2]
                    END_ELSEIF/
        I've never used dot product, so not so familiar with the data format of the arrays.
        If it were me, I'd simplify by creating an interim alignment, level to a basic plane (to normalize the vector), and deal with extracting the top three Z values. That way my arrays and math is only judging one value (Z).

        Comment


        • VinniUSMC
          VinniUSMC commented
          Editing a comment
          Yes, but the values of DP1 and DP2 are integers, not measured values. So, the values would be something like (6, 5, 1, 2, 3, 4) and (1, 2, 3, 4, 5, 6). But if point 2 in set 2 is higher deviation than point 5 in set 1, it would say 5 is greater than 2, not "the deviation of 2 is higher than the deviation of 5."

          Dot product just gives the T value of the point deviations.

      • #7
        Originally posted by JEFMAN View Post

        I don't understand why it works... !
        You're right, MAXINDICES sort down, but D1 and D2 are not sorted, so D1[2] can be the 2nd highest value, but only due to the hazard...
        In your code, it should be :

        Code:
        IF/D1[DP1[2]]>D2[DP2[2]]
        ASSIGN/P3=PP1[2]
        END_IF/
        ELSE_IF/D2[DP2[2]]>D1[DP1[2]]
        ASSIGN/P3=PP2[2]
        END_ELSEIF/
        And I don't understand why it works when you type P3 !!!!!!
        Or does PC-DMIS uses the last value of P3 in the code above ? So the point could be a bad one (not this that you're looking for ?)

        This software is very surprising !
        I put in the sorting assignment, but running the program still gave me back a 0,0,0 PNT_A3 again. Only that point doesn't work. So, it must have something to do with the IF/THEN and IF/ELSE.
        "This is my word... and as such is beyond contestation."

        Comment


        • #8
          I tried changing to back-to-back IF/THEN statements, and also IF/THEN, ELSE. Neither of those worked either.
          "This is my word... and as such is beyond contestation."

          Comment


          • #9
            I'm not really folllowing what you're doing but:

            1) Are PP1 and PP2 actually arrays? I've not used ELEMENT before but it seems to me it returns a single element? Yet you're asking for the second element of it?

            IF/D1[2]>D2[2]
            ASSIGN/P3=PP1[2]
            END_IF/
            ELSE_IF/D2[2]>D1[2]
            ASSIGN/P3=PP2[2]
            END_ELSEIF/


            Also if that's correct, should it not be ASSIGN/P3={PP1[2]} to point it to the feature?
            Automettech - Automated Metrology Technology

            Comment


            • VinniUSMC
              VinniUSMC commented
              Editing a comment
              The assignments for the other 2 points are exactly the same, and they work every time.

            • NinjaBadger
              NinjaBadger commented
              Editing a comment
              See Neil Chalinors answer below relating to {} brackets, but it lets PC-Dmis know it''s a feature.


              For the other point I'm trying to make is this...


              Code:
              ASSIGN/P1=ELEMENT(DP1[1], ",", "DAT_A1,DAT_A2,DAT_A3,DAT_A4,DAT_A5,DAT_A6")
              ASSIGN/P2=ELEMENT(DP2[1], ",", "DAT_A7,DAT_A8,DAT_A9,DAT_A10,DAT_A11,DAT_A12")
              ASSIGN/PP1=ELEMENT(DP1[2], ",", "DAT_A1,DAT_A2,DAT_A3,DAT_A4,DAT_A5,DAT_A6")
              ASSIGN/PP2=ELEMENT(DP2[2], ",", "DAT_A7,DAT_A8,DAT_A9,DAT_A10,DAT_A11,DAT_A12")
              IF/D1[2]>D2[2]
              ASSIGN/P3=PP1[2]
              END_IF/
              ELSE_IF/D2[2]>D1[2]
              ASSIGN/P3=PP2[2]
              END_ELSEIF/
              For P1 and P2 you are selecting the desired element from the list/array - no issues with that.

              For P3, you seem to be asking to the second element by using array notation i.e. PP1[2] of either PP1 or PP2, BUT as far as I can see, PP1 and PP2 are simply single elements already selected above.
              Last edited by NinjaBadger; 12-03-2019, 05:59 AM.

            • VinniUSMC
              VinniUSMC commented
              Editing a comment
              Oooohhhhhhh, I see it now. Good catch Mr NinjaBadger

              Yeah, that was leftover from the first try. PP1 and PP2 are single items already. Now, let's just hope that fixes this.
              Last edited by VinniUSMC; 12-03-2019, 07:56 AM.

          • #10
            VinniUSMC : It designs a feature !
            You could also try to add a comment $ or operator auto execute 1s:
            IF/D1[2]>D2[2]
            ASSIGN/P3=PP1[2]
            $
            P3.XYZ

            END_IF/
            ELSE_IF/D2[2]>D1[2]
            ASSIGN/P3=PP2[2]
            $
            P3.XYZ

            END_ELSEIF

            Comment


            • VinniUSMC
              VinniUSMC commented
              Editing a comment
              This is just to force PC-DMIS to pause and think about it? Stupid Demon. I'll give that a try next.

            • louisd
              louisd commented
              Editing a comment
              I think JEFMAN was suggesting to add the comment to attempt to trace where the P3 assignment is breaking as well.
              If you make an operator comment, it captures and locks the value of P3 as a string output, so you can review the true value pf P3 at that moment.

              I've recently seen the demon 'skip' file/writelines on me, and if i add a comment before the skipped writeline, to slow it down or interrupt its burp/hiccup, they work with no issue.
              --There's an execution speed within the F5 settings under animation tab, that you can toggle down to 1ms delay. However, it doesn't seem to correct these skipped writelines (or possibly if statements for you) even if you set it to 200ms.

          • #11
            VinniUSMC and louisd : I usually add a comment to slow down PC-DMIS execution...
            In addition, it can give some interseting informations !
            When I just want to slow down, I input a operator comment "Tempo", with a delay of 1s (so it lasts 2 seconds ! 1 only doesn't exists, even if you write 0 !)

            Comment


            • #12
              What is the squiggly bracket supposed to do? My problem is that the cast point constructs exactly as expected when you type "P3" into the Cast Point (see post #2) and then say "YES" when it asks "A variable with this name exists. Does this refer to that variable?" It only doesn't populate when the program actually runs. I have to assume it's something wrong with the IF statements assigning P3, maybe because of the iterative above it? I don't know.
              Just want to check that I understand correctly, are P1, P2 & P3 feature names? If they are then you need to enclose them in {} ("squiggly" brackets) which denote a pointer - i.e the variable is pointing PC-Dmis at the feature. When you assign variables in PC-Dmis they are stored as variants unless you use a function such as Str() or Int() to force them to become a particular type. Variants are useful because you don't have to handle declaring or converting them to different types - it happens automatically - see extract from the PC-Dmis help files below

              The variant data type is capable of storing numbers, strings, dates, and times. When using a variant you do not have to explicitly convert a variable from one data type to another. This data type conversion is handled automatically.
              for help on pointers see https://docs-dev.hexagonmi.com/pcdmi...hlterm=pointer

              Comment


              • VinniUSMC
                VinniUSMC commented
                Editing a comment
                Well, P1, P2 and P3 are just variable names, but they do represent features. Why does it work just fine for 2 of the points (PNT_A1 and PNT_A2 work 100% every time), but then doesn't work for the third point? The only difference is the third point is being selected by the IF statements.

              • VinniUSMC
                VinniUSMC commented
                Editing a comment
                neil.challinor Ninja's catch was the fix, so follow up question, why does it populate the cast point when I manually type in P3? PP1[2] and PP2[2] should be empty items even when I manually type P3 into the cast point, but it fills in with the expected values.

            • #13
              Originally posted by VinniUSMC View Post
              Ok, so I'm trying to make a high point plane from 2 surfaces using 3 points, and forcing the 2 highest points to be on different surfaces and forcing the 3rd point to be neither of those 2 points
              Why? What problem with "Tangent plane" are you trying to workaround? How do you know that a real, physical, tangent plane will always rest on both surfaces? And if you are, how do you know that they are not offset to each other, so that the tangent plane rests completely on the edges of your two planes (at places where you have not taken any hits)?

              VinnieHighPoint.PNG
              Which version of PC-DMIS?


              AndersI
              SW support - Hexagon Metrology Nordic AB

              Comment


              • VinniUSMC
                VinniUSMC commented
                Editing a comment
                My datum A is "2 Surfaces". Two coplanar, parallel surfaces. Coincidentally, the part is currently formed roughly like your sketch (0.07 measured profile, form only).

                Tangent plane doesn't work because I can't iterate on it, and because the surfaces are at 20-30 degrees rotated from Z about X. I also tried making a tangent plane on each surface, and a tangent plane from both surfaces, but that gave me an iterative alignment error. Also, the surfaces are maybe .500 square inches each, and only separated by about .25 inches. If the tangent plane settled on one surface, that would have a major impact on the alignment that would not be confirmed when the part is on the check fixture. I have to also make sure that when people see my measurement data, that we can correlate it to the fixture (assuming the fixture is in spec also).
                Last edited by VinniUSMC; 12-03-2019, 08:06 AM.

              • VinniUSMC
                VinniUSMC commented
                Editing a comment
                Certainly it's not perfect. Of course it's not. We're in the business of making best approximations. If we were always worried about "at places where you have not taken any hits" then no work would ever get done.

            • #14
              Originally posted by NinjaBadger View Post
              I'm not really folllowing what you're doing but:

              1) Are PP1 and PP2 actually arrays? I've not used ELEMENT before but it seems to me it returns a single element? Yet you're asking for the second element of it?

              IF/D1[2]>D2[2]
              ASSIGN/P3=PP1[2]
              END_IF/
              ELSE_IF/D2[2]>D1[2]
              ASSIGN/P3=PP2[2]
              END_ELSEIF/


              Also if that's correct, should it not be ASSIGN/P3={PP1[2]} to point it to the feature?
              Winner, winner, chicken dinner. PP1 and PP2 are already a single item. Removing the bracketed item indicator fixed the problem.

              +1,000,000 interwebz to you sir.

              Thanks everyone else for helping.
              "This is my word... and as such is beyond contestation."

              Comment


            • #15
              I just wanna say this entire topic is Waaaaaaayyy above my skill level but I did enjoy reading and am humbled by the wealth of knowledge and willingness of members to take time from their day to help others.
              Sheffield Endeavor3 9.20.8, Tesastar-SM, Leitz LSP-X1s & LSP-X1M, PCDMIS 2011 MR1

              Comment

              Related Topics

              Collapse

              Working...
              X