[Ri...] Posted April 10 Share Posted April 10 I am trying to set a tolerance based on a Gage Class, X or XX and a range of size to a variable "cl_tol". //Class and Size Tolerances //Class X Ø.010-Ø.825 if id_size>0.08999 and id_size <0.8251 and gage_class="X" cl_tol=0.00004 endif //Class XX Ø.010-Ø.825 if id_size>0.08999 and id_size <0.8251 and gage_class="XX" cl_tol=0.00002 endif My parameters from a para file. PN = "TR-00250-024" type_ring=RING GAGE part_name=GAGE, RING, .2500 id_size=0.25 gage_class=X plane_speed=0.295 id_speed=.09055 id_depth=0.50 MP=TR-00250-024 What I appear to be getting is the last tolerance from both If statements. I am unsure if "and" can be used in PCM, but it appears to accept it. (I may be mixing VB with PCM?). Any help is appreciated. Link to comment Share on other sites More sharing options...
[Ch...] Posted April 10 Share Posted April 10 Richard, I don't believe 'and' works with if/then/else, I would like to see this in a future update as well. You should be able to accomplish your need with "nested" or multiple 'if' statements. Best regards, Chris Link to comment Share on other sites More sharing options...
[DW...] Posted April 10 Share Posted April 10 (edited) Please sign in to view this quote. Please sign in to view this username. I do not have PCM, but does this work? // Class and Size Tolerances // Class X Ø0.010-Ø0.825 if (id_size > 0.08999) and (id_size < 0.8251) and (gage_class = "X") then cl_tol = 0.00004 endif // Class XX Ø0.010-Ø0.825 if (id_size > 0.08999) and (id_size < 0.8251) and (gage_class = "XX") then cl_tol = 0.00002 endif Been quite some time, but I believe I have used 'and' in this context before. Edited April 10 Link to comment Share on other sites More sharing options...
[Ri...] Posted April 10 Author Share Posted April 10 (edited) Thanks for the assist, the output is two errors. 1. parameter XX is not defined. 2. Not a boolean value. Edit: I have added quotes around the class variable in Excel, X and XX, to be "X" and "XX". (Did not help). Edited April 10 Added quotes around X and XX Link to comment Share on other sites More sharing options...
[Ri...] Posted April 10 Share Posted April 10 I'd first start by removing the "then" from the if statement. Then I'd look at each test to see what boolean value you get (true or false). Then you can select them all together and see what the test results are. Link to comment Share on other sites More sharing options...
[He...] Posted April 10 Share Posted April 10 Please sign in to view this quote. When doing boolean check you need double equal signs. gage_class == "XX" gage_class = XX will not work. gage_class = "XX" will work. No sure about the parameterXX not defined. Probably somewhere in the code that has not been shown here. normall when this happens is when you dont have the text (XX) within quotation marks Link to comment Share on other sites More sharing options...
[Ch...] Posted April 10 Share Posted April 10 Looks like 'and; may be an option - Nice ! It doesn't mention it in the standard PCM commands. I thought I tried it a while back. Anyway good luck ! Link to comment Share on other sites More sharing options...
[Ri...] Posted April 10 Author Share Posted April 10 (edited) Seemed to have got it to work with all the help. My program now is dependent on the Class of X or XX and a range to set a tolerance. if (id_size > 0.08999) and (id_size < 0.82501) and (gage_class == "X") cl_tol = 0.00004 endif if (id_size > 0.08999) and (id_size < 0.82501) and (gage_class == "XX") cl_tol = 0.00002 endif I also changed the para variable from X and XX to "X" and "XX" (added quotes). Please sign in to view this quote. Edited April 10 Link to comment Share on other sites More sharing options...
[DW...] Posted April 10 Share Posted April 10 Please sign in to view this quote. Good stuff! 👍 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in