1 2 Next Last 23 Replies Latest reply on Apr 2, 2010 12:09 PM by artsiom.shchatsko Go to original post
      • 15. Re: Automation and .hkp files.
        ed_smith

        OH, the question is really about DXF Export and not about the General Interfaces dialog! The code in the above script searches for the "General Interfaces" dialog but I see that is bogus and those lines shouldn't be in the script. :-)

         

        So to answer the question: DXF export is not currently available in the engines nor do I know when it will be available.

         

        However, we might be able to do something with the existing Automation methods in conjunction with the DXF dialog. Take a look at this:

         

        Option Explicit

        Dim app: Set app=GetObject(,"MGCPCB.Application")
        Dim doc: Set doc=app.ActiveDocument

        call ValidateServer(doc)

         

        ' invoke the DXF export command

        app.Gui.ProcessCommand("File->Export->DXF...")

         

        ' get a reference to this DXF dialog
        Dim dlgObj: Set dlgObj = app.Gui.FindDialog("DXF Export")

         

        ' get a reference to the edit string which holds the output file name
        Dim editbox: Set editbox = dlgObj.FindEditBox("DXF output file:")

         

        ' change name of output file
        editbox.Text = "c:\esmith\Ed.dxf"

         

        ' find the OK button
        dim OKButton: set OKButton = dlgObj.FindButton("OK")

         

        ' and press it to execute the dialog
        call OKButton.Click

         

        MsgBox "DXF Export done"


        Private Function ValidateServer(doc)
            dim key, licenseServer, licenseToken

            ' Ask Expedition’s document for the key
            key = doc.Validate(0)

            ' Get license server
            Set licenseServer = CreateObject("MGCPCBAutomationLicensing.Application")

            ' Ask the license server for the license token
            licenseToken = licenseServer.GetToken(key)

            ' Release license server
            Set licenseServer = nothing

            ' Turn off error messages.  Validate may fail if the token is incorrect
            On Error Resume Next
            Err.Clear

            ' Ask the document to validate the license token
            doc.Validate(licenseToken)
            If Err Then
                ValidateServer = 0   
            Else
                ValidateServer = 1
            End If
        End Function

         

         

        The above script will bring up the DXF export dialog, load the last output scheme (controlled by the file \config\DXFSettings.txt in the job directory), change the output filename and press the OK button to get the DXF file generated. If you want a mechanism like this to generated a DXF file with the press of a button you must have a number of predefined scheme you output otherwise you would just use the dialog... So, you could generate your own scheme (or schemes) using the DXF dialog and store them in a central location. Then you could modify the above script to use the FileSystemObject to copy the scheme from the central location over the top of the existing config\DXFSettings.txt file before the dialog is invoked from the above script. This way the dialog will be prepopulated with the required scheme and the script will press the OK button and generate the DXF file with the contents specified by the scheme.

         

        I hope this helps.

         

        Regards, Ed

        • 16. Re: Automation and .hkp files.
          yu.yanfeng

          Hi Ed,

           

          Thank very much. Your method works well and I used to use setting files under \config.

          the difficulty to me is that I don't how know to use API find some fields in the dialog GUI.It seems not all fields supported by Automation API. For example, I can't use API to control which drill symbol to assign

           

          12.bmp

          Another way I like hkp.files is that HKP give a robust way to translate Expeditionpcb database to Allegro database)_:

           

           

          Yanfeng

          • 17. Re: Automation and .hkp files.
            patrick.cashman

            I have a first pass at a complete piece of software that will get all currently visible layers and write a dxf file out with just those layers included.  It may be a bit scratchy at the moment and could probably use some work.  Please test drive it and let me know what you think.

             

             

            -Patrick

            • 18. Re: Automation and .hkp files.
              lary.e

              Hi Ed,

               

              One of the thing that we do with hkp files is library maintenance.

              We get from external sources information about parts.

              We get the name of a datasheet file for a part.

              We add this as an attachment property to the part.

              This is done by exporting the pdb to hkp, manipulating the text file and importing it back to the library.

              This can be done with no license issue and as a scheduled task on a server with no open GUI.

              Second, we get information about obsolescence of parts.

              We move the obsolete part from it's partition to a partition of obsolete parts which is not in the default search order scheme.

              This is done by cutting the part section from one hkp and pasting it in the other one.

              Again, no license issue and this is done as a scheduled task on a server with no open GUI.

               

              Please suggest automation programs for these operations.

               

              Best Regards

              Lary

              • 19. Re: Automation and .hkp files.
                artsiom.shchatsko

                I guess the only suggestion here is to write appropriate automation scripts by yourself

                • 20. Re: Automation and .hkp files.
                  lary.e

                  Artisom,

                  We have the hkp programs working for many years.

                  The question is what are the advantages and disadvantages of implementing the functionality by automation.

                   

                  Lary

                  • 21. Re: Automation and .hkp files.
                    artsiom.shchatsko

                    Well, I also use HKP and symbol parsing scripts to maintain library.

                    The advantage of using Automation is that it is (and I hope will be) documented and supported when HKP format is considered Mentor proprietary.

                    With aoutomation you job is much easier as you don't need to parse data, you have a direct interface to CAD internal functions.

                    The disadvantage of automation could be that not all you need is implemented/accessible.

                    Personally I'm thinking about switching to Automation when I have time.

                    • 22. Re: Automation and .hkp files.
                      lary.e

                      Artsiom,

                      Thanks for your response.

                       

                      "The disadvantage of automation could be that not all you need is implemented/accessible." - This is a show stopper.

                      What about the need for a GUI environment for running the automation server vs. the ability to run programs on a file/application server as a scheduled task?

                      • 23. Re: Automation and .hkp files.
                        artsiom.shchatsko

                        Good point! And also, if I recall correctly, (advanced) automation requires license.

                        But the bottom line as I see it is that Mentor is not going to promote/support file level parsing so we have to cope with it as I don't think this policy is going to change

                        1 2 Next Last