Select / End Select Case / End Case Issue

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

  • Select / End Select Case / End Case Issue

    I'm having a problem getting PC-DMIS to resolve Boolean equations within the Case / End Case. Here's a code snippet:

    ASSIGN/V1=LOC25_159_223.D.DEV
    ASSIGN/V5=0
    SELECT/V1
    CASE/V1 < 0
    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    too big
    END_CASE/
    CASE/V1 > 0.4
    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    too small
    END_CASE/
    END_SELECT/
    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    V5

    I can get this to work in MMax 6.5 under Visual Basic. But it doesn't work like that here in PCDMIS. Logically it should work but it steps right through it like it doesn't exist regardless of the value of V1. I did a work around for this several years ago but I don't want to have to root through hundreds of programs to find it. Any suggestions?

  • #2
    Yeah it doesn't work that way.

    Each case should be a fixed value of the variable

    CASE/0.4

    CASE/3


    You might as well just use an if statement.

    Automettech - Automated Metrology Technology

    Comment


    • #3
      What gets me is that when V1 is, say, negative and I place the cursor on V1<0 it pops up a window showing V1<0 = 1. The boolean value is correct and the condition is true just as it would be with a fixed value. But PCDMIS somehow ignores it. Using IF statements will be a real PITA. I wonder if enclosing it in parenthesis will trigger it. I'll find out...

      Comment


      • #4
        That didn't work either. Looks like I'll have to use IF and ELSE IF to work around this.

        Comment


        • #5
          N8VES
          The way that this program flow technique works is the argument for SELECT (V1) is checked for equality between any one of your CASE arguments. The problem here is that you are using inequalities as your CASE arguments. An inequality will either evaluate to TRUE (1) or FALSE (0). Your SELECT argument will more than likely be a real number and will never equal TRUE (1) or FALSE (0), and thus every CASE is skipped.

          The only way you could get it to work, for testing purposes, would be to make V1 equal to 0. In that case, V1 < 0 would evaluate to FALSE (0) because the inequality is exclusive. Now V1 (0) would be equal to the evaluation of your CASE argument (0) and the control should flow to the "too big" comment.
          Last edited by JacobCheverie; 03-03-2021, 07:22 AM.

          Comment


          • #6
            This might help and also this if the masters of this domain won't let me insert the link give me a shout and I'll pass it on to you through a PM
            Last edited by dwade; 03-03-2021, 07:49 AM.
            Xcel & MicroVal Pfx & Global 37mr4 thru 2012mr1sp3
            Contura Calypso 5.4

            Lord, keep Your arm around my shoulder and Your hand over my mouth. Amen.

            Comment


          • #7
            The problem here is that you are using inequalities as your CASE arguments. An inequality will either evaluate to TRUE (1) or FALSE (0).
            If the CASE were just a single real number, it still evaluates it as TRUE (it equals that) or FALSE (it does not). It should not matter if the CASE is a Boolean expression or a real number. I did get it to work with IF/END IF and ELSE IF/END ELSE IF.

            Yeah, Dwade, I've been there before. Can't remember my password and I can't get the site to email me a link to reset it. I can see why it was banned. A few of the posters are quite rude, especially to newbies. They have to be nice here.

            Comment


            • JacobCheverie
              JacobCheverie commented
              Editing a comment
              I think that with the way you have it set up using inequalities, you are asking if "V1" = "V1 < 0" which can't be true.

              In other words, the CASE control is for discrete options rather than ranges of values.

            • dwade
              dwade commented
              Editing a comment
              You should not need a password to view the links. There is a lot of info that can be seen without logging in.

          • #8
            the CASE control is for discrete options rather than ranges of values
            Would seem to be true here in PCDMIS. VB handles this differently by stating CASE IS, meaning V1 IS < 0 or V1 IS 0.41. The word IS is not needed when stating a discreet number, object or string. It's implied but it does add it before the boolean operand (<,> or <>). Too bad PCDMIS doesn't treat CASE/ the same way. I could port it out into a VB script and then back into PCDMIS. I use VB a lot in MeasureMax because., well, I have to. I don't use scripting in PCDMIS because nearly all of the functions and commands I need are built in.

            Dwade,
            You need the password, or at least I do. Can't reset my password cuz it won't email me the link.

            Comment

            Related Topics

            Collapse

            • shoey
              If/end if statements
              by shoey
              Does anyone know how to get pcdmis to read one or/and multiple inputs in an if/end if statement?



              C2 =comment/input,no,'which...
              02-16-2012, 04:11 PM
            • djayne
              Assigning Variables
              by djayne
              I've searched through some of the archives and still can't get this down right. I'm asking the operator to enter the fixture letter of the part that...
              07-27-2006, 02:04 PM
            • DAN_M
              Input statement help
              by DAN_M
              I wrote a program that controles various avriables with an input statement. I am trying to control the acceptable responses to this input statement. How...
              10-03-2017, 09:58 AM
            • cjtronetti
              Expression help, please.
              by cjtronetti
              Below are the expressions I use to assign a Y value to Variable 4.
              V1 returns false, V2 and V3 both return true.
              The way I understand it,...
              01-31-2014, 07:19 PM
            • joseq7
              Assignment "letters"
              by joseq7
              I am trying to get the system to select 1 of 10 different points which I have called C_1, C_2...........C_10.

              It won't be the same point...
              10-14-2014, 08:55 AM
            Working...
            X