hexagon logo

Auto finding with variables

1 OF 2:

A couple weeks ago i ventured on a journey to have PC-DMIS auto find a feature on a part with many different configurations. Upon find the feature (or in this case missing a hit, thus knowing a cutout is there) it will measure the top side of the cutout then the bottom side of the cutout. If the cutout length varies in length, it will loop until it finds the bottom side of the cutout. After that it will measure the left then right side of the cutout directly in the middle of the cutout. I hope this sparks some ideas for you guys. Also, feel free to critique my programming as i am still learning and will always be learning.

Code is posted bellow -
Parents
  • 2 OF 2

    Here is the program:

    startup    =alignment/start,recall:use_part_setup,list=yes
                alignment/end
                fly/on,0.1
                mode/dcc
                prehit/0.03
                retract/0.25
                format/text,options, ,headings,symbols, ;nom,tol,meas,dev,outtol, , 
                loadprobe/jenkins
                tip/t1a0b0, shankijk=0, 0, 1, angle=0
                scanspeed/10
                move/point,normal,<2.8746,5.7093,-14.7501>
    plane_to_level=feat/plane,cartesian,triangle
                theo/<3.4028,4.4663,-15.3948>,<0.0032216,0.0003598,0.9999947>
                actl/<3.4028,4.4664,-15.3954>,<0.0035087,0.0005833,0.9999937>
                meas/plane,4
                hit/basic,normal,<2.8903,5.7692,-15.3939>,<0.0032216,0.0003598,0.9999947>,use theo=yes
                move/point,normal,<3.7959,5.7712,-15.1439>
                hit/basic,normal,<3.7959,5.7712,-15.3962>,<0.0032216,0.0003598,0.9999947>,use theo=yes
                hit/basic,normal,<3.9173,3.1567,-15.3963>,<0.0032216,0.0003598,0.9999947>,use theo=yes
                move/point,normal,<3.0077,3.1684,-15.1439>
                hit/basic,normal,<3.0077,3.1684,-15.3927>,<0.0032216,0.0003598,0.9999947>,use theo=yes
                endmeas/
    a1         =alignment/start,recall:,list=yes
                alignment/rotate,zplus,to,plane_to_level,about,xplus
                alignment/level,zplus,plane_to_level
                alignment/trans,zaxis,plane_to_level
                alignment/end
                retract/0.03
                clearp/zplus,0.25,zplus,0,on
    line_to_align=feat/line,cartesian,unbounded
                theo/<2.7276,3.4081,0.0317>,<-0.0027607,0.9999962,0>
                actl/<2.731,3.4082,0.0317>,<-0.0021819,0.9999976,0>
                meas/line,3,zplus
                move/clearplane
                hit/basic,normal,<2.7272,3.4081,0.0315>,<0.9999962,0.0027607,0>,use theo=yes
                hit/basic,normal,<2.7257,4.3711,0.0317>,<0.9999962,0.0027607,0>,use theo=yes
                hit/basic,normal,<2.722,5.3196,0.032>,<0.9999962,0.0027607,0>,use theo=yes
                endmeas/
    a2         =alignment/start,recall:a1,list=yes
                alignment/rotate,yplus,to,line_to_align,about,zplus
                alignment/trans,xaxis,line_to_align
                alignment/end
                prehit/0.02
                retract/0.02
    pin_rear   =feat/circle,cartesian,out,least_sqr
                theo/<0.0993,5.7476,0.0323>,<0,0,1>,0.0708,0
                actl/<0.0996,5.7541,0.0323>,<0,0,1>,0.0708,0
                meas/circle,4,zplus
                hit/basic,normal,<0.0767,5.7204,0.0322>,<-0.6399918,-0.7683817,0>,use theo=yes
                move/circular
                hit/basic,normal,<0.0795,5.7769,0.0322>,<-0.5593179,0.8289532,0>,use theo=yes
                move/circular
                hit/basic,normal,<0.1215,5.7752,0.0324>,<0.6257389,0.7800326,0>,use theo=yes
                move/circular
                hit/basic,normal,<0.1231,5.7214,0.0324>,<0.6727338,-0.7398846,0>,use theo=yes
                endmeas/
    pin_front  =feat/circle,cartesian,out,least_sqr
                theo/<1.1262,3.1741,0.0307>,<0,0,1>,0.0707,0
                actl/<1.1269,3.1804,0.0308>,<0,0,1>,0.0707,0
                meas/circle,4,zplus
                hit/basic,normal,<1.1007,3.1986,0.0309>,<-0.7208867,0.6930529,0>,use theo=yes
                move/circular
                hit/basic,normal,<1.151,3.1992,0.0312>,<0.7015372,0.7126328,0>,<1.1543,3.2026,0.0311>,use theo=yes
                move/circular
                hit/basic,normal,<1.1486,3.1467,0.0311>,<0.6330678,-0.7740964,0>,<1.146,3.1507,0.031>,use theo=yes
                move/circular
                hit/basic,normal,<1.1036,3.1469,0.0294>,<-0.6397113,-0.7686153,0>,<1.1053,3.1524,0.0303>,use theo=yes
                endmeas/
    center_from_pins=feat/point,cartesian,no
                theo/<0.6128,4.4608,0.0315>,<-0.0032226,-0.0003509,0.9999947>
                actl/<0.6133,4.4672,0.0316>,<-0.0035167,-0.0006371,0.9999936>
                constr/point,mid,pin_rear,pin_front
    a3         =alignment/start,recall:a2,list=yes
                alignment/trans,yaxis,center_from_pins
                alignment/trans,xaxis,center_from_pins
                alignment/trans_offset,xaxis,0.0745
                alignment/end
                assign/v1=1.2
                assign/v2=.84
                onerror/probe_miss,goto cutout_miss
    co_1       =feat/point,cartesian
                theo/<0,1.02,-0.09>,<0,0,1>
                actl/<0,1.02,-0.1233>,<0,0,1>
                meas/point,1,workplane
                move/clearplane
                hit/basic,normal,<0,1.02,-0.09>,<0,0,1>,<0,1.02,-0.1233>,use theo=yes
                endmeas/
                onerror/probe_miss,goto cutout_miss
    co_2       =feat/point,cartesian
                theo/<0,0.68,-0.09>,<0,0,1>
                actl/<-0.0006,0.6802,-0.1216>,<0,0,1>
                meas/point,1,workplane
                assign/v1=v1-.34
                assign/v2=v2-.34
                hit/basic,normal,<0,0.68,-0.09>,<0,0,1>,<-0.0006,0.6802,-0.1216>,use theo=yes
                endmeas/
                onerror/probe_miss,goto cutout_miss
    co_3       =feat/point,cartesian
                theo/<0,0.34,-0.09>,<0,0,1>
                actl/<0.0002,0.3401,-0.1206>,<0,0,1>
                meas/point,1,workplane
                assign/v1=v1-.34
                assign/v2=v2-.34
                hit/basic,normal,<0,0.34,-0.09>,<0,0,1>,<0.0002,0.3401,-0.1206>,use theo=yes
                endmeas/
                onerror/probe_miss,goto cutout_miss
    co_4       =feat/point,cartesian
                theo/<0,0,-0.09>,<0,0,1>
                actl/<0.0029,-0.0026,-0.0865>,<-0.0002516,-0.000065,1>
                meas/point,1,workplane
                assign/v1=v1-.34
                assign/v2=v2-.34
                hit/basic,normal,<0,0,-0.09>,<0,0,1>,<-0.0002,0.0017,-0.0899>,use theo=yes
                endmeas/
                onerror/probe_miss,goto cutout_miss
    co_5       =feat/point,cartesian
                theo/<0,-0.34,-0.09>,<0,0,1>
                actl/<0.0022,-0.3426,-0.0874>,<-0.0002516,-0.000065,1>
                meas/point,1,workplane
                assign/v1=v1-.34
                assign/v2=v2-.34
                hit/basic,normal,<0,-0.34,-0.09>,<0,0,1>,<-0.0003,-0.3383,-0.0902>,use theo=yes
                endmeas/
                onerror/probe_miss,goto cutout_miss
    co_6       =feat/point,cartesian
                theo/<0,-0.68,-0.09>,<0,0,1>
                actl/<0.0024,-0.6826,-0.1203>,<-0.0002516,-0.000065,1>
                meas/point,1,workplane
                assign/v1=v1-.34
                assign/v2=v2-.34
                hit/basic,normal,<0,-0.68,-0.09>,<0,0,1>,<-0.0004,-0.6783,-0.0905>,use theo=yes
                endmeas/
                onerror/probe_miss,goto cutout_miss
    co_7       =feat/point,cartesian
                theo/<0,-1.02,-0.09>,<0,0,1>
                actl/<-0.0016,-0.9881,-0.1237>,<-0.0002943,-0.0002845,0.9999999>
                meas/point,1,workplane
                assign/v1=v1-.34
                assign/v2=v2-.34
                hit/basic,normal,<0,-1.02,-0.09>,<0,0,1>,<-0.0005,-1.0183,-0.0909>,use theo=yes
                endmeas/
                goto/end
    cutout_miss=label/
    cutout_top =feat/point,cartesian
                theo/<0.0209,v1,-0.1555>,<0,-1,0>
                actl/<0,0.1843,-0.1555>,<0,-1,0>
                meas/point,1,workplane
                hit/basic,normal,<0,v1,-0.1555>,<0,-1,0>,<0,0.1843,-0.1555>,use theo=yes
                endmeas/
    cutout_bottom_start=label/
                onerror/probe_miss,goto cutout_bottom_miss
    cutout_bottom=feat/point,cartesian
                theo/<0,v2,-0.1561>,<0,1,0>
                actl/<-0.0007,-0.1759,-0.156>,<0,1,0>
                meas/point,1,workplane
                hit/basic,normal,<0,v2,-0.1561>,<0,1,0>,<-0.0007,-0.1759,-0.156>,use theo=yes
                endmeas/
    cutout_center_y=feat/point,cartesian,no
                theo/<0.0105,0,-0.1558>,<-0.0032226,-0.0003509,0.9999947>
                actl/<-0.0004,0.0042,-0.1558>,<-0.0036329,-0.000405,0.9999933>
                constr/point,mid,cutout_top,cutout_bottom
    cutout_left=feat/point,cartesian
                theo/<-0.4625,1.0233,-0.1572>,<1,0,0>
                actl/<-0.4619,0.0038,-0.1576>,<1,0,0>
                meas/point,1,workplane
                hit/basic,normal,<-0.4625,cutout_center_y.y,-0.1572>,<1,0,0>,<-0.4619,0.0038,-0.1576>,use theo=yes
                endmeas/
    cutout_right=feat/point,cartesian
                theo/<0.4625,1.0233,-0.1543>,<-1,0,0>
                actl/<0.4635,0.0042,-0.1543>,<-1,0,0>
                meas/point,1,workplane
                hit/basic,normal,<0.4625,cutout_center_y.y,-0.1543>,<-1,0,0>,<0.4635,0.0042,-0.1543>,use theo=yes
                endmeas/
    cutout_center_x=feat/point,cartesian,no
                theo/<0,1.0233,-0.1557>,<-0.0032226,-0.0003509,0.9999947>
                actl/<0.0008,0.004,-0.1559>,<-0.0036329,-0.000405,0.9999933>
                constr/point,mid,cutout_left,cutout_right
                goto/end
    cutout_bottom_miss=label/
                assign/v2=v2-.34
                goto/cutout_bottom_start
    end        =label/
                move/increment,<0,0,1>
                move/point,normal,<-1.6092,2.5160,1.2624>
                assign/v3=v1-v2
Reply
  • 2 OF 2

    Here is the program:

    startup    =alignment/start,recall:use_part_setup,list=yes
                alignment/end
                fly/on,0.1
                mode/dcc
                prehit/0.03
                retract/0.25
                format/text,options, ,headings,symbols, ;nom,tol,meas,dev,outtol, , 
                loadprobe/jenkins
                tip/t1a0b0, shankijk=0, 0, 1, angle=0
                scanspeed/10
                move/point,normal,<2.8746,5.7093,-14.7501>
    plane_to_level=feat/plane,cartesian,triangle
                theo/<3.4028,4.4663,-15.3948>,<0.0032216,0.0003598,0.9999947>
                actl/<3.4028,4.4664,-15.3954>,<0.0035087,0.0005833,0.9999937>
                meas/plane,4
                hit/basic,normal,<2.8903,5.7692,-15.3939>,<0.0032216,0.0003598,0.9999947>,use theo=yes
                move/point,normal,<3.7959,5.7712,-15.1439>
                hit/basic,normal,<3.7959,5.7712,-15.3962>,<0.0032216,0.0003598,0.9999947>,use theo=yes
                hit/basic,normal,<3.9173,3.1567,-15.3963>,<0.0032216,0.0003598,0.9999947>,use theo=yes
                move/point,normal,<3.0077,3.1684,-15.1439>
                hit/basic,normal,<3.0077,3.1684,-15.3927>,<0.0032216,0.0003598,0.9999947>,use theo=yes
                endmeas/
    a1         =alignment/start,recall:,list=yes
                alignment/rotate,zplus,to,plane_to_level,about,xplus
                alignment/level,zplus,plane_to_level
                alignment/trans,zaxis,plane_to_level
                alignment/end
                retract/0.03
                clearp/zplus,0.25,zplus,0,on
    line_to_align=feat/line,cartesian,unbounded
                theo/<2.7276,3.4081,0.0317>,<-0.0027607,0.9999962,0>
                actl/<2.731,3.4082,0.0317>,<-0.0021819,0.9999976,0>
                meas/line,3,zplus
                move/clearplane
                hit/basic,normal,<2.7272,3.4081,0.0315>,<0.9999962,0.0027607,0>,use theo=yes
                hit/basic,normal,<2.7257,4.3711,0.0317>,<0.9999962,0.0027607,0>,use theo=yes
                hit/basic,normal,<2.722,5.3196,0.032>,<0.9999962,0.0027607,0>,use theo=yes
                endmeas/
    a2         =alignment/start,recall:a1,list=yes
                alignment/rotate,yplus,to,line_to_align,about,zplus
                alignment/trans,xaxis,line_to_align
                alignment/end
                prehit/0.02
                retract/0.02
    pin_rear   =feat/circle,cartesian,out,least_sqr
                theo/<0.0993,5.7476,0.0323>,<0,0,1>,0.0708,0
                actl/<0.0996,5.7541,0.0323>,<0,0,1>,0.0708,0
                meas/circle,4,zplus
                hit/basic,normal,<0.0767,5.7204,0.0322>,<-0.6399918,-0.7683817,0>,use theo=yes
                move/circular
                hit/basic,normal,<0.0795,5.7769,0.0322>,<-0.5593179,0.8289532,0>,use theo=yes
                move/circular
                hit/basic,normal,<0.1215,5.7752,0.0324>,<0.6257389,0.7800326,0>,use theo=yes
                move/circular
                hit/basic,normal,<0.1231,5.7214,0.0324>,<0.6727338,-0.7398846,0>,use theo=yes
                endmeas/
    pin_front  =feat/circle,cartesian,out,least_sqr
                theo/<1.1262,3.1741,0.0307>,<0,0,1>,0.0707,0
                actl/<1.1269,3.1804,0.0308>,<0,0,1>,0.0707,0
                meas/circle,4,zplus
                hit/basic,normal,<1.1007,3.1986,0.0309>,<-0.7208867,0.6930529,0>,use theo=yes
                move/circular
                hit/basic,normal,<1.151,3.1992,0.0312>,<0.7015372,0.7126328,0>,<1.1543,3.2026,0.0311>,use theo=yes
                move/circular
                hit/basic,normal,<1.1486,3.1467,0.0311>,<0.6330678,-0.7740964,0>,<1.146,3.1507,0.031>,use theo=yes
                move/circular
                hit/basic,normal,<1.1036,3.1469,0.0294>,<-0.6397113,-0.7686153,0>,<1.1053,3.1524,0.0303>,use theo=yes
                endmeas/
    center_from_pins=feat/point,cartesian,no
                theo/<0.6128,4.4608,0.0315>,<-0.0032226,-0.0003509,0.9999947>
                actl/<0.6133,4.4672,0.0316>,<-0.0035167,-0.0006371,0.9999936>
                constr/point,mid,pin_rear,pin_front
    a3         =alignment/start,recall:a2,list=yes
                alignment/trans,yaxis,center_from_pins
                alignment/trans,xaxis,center_from_pins
                alignment/trans_offset,xaxis,0.0745
                alignment/end
                assign/v1=1.2
                assign/v2=.84
                onerror/probe_miss,goto cutout_miss
    co_1       =feat/point,cartesian
                theo/<0,1.02,-0.09>,<0,0,1>
                actl/<0,1.02,-0.1233>,<0,0,1>
                meas/point,1,workplane
                move/clearplane
                hit/basic,normal,<0,1.02,-0.09>,<0,0,1>,<0,1.02,-0.1233>,use theo=yes
                endmeas/
                onerror/probe_miss,goto cutout_miss
    co_2       =feat/point,cartesian
                theo/<0,0.68,-0.09>,<0,0,1>
                actl/<-0.0006,0.6802,-0.1216>,<0,0,1>
                meas/point,1,workplane
                assign/v1=v1-.34
                assign/v2=v2-.34
                hit/basic,normal,<0,0.68,-0.09>,<0,0,1>,<-0.0006,0.6802,-0.1216>,use theo=yes
                endmeas/
                onerror/probe_miss,goto cutout_miss
    co_3       =feat/point,cartesian
                theo/<0,0.34,-0.09>,<0,0,1>
                actl/<0.0002,0.3401,-0.1206>,<0,0,1>
                meas/point,1,workplane
                assign/v1=v1-.34
                assign/v2=v2-.34
                hit/basic,normal,<0,0.34,-0.09>,<0,0,1>,<0.0002,0.3401,-0.1206>,use theo=yes
                endmeas/
                onerror/probe_miss,goto cutout_miss
    co_4       =feat/point,cartesian
                theo/<0,0,-0.09>,<0,0,1>
                actl/<0.0029,-0.0026,-0.0865>,<-0.0002516,-0.000065,1>
                meas/point,1,workplane
                assign/v1=v1-.34
                assign/v2=v2-.34
                hit/basic,normal,<0,0,-0.09>,<0,0,1>,<-0.0002,0.0017,-0.0899>,use theo=yes
                endmeas/
                onerror/probe_miss,goto cutout_miss
    co_5       =feat/point,cartesian
                theo/<0,-0.34,-0.09>,<0,0,1>
                actl/<0.0022,-0.3426,-0.0874>,<-0.0002516,-0.000065,1>
                meas/point,1,workplane
                assign/v1=v1-.34
                assign/v2=v2-.34
                hit/basic,normal,<0,-0.34,-0.09>,<0,0,1>,<-0.0003,-0.3383,-0.0902>,use theo=yes
                endmeas/
                onerror/probe_miss,goto cutout_miss
    co_6       =feat/point,cartesian
                theo/<0,-0.68,-0.09>,<0,0,1>
                actl/<0.0024,-0.6826,-0.1203>,<-0.0002516,-0.000065,1>
                meas/point,1,workplane
                assign/v1=v1-.34
                assign/v2=v2-.34
                hit/basic,normal,<0,-0.68,-0.09>,<0,0,1>,<-0.0004,-0.6783,-0.0905>,use theo=yes
                endmeas/
                onerror/probe_miss,goto cutout_miss
    co_7       =feat/point,cartesian
                theo/<0,-1.02,-0.09>,<0,0,1>
                actl/<-0.0016,-0.9881,-0.1237>,<-0.0002943,-0.0002845,0.9999999>
                meas/point,1,workplane
                assign/v1=v1-.34
                assign/v2=v2-.34
                hit/basic,normal,<0,-1.02,-0.09>,<0,0,1>,<-0.0005,-1.0183,-0.0909>,use theo=yes
                endmeas/
                goto/end
    cutout_miss=label/
    cutout_top =feat/point,cartesian
                theo/<0.0209,v1,-0.1555>,<0,-1,0>
                actl/<0,0.1843,-0.1555>,<0,-1,0>
                meas/point,1,workplane
                hit/basic,normal,<0,v1,-0.1555>,<0,-1,0>,<0,0.1843,-0.1555>,use theo=yes
                endmeas/
    cutout_bottom_start=label/
                onerror/probe_miss,goto cutout_bottom_miss
    cutout_bottom=feat/point,cartesian
                theo/<0,v2,-0.1561>,<0,1,0>
                actl/<-0.0007,-0.1759,-0.156>,<0,1,0>
                meas/point,1,workplane
                hit/basic,normal,<0,v2,-0.1561>,<0,1,0>,<-0.0007,-0.1759,-0.156>,use theo=yes
                endmeas/
    cutout_center_y=feat/point,cartesian,no
                theo/<0.0105,0,-0.1558>,<-0.0032226,-0.0003509,0.9999947>
                actl/<-0.0004,0.0042,-0.1558>,<-0.0036329,-0.000405,0.9999933>
                constr/point,mid,cutout_top,cutout_bottom
    cutout_left=feat/point,cartesian
                theo/<-0.4625,1.0233,-0.1572>,<1,0,0>
                actl/<-0.4619,0.0038,-0.1576>,<1,0,0>
                meas/point,1,workplane
                hit/basic,normal,<-0.4625,cutout_center_y.y,-0.1572>,<1,0,0>,<-0.4619,0.0038,-0.1576>,use theo=yes
                endmeas/
    cutout_right=feat/point,cartesian
                theo/<0.4625,1.0233,-0.1543>,<-1,0,0>
                actl/<0.4635,0.0042,-0.1543>,<-1,0,0>
                meas/point,1,workplane
                hit/basic,normal,<0.4625,cutout_center_y.y,-0.1543>,<-1,0,0>,<0.4635,0.0042,-0.1543>,use theo=yes
                endmeas/
    cutout_center_x=feat/point,cartesian,no
                theo/<0,1.0233,-0.1557>,<-0.0032226,-0.0003509,0.9999947>
                actl/<0.0008,0.004,-0.1559>,<-0.0036329,-0.000405,0.9999933>
                constr/point,mid,cutout_left,cutout_right
                goto/end
    cutout_bottom_miss=label/
                assign/v2=v2-.34
                goto/cutout_bottom_start
    end        =label/
                move/increment,<0,0,1>
                move/point,normal,<-1.6092,2.5160,1.2624>
                assign/v3=v1-v2
Children
No Data