1 Reply Latest reply on Feb 20, 2014 11:52 PM by Patrick.Cashman

    How can I translate particular Part number in Library manager and Dxdesigner with excel sheet?

    bkk.kim

      Hello...

      I want to translate temporary part number to formal part number in Library manager.

      we have many tempoorary parts.

      For example, we have many temp part numbers to be converted as below chart.

      I want to use automation script to translate at once.

      Please can you help me???

       

      Temp CodeFormal Code
      T000001F001280
      T000002F001989
      T000004F001992
      T000005F001993
      T000003F001736
      T000001F002724
      T000002F002725
      T000003F003186
      T000006F003190
      T000006F001470

        • 1. Re: How can I translate particular Part number in Library manager and Dxdesigner with excel sheet?
          Patrick.Cashman

          This is possible with the use of the Part Editor Dialog.

           

          Notes:

          1. I work in VB.net, so this will be somewhat different than VBS or doing it with an EFM.

          2. I use the following example in conjuction with an open DxDesigner project.  Thus I have a prj variable here that derives from the Viewdraw application project data.

           

          How to do it:

          1. I have a module that connects to the Part Editor in the Central Library by way of Get_Part_Editor():

           

          Public Module DX_Library_Interface

           

              Public job As String

              Public part_ed_dlg As MGCPCBPartsEditor.PartsEditorDlg

              Public pdb_db As MGCPCBPartsEditor.PartsDB

           

              Public partitions As MGCPCBPartsEditor.Partitions

              Public partition As MGCPCBPartsEditor.Partition

              Public parts As MGCPCBPartsEditor.Parts

              Public part As MGCPCBPartsEditor.Part

           

              Public Sub Get_Part_Editor()

                  'Creates a handle to the Parts Editor in Library Manager

                  job = prj.CentralLibraryPath

                  part_ed_dlg =CreateObject("MGCPCBLibraries.PartsEditorDlg")

                  pdb_db = part_ed_dlg.OpenDatabaseEx(job, False)

                  If part_ed_dlg.LockServer() Then

                      'do nothing

                  else

                      msgbox("Could not lock database for writing")

                  End If

              End Sub

           

              Public Sub Drop_Part_Editor()

                  'Close the open library and release hooks

                  part_ed_dlg.UnlockServer

                  part_ed_dlg.CloseActiveDatabase

                  pdb_db = Nothing

                  part_ed_dlg = Nothing

              End Sub

           

          End Module

           

          2. Here is an example Subroutine that uses an externally created arraylist (obs_parts) to change the part number of certain parts in the Central Library:

           

              Public Sub set_library_obsolete_parts()

                  Dim tmp As String

                  Dim part As MGCPCBPartsEditor.Part

                  Dim partition as MGCPCBPartsEditor.Partition

           

                  Get_Part_Editor()

           

                  partitions = pdb_db.Partitions

                  For Each partition In partitions

                     parts = partition.parts

                      For Each part In parts

                          If obs_parts.Contains(part.number) Then

                              tmp = part.number

                              part.Number = tmp & "-OBS"

                              part.Name = tmp & "-OBS"

                          End If

                      Next

                  Next

                  part_ed_dlg.SaveActiveDatabase

                  Drop_Part_Editor()

           

              End Sub

           

          So I suppose you could use VBA in Excel to connect to the Part Editor then make a routine that runs against the part of the spreadsheet with the temp and formal part numbers. To do this you need to reference the MGCPCBPartsEditor COM object.  Also a reference to the ViewDraw COM object if you want to use it like I do with a DxDesigner database. Otherwise just simply provide the path to the Central Library in string format in place of how I do it with the job = prj.CentralLibraryPath method.