This Question is Possibly Answered

1 "correct" answer available (5 pts)
16 Replies Last post: May 19, 2009 3:05 PM by yu.yanfeng  
ed_smith Wannabe 20 posts since
Oct 6, 2008
Reply
Currently Being Moderated

May 8, 2009 9:52 AM

Automation and .hkp files.

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

Reply
yu.yanfeng Aficionado 348 posts since
Jul 23, 2008
Currently Being Moderated
May 8, 2009 11:00 AM in response to: ed_smith
Re: Automation and .hkp files.

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

artsiom.shchatsko Wannabe 38 posts since
Sep 4, 2008
Currently Being Moderated
May 11, 2009 8:18 AM in response to: ed_smith
Re: Automation and .hkp files.

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.

yu.yanfeng Aficionado 348 posts since
Jul 23, 2008
Currently Being Moderated
May 16, 2009 4:15 PM in response to: ed_smith
Re: Automation and .hkp files.

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

yu.yanfeng Aficionado 348 posts since
Jul 23, 2008
Currently Being Moderated
May 16, 2009 7:35 PM in response to: ed_smith
Re: Automation and .hkp files.

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.

chris_steiner Lurker 1 posts since
Dec 5, 2008
Currently Being Moderated
May 19, 2009 6:04 AM in response to: ed_smith
Re: Automation and .hkp files.

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

yu.yanfeng Aficionado 348 posts since
Jul 23, 2008
Currently Being Moderated
May 19, 2009 3:05 PM in response to: ed_smith
Re: Automation and .hkp files.

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

artsiom.shchatsko Wannabe 38 posts since
Sep 4, 2008
Currently Being Moderated
May 16, 2009 4:59 PM in response to: ed_smith
Re: Automation and .hkp files.

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

artsiom.shchatsko Wannabe 38 posts since
Sep 4, 2008
Currently Being Moderated
May 17, 2009 1:47 AM in response to: ed_smith
Re: Automation and .hkp files.

And will it have write method in the future?

artsiom.shchatsko Wannabe 38 posts since
Sep 4, 2008
Currently Being Moderated
May 18, 2009 4:30 PM in response to: ed_smith
Re: Automation and .hkp files.

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

More Like This

  • Retrieving data ...