AnsweredAssumed Answered

Quick Pin Out - DxDesigner

Question asked by andrew_french on Jul 24, 2013
Latest reply on Sep 16, 2013 by robert_davies

I had a request for a script in Dx (EE7.9.4) so that the end user could select a symbol in the schematic and run a quick command that would dump into a text file the ref des, part number, pin number, and then the name of the net connected to that pin.  So the output looks something like the following, one line for every pin on the symbol.

 

J1     somePnum     A1     GND

J1     somePnum     A2     +5V

....

 

I figured out a way to do this and all was good for a while until someone decided to do pin swaps.  For some reason the script only reports the original way the symbol was hooked up despite what the schematic shows and yes I checked to make sure that the front end and the back end were in sync with each other first.  I'm not sure if this is due to the way I coded my script or if it has to do with a discrepancy on Mentor's end.  Any help figuring this out would be awesome!  I believe my issues start after the comment //grab the connections to the part

here are the meat and potatos of the script, its in C#.net

 

//Creates a handle to a running instance of DxDesigner

ViewDraw.Application VdApp = (ViewDraw.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Viewdraw.Application");

 

//Creates a handle to the current view in DxDesigner

ViewDraw.IVdView VdView = VdApp.ActiveView;

 

//A list to store all the Part Info in

 

List<PartInfo> PIList = new List<PartInfo>();

 

//Variable that will hold the collection of symbols

ViewDraw.IVdObjs compObj;

 

//Query the view for the collection of symbols

compObj = VdView.Query(ViewDraw.VdObjectTypeMask.VDM_COMP, ViewDraw.VdAllOrSelected.VD_SELECTED);

 

//Verify that at least one symbol was selected

 

if (compObj.Count >= 1)

{

 

     //iterate through the collection of symbols selected

     for (int x = 1; x <= compObj.Count; x++)

     {

     ViewDraw.Component comp = compObj.Item(x);

     PartInfo PI = new PartInfo();

 

     //Attempt to grab the Part Number

 

     try

     {

          PI.PartNumber = comp.FindAttribute("Part Number").Value.ToString();

          PI.RefDes = comp.Refdes;

     }

 

     catch

     {

          //If it fails finding the part number the item is a Hierarchy Block/Composite Symbol

          PI.PartNumber = "Composite Symbol";

          PI.RefDes = "No Refdes";

     }

 

     //grab the connections to the part

     ViewDraw.IVdObjs connectObj;

     connectObj = comp.GetConnections();

 

     //iterate through the connections

     for (int y = 1; y <= connectObj.Count; y++)

     {

          ViewDraw.Connection conn = connectObj.Item(y);

 

          //get the pin name at the connection

          PI.PinName.Add(conn.CompPin.Pin.GetName(ViewDraw.VdNameType.FULL_PATH_FROM_BLOCK));

 

          //Attempt to get the segments(nets) attached to the connection

 

          try

          {

               ViewDraw.IVdObjs segmentObjs = conn.Net.GetSegments();

               PI.NetName.Add(conn.Net.GetConnectedNetName(segmentObjs.Item(1)).ToString());

          }

 

          catch

          {

 

          //if there are no segments(nets) connected report it

          PI.NetName.Add("No Connection");

          }

  

     }

 

//Add the current part to the list of Part Information

PIList.Add(PI);

}

 

 

Outcomes