Opening Program in PCDmis via VBA in Excel

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

  • Opening Program in PCDmis via VBA in Excel

    I have looked though all of the posts in the Code section and cannot seem to find what I want so am hopin someone out there can help me.

    I am a newbie using VBA so am starting off simple and even that has got me baffled. Is it possible to open a program in PCDmis using scripts in Excel ?

    If so I would appreciate it if someone could post the code to get me started

    Jon
    sigpic

  • #2
    Open program sample code

    Here is some code from VB which starts PC-DMIS, opens a program, and executes it. You should be able to adapt it to your program without too much trouble. . .



    ' Launch PC-Dmis by creating the app object
    Set app = CreateObject("PCDLRN.Application")

    If Not app.WaitUntilReady(300) Then
    MsgBox "Machine did not initialize, Exiting"
    Exit Sub
    End If
    'if you get here, the machine initialized successfuly

    ' Ask the App object for the partprograms object
    Set Parts = app.PartPrograms
    ' Ask the Partprograms object to display the file
    ' open dialog and return the opened part program object
    Set part = Parts.Open("C:\Program Files\WAI\PC-DMIS V42\ip1.prg", "OFFLINE")

    app.Visible = True

    ' Execute the opened part program
    part.EXECUTE
    ' Close the part program
    part.Close
    ' Quit the Application (shut down PC-Dmis)
    ' app.Quit

    Comment


    • #3
      Make sure you configure excel to reference the "pcdlrn.tlb" file in your directory. It's the pcdmis object library that will be required.
      I used to be high on life but I built up a tolerance.

      Brown & Sharpe Global Advantage
      PCDMIS CAD++ v2011mr2
      PH10MQ/SP600M


      sigpic

      Comment


      • #4
        Thanks for the help, I will hopefully get some time today to spend on this and see how far I get.
        sigpic

        Comment


        • #5
          May I ask why you would like to open a dmis program using Excel? What is the primary advantage of doing this?

          Aaron Fenner
          Quality Engineer
          PC-Dmis v4.3
          B & S Global Status 7.7.7
          6 years xp 32-bit

          sigpic

          Comment


          • #6
            I don't think he wants to run programs from Excel. I'm willing to bet he's wanting to pull data straight out from a current program onto a spreadsheet, which would make life so much easier.
            I used to be high on life but I built up a tolerance.

            Brown & Sharpe Global Advantage
            PCDMIS CAD++ v2011mr2
            PH10MQ/SP600M


            sigpic

            Comment


            • #7
              To answer afenner

              Due to the way my factory is set-up, all my programs are ran by operators who really have no idea what CMM's are or do, they just need to see a fancy output that tells them how to adjust the offsets on the machine to keep the parts in spec. Currently I have a big list of programs stored in one folder on the hard drive which when opened in operator mode, run automatically prompting for things like Contract No, Part No etc etc and dependant on these answers create and store the reports in subfolders. The problem being is some operators struggle to find the programs (not pc literate) or use the incorrect ones / enter incorrect contract / part information and basically everything goes t**ts up.

              So in my spare time (lol) I am going to try and build a fancy front end which runs independently of PC Dmis (I dont have VB Net only Excel) and basically drives the operator down a path to his correct program by prompting for contract information etc. Once there it will start PC Dmis, run the program and then close PC Dmis before displaying and saving the report etc etc. I may or may not then choose to pull some data across into Excel as Underspec has mentioned.

              Dont know if this will work or not but I like a challenge anyhow. No doubt I will be posting for help once I get started as my grasp of VB is fairly limited.
              sigpic

              Comment


              • #8
                Originally posted by jon_dav_uk View Post
                I dont have VB Net only Excel
                Save yourself the headache of VBA and download the free VB.Net Studio Express package: http://msdn.microsoft.com/vstudio/express/vb/
                It's a lot more powerful and IMHO easier to program in than VBA.

                Take a look MSDN for your programming questions. There are tons of examples out there. Also VBForums.com.

                Check out this thread to see what issues you *will* run into while trying to automate PC-DMIS: http://www.pcdmisforum.com/showthread.php?t=3328
                sigpic:rolleyes:

                Comment


                • #9
                  Thank you for the explanation. That sounds like something I need to do. I'm currently setting up a system of programs for operators to use in 6 months to a years time. I don't know VB, but I'm good with Excel. I really need to learn how to send results to Excel in a customizable way. Such as, I need to be able to send a dimensional result to a particular cell of my choosing in an Excel document, automatically, and I haven't figured it out yet. I was told that I need ed VB to really do it the way I want.

                  Your task sounds like a challenging one. I'll be interested to hear of your success in the future, perhaps along with some pointers

                  Aaron Fenner
                  Quality Engineer
                  PC-Dmis v4.3
                  B & S Global Status 7.7.7
                  6 years xp 32-bit

                  sigpic

                  Comment


                  • #10
                    Thanks for that SeanO might give it a go. Our IT department has everything set-up so that unless a member of IT has approved what you are downloading its impossible, however I will give it a go.

                    I if get anything worthwhile sorted I will post back and let you all know.
                    sigpic

                    Comment


                    • #11
                      I'm actually working on a front-end project using VB.net. If you have VB 6.0 you can download the ALLGUI example from the Wilcox "files" site. VB.net is somewhat different from VB 6.0 and cannot convert it over as far as I've tried.
                      I used to be high on life but I built up a tolerance.

                      Brown & Sharpe Global Advantage
                      PCDMIS CAD++ v2011mr2
                      PH10MQ/SP600M


                      sigpic

                      Comment


                      • #12
                        No joy downloading free VB Net Studio package....grrrr, may have to buy the full version if I want it.

                        Gonna carry on with what I am doing in Excel and get that working, will then decide if i want to use VB net and if so, buy that then re-write based on what i already have, if nothing else the principles will be the same

                        Its going ok at the minute but am stuck on something else now, anyone have any ideas what is the best way to automate getting the probe details from the program and say into a text file. dont know if i need or want to do this but i thought it might be a good idea that when an operator selects a program from the vba front end it displays the probe/probes that will be used (if the cmm they are using has no toolchanger they sometimes have to manually switch probes which they often forget and wonder why they crash

                        Ideas anyone ?
                        sigpic

                        Comment


                        • #13
                          Probe.Name returns the name of your probe file. You could substring it to remove the .prb extension. I name my probe files according to the build (ie a 3X30 is P_3X30.prb) so that could work depending on your naming convention.

                          In regards to VB.Net, there are some pretty significant language differences. I like it but be prepared for things not to be the same from VB to VB.Net.
                          <internet bumper sticker goes here>

                          Comment


                          • #14
                            Thanks craiger, that should be good enough for what I want. My mate did mention that VB Net and 6.0 were different, didnt say how much tho.....good job I like a challenge
                            sigpic

                            Comment


                            • #15
                              Originally posted by jon_dav_uk View Post

                              Gonna carry on with what I am doing in Excel and get that working, will then decide if i want to use VB net and if so, buy that then re-write based on what i already have, if nothing else the principles will be the same
                              If you start in Excel, you are actually using version 6 and not .NET(not positive on excel2007). I still use VB6 and like it. Craiger is hooked on .NET

                              The one advantage of VB6 is that I can compile a program and distribute it without the user installing .NET support. This advantage may change with windows Vista.
                              Links to my utilities for PCDMIS

                              Comment

                              Related Topics

                              Collapse

                              Working...
                              X