How to: Stipulate within a Part Program which template to use

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

  • How to: Stipulate within a Part Program which template to use

    Hello,

    Firstly: I would like to stipulate within my part program such every time it runs, it always uses C:\MyTemplate.RTP to automatically generate a report.


    I thought I had found the approrpiate command. But not only is an additional report simply appended to the default.rtp report in Report View, but the command syntax itself does not seem to follow what the help file says:
    Code:
    [COLOR=DarkRed][B]The REPORT Command Syntax:[/B][/COLOR] (quoting pcdmis help file)
    
    [B]<ID>  =REPORT/<TOG1>, FILENAME= <PATHWAY>, AUTOPRINT=<TOG2>, Section=<NUM1>
    
                     PARAM/=
    
                    ENDREPORT/[/B]
    .
    Instead when I insert this command I get the below. I have tried to manually add the AUTOPRINT parameter and fix 'Section=-1REPORTMODE=INSERT' but with no luck:
    CS1 =REPORT/TEMPLATE, FILENAME= C:\MyTemplate.RTP, Section=-1REPORTMODE=INSERT
    PARAM/=
    ENDREPORT/
    Secondly: I then want a PDF of this generated report (using C:\MyTemplate.RTP) to be created and saved with a specified name. Is this even possible to do within a part program, or do I need to make calls from an external program? Or better yet, write a subroutine?

    And if you've got this far down the page - thanks already. Any advice or pointers would be great appreciated, thank-you michelle.
    Last edited by michelle; 11-24-2009, 01:31 PM. Reason: forgot a word

  • #2
    1: You can assign a report template to your part program, without using any code. Just open the report window and choose your template to be used - then save the program. You may have to add your template to the 'report template library' before you can choose it. Check the helpfile or see Jared Hess' videos for methods of doing this (available @ the WAI site).

    2: Add a print command to your program and set it up to use the PDF printer (of your choice) to print (save) a report to the folder specified by you. Again, see the help file or search the forum for instructions of how to do this. I know there can be some problems with getting that print command to work.
    PC-DMIS CAD++ 2o22.2 SP1

    Comment


    • #3
      I think Michelle's main question is: is there a way to, within the code, change which template is used? (Without having to pick it.)

      I would be interested to see if this is possible as well. This would be very useful to both keep my programmers from switching the reports around, and to easily manage several report templates for different customers.

      Comment


      • #4
        look in your 'settings editor'
        in there (open 'find')type in 'DefaultReportTemplate' & enter, you'll see whats set to default there.
        change it to what report you wish to put in & hey presto your done.
        don't forget to 'save setting' then 'update registry' before you close.
        sigpicRichie the Villian!!

        V4.2 MR1 CAD++/MISTRAL 10-07-07 DCC/XP

        Comment


        • #5
          Originally posted by RCW52 View Post
          look in your 'settings editor'
          in there (open 'find')type in 'DefaultReportTemplate' & enter, you'll see whats set to default there.
          change it to what report you wish to put in & hey presto your done.
          don't forget to 'save setting' then 'update registry' before you close.
          be sure to close the Demon first before opening Settings Editor!
          sigpic
          Originally posted by Ironhoe
          I got something under my sporran for you, take care of it and you got my vote.

          Comment


          • #6
            i'm pretty sure you can't open both at the same time
            sigpicRichie the Villian!!

            V4.2 MR1 CAD++/MISTRAL 10-07-07 DCC/XP

            Comment


            • #7
              Originally posted by RCW52 View Post
              i'm pretty sure you can't open both at the same time
              isn't that kinda like saying "cut the red wire, no, cut the blue wire" when defusing a bomb, Richie?

              same result when you cut the wrong one............. just sayin


              at training they always stressed getting out of the demon before opening the settings editor - might have something to do with stepping on the demons tail...........
              sigpic
              Originally posted by Ironhoe
              I got something under my sporran for you, take care of it and you got my vote.

              Comment


              • #8
                Originally posted by Lab_ratt View Post
                isn't that kinda like saying "cut the red wire, no, cut the blue wire" when defusing a bomb, Richie?

                same result when you cut the wrong one............. just sayin


                at training they always stressed getting out of the demon before opening the settings editor - might have something to do with stepping on the demons tail...........
                No
                if you try & open setting editor while running the demon.....it says you can't.
                sigpicRichie the Villian!!

                V4.2 MR1 CAD++/MISTRAL 10-07-07 DCC/XP

                Comment


                • #9
                  Originally posted by RCW52 View Post
                  look in your 'settings editor'
                  in there (open 'find')type in 'DefaultReportTemplate' & enter, you'll see whats set to default there.
                  change it to what report you wish to put in & hey presto your done.
                  don't forget to 'save setting' then 'update registry' before you close.

                  This still only sets the default for one template. Can template switching be done within the code, hands-off? That is the question.

                  Comment


                  • #10
                    i read it differently? she says :
                    Firstly: I would like to stipulate within my part program such every time it runs, it always uses C:\MyTemplate.RTP to automatically generate a report.

                    isn't that the same as putting her own template in the default setting,then it will run every time?
                    sigpicRichie the Villian!!

                    V4.2 MR1 CAD++/MISTRAL 10-07-07 DCC/XP

                    Comment


                    • #11
                      I am still not so sure, though I see your point. I was reading the title:

                      How to: Stipulate within a Part Program which template to use
                      and then looking at how she was trying to call it in the code she posted. It appears she wants to set, through code, a certain template for a certain part program. I, myself, am still very much interested in how to call different templates through code. I will tinker around with that command and see what I can get it to do. That would be a versatile function.

                      Michelle, some clarification?

                      Comment


                      • #12
                        Thank-you for the replies. I think let me give some context and what I need to do should become more clear. I'll do my best to be concise:

                        We make gear cutters (amongst other parts). My operator, Henry, is 70. The *only* computer task he must need to do is key in the cutter's name - which is always engraved on the cutter itself. That is:
                        Step1: Henry puts cutter on the CMM ~ For example, lets inspect cutter 'GC22' (cutters always have their names already engraved on themselves)
                        Step2: Henry enters in cutter name ~ 'GC22'
                        Step3: Henry waits whilst CMM inspects
                        Step4: Henry locates the generated inspection report on desktop ~ GC22.pdf
                        Step5: Henry prints GC22.pdf and ships it together with the cutter

                        To accomplish this 'process' I have written two programs:
                        Program1: "DMIS-Code-Generator" written in C. This program spits out GC22.DMI (ie the DMIS code appropriate to inspect the cutter at hand)
                        Program2: "One-Click-Inspector" written in ruby. This program is the front end where Henry enters in 'GC22'. One-Click-Inspector will then find GC22.DMI, load it into PC-DMIS (convert it) and kick off the inspection.

                        WHAT I DON'T WANT
                        Because I want to keep things easy for Henry I don't want him to have to select MyTemplate or even know about it. And because other people use this CMM too I would prefer not to set MyTemplate as the default.


                        WHAT I NEED
                        Is to find a way within the PC-DMIS edit window to (1) specify MyTemplate as the template to use for (2) the automatic generation of GC22.pdf onto the desktop once cmm inspection completes

                        Anyone got any ideas?



                        Sorry to be long winded but I hope I have managed to come across more clearly now - but please feel free to let me know if I haven't. Thanks again (and in advance),
                        Michelle

                        PS For anyone wondering (I'm surprised you read down this far =) ) once I have a way to do (1) and (2) within the PC-DMIS edit window, I will then export the PC-DMIS edit window as DMIS and use this syntax to guide me in appropriately modifying "DMIS-Code-Generator". Once that is done, then all cutter inspections will know to use MyTemplate, generate as a pdf and save as CUTTERNAME.pdf. Hooray.
                        Last edited by michelle; 11-25-2009, 05:00 PM.

                        Comment


                        • #13
                          In BASIC, recode it to suit your C-program.

                          Code:
                          sub Main
                          Dim PCDApp as object
                          Dim PCDProg as object
                          Dim PCDRepWindow as object
                          
                          Set PCDApp = CreateObject("PCDLRN.Application")
                          Set PCDProg = PCDApp.ActivePartProgram
                          Set PCDRepWindow = PCDProg.ReportWindow
                          
                          PCDRepWindow.LoadReportTemplate "C:\Your_path_to\report_template_here.RTP"
                          PCDRepWindow.RefreshReport
                          End Sub
                          PC-DMIS CAD++ 2o22.2 SP1

                          Comment


                          • #14
                            Originally posted by vpt.se View Post
                            In BASIC, recode it to suit your C-program.

                            Code:
                            sub Main
                            Dim PCDApp as object
                            Dim PCDProg as object
                            Dim PCDRepWindow as object
                            
                            Set PCDApp = CreateObject("PCDLRN.Application")
                            Set PCDProg = PCDApp.ActivePartProgram
                            Set PCDRepWindow = PCDProg.ReportWindow
                            
                            PCDRepWindow.LoadReportTemplate "C:\Your_path_to\report_template_here.RTP"
                            PCDRepWindow.RefreshReport
                            End Sub
                            Hooray!

                            Comment


                            • #15
                              ja but the only thing now is that VPT's reply is faster than I am in getting everything working together! :-)

                              [thanks again VPT for the little script, its much appreciated - I'll let you know when I've got it all plugged in and 'verking]

                              Comment

                              widgetinstance 190 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...
                              X