hexagon logo

Autoname and save file as .pdf

Longtime reader, first-time poster. Thanks to all for the help this forum has provided to me thus far.

I am new to PCDMIS, but an experienced programmer with GeoMeasure (MTI). GeoMeasure is a DMIS language, but vastly different from PCDMIS. I have programmed (10 years) and even taught programming at a local community college (2 yrs). I was away from CMM's for a couple years until I moved to MA from MI last year and took this job, where I first encountered the Demon.

So now that you all have a little background info on me, here is the problem that searching the forum archives has failed to find a solution to.

I had a fixture fabricated that holds up to 16 parts in a 4X4 configuration. I took an existing program that measures a couple hundred points for flatness and created a nested loop to get my vertical and horizontal offsets. I can execute the program without a problem and everything runs fine except for one minor issue: the report needs to print out with a custom report name for each part before the loop completes.

I found a few threads that address using variables to assign the printpath to and then insert the variable into the print command. What I end up with when running is a prompt to save the file (I am not using the print setup from the "file>printing>edit print window setup" dialog box; all of those options are left unchecked). I think the problem may be network related because when I change the file location to the local C: drive, it works flawlessly.

I have attached the program for reference and I appreciate any and all comments that may be helpful.

Also, I am working a 12:30pm to midnight shift and 7:00am-noon on Saturdays, so outside of those hours I may be a bit unresponsive.
  • Just post the relevant code. Most dont have time to download, unzip and then load your program, not to mention not having all the settings, tips, etc... that you might have used. Use the [code]program code [/code] bbcode to wrap around your program.


    Network drive letters sometimes dont work with the standard path description. You may have to use the UNC for defining the path instead of the mapped drive letter, ie, \\ComputerName\SharedFolder\Resource

    post your code.
  • PART NAME  : 378A47 Rev D Flatness
    REV NUMBER : 1
    SER NUMBER : 
    STATS COUNT : 1
     
    STARTUP    =ALIGNMENT/START,RECALL:, LIST= YES
                ALIGNMENT/END
                MODE/MANUAL
                CHECK/ 0.3,1
                TOUCHSPEED/ 2
                MOVESPEED/ 100
                MANRETRACT/1
                LOADPROBE/2BY20WITH10MM
                TIP/T1A0B0, SHANKIJK=0, 0, 1, ANGLE=0
                FLY/ON,0.118
                FORMAT/TEXT,OPTIONS, , ,SYMBOLS, ;MEAS,NOM,TOL,DEV,OUTTOL, , 
    VER_COMMENT =COMMENT/INPUT,NO,'How many parts are in the tallest vertical column?'
                ASSIGN/VER_QTY = VER_COMMENT.INPUT
    HORIZ_COMMENT =COMMENT/INPUT,NO,'How many parts are in the longest horizontal row?'
                ASSIGN/HORIZ_QTY = HORIZ_COMMENT.INPUT 
    SO_COMMENT =COMMENT/INPUT,NO,'Enter the shop order number'
                ASSIGN/SO = SO_COMMENT.INPUT
    SN_COMMENT =COMMENT/INPUT,NO,'Enter all of the nameplate serial numbers'
                ASSIGN/SN = SN_COMMENT.INPUT
    CASE_SN_COMMENT =COMMENT/INPUT,NO,'Enter all of the case serial numbers'
                ASSIGN/CASE_SN = CASE_SN_COMMENT.INPUT
                ASSIGN/V1 = 1
                MODE/DCC
                RECALL/ALIGNMENT,EXTERNAL,BV_ARRAY,
    HORIZONTAL =LOOP/START, ID = YES, NUMBER = HORIZ_QTY, START = 1, SKIP = ,
                   OFFSET: XAXIS = -6.5, YAXIS = 0, ZAXIS = 0, ANGLE = 0
    VERTICAL   =LOOP/START, ID = YES, NUMBER = VER_QTY, START = 1, SKIP = ,
                   OFFSET: XAXIS = 0, YAXIS = 6, ZAXIS = 0, ANGLE = 0
                COMMENT/REPT,"This report is for downstream assy flatness for plate position #" + V1
                COMMENT/REPT,
                COMMENT/REPT,"This report is for shop order " + SO
                COMMENT/REPT,
                COMMENT/REPT,Downstream assy case serial numbers in this sample:
                COMMENT/REPT,CASE_SN
                COMMENT/REPT,
                COMMENT/REPT,Nameplate serial numbers in this sample:
                COMMENT/REPT,SN
                COMMENT/REPT,
                CLEARP/ZPLUS,0.25,ZPLUS,0
                ONERROR/PROBE_MISS,GOTO MISSED_PROBE_HIT
    PLN2       =FEAT/PLANE,RECT,TRIANGLE
                THEO/-4.003,8.017,0,-0.0000572,-0.000059,1
                ACTL/-4.003,8.017,0,-0.0000572,-0.000059,1
                MEAS/PLANE,4
                MOVE/CLEARPLANE
                HIT/BASIC,NORMAL,-6.622,6.167,0,-0.0000572,-0.000059,1,-6.622,6.167,0,USE THEO = YES
                HIT/BASIC,NORMAL,-1.372,6.164,0,-0.0000572,-0.000059,1,-1.372,6.164,0,USE THEO = YES
                HIT/BASIC,NORMAL,-1.369,9.867,0,-0.0000572,-0.000059,1,-1.369,9.867,0,USE THEO = YES
                HIT/BASIC,NORMAL,-6.651,9.87,0,-0.0000572,-0.000059,1,-6.651,9.87,0,USE THEO = YES
                ENDMEAS/
                MOVE/CLEARPLANE
    CIR4       =AUTO/CIRCLE,SHOWALLPARAMS = NO,SHOWHITS = YES
                THEO/-6.5,6,0,0,0,1,0.19
                ACTL/-6.5,6,0,0,0,1,0.19
                TARG/-6.5,6,0,0,0,1
                MEAS/CIRCLE
                HIT/BASIC,-6.405,6,-0.1,-1,0,0,-6.405,6,-0.1
                HIT/BASIC,-6.5,6.095,-0.1,0,-1,0,-6.5,6.095,-0.1
                HIT/BASIC,-6.595,6,-0.1,1,0,0,-6.595,6,-0.1
                HIT/BASIC,-6.5,5.905,-0.1,0,1,0,-6.5,5.905,-0.1
                ENDMEAS/
                MOVE/CLEARPLANE
    CIR5       =AUTO/CIRCLE,SHOWALLPARAMS = NO,SHOWHITS = YES
                THEO/-1.365,6,0,0,0,1,0.19
                ACTL/-1.365,6,0,0,0,1,0.19
                TARG/-1.365,6,0,0,0,1
                MEAS/CIRCLE
                HIT/BASIC,-1.27,6,-0.1,-1,0,0,-1.27,6,-0.1
                HIT/BASIC,-1.365,6.095,-0.1,0,-1,0,-1.365,6.095,-0.1
                HIT/BASIC,-1.46,6,-0.1,1,0,0,-1.46,6,-0.1
                HIT/BASIC,-1.365,5.905,-0.1,0,1,0,-1.365,5.905,-0.1
                ENDMEAS/
                MOVE/CLEARPLANE
    CIR6       =AUTO/CIRCLE,SHOWALLPARAMS = NO,SHOWHITS = YES
                THEO/-6.5,10.03,0,0,0,1,0.19
                ACTL/-6.5,10.03,0,0,0,1,0.19
                TARG/-6.5,10.03,0,0,0,1
                MEAS/CIRCLE
                HIT/BASIC,-6.405,10.03,-0.1,-1,0,0,-6.405,10.03,-0.1
                HIT/BASIC,-6.5,10.125,-0.1,0,-1,0,-6.5,10.125,-0.1
                HIT/BASIC,-6.595,10.03,-0.1,1,0,0,-6.595,10.03,-0.1
                HIT/BASIC,-6.5,9.935,-0.1,0,1,0,-6.5,9.935,-0.1
                ENDMEAS/
    LIN3       =FEAT/LINE,RECT,UNBND
                THEO/-6.5,6,0,1,0,0
                ACTL/-6.5,6,0,1,0,0
                CONSTR/LINE,BF,2D,CIR4,CIR5,,
                OUTLIER_REMOVAL/OFF,3
                FILTER/OFF,WAVELENGTH=0
    LIN4       =FEAT/LINE,RECT,UNBND
                THEO/-6.5,6,0,0,1,0
                ACTL/-6.5,6,0,0,1,0
                CONSTR/LINE,BF,2D,CIR4,CIR6,,
                OUTLIER_REMOVAL/OFF,3
                FILTER/OFF,WAVELENGTH=0
    ARRAY_POSITION_1=ALIGNMENT/START,RECALL:, LIST= YES
                ALIGNMENT/LEVEL,ZPLUS,PLN2
                ALIGNMENT/ROTATE,XPLUS,TO,LIN3,ABOUT,ZPLUS
                ALIGNMENT/TRANS,YAXIS,LIN3
                ALIGNMENT/TRANS,XAXIS,LIN4
                ALIGNMENT/TRANS,ZAXIS,PLN2
                ALIGNMENT/END
                FLY/ON,0.118
     
    <<PART PROGRAM HERE........................................
     
    DISPLAYPRECISION/4
    DIM FLAT1= FLATNESS OF PLANE PLN3  UNITS=IN ,$
    GRAPH=OFF  TEXT=ON  MULT=10.00  OUTPUT=BOTH
    M      0.0000     0.0000     0.0020     0.0000     0.0000     0.0000 #--------
                [COLOR=blue]ASSIGN/PRINTPATH = "\\Lyt-srv-2\qual\New Insprpt\CMM - BROWN AND SHARPE\CMM Data\BLEED VALVE DATA\378A47 Flatness" + "\378A47 REV D FLATNESS " + SO + "-" + V1 + ".PDF"[/COLOR]
                PRINT/REPORT,EXEC MODE=END,$
                  TO_FILE=ON,APPEND=PRINTPATH,$
                  TO_PRINTER=OFF,DRAFTMODE=OFF,$
                  TO_DMIS_REPORT=OFF,FILE_OPTION=OVERWRITE,FILENAME=,$
                  REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
                  PREVIOUS_RUNS=DELETE_INSTANCES
                ASSIGN/V1 = V1 + 1
                LOOP/END
                LOOP/END
    MISSED_PROBE_HIT=LABEL/
                MOVE/INCREMENT,0,0,15
    
  • Can you edit the path, the forum seems to think it is a website and fubar'd it for you. I cant tell what it added versus what you originally posted.
  • Here is the line where I assign the filename and directory to the variable "PRINTPATH"

    ASSIGN/PRINTPATH = "\\Lyt-srv-2\qual\New Insprpt\CMM - BROWN AND SHARPE\CMM Data\BLEED VALVE DATA\378A47 Flatness" + "\378A47 REV D FLATNESS " + SO + "-" + V1 + ".PDF"

    What I am going for is a report for part #1 that is named "378A47 REV D FLATNESS 123456-1.pdf" and saved in the "378A47 Flatness" folder on the network. The next loop would save a report called "378A47 REV D FLATNESS 123456-2.pdf" and so on...
  • What I see should work... so we start with dumb questions and then go from there.

    Is the UNC path valid?
    Have you tried this with a mapped drive letter instead of the UNC?
    Can you assign this entire string to a variable first then use the variable to test the path.

    PCDMIS uses the double-whack to "help" it and maybe the double whack in the UNC is giving it grief.
  • Is the UNC path valid?

    Yes, I copied the path from the program and pasted it into Windows Explorer address bar--it went right to the folder.

    Have you tried this with a mapped drive letter instead of the UNC?

    I mapped the folder as a drive and used the drive letter instead of the file path in PCDMIS and it didn't like that at all. What I got was a file saved in the program directory folder and named 0. Just "0" no file extension. I assume this means the path wasn't valid to PCDMIS.

    Can you assign this entire string to a variable first then use the variable to test the path.

    Good idea. I just tried this and it does the same thing as the original code; The .pdf is generated and PCDMIS open a save dialog box with the correct filename and in the correct directory, it just wants me to hit the save button. My head hurts...I'm going home for the night and I'll look at it with fresh eyes in the morning. Thanks for the help so far.
  • Like J said, use the doublewhacks in the path and add an extra \ in the beginning:

    ASSIGN/PRINTPATH = 
    "\\\Lyt-srv-2\qual\New Insprpt\CMM - BROWN AND SHARPE\CMM Data\BLEED VALVE DATA\378A47 Flatness" + "\378A47 REV D FLATNESS " + SO + "-" + V1 + ".PDF"


    If it still would prompt you to hit save, then try to put the concatenation directly in the 'APPEND=' part instead of putting the finished path in a variable and then passing the variable as printpath to the print command.

    I did not try the concatenated path -> variable -> printcommand, but I did try the "\\\server\folder\folder\filename.pdf " directly in the printcommand, so it works (at least in 2009MR1).

    Note: If you leave the doublewhacks (") out, it will prompt you to hit SAVE.
  • This has work for me since 3.7 MR2....

    C1 =COMMENT/INPUT,NO,'Operator Clock Number'
    C2 =COMMENT/INPUT,NO,'Shift'
    ASSIGN/PART=STR(GETTEXT(191,1,{FILEHEDR}))
    ASSIGN/REVI=STR(GETTEXT(192,1,{FILEHEDR}))
    ASSIGN/SERI=STR(GETTEXT(193,1,{FILEHEDR}))
    ASSIGN/STATCNT=STR(GETTEXT(194,1,{FILEHEDR}))
    ASSIGN/DATE=SYSTEMDATE ("MMddyyyy")
    ASSIGN/TIME=SYSTEMTIME ("HHmmss")
    ASSIGN/FILESTORELOCATION="J:\PUBLIC\CMM REPORTS\HEX DEMO BLOCK\_"
    ASSIGN/FILENAME=PART + "_" + DATE + "_" + TIME + ".RTF"
    COMMENT/REPT,"OPERATOR CLOCK NUMBER: " + C1.INPUT
    COMMENT/REPT,"SHIFT: " + C2.INPUT
    ASSIGN/VAL_FILE=FILESTORELOCATION + FILENAME
    COMMENT/REPT,"REPORT FILE LOCATION: " + VAL_FILE
    $$-- Part Program --
    $$-- End of Part Program
    C3 =COMMENT/YESNO,NO,Do you wish to print report?
    IF/C3.INPUT == "YES"
    PRINT/REPORT,EXEC MODE=END,$
    TO_FILE=ON,OVERWRITE=VAL_FILE,$
    TO_PRINTER=ON,$
    TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
    PREVIOUS_RUNS=DELETE_INSTANCES
    END_IF/
    IF/C3.INPUT == "NO"
    PRINT/REPORT,EXEC MODE=END,$
    TO_FILE=ON,OVERWRITE=VAL_FILE,$
    TO_PRINTER=OFF,$
    TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
    PREVIOUS_RUNS=DELETE_INSTANCES
    END_IF/
  • You nailed it vpt.se! The extra \ at the beginning of the filepath is the missing link (pun intended).

    I figured there was some kind of quirk related to the network address that was causing the problem, I just am not familiar enough with this software to know what it was.

    Thanks again to cmmguy, vpt.se, and cmccullough.