1 2 First Previous 23 Replies Latest reply on Apr 2, 2010 12:09 PM by artsiom.shchatsko

    Automation and .hkp files.

    ed_smith

      I see from the Blogs that a number of people have started new projects which read and parse .hkp files. Help me to understand why you would choose to read an .hkp file when the use of Automation would seem to be easier and offer so many other advantages (such as speed of development, speed of execution and ease of integration into the application). Everything (and more) that is in an .hkp file is available through Automation.

       

      I have done both - I've picked information out of .hkp files and I've used Automation and I wouldn't want to go back to reading .hkp files.

       

      Does Automation have the perception of having a steep learning curve? Is it just that it's easier to work with what you already know? Is Automation deficient in some respect?

       

      I would find it instructive to understand why, when undertaking a new project, you would rather read an .hkp file than use Automation. Any feedback will be appreciated.

       

      Thanks, Ed

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

          For me, I use both .HKPs and Automation. Automation is good and easy to use, there is no long-learn curve there,but have limited API and seems not so stable. Sometime I what things be done without Expeditionpcb GUI, so I turn to .HKPs. Sometime may pepople prefer the openss of HKPs just loving freedom^_^

          Yanfeng

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

            First reason is that we are still on 2005 and as library design is concerned it's better to stay on it for at least a year. Second, as mentioned above, is that automation API is not providing all the functionality of HKP (yet). I haven't used automation but I support the idea of providing users with access to CAD's internal functions. But at the same time there must be an export to human-readable format and it must export everything (it may be new XML-based format as extending current HKP format may be tricky, and this new format must be documented). Many things are easier, faster and better to do by processing text files, not by using automation.

            • 3. Re: Automation and .hkp files.
              ed_smith

              Thank you both for replying - I hope to pick up some additional comments in time.

               

              If you are both on 2005 then you are correct not everything that can be extracted from .hkp is available in Automation. If we are talking about 2007.3+ then I am hard pressed to think of something that's not available in Automation.

               

              A comment was made about the stability of Automation: It's our experience that it is very stable - we are huge consumers of Automation so we tend to shake out all the issues internally. I won't say there are zero defects but there are very few. If you discover an Automation defect I would encourage you to submit it - we work very aggressively to fix these defects.

               

              Thanks, Ed

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

                Hi Smith,

                We use 2007.2. When I  wanna output a DXF file from Expeditionpcb, I can't find how to control which items to output using API, I have to use a reply file, and it's not so stable.

                Yanfeng

                 

                Option Explicit

                ' Get the application object
                Dim pcbApp
                Set pcbApp = GetObject(,"MGCPCB.Application")

                ' Get the active document
                Dim pcbDoc
                Set pcbDoc = pcbApp.ActiveDocument

                ' License the document
                ValidateServer(pcbDoc)

                pcbApp.Gui.SuppressTrivialDialogs=true

                ' add a reference to the MGCPCB type library in order to use enums
                Scripting.AddTypeLibrary("MGCPCB.Application")

                ' Invoke Idf Import dialog
                pcbApp.Gui.ProcessCommand("File->Export->DXF...")

                ' Get a reference to this dialog
                dim dlgObj
                Set dlgObj = pcbApp.Gui.FindDialog("General Interfaces")

                ' Create a replay file to fill out the controls in the form.
                Dim fso
                Set fso = CreateObject("Scripting.FileSystemObject")

                Dim file
                Set file = fso.CreateTextFile("C:\Temp\FillDXF.l", True)
                file.WriteLine("* Version 1.0: ")
                file.WriteLine("c 0 32937")
                file.WriteLine("c 0 32697")
                file.WriteLine("n 0 16 102 0 1008 c Local: ZTEFabDataOutDXF_MM")
                file.WriteLine("n 0 16 102 0 1 b 8")
                file.WriteLine("a 0 1")
                file.WriteLine("e 0 0 <22202567,220885370> 0 0 36592")
                pcbDoc.ReplayFile("C:\Temp\FillDXF.l")
                ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                'Local functions

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

                    ' Ask Expedition 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

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

                  Does automation already provides intreface to modify pinmapping data (and in general all that data in PDB)?

                  • 6. Re: Automation and .hkp files.
                    ed_smith

                    I see you are using the hidden, undocumented and unsupported, ReplayFile method on the document. There is a reason that it's hidden - it's designed for internal use, not for general use. :-)

                     

                    If you want to drive the General Interfaces dialog there is an engine available in Automation Pro.

                     

                    Regards, Ed

                    • 7. Re: Automation and .hkp files.
                      ed_smith

                      Pinmapping is readonly at this point in time. It's one of those few items that does not have a 'write' mechanism.

                       

                      Regards, Ed

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

                        Yes, I used the undocumented menthod to control what items be outputed. I know there is  the engines, but the difficulty is that we don't know how to control items be ouputed.

                        • 9. Re: Automation and .hkp files.
                          ed_smith

                          The methods on the General Interfaces object are described in the Automation Help document. Let me know if that is not sufficient and I will see if I can find you some additional information.

                           

                          Regards, Ed

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

                            And will it have write method in the future?

                            • 11. Re: Automation and .hkp files.
                              ed_smith

                              Apparently it is available in the newly released 2007.5... So yes!

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

                                Well, then it may  really worth looking into. Another question would be to interface Python with automation.

                                • 13. Re: Automation and .hkp files.
                                  ed_smith

                                  I have no experience with this but I believe using Python with Automation is possible. Python's win32.client package has support for COM. Also see the MakePy utility in this package.

                                   

                                  I also believe that ActiveState (www.activestate.com) have excellent integration between their Python and the Microsoft .Net framework and COM.

                                   

                                  Regards, Ed

                                  • 14. Re: Automation and .hkp files.
                                    chris_steiner

                                    Hello everybody,

                                     

                                    I found this interesting thread and I have the same requirement like Yu Yanfeng: Export DXF with Automation.

                                    So I took a look on the automation documentation in EE2007.5. In one point you're right meanwhile there are more export engines available through automation than in EE2005, but DXF export is still missing. Or better said: I was not able to find anything about how to modify the elements in the DXF export dialog. DXF export seems to be still the same like in 2005.

                                     

                                    I have to admit that I don't have an AutomationPro license but I think the documentation is not depending on any licensed features. :-)

                                     

                                    Regards,

                                    Chris

                                    1 2 First Previous