Programming techniques

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

  • A-machine-insp
    replied
    An update on the code example I posted above. I cut out the part where I can run the complete part without tooling tabs attached since we will surely never have a first part run the whole program at one time. We will always get it with tooling tabs then see the same part again with them removed.

    Deleting that part of the program cleans the CAD points up since we have to submit reports to the customer with the CAD included. If I didn't delete that part, I would have points out in space and the actual CAD model would be smaller on the report due to DMIS fitting everything into the window.

    Leave a comment:


  • A-machine-insp
    replied
    flow control example for tooling tabs
    Code:
    format/text,options, ,headings,symbols, ;nom,tol,meas,maxmin,dev,outtol,
                loadprobe/1point5mm80
                tip/t1a0b0, shankijk=0, 0, 1, angle=0
    c1         =comment/yesno,no,full screen=no,auto-continue=no,   (question asks if the part is complete with out tabs or not)
                is this a complete part with tooling tabs removed?   
                If/c1.input=="yes"  (if comment c1 is answered "no" this comment will be skipped and tab areas will not be ran)
    c2           =comment/yesno,no,full screen=no,auto-continue=no,  (questions operator if they want to run the whole part with the tab areas or run the tab areas only)
                  do you want to run the tooling tab areas only?      
    
                  "yes" will run the tooling tab areas only.
    
                  "no" will run the entire program.
    
                  If_goto/c2.input=="yes",goto = l2  (if running tabareas only, this will send you to the beginning of the second manual alignment)
                end_if/
    
    
    (body of program)
    
    
    dim loc2= location of cylinder cyl1  units=in ,$        (last dimension in body of program before tooling tab areas)
    graph=off  text=off  mult=10.00  output=both  half angle=no
    ax    nominal       +tol       -tol       meas        max        min        dev     outtol
    x       0.5011     0.0050     0.0050     0.5011     0.9656     0.0366     0.0000     0.0000 ----#----
    y      12.5500     0.0050     0.0050    12.5500    12.9523    12.1477     0.0000     0.0000 ----#----
    d       0.9290     0.0050     0.0050     0.9290     0.9290     0.9290     0.0000     0.0000 ----#----
    end of dimension loc2
                if_goto/c1.input=="no",goto = end     (if tooling tabs are present, goto the end of the program before tab area dimensions)
                move/clearplane
    pnt1171    =feat/contact/vector point/default,cartesian   (first point on tooling tab areas when rinning the entire part w/tooling tabs removed)
                theo/<6.1288,46.31,-0.0711>,<0,1,0>
                actl/<6.1288,46.31,-0.0711>,<0,1,0>
                targ/<6.1288,46.31,-0.0711>,<0,1,0>
                snap=no
                show feature parameters=no
                show contact parameters=no
    
    
    pnt1345    =feat/contact/vector point/default,cartesian    (last point on tooling tab areas when rinning the entire part w/tooling tabs removed)
                theo/<-1.2252,0.3366,-0.0449>,<0.4216606,-0.0284342,0.9063078>
                actl/<-1.2252,0.3366,-0.0449>,<0.4216606,-0.0284342,0.9063078>
                targ/<-1.2252,0.3366,-0.0449>,<0.4216606,-0.0284342,0.9063078>
                snap=no
                show feature parameters=no
                show contact parameters=no
                move/clearplane
                tip/t1a0b0, shankijk=0.0011, -0.001, 1, angle=-0.3476
                move/increment,<0,0,9>
                if_goto/c2.input=="no",goto = end    (if running entire part, not tooling tab areas by themselves, this comment sends you to the dimensioning)
    l2         =label/   (if running tab areas only, answering "yes" to question c2 will send you here)
                recall/alignment,internal,startup   (recall startup alignment for running tooling tabs only)
                mode/manual    (manual mode for taking manual alignment)
    pnt1-a     =feat/contact/vector point/default,cartesian   (first point on second manual alignment when running only tooling tab areas)
                theo/<-8.5119,5.8974,0>,<0,0,1>
                actl/<-8.5119,5.8974,0>,<0,0,1>
                targ/<-8.5119,5.8974,0>,<0,0,1>
                show feature parameters=no
                show contact parameters=yes
                  avoidance move=no,distance=0.25
                show hits=no
    
    
    man_aln_2  =alignment/start,recall:startup,list=yes   (second manual alignment)
                  alignment/iterate
                    pnt target rad=0.005,start label=,fixture tol=0,error label=
                    meas all feat=once,level axis=zaxis,rotate axis=xaxis,origin axis=yaxis
                  level=pnt1-a,pnt2-a,pnt3-a,,
                  rotate=pnt4-a,pnt5-a,,
                  origin=pnt6-a,,
                alignment/end
                mode/dcc    (mode dcc for remainder of part)
                clearp/zplus,3,zplus,0,off
                move/clearplane
    pnt-a3-a   =feat/contact/vector point/default,cartesian   (first dcc alignment point)
                theo/<2.1556,6.45,0>,<0,0,1>
                actl/<2.1556,6.45,0>,<0,0,1>
                targ/<2.1556,6.45,0>,<0,0,1>
                snap=no
                show feature parameters=no
                show contact parameters=yes
                  avoidance move=no,distance=0.25
                show hits=no
    
    
    dcc_aln_2  =alignment/start,recall:man_aln_2,list=yes (second dcc alignment)
                  alignment/iterate
                    pnt target rad=0.005,start label=,fixture tol=0,error label=
                    meas all feat=always,max iterations=99,level axis=zaxis,rotate axis=xaxis,origin axis=yaxis
                  level=pnt-a3-a,pnt-a2-a,pnt-a1-a,,
                  rotate=pnt-b1-a,pnt-b-a,,
                  origin=pnt-ref-c-a,,
                alignment/end
                equate/dcc_aln_2, to alignment, dcc_aln   (equate alignment. Doing this will allow you to run the part with tooling tabs then running the tooling tab areas later and have one report with all points and features where they need to be on the report cad)
    
    
    
    
                move/clearplane
    pnt1346    =feat/contact/vector point/default,cartesian    (first point on tab areas if only running tab areas with the equate alignment)
                theo/<6.1288,46.31,-0.0711>,<0,1,0>
                actl/<6.1288,46.31,-0.0711>,<0,1,0>
                targ/<6.1288,46.31,-0.0711>,<0,1,0>
                snap=no
                show feature parameters=no
                show contact parameters=no
    
    
    pnt1393    =feat/contact/vector point/default,cartesian    (last point on tab areas if only running tab areas with the equate alignment)
                theo/<-1.2252,0.3366,-0.0449>,<0.4216606,-0.0284342,0.9063078>
                actl/<-1.2252,0.3366,-0.0449>,<0.4216606,-0.0284342,0.9063078>
                targ/<-1.2252,0.3366,-0.0449>,<0.4216606,-0.0284342,0.9063078>
                snap=no
                show feature parameters=no
                show contact parameters=no
                move/clearplane
                tip/t1a0b0, shankijk=0.0011, -0.001, 1, angle=-0.3476
    end        =label/    (end of program label. If running entire part, the goto comment before the second manual alignment will send you here)
                move/increment,<0,0,9>
    scn73      =feat/set,cartesian    (scan set of tab area points when running the entire part)
                theo/<-2.4715,19.2468,-0.0978>,<0,0,1>
                actl/<-2.4715,19.2468,-0.0978>,<0,0,1>
                constr/set,basic,pnt1171,pnt1172,pnt1173,pnt1174,pnt1175,pnt1176,pnt1177,pnt1244,pnt1245,pnt1246,pnt1247,pnt1248,pnt1249,
                           pnt1285,pnt1286,pnt1287,pnt1288,pnt1289,pnt1290,pnt1291,pnt1292,pnt1333,pnt1334,pnt1335,pnt1336,pnt1337,pnt1338
    scn77      =feat/set,cartesian     (scan set of tab area points when running only the tab areas)
                theo/<-2.4715,19.2468,-0.0978>,<0,0,1>
                actl/<-2.4715,19.2468,-0.0978>,<0,0,1>
                constr/set,basic,pnt1346,pnt1347,pnt1348,pnt1349,pnt1350,pnt1351,pnt1352,pnt1353,pnt1354,pnt1355,pnt1356,pnt1357,pnt1358,
                           pnt1373,pnt1374,pnt1375,pnt1376,pnt1377,pnt1378,pnt1379,pnt1380,pnt1381,pnt1382,pnt1383,pnt1384,pnt1385,pnt1386
    
    (the if/end_if comments set the output of the dimensioning of the tab areas. These will change based upon how you state your comment/questions at the begining of the program)
    
    
                if/c2.input=="yes"         (if c2 is answered "yes" then dimension below with "output=optoggle2" will be set to "report")
                  assign/optoggle2="report"
                end_if/
                if/c2.input=="no"          (if c2 is answered "no" then dimension below with "output=optoggle2" will be set to "none")
                  assign/optoggle2="none"
                end_if/
                if/c2.input=="no"          (if c2 is answered "no" then dimension below with "output=optoggle" will be set to "report")
                  assign/optoggle="report"
                end_if/
                if/c2.input=="yes"         (if c2 is answered "yes" then dimension below with "output=optoggle" will be set to "none")
                  assign/optoggle="none"
                end_if/
                if/c1.input=="no"          (if c1 is answered "no" then dimension below with "output=optoggle" will be set to "none")
                  assign/optoggle="none"
                end_if/
                if/c1.input=="no"          (if c1 is answered "no" then dimension below with "output=optoggle2" will be set to "none")
                  assign/optoggle2="none"
                end_if/
    dim 141a= profile of surface of set scn73    formandlocation  units=in ,$   (profile of tab areas scan set when running the entire part)
    graph=off  text=off  mult=10.00  arrowdensity=100  output=optoggle
    ax    nominal       +tol       -tol       meas        max        min        dev     outtol
    m       0.0000     0.0300     0.0300     0.0000     0.0000     0.0000     0.0000     0.0000 ----|----
    dim 141b= profile of surface of set scn77    formandlocation  units=in ,$   (profile of tab areas scan set when running the tab areas only)
    graph=off  text=off  mult=10.00  arrowdensity=100  output=optoggle2
    ax    nominal       +tol       -tol       meas        max        min        dev     outtol
    m       0.0000     0.0300     0.0300     0.0000     0.0000     0.0000     0.0000     0.0000 ----|----
    Last edited by A-machine-insp; 02-14-2019, 08:54 AM.

    Leave a comment:


  • A-machine-insp
    replied
    So we are running into the same thing here except with tooling tabs. We have separate programs for side 1, 2 and tooling tab areas. I combined side 1 and tooling tab areas and used YES/NO comments with the IF_END to navigate the program. We run side 1, analyze, then save the program under that job number and date. When the part comes back in, we use the YES/NO comments to just run the tooling tab areas. I align the part then equate that alignment to the original side 1 alignment so we get one report for side 1 without tooling tabs. I could do it without equating but we have to have the CAD in the report and don't want one set of points out in space.

    My next step is to incorporate both sides and the tooling tab areas in one program, and thus, one report instead of instead of sending 3 reports to the customer.

    Code is in the next post with my personal notes in ().

    I can run this program in three different ways. Side one with tooling tabs attached, side one tooling tab areas only, and side one complete without tooling tabs attached. Program would mostly be run the first two ways, I just threw the complete part without tooling tabs option in because I could.

    Leave a comment:


  • William Johnson
    replied
    Marked sets is what I would use. They work well and are easy to set up. No coding needed.

    I like marked sets for when you have to do a 100% sort for a dimension that is out of tolerance. You can create it to measure only what is needed to get the results you want. This also saves valuable CMM time VS running the full program for 1 or 2 dimensions.
    Last edited by William Johnson; 02-14-2019, 07:47 AM.

    Leave a comment:


  • Ravenmaniac
    replied
    Thanks Everyone! I will experiment around with the If statements. Also to examine the proper sequencing and structure of using them. I have noted that keeping the alignment sequences pristine is critical when surfing around the program using cases. I always try to "leave a case subroutine the same way you found it when you entered." Helps keep the program from locking up. Again, thanks everyone!

    Leave a comment:


  • AndersI
    replied
    kingsld1 mentioned both things I was thinking of, but note that if you have used the SELECT CASE construct

    Code:
    SELECT/OP_NO
      CASE/1
       …
      END_CASE
      CASE/2
       …
      END_CASE
      CASE/3
       …
      END_CASE
    END_SELECT

    there is no [simple, recommendable] way to execute all cases in sequence. You need the following IF structure to be able to do that

    Code:
    IF/(OP_NO == 1) or (ALL_OPS == TRUE)
      …
    ENDIF
    IF/(OP_NO == 2) or (ALL_OPS == TRUE)
      …
    ENDIF
    IF/(OP_NO == 3) or (ALL_OPS == TRUE)
      …
    ENDIF

    But mainly you should look into mini routines, and possibly the FBM (Feature Based Measurement) option.

    Leave a comment:


  • kingsld1
    replied
    No experience with this, but mini routines might be worth investigating as well.

    Leave a comment:


  • Ego Murphy
    replied
    Originally posted by Ravenmaniac View Post
    I guess I'm asking for something that says, "hey, the part's complete, just ignore the following case commands and go to town." Thanks....just trying to get more efficient.
    In these cases, there's always a point/gray area where a program made sufficiently complicated enough to handle both partial and complete parts becomes more problematic to write AND more difficult to maintain than it's worth, and it would actually make more sense to keep separate programs for each stage of manufacturing.

    bfire85 makes an excellent point: you can get into serious trouble skipping or nor skipping alignments in a flexible program. This flexibale-program technique really only makes sense if the master alignment is common across all stages of manufacture.

    Also kingsld1 suggestion of using OR is spot-on, that should work elegantly for making sure each modular section gets run for a final inspection.



    Leave a comment:


  • kingsld1
    commented on 's reply
    Form documentation, especially code is hard to come by. There is a tutorial in the help files. Tutorial - Creating forms

  • A-machine-insp
    commented on 's reply
    Is there an explanation somewhere of how to use these radio buttons? Cant find anything in the DMIS help section and not having much luck searching here.

  • kingsld1
    replied
    An OR command in your case checks should work.

    Pseudo Code

    If "Meas_OP_1" OR "Meas_all_ops" execute measurement code block.

    Leave a comment:


  • Sora5
    replied
    Good call on the alignments. If you're skipping around the program, it's a good practice to recall or make a new alignment. You'll also want to redefine your parameters. Especially your probe and probe angle, prehit/retract, touchspeed, etc. PCDMIS likes to roll with whatever parameters was last in the code even if you skipped over that portion.

    Leave a comment:


  • bfire85
    replied
    I tend to utilize Forms for flow control. Depending on their selection, I use IF/THEN statements with GOTO labels. Be careful if you do that. You want to make sure your alignments are correct. There are some flow controls I use that skip over some alignment features, so I need to recall previous alignments in order for the CMM to not crash.

    Leave a comment:


  • BKulpa
    replied
    I like to use a for with several radio buttons for each operation.
    For one particular part there are 12 stations in the machine and we need to check them at all the various stages.
    The 1st button is the complete part it's value equal 12.
    Using combinations of:
    IF/GOTO
    IF/END_IF


    IF radio button==12 (nothing happens and entire program runs)

    IF radio button<=11/ goto label

    etc, etc.

    Leave a comment:


  • Sora5
    replied
    A couple of simple If/goto statements. Add an input comment at the beginning of the program where the operator type in 5 for full inspection. Add a label at the beginning of each of your case, ie. Case1, Case2, etc. Then at the end of your case 1, add in a IF c1.input == "5", goto case2. At the end of your case2, add If c1.input == "5" goto case 3. And so on.

    Leave a comment:

Related Topics

Collapse

Working...
X