hexagon logo

How to add variable hole size

We have part numbers that have several dash numbers after them that basically are the same part but the hole size varies depending on the dash number.  I was wondering how I could write the program where the operator could just input the hole diameter at the beginning of the program (or select from a dropdown menu list of hole sizes) and have the program run.  Obviously this input would be need to be fed into a variable.  I'm just not sure how the syntax is.  Any ideas?

Parents
  • If your program name contains a dash code relating to the hole diameter then there is no need to have the operator enter it.  You can get the program name as a variable using ASSIGN/V1=GETPROGRAMINFO("PARTNAME").  You can then manipulate that variable to extract the relevant dash number.  For example, if the dash number is always the last 2 digits of the program name, then ASSIGN/V2=RIGHT(V1,2) would put those 2 digits into variable V2.  Once you have the dash code, you can add IF/END_IF or SELECT/CASE logic to your routine to set the diameter based on the dash code or, if the dash code IS the hole diameter, you can use the V2 variable directly.

  • The dash code doesn't relate directly to the hole diameter.  You still have to look at the drawing and that particular dash number will refer to a chart and there might be more than one hole that will vary in size depending on the dash number.  In that case, I would need operator input.  And I'm still not sure how to incorporate that into the hole size(s) in the program.

  • There is many different ways you can control this. You can use operator input to determine what to use easily. You can also put the relevant chart data into arrays based on the dash number if theres multiple features that can change. Can you give an example of a Dash Number and how many holes it controls? 

    Something like this where based on the dash number, and number of holes the chart controls, the diameters of the holes change

    INPUT      =LABEL/
    C1         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                Enter Dash Number
                IF/C1.INPUT=="520"
                  ASSIGN/V1=ARRAY(.281,.375,1)
                  GOTO/HOLES
                END_IF/
                IF/C1.INPUT=="525"
                  ASSIGN/V1=ARRAY(.5, .325, .520)
                  GOTO/HOLES
                END_IF/
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,OVC=NO,
                INVALID ENTRY
                GOTO/INPUT
    HOLES      =LABEL/
    CR1        =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
                THEO/<-0.938,0,0>,<0,0,1>,V1[1]
                ACTL/<-0.938,0,0>,<0,0,1>,0.281
                TARG/<-0.938,0,0>,<0,0,1>
                START ANG=0,END ANG=360
                ANGLE VEC=<1,0,0>
                DIRECTION=CCW
                SHOW FEATURE PARAMETERS=NO
                SHOW CONTACT PARAMETERS=NO
    CR2        =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
                THEO/<1,-1,0>,<0,0,1>,V1[2]
                ACTL/<1,-1,0>,<0,0,1>,0.375
                TARG/<1,-1,0>,<0,0,1>
                START ANG=0,END ANG=360
                ANGLE VEC=<1,0,0>
                DIRECTION=CCW
                SHOW FEATURE PARAMETERS=NO
                SHOW CONTACT PARAMETERS=NO
    CR3        =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
                THEO/<-2.558,-1.5,0>,<0,0,1>,V1[3]
                ACTL/<-2.558,-1.5,0>,<0,0,1>,1
                TARG/<-2.558,-1.5,0>,<0,0,1>
                START ANG=0,END ANG=360
                ANGLE VEC=<1,0,0>
                DIRECTION=CCW
                SHOW FEATURE PARAMETERS=NO
                SHOW CONTACT PARAMETERS=NO

    I also have it so if the input isn't any you've set it for, it throws an "error" and loops back to the input

  • You would need to map your dash codes and part numbers to a series of variables representing the hole sizes.  Once you have the variables set, you just replace the D value in any features / dimensions with the applicable variable(s).  If you're using auto-features, make sure void detection is turned off because that can cause PC-DMIS to ignore the variable.

  • This would be the easiest approach (from a programming perspective) but would require the operator to key in each diameter...

    C1         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                Enter the diameter
                ASSIGN/V1=C1.INPUT
    CIR1       =FEAT/CONTACT/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
                THEO/<0,0,0>,<1,0,0>,V1
                ACTL/<0,0,0>,<1,0,0>,6
                TARG/<0,0,0>,<1,0,0>
                START ANG=0,END ANG=360
                ANGLE VEC=<0,0,-1>
                DIRECTION=CCW
                SHOW FEATURE PARAMETERS=YES
                  VOID DETECTION=NO
                  REMEASURE=NO
                  SURFACE=THICKNESS_NONE,0
                  MEASURE MODE=NOMINALS
                  RMEAS=NONE,NONE,NONE
                  AUTO WRIST=NO
                  GRAPHICAL ANALYSIS=NO
                  FEATURE LOCATOR=NO,NO,""
                SHOW CONTACT PARAMETERS=YES
                  NUMHITS=4,DEPTH=2,PITCH=0
                  SAMPLE METHOD=SAMPLE_HITS
                  SAMPLE HITS=0,SPACER=0.5
                  AVOIDANCE MOVE=BOTH,DISTANCE BEFORE=10,DISTANCE AFTER=10,DIRECTION=ALONG FEATURE VECTOR
                  FIND HOLE=DISABLED,ONERROR=NO,READ POS=NO
                SHOW HITS=NO

  • I use input comments and IF/GOTO for a 'variable' program

    type out the acceptable value and a description of what that variable is for:

    LAB1       =LABEL/
    CL1        =COMMENT/INPUT,NO,'1=Validator
                                ,2=Global'
                                ,3=Global slow for testing
                IF_GOTO/CL1.INPUT<1,GOTO = LAB1
                IF_GOTO/CL1.INPUT>3,GOTO = LAB1
                IF_GOTO/CL1.INPUT>2,GOTO = GLO2
                IF_GOTO/CL1.INPUT>1,GOTO = GLO
                IF_GOTO/CL1.INPUT<2,GOTO = VAL
                GOTO/CL1

    if operators doesn't enter a valid number, it loops back and asks again

    it goes to different 'section' using the GOTO command and sets variables:

    VAL        =LABEL/
                ASSIGN/MS = 150
                ASSIGN/TS = 2.5
                GOTO/LAB2
    GLO        =LABEL/
                ASSIGN/MS = 500
                ASSIGN/TS = 6
                GOTO/LAB2
    GLO2       =LABEL/
                ASSIGN/MS = 150
                ASSIGN/TS = 6
                GOTO/LAB2

    and it then goes to the section that uses those variables:

    LAB2       =LABEL/
                MOVESPEED/ MS
                TOUCHSPEED/ TS
                ASSIGN/ACL = MS*2

    you would need as many inputs as different parts and an assignment section for each part, like this:

    part1 = label/

    assign/h01d=10

    assign/h02d=11

    and so on, one for EACH hole that could have a different diameter, and you MUST include ALL holes in each section that could have a different diamater so that the proper D is assigned each time.

Reply
  • I use input comments and IF/GOTO for a 'variable' program

    type out the acceptable value and a description of what that variable is for:

    LAB1       =LABEL/
    CL1        =COMMENT/INPUT,NO,'1=Validator
                                ,2=Global'
                                ,3=Global slow for testing
                IF_GOTO/CL1.INPUT<1,GOTO = LAB1
                IF_GOTO/CL1.INPUT>3,GOTO = LAB1
                IF_GOTO/CL1.INPUT>2,GOTO = GLO2
                IF_GOTO/CL1.INPUT>1,GOTO = GLO
                IF_GOTO/CL1.INPUT<2,GOTO = VAL
                GOTO/CL1

    if operators doesn't enter a valid number, it loops back and asks again

    it goes to different 'section' using the GOTO command and sets variables:

    VAL        =LABEL/
                ASSIGN/MS = 150
                ASSIGN/TS = 2.5
                GOTO/LAB2
    GLO        =LABEL/
                ASSIGN/MS = 500
                ASSIGN/TS = 6
                GOTO/LAB2
    GLO2       =LABEL/
                ASSIGN/MS = 150
                ASSIGN/TS = 6
                GOTO/LAB2

    and it then goes to the section that uses those variables:

    LAB2       =LABEL/
                MOVESPEED/ MS
                TOUCHSPEED/ TS
                ASSIGN/ACL = MS*2

    you would need as many inputs as different parts and an assignment section for each part, like this:

    part1 = label/

    assign/h01d=10

    assign/h02d=11

    and so on, one for EACH hole that could have a different diameter, and you MUST include ALL holes in each section that could have a different diamater so that the proper D is assigned each time.

Children
No Data