9 Replies Latest reply on Aug 26, 2014 4:18 AM by zabrovskiy

    Bulk update of Parts parameter

    kurnakov

      We have a large base of element (~14k) and we want to update parts properties,

      which contains link to DataSheet. Advanced Library Editor cant help us,

      because we want to modify property based on another properties. For example,

      for each part we get it name or other property, send it into program as

      parameter, get string with link to DataSheet and replace old value to a new.

      How we can do it without manual change property of each part?

        • 1. Re: Bulk update of Parts parameter
          Patrick.Cashman

          More information is needed:

           

          What scripting language/envrironment do you use?

           

          Are you using an external database with DxDatabook?  If so, what kind of database?

           

          (The alternative would be to include all the properties in the PDB's in the Mentor Library, which would mean a different approach.)

           

          Do you have any experience with scripting or modern programming languages? If so, which ones and how much?

           

           

          Let's get started with those and take it from there.

          • 2. Re: Bulk update of Parts parameter
            zabrovskiy

            I'm a developer from same company as kurnakov. Now we use DxDataBook, through MS Access db, which create from single xls files. In this part no any difficulty. I parse xls, change DataSheet and recreate access db. But second db, which we use in parallel is Mentors Graphic Library(.imc file extension). We dont know how modify this part automatically. Now I found the difficult way through changing pdb file of Mentor Graphic Library. I extend all parameters by special symbols using Advansed Library Editor (for example our param were like 'file:\\file_path\filename' and I extend it with '#' symbols, using substitution in ALE: 'file:\\' replace on '##file:\\'). After this I parse pdb files, like binary file and change DataSheet parameter, using ruby, rake task and conect to our MySQL database. I save length of parameter during this operation. This need to evade from corruption of pdb file. Then I removed residual '#' symbols using ALE(I use many times substitute '#https:' on 'https:'). This approach is rather long and has several places, where I can corrupt the data. I want to make it, using single script/programm/etc.

             

            As for the programming experience, I know ruby, python, C++, C#, bash and some other languages.

             

            You can offer any solution, which provide high automatization and low probability of data corruption. Maybe you know specification on pdb format? Or any improved variant of ALE or alternative for it?

            • 3. Re: Bulk update of Parts parameter
              Patrick.Cashman

              There are multiple elments in play here that all have to work together. 

               

              1. Working with data in an external MS Access database is not too difficult and is very fast. I recommend that you learn how to do this directly and skip the step of using the XLS files.  Of course if you are accustomed to doing it that way, it's ok, but you can save steps and time by working directly with the database. The basic idea is that you make a connection to the database, then derive a dataset from it, break the dataset down into datarows and the individual elements of the datarows to get to a specific field, modify it, then update the database from your now changed dataset.

               

              2. Most of the properties applied to the instantiated schematic components should come from the Access database, and do not need to also be stored in the PDB.  This is more of a structural issue in how you have the whole system set up.  Get in touch with your Mentor applications engineer to make sure you have this part right.  There are only a few properties that need to be on the symbol or included in the PDB. All the rest should be in the databook.  This avoids duplication of data and the need to do what you have been doing, which is not necessary.

               

              The properties needed on the symbol are:

               

              Ref Designator

              SCHEMATIC_VALUE

               

              (neither of these properties has a value at the symbol level. The values are adopted later.  These properties are only placeholders at this point.)

               

              The only property we have on the PDB is Height.  Of course in the PDB definition there is Number, Name, and Label. We have a Part Label field in our DxDatabook database as well, and use the identical value in this field as label value in the PDB definition.  We also have SCHEMATIC_VALUE field in the database, which is where the SCHEMATIC_VALUE property on the symbol gets its value when the part is instantiated.  This all seems to work fine.

               

              All other properties are contained only in the DxDatabook MS Access database. 

               

              3. In the MS Access database, we have a field called Datasheet.  In the DxDatabook configuration, the Field Type of this field is Document.  That field type definition is what tells DxDatabook to run the Application_ViewDocument function in the DxDatabook script.  The parameters of that function are "properties" and "document":

               

              Our Application_ViewDocument function looks like this:

               

              Function Application_ViewDocument(properties, document)

                   dim tmp

                   dim path

               

                   path = "X:\ENG\Datasheets\ELECTRONIC\"

                   set wsh = CreateObject("shell.application")

                   tmp = document.value

                   tmp = path & tmp

                   wsh.Open tmp

                   document.value = ""

               

                   'we set the document.value to nothing to prevent databook

                   'from trying to open the file by itself after the external

                   'shell command, which causes an error message.

               

                    set wsh = Nothing

              End Function

               

              Apparently the properties parameter is not really needed. I'm not sure what it does. But it has to be in the function declaration, so I leave it there.

               

              In the database, the Datasheet field value is simply the name of the PDF file of the datasheet.  Such as: 38263_A150 5 5_TELE.PDF

               

              It does not need any other characters (like the #).  This works fine using the windows shell  Open command (wsh.Open tmp in the script above), which just uses the default application in Windows to open the file supplied in the path.  I think the DxDatabook tries to open it too, but needs the # in the filename, which causes all kinds of trouble like what you have been experiencing.  Our method is much simpler and eliminates a bunch of problems with all the search and replace functions. That's why we set the document.value to "" in the script - it bypasses the default dxdatabook open file command.

               

              So if you get all the properties in your PDBs out, then you only need to do data manipulation of the data in your XLS or MS Access files, which is easy and you probably already know how to do it.  The whole business of messing with the binary of the PDB is completely not necessary if you do it this way.  Combine this with bypassing the default file opener in the DxDatabook script by using the windows shell to open it, and suddenly the whole process is very straightforward and you don't even have to worry about the #.

               

              Let me know if you have any more questions or need further clarification on some points.

              • 4. Re: Bulk update of Parts parameter
                Mike_Walsh

                zabrovskiy wrote:

                 

                I'm a developer from same company as kurnakov. Now we use DxDataBook, through MS Access db, which create from single xls files. In this part no any difficulty. I parse xls, change DataSheet and recreate access db. But second db, which we use in parallel is Mentors Graphic Library(.imc file extension). We dont know how modify this part automatically. Now I found the difficult way through changing pdb file of Mentor Graphic Library. I extend all parameters by special symbols using Advansed Library Editor (for example our param were like 'file:\\file_path\filename' and I extend it with '#' symbols, using substitution in ALE: 'file:\\' replace on '##file:\\'). After this I parse pdb files, like binary file and change DataSheet parameter, using ruby, rake task and conect to our MySQL database. I save length of parameter during this operation. This need to evade from corruption of pdb file. Then I removed residual '#' symbols using ALE(I use many times substitute '#https:' on 'https:'). This approach is rather long and has several places, where I can corrupt the data. I want to make it, using single script/programm/etc.

                 

                As for the programming experience, I know ruby, python, C++, C#, bash and some other languages.

                 

                You can offer any solution, which provide high automatization and low probability of data corruption. Maybe you know specification on pdb format? Or any improved variant of ALE or alternative for it?

                There is no reason why you couldn't, besides lack of examples, code your program to manipulate the PDB through the API in whatever language you like as long as it supports COM.  I did a couple simple examples in Python for a customer several years ago.  I have written a fair amount of Tcl code which manipulates (mostly create) library elements using the various editors (Padstack, Cell, PDB).  The API for the Library Editors is pretty extensive so I suspect you'd be able to do what you want to do pretty easily.

                • 5. Re: Bulk update of Parts parameter
                  zabrovskiy

                  I can't find anything about API of Library Editor. If you can post any links or documentation for it, I would be grateful. Maybe it is exactly what we want.

                  • 6. Re: Bulk update of Parts parameter
                    zabrovskiy

                    Thanks for the advising. it is good variant if you just started production and hasn't a lot of details, projects and stable development structure. If you already have big production - any fundamental changing in development process and in DB structure is prohibited.

                    • 7. Re: Bulk update of Parts parameter
                      Patrick.Cashman

                      There is a basic template for how to step through all the library objects in this thread:

                       

                      http://communities.mentor.com/message/20510#20510

                       

                      And I posted an example vb.net project in this thread.  It includes all the stuff to make hooks into the part editor:

                       

                      http://communities.mentor.com/message/20660#20660

                       

                       

                      Also I posted similar stuff in this thread:

                       

                      http://communities.mentor.com/thread/12291?tstart=0

                      • 8. Re: Bulk update of Parts parameter
                        Mike_Walsh

                        zabrovskiy wrote:

                         

                        I can't find anything about API of Library Editor. If you can post any links or documentation for it, I would be grateful. Maybe it is exactly what we want.

                         

                        The PDF version of the Library Automation manual can be found at:  C:\MentorGraphics\7.9.4EE\docs\pdfdocs\library_editors_auto.pdf

                         

                        Your path may be slightly different due to version and platform but the manual will be in the "pdfdocs" directory.  There is also an HTML version but I prefer the PDF version myself.

                         

                        There are some examples in the AATK/examples directory.  There are Library Automation examples written in VBscript, C#, and JScript.  Somehwhere I have a very simple Python example if you need it.  If you want to see a fairly complex Tcl application I am working on, you can find it on GitHub.  The interactions with the various Mentor editors are concentrated in the MGC.tcl file.

                        • 9. Re: Bulk update of Parts parameter
                          zabrovskiy

                          Thanks, library_editors_auto.pdf is exactly that we want. It allows to manipulate with MentorGraphica DB data through VBscript and make all common actions like send HTTP(S) requests, write logs, etc.

                          It completely solves our problem.