Replace vertical component, rotate and align with net

Discussion created by Cadiat on Jul 23, 2014
Latest reply on Apr 10, 2017 by


I need some help with automation of replacing our vertical symbols. I can't manage to align rotated symbol with its predecesor.


CAP.1 = horizontal symbol, CAP.2 = vertical symbol


When I find CAP.2 I get the component's net and X,Y location of the pin:


Comp.Selected = True

For each Conn in Comp.GetConnections

     set NetName = Conn.Net

     set CmpPin = Conn.CompPin

     if not NetName is Nothing Then

          net = NetName.GetConnectedNetName(Conn.Segment)

          set AttrPinNum = CmpPin.FindAttribute("Pin Number")

          if not AttrPinNum is Nothing Then

               PinNum = AttrPinNum.Value

               pins.Add PinNum, net

               PinX = CmpPin.GetLocation().X

               PinY = CmpPin.GetLocation().Y

               pinsX.Add PinNum, PinX

               pinsY.Add PinNum, PinY

          End if

          End If



Then I replace symbol:


ActiveView.Block.ChangeComponentPreserveRefDes "< Selected Components >", "CAP.1"



After that I tried to rotate the symbol and set connections back as they should be:


Comp.Orientation = VDORIENT_ROT90

For each ObjPin in vdview.Query(VDM_PIN, VD_ALL)

     set AttrPinNum = ObjPin.FindAttribute("Pin Number")

     if not AttrPinNum is Nothing Then

          PinValue = AttrPinNum.Value

          ObjPin.SetLocation pinsX.Items(PinValue), pinsY.Items(PinValue)

     end if



The result is unfortunately not as expected. How can I force my pin location to determine the component location?


Also this process is quite slow. Any suggestion how can I speed it up?