8 Replies Latest reply: Apr 21, 2014 10:40 AM by rohan.dervankar

    Request Expedition Cell Editor: Assembly font settings on every cell in library?

    David_S

      All,

      Since my first request went so well (Thanks again!!!) I'm going to ask for a second, and hope someone helps me again.

       

      I need to change the Assembly Ref Des on every cell in the the library.  I want to control the font, the height and stroke width.   (I'll need to do the Silkscreen too, but I can run the script twice, second time with different settings, or get a second set of settings???)

       

      Can someone throw something like this together????  Sure would help.

        • 1. Re: Request Expedition Cell Editor: Assembly font settings on every cell in library?
          Satoru

          Hi David-san,

           

          I made easy sample script.

          Please check it.

           

          This script changes the font name, height, and pen width of RefDes(Silk&Assy) in Cell.

          ===============================================================

          Sub edit_Cell()
              Dim celEditor
              Dim celDB
              Dim ptin
              Dim cel
             
              Dim celApp
              Dim celDoc
              Dim fabTxts, fabTxt
              Dim flag

              'Create CellEditorDlg Object
              Set celEditor = CreateObject("CellEditorAddin.CellEditorDlg")
              Scripting.AddTypeLibrary("CellEditorAddin.CellEditorDlg")

              'Open CellDB
              Set celDB = celEditor.OpenDatabase(lmcPath, False)

              'Lock CellEditor
              Call celEditor.LockServer

              'Loop Patitions
              For Each ptin In celDB.Partitions("*")
                  ScriptHelper.Echo "Partition: " & ptin.Name
                  'Loop Cell
                  For Each cel in ptin.Cells(ecelldbCellTypeAll, ecelldbPackageGroupAll)
                      flag = False
                      ScriptHelper.Echo "    Cell: " & cel.Name
                      'Start Cell Editor(Layout) & Get Cell Document Object
                      Set celDoc = cel.Edit
                      'Get CellEditor Application Object
                      Set celApp = celDoc.Application
                      Scripting.AddTypeLibrary("MGCPCB.CellEditorApplication")

                      'Visible CellEditor
                      'celApp.Visible = True

                      'Get FabricationLayerGfxs Object
                      Set fabTxts = celDoc.FabricationLayerTexts(epcbFabAssembly + epcbFabSilkscreen, epcbSelectPlaced, epcbSideTopOrBottom, True)
                      For Each fabTxt In fabTxts
                          'Check RefDes Text
                          If fabTxt.TextType = epcbTextRefDes Then
                              fabTxt.Format.Font = newFont
                              fabTxt.Format.Height = newHeight
                              fabTxt.Format.PenWidth = newWidth

                              flag = True
                          End If
                      Next
                      'CellEditor Save & Close
                      If flag = True Then
                          Call celDoc.Close(True)
                          ScriptHelper.Echo "      --> Edit"
                      Else
                          Call celDoc.Close(False)
                      End If
                  Next
              Next

              'Un Lock CellEditor
              Call celEditor.UnlockServer
              Call celEditor.CloseActiveDatabase(True)

          End Sub

          ===============================================================

           

          Regards,

          Satoru

          • 2. Re: Request Expedition Cell Editor: Assembly font settings on every cell in library?
            David_S

            Thanks for the quick response.

             

            I think you made a mistake.  Ran the script, and it didn't change anything, and it reported it only changed when I'd already changed it?????

             

             

            I'm out until Monday, so can't do any more checking until then.

            • 3. Re: Request Expedition Cell Editor: Assembly font settings on every cell in library?
              Satoru

              David-san,

               

              I don't know a rule.

              Therefore, a script will be changed if there is RefDes of Silk or Assy.

               

              A rule like a Width change script is required.

               

              Regards,

              Satoru

              • 4. Re: Request Expedition Cell Editor: Assembly font settings on every cell in library?
                David_S

                Oops, I'm using a batch file to run the script, and didn't retype part of the script when I did a cut and paste.   (was trying to leave for vacation, and was in a hurry)  So I was running the wrong script!

                 

                 

                But, I'm getting a:

                 

                Source:'Cell Editor'
                Line:80  Char:20
                Error:0x80040209  'Font not found.  This font may not be loaded.'

                 

                about the time I run out of physical memory.   Will try and decrease library (I'm using a copy anyway) size, and rerun, when I have a few minutes.

                • 5. Re: Request Expedition Cell Editor: Assembly font settings on every cell in library?
                  MikeD

                  David,

                  I would write each cell partition out to ASCII and change them using a text editor or a script.  You may have to use DataConvert depending upon the version you're using.

                  • 6. Re: Request Expedition Cell Editor: Assembly font settings on every cell in library?
                    David_S

                    Sorry, should have posted, the script above worked fine.  I did modify it a bit to do just silkscreen, and then copied it to just do the assembly, but over all, it was fine.

                     

                    I did have to do 1/2 the cells at a time, but that was because I only have 2G on my machine, and with all the crap running in the back ground, I ran out of RAM.  I think if I'd had 3G, I could do all of it at once.

                    • 7. Re: Request Expedition Cell Editor: Assembly font settings on every cell in library?
                      hgk-layout

                      Hi Satoru-San,

                      I get more and more angry about Mentor Graphics´ underhand Licensing Methods.

                      First they kill ASCII-Options and the self-written software that did all I needed is now trash.

                      And they canted about the better working with Automation Tools.

                      What I see now is, that this replacement is mostly associated with automation pro license.

                      My assembly and silkscreen manipulation software (Java) was very time-saving (local changing in Layout),

                      now I have to change the customer-specific graphical parameters by hand again.

                      And I am not open for paying a Fablink license only to use a lost functionality.

                      Is there any way to run your script with automation basic?

                       

                      Greetings from Germany, Guenni

                      • 8. Re: Request Expedition Cell Editor: Assembly font settings on every cell in library?
                        rohan.dervankar

                        i m getting an error on line 62. undefined variable scripthelper.

                         

                        pls help.