13 Replies Latest reply on Jul 15, 2010 9:01 AM by scott_williams

    HKP Automation Solution Space

    kendall_hiles

      I would like to help more this discussion up a level and start a thread dedicated to solutions. Use the other threads to debate the issue. This thread is for examples so we can all learn together.  I'm new to the library scripts and I need scripts for inclusion in AATK.  If you use and appriciate AATK it's your turn to help, that is why it is called Communities.

       

      Joe has stated:

      We believe it is important to highlight, that the ASCII Import and Export have not been disabled in EE7.9. This might be misleading. No work is gone, no workarounds have been removed.

      We have introduced new licenses for Decryptor and Encryptor, which we will of course provide to customers, who require any of these licenses in their process.

      Our engineering team is very responsive. We have reviewed an approved a number of requests for licenses already as they have been submitted to ASCII_Answers@mentor.com.

       

      So take advantage of this. If you use ASCII today and want to continue in 7.9, help SDD by telling them why and how you are using it.  They are trying to sort though these use cases and provide users solutions native to the tool before HKP gets turned off.  This should take care of the casual user and give you the ability to do the things you did in a simple ASCII export/import and some of the moderate and harder user cases as well. As I said above don't debate it here, go to one of the other threads and ask Joe Krolla the Business Marketing Manager.

       

      I am a solutions guy and probally will come up against something that is very specific to an specific customer or problem.  To figure out solutions we need examples so, if you have examples of HKP replacement code you have written post them here.  In attempt to share data dealing with libraries and parts, I don't want you to hork up your production library when testing code so I have added a sample Central Library to AATK.  It is not on http://sourceforge.net/projects/uwtoolbox/ yet so I zipped it and included it here. Unzip this in the root of your %AATK% directory.   When you write your code for inclusion here, you can use one of the following so everybody is on the same page:  If you use another platform or language, I can appriciate that, just do a similar thing in your code.  If you run into bugs while writing thes HKP replacement scripts, post the script and the problem you are having and we can work through this together as a community.

       

      VBscript or IDE form based

               Dim aatk_env, aatk_cl
                aatk_env = Scripting.GetEnvVariable("AATK")
                aatk_cl = aatk_env & "\AATK_Central_Lib\AATK_Central_Lib.lmc"

       

      VB6 (What I use for development)

               Dim aatk_env, aatk_cl

                aatk_env = Environ("AATK")

                aatk_cl = aatk_env & "\AATK_Central_Lib\AATK_Central_Lib.lmc"

       

      When submitting a script please include the following:

      1. General purpose of the script
      2. What is the native language/platform it is written it
      3. How to invoke it
      4. Does it use AATK_Central_Lib  or is it specific to your flow.
      5. Since we can't post .vbs you must zip it or change it's name to .txt, if so what is the real name of the script.

       

      Please do not post your companies libs or anything that may be considered confidential.

        • 1. Re: HKP Automation Solution Space
          kendall_hiles

          I have a sample script that makes a jumper in the first Cell partition and I am seeing a bug and need to know if you see the same thing.

          When I run this it shows the correct Height and underside height before I do the newcell.edit and go into graphics mode but when I come out of graphics the heights are both set to "0"

           

          1. BUG - Create a new jumper cell in the first cell partition losing height properties
          2. VB6
          3. Run in VB6 it will open it's own lib
          4. Does it use AATK_Central_Lib - YES (You can download from the first post of this thread)
          5. cellcreate.vbs

           

           

          -kendall

          • 2. Re: HKP Automation Solution Space
            kendall_hiles

            Andrew French posted this in the other thread.  I took it and VB6'd it with a call to the AATK_Central_Lib

             

            1. Opens CL and walks through the items as a high level example
            2. VB.Net or VB6
            3. Run in VB6 (Excel has a VB6 debugger in it see %AATK%\help\LABS-Powerpoints\Automation_Lab.ppt)
            4. Does it use AATK_Central_Lib  - Yes.
            5. PDBEditor_Example_VB6.vbs or PDBEditor_Example-Net.vbs

             

             

            -kendall

            • 3. Re: HKP Automation Solution Space
              joe_krolla

              Kendall, all,

              we are working to put an Exchange platform together here. This will allow to provide examples, tutorials, utilities.

              We are expecting this to go live within the next couple of weeks and providing a structure to manage, find and retrieve samples effectively.

               

              Stay tuned please.

              • 4. Re: HKP Automation Solution Space
                taco.de.vries

                Kendall, or perhaps others,

                 

                I am looking into this library scripting, taking examples from the documentation

                to learn what can be done with this automation and what may be missing.

                 

                My goal is to get some sample code that can dump parts into an ascii file for each

                part and be able to import that file back into the library.

                 

                I am working on the library, not on Expediton or DxDesigner data.

                 

                Sofar I have taken this example that dumps to a file all part partitions and loops

                over all the parts in that partition and modified it to create a file for each part with some info.

                I have not gotten to the pinmapping, first I need to get the basics in.

                 

                All of this seems to be working fine, but there is a big difference in the number of parts

                that are in my library (2545) and the number of parts that are processed by the script (776).

                I am very much puzzeled by this, the program does not give any errors and seems to work

                well.

                 

                I have taken out all code exept for the looping over partitions and parts, but still get the same

                results. I did also take the 'On Error' statements out, again with no difference.

                 

                I hope somebody can shed some light on this..

                 

                Now some info Kendall wants:

                1. Purpose: write all partsnames in all partitions in a Central Library

                2. Language: Visual Scripting, I am running on Linux

                3. Invocation: I use 'icscript scriptfile.vbs' from the command line, but it also works running it with 'run scriptfile.vbs' from DxDesigner

                                      Note: you need to modify 'job' to the full path to your library .lmc file

                                               you need to modify 'fileout' to the full path of the output file

                4. Library: I am using our company library for this, but it should work just as good with the AATK library

                5. scriptfile: I called this partname.vbs

                 

                Taco

                 

                This is the code I am using:

                 

                Dim job
                Dim pdbEditor

                job = "full_path_to_library.lmc"

                Scripting.AddTypeLibrary("LibraryManager.Application")

                Set appObj    = CreateObject("LibraryManager.Application")
                Set libObj    = AppObj.OpenLibrary(job)
                Set fso       = CreateObject("Scripting.FileSystemObject")
                set fileout   = fso.CreatetextFile("full_path_to_out.txt")
                Set pdbEditor = CreateObject("MGCPCBLibraries.PartsEditorDlg")
                set pdbDB     = pdbEditor.OpenDatabase(job)

                pdbEditor.Visible = true

                fileout.Writeline ("PDB " & pdbDB.Name & " at " & pdbDB.Fullname & vbCrLf & vbCrLf)
                WritePDB (pdbDB)

                pdbEditor.QUIT

                Function WritePDB(pdbDB)
                'On Error Resume Next
                Dim ptis
                Set ptis = pdbDB.Partitions
                Dim pti
                For Each pti In ptis
                  fileout.WriteLine ("Partition: " &  pti.Name ) 
                  WritePartition (pti)
                Next
                End Function ' WritePDB

                Function WritePartition(pti)
                'On Error Resume Next
                If Not pti Is Nothing Then
                  Dim pts, pt
                  Set pts = pti.Parts
                  For Each pt In pts
                   WritePart  pt,pti.Name 
                  Next
                End If
                End Function 'WritePartition

                Private Function WritePart(pt,partition)
                'On Error Resume Next
                  fileout.WriteLine ("Parts: " & partition &" "& pt.Number ) 
                End Function 'WritePart

                'End program


                 

                Message was edited by: taco.de.vries    Add Notes to invocation, and removed fileout (was pointing to a file in my home directory)

                 

                Message was edited by: taco.de.vries    Grrr, the code was in there 2 times..

                • 5. Re: HKP Automation Solution Space
                  taco.de.vries

                  Just to make sure, I ran the script against the AATK library, this library

                  contains 71 parts of which 70 are processed.

                   

                  The part missing is: CY2DL814ZC in the partition misc

                   

                  But.. after opening the library in Library Manager,opening the

                  Part editor on that part and saving the partition, all 71 parts

                  are now processed.

                   

                  Odd...

                   

                  I am using EE7.9 Update 0 for this.

                   

                  Taco

                  • 6. Re: HKP Automation Solution Space
                    kendall_hiles

                    tobBug found!  Jumpers are strange animals and not a good for trials.  The error I was seeing was that when you create the outline the heights were being reset to 0:

                    Set outline = cedDoc.PutPlacementOutline(layer, points, pntsarray, 0, 0, component, unit)

                     

                    Thats my bad, I didn't write the sample and I forgot that the outline had them built in.

                     

                    I re-wrote this as a base it is a stand-alone Microsoft Excel Script that mimics what I was doing in the hardcoded script.  It is in Excel because Excel has a free VB editor and debugger.  It isn't as good as VB6 but it's close.  Sorry taco, I know you run Linux and I have other examples on how to connect to Open Office as well.

                     

                    excel-cell.gif

                    • Create a new cell in the first cell partition
                    • Developer enabled Excel2007
                    • Open the sheet fill out the form and mash GO
                    • Does it use AATK_Central_Lib - YES (You can download from the first post of this thread)
                    • ExcelNewCell.xlsm  (Macro enabled 2007 Excel file)

                     

                    I see this as a good start for those who use HKP to read in Cells that have the data coming from other formats.  The Excel sheet has lists so it limits the user to values that work but, you don't need to stick to my whacky format.  Use it as an example to create your own.

                     

                    Caveats: (I'll work on these when I get more time or better yet, you guys fix it and post it back)

                    1. It will only create a new cell, if it already exits it will error out.
                    2. It will create it in the first partition in the first tab.
                    3. I don't have the pin start stop layers automated yet for smt vs thru hole.
                    4. There is absolutely no error handling.  If you do something and it gets horked up you will need to debug it.

                     

                    Good Luck!

                     

                    -kendall

                    • 7. Re: HKP Automation Solution Space
                      kendall_hiles

                      I looks like the part you found In AATK_CL did not pass the verify checks.  Do all the parts in your PDB verify or, are you missing all the parts that do not turn red?

                       

                      I ran it in the VB debugger and it is skipping that part:

                       

                       

                      pdb.gif

                       

                      -kendall

                      • 8. Re: HKP Automation Solution Space
                        taco.de.vries

                        Kendall,

                         

                        All parts are 'black' in the part editor. btw odd coloring, Red implies verified??

                         

                        'if' this verify flag is causing this, how can I get to it, I don't see anything in the editor

                        that will affect it.

                         

                        I did find a menu pulldown that says 'verify all entries' when I run that, some part entries turn

                        red, most do not.

                         

                        Sorry, but this only gets more confusing..

                         

                        Taco

                        • 9. Re: HKP Automation Solution Space
                          john_dube

                          Hi Taco,

                           

                          The PDB automation interface requires that the "Type" property is set:

                           

                          TypeProperty.jpg

                           

                          John

                          • 10. Re: HKP Automation Solution Space
                            taco.de.vries

                            John,

                             

                            I just spend some time fixing the library changing empty Type Properties to 'Misc'.

                            Of course the only way to do this fast is by exporting to HKP, use perl or the stream editor

                            to change this and reload the HKP files back into the library.

                             

                            This fixes the problem, thanks for pointing this out.

                             

                            Now I consider this a bug in the automation interface and will file a DR for this.

                             

                            Agree?

                             

                            Taco

                            • 11. Re: HKP Automation Solution Space
                              john_dube

                              More likely it is a bug in how the parts were created (by translator or HKP import), since creating a part in the PDB Editor forces the Type property to be set.

                               

                              But it would be good to be able to use the automation interface to set the Type property even if it is not set.

                               

                              John

                              • 12. Re: HKP Automation Solution Space
                                yu.yanfeng

                                Hello Joe,

                                 

                                I always get lot of laughts when I see your posts.  Automation is only complement to ready-use features and functions of Expeditionpcb, Mentor shouldn't force Expeditionpcb user have to use Automation for get those features and functions which should be common to design tasks.

                                 

                                Mentor shouldn't  expect PCB designer be a programmer and service themself using customerized codes.  Of course, I agree that Automation is the right way if  Expeditionpcb is a freeware or open software. It make money!

                                 

                                Yanfeng

                                • 13. Re: HKP Automation Solution Space
                                  scott_williams

                                  So is it the lack of a "Type" property that is causing these parts to not be returned by Automation, rather than their verification status?  Is it the missing "Type" property that caused these parts to fail verification?

                                   

                                  Thanks,

                                   

                                  Scott