9 Replies Latest reply on Feb 21, 2014 12:15 AM by Patrick.Cashman

    Move Components (Relative or Absolute) in Expedition PCB

    fuba

      Hello Community,

       

      I am trying since a while, to move components (Resistors, Capacitors, ...) on a PCB by using VB Script / VB.Net.

      Unfortunately I have no luck. I am trying this by using the COM Automation Interface to the Expedition PCB Application.

       

      The Simple Version of the Code I am using right now is listed below.

      My problem is, that it always gives me the Error "DRC-Violation" what might be wrong ?

      Any suggestions ?

       

      '#################

       

              Dim pcbApp As MGCPCB.Application

              pcbApp = GetObject(, "MGCPCB.Application")

       

              Dim pcbDoc As MGCPCB.Document

              pcbDoc = pcbApp.ActiveDocument

       

              Dim MyComp As MGCPCB.Component

              MyComp = pcbDoc.FindComponent("R3")

       

              If IsNothing(MyComp) Then

                  Exit Sub

              Else

                  'go on

              End If

       

              If (MyComp.Placed = False) Then

       

                  '#

                  '# unplaced components are not / cannot be moved

                  '#


              End If

       

              If MyComp.Name = "R3" Then

       

                  Debug.Print("Component Found")

       

                  'Place the component in the correct location

       

                  ' pcbDoc.TransactionStart()


                  Call MyComp.MoveRelative(2.0, 5.1, EPcbUnit.epcbUnitCurrent)


                  ' pcbDoc.TransactionEnd()

       

                  MyComp = Nothing

       

              End If

       

       

      '#################

       

      The Line

       

                  Call MyComp.MoveRelative(2.0, 5.1, EPcbUnit.epcbUnitCurrent)

       

      fires the "DRC-Violation" Error. I also read in the Expedition Help, that using the Trasaction Start/End

      Commands should be used. But this also gives me an error. not the same error, but it tells me

      something like "Cannot Lock the server".

       

      So, If someone has a good Idea, I am happy to test it.

       

      Thanks

       

      Stefan