Line Vector and If/End Statement

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

  • Line Vector and If/End Statement

    All,
    A lot of my programs use a manually measured line to create the initial manual alignment. As we all know, the direction in which the line is measured is very important. I know Craig has posted some code that will check if the vector is correct and if not prompt the user to measure it again. This is all well and good but I was thinking about trying to use an If/End statement to get the program to run no matter which vector the line has. Has anyone messed with this before? Here is what I am thinking:

    Measure a line with a vector of 1,0,0
    Create a reverse line of this line so one with a vector of -1,0,0
    Use an If/End to pick the line with a vector of 1,0,0 and insert it somehow into the alignment - variable & generic feature maybe?

    That way, if the manual line is measured as -1,0,0 the program will create a reverse line 1,0,0 and will figure out which line to use. I can't mess around with it right now b/c the machine is in use so I am not sure how viable this approach is.

    What do you guys think?

  • #2
    Why not just use variables? Can you construct a line using 2 points and use a variable to set the vector of the line?
    sigpic
    Originally posted by AndersI
    I've got one from September 2006 (bug ticket) which has finally been fixed in 2013.

    Comment


    • #3
      Nope, I just tried it, it won;t let me 'tweak' the constructed vector.
      sigpic
      Originally posted by AndersI
      I've got one from September 2006 (bug ticket) which has finally been fixed in 2013.

      Comment


      • #4
        Why couldn't you just check the vector of the major axis and then create a reverse line of it if the vector is less than one.
        Links to my utilities for PCDMIS

        Comment


        • #5
          How about this?

          LIN5 =FEAT/LINE,RECT,UNBND
          THEO/102.9423,97.8978,-170.9922,0,-0.0162039,-0.9998687
          ACTL/104.6628,98.0995,-171.1288,0,-0.0200879,-0.9997982
          CONSTR/LINE,BF,2D,FACE_PNT1,FACE_PNT2,,
          OUTLIER_REMOVAL/OFF,3
          FILTER/OFF,WAVELENGTH=0
          LIN6 =FEAT/LINE,RECT,UNBND
          THEO/102.9423,97.7212,-181.8887,0,0.0162039,0.9998687
          ACTL/104.6628,97.9238,-179.8726,0,0.0200879,0.9997982
          CONSTR/LINE,REV,LIN5,10.898
          IF/LIN5.K >0.0
          ASSIGN/V3 = "LIN5"
          END_IF/
          ELSE_IF/LIN5.K <0.0
          ASSIGN/V3 = "LIN6"
          END_ELSEIF/
          LIN7 =FEAT/LINE,RECT,UNBND
          THEO/102.9423,97.8978,-170.9922,0,-0.0162039,-0.9998687
          ACTL/104.6628,98.0995,-171.1288,0,-0.0200879,-0.9997982
          CONSTR/LINE,CAST,V1,10.898,DEPENDENT

          Comment


          • #6
            Originally posted by cmmguy View Post
            Why couldn't you just check the vector of the major axis and then create a reverse line of it if the vector is less than one.
            That is what I was thinking. The problem comes in when you get to the alignment. I think the line in the alignment always has to have the same feature name. Therefore, I need a way to create a line which will use the vector of one of two lines. It is almost as if I need an If/End inside a feature or alignment. Is that possible?

            Comment


            • #7
              Originally posted by Tested View Post
              How about this?

              LIN5 =FEAT/LINE,RECT,UNBND
              THEO/102.9423,97.8978,-170.9922,0,-0.0162039,-0.9998687
              ACTL/104.6628,98.0995,-171.1288,0,-0.0200879,-0.9997982
              CONSTR/LINE,BF,2D,FACE_PNT1,FACE_PNT2,,
              OUTLIER_REMOVAL/OFF,3
              FILTER/OFF,WAVELENGTH=0
              LIN6 =FEAT/LINE,RECT,UNBND
              THEO/102.9423,97.7212,-181.8887,0,0.0162039,0.9998687
              ACTL/104.6628,97.9238,-179.8726,0,0.0200879,0.9997982
              CONSTR/LINE,REV,LIN5,10.898
              IF/LIN5.K >0.0
              ASSIGN/V3 = "LIN5"
              END_IF/
              ELSE_IF/LIN5.K <0.0
              ASSIGN/V3 = "LIN6"
              END_ELSEIF/
              LIN7 =FEAT/LINE,RECT,UNBND
              THEO/102.9423,97.8978,-170.9922,0,-0.0162039,-0.9998687
              ACTL/104.6628,98.0995,-171.1288,0,-0.0200879,-0.9997982
              CONSTR/LINE,CAST,V1,10.898,DEPENDENT
              That looks pretty good. Does it work?

              Comment


              • #8
                Originally posted by Goodluck View Post
                That is what I was thinking. The problem comes in when you get to the alignment. I think the line in the alignment always has to have the same feature name. Therefore, I need a way to create a line which will use the vector of one of two lines. It is almost as if I need an If/End inside a feature or alignment. Is that possible?
                OK, how about an IF statement that will take you to 1 of 2 places, with each place constructing a line in a different manner, a line with the SAME ID, which is then used in the alingment?

                (warning, syntax IS all wrong, I only use IF/THEN statements in GWBASIC, but hopefully you'll get the idea)

                IF line1.meas.I < 0.8 then POS else NEG

                and then POS

                construct line LINE2 = LINE1
                goto alignstart

                and then NEG

                construct line LINE2 = -LINE1
                goto alignstart

                Would something along those 'lines' work? (snicker, I made a punny-joke)

                I know you can make two different features in Pcdmis WITH the same name, but will IF/THEN/GOTO make sure that it uses the right data for the one you want?
                sigpic
                Originally posted by AndersI
                I've got one from September 2006 (bug ticket) which has finally been fixed in 2013.

                Comment


                • #9
                  Originally posted by Goodluck View Post
                  That looks pretty good. Does it work?
                  It works off line. Can't tell right now behond that but I have done things like this that have worked.

                  Comment


                  • #10
                    Originally posted by Goodluck View Post
                    That is what I was thinking. The problem comes in when you get to the alignment. I think the line in the alignment always has to have the same feature name. Therefore, I need a way to create a line which will use the vector of one of two lines. It is almost as if I need an If/End inside a feature or alignment. Is that possible?
                    The alignment could always use the same generic feature. Use a variable to flip the vectors. Remember that the reverse is usually all three vectors. The IF/Then makes the variable either a 1 or a -1 depending on the initial direction. I think tested is on the right track with his post.
                    Links to my utilities for PCDMIS

                    Comment


                    • #11
                      Originally posted by Tested View Post
                      How about this?

                      LIN5 =FEAT/LINE,RECT,UNBND
                      THEO/102.9423,97.8978,-170.9922,0,-0.0162039,-0.9998687
                      ACTL/104.6628,98.0995,-171.1288,0,-0.0200879,-0.9997982
                      CONSTR/LINE,BF,2D,FACE_PNT1,FACE_PNT2,,
                      OUTLIER_REMOVAL/OFF,3
                      FILTER/OFF,WAVELENGTH=0
                      LIN6 =FEAT/LINE,RECT,UNBND
                      THEO/102.9423,97.7212,-181.8887,0,0.0162039,0.9998687
                      ACTL/104.6628,97.9238,-179.8726,0,0.0200879,0.9997982
                      CONSTR/LINE,REV,LIN5,10.898
                      IF/LIN5.K >0.0
                      ASSIGN/V3 = "LIN5"
                      END_IF/
                      ELSE_IF/LIN5.K <0.0
                      ASSIGN/V3 = "LIN6"
                      END_ELSEIF/
                      LIN7 =FEAT/LINE,RECT,UNBND
                      THEO/102.9423,97.8978,-170.9922,0,-0.0162039,-0.9998687
                      ACTL/104.6628,98.0995,-171.1288,0,-0.0200879,-0.9997982
                      CONSTR/LINE,CAST,V1,10.898,DEPENDENT
                      Just noticed this. Typo?

                      Comment


                      • #12
                        Originally posted by Goodluck View Post
                        Just noticed this. Typo?

                        Darn maybe it didn't work off line.

                        Comment


                        • #13
                          This works for me

                          IF/LIN1.J<.9
                          GOTO/REVERSE
                          END_IF/
                          A3 =ALIGNMENT/START,RECALL:A2, LIST= YES
                          ALIGNMENT/ROTATE,YPLUS,TO,LIN1,ABOUT,ZPLUS
                          ALIGNMENT/END
                          GOTO/NORMAL
                          REVERSE =LABEL/
                          A4 =ALIGNMENT/START,RECALL:A3, LIST= YES
                          ALIGNMENT/ROTATE,YMINUS,TO,LIN1,ABOUT,ZPLUS
                          ALIGNMENT/END
                          NORMAL =LABEL/

                          TK
                          sigpicHave a homebrew

                          Comment


                          • #14
                            Originally posted by tking View Post
                            This works for me

                            IF/LIN1.J<.9
                            GOTO/REVERSE
                            END_IF/
                            A3 =ALIGNMENT/START,RECALL:A2, LIST= YES
                            ALIGNMENT/ROTATE,YPLUS,TO,LIN1,ABOUT,ZPLUS
                            ALIGNMENT/END
                            GOTO/NORMAL
                            REVERSE =LABEL/
                            A4 =ALIGNMENT/START,RECALL:A3, LIST= YES
                            ALIGNMENT/ROTATE,YMINUS,TO,LIN1,ABOUT,ZPLUS
                            ALIGNMENT/END
                            NORMAL =LABEL/

                            TK
                            Did you try this both ways? I would think it would always run from NORMAL =LABEL/ using A4. or did I miss something?

                            Comment


                            • #15
                              Originally posted by Tested View Post
                              Did you try this both ways? I would think it would always run from NORMAL =LABEL/ using A4. or did I miss something?
                              Sure, If the line is reversed the program flows thru the reverse alignment and proceeds as "normal", else it proceeds as "normal".

                              TK
                              sigpicHave a homebrew

                              Comment

                              Related Topics

                              Collapse

                              Working...
                              X