AnsweredAssumed Answered

How do I get a collection of properties on a part using MGCPCBPartsEditor and C#

Question asked by andrew_french on Mar 7, 2011
Latest reply on Mar 7, 2011 by mans.joling

I'm trying to convert my scripts from vb to c#.  I wrote a template for getting info on parts from the library a while back: my vb code is at the bottom or you can view it here.


'Iterates through each part in each partition and collects the needed info for oracle and DxDatabook


Dim partitions As MGCPCBPartsEditor.Partitions

Dim partition As MGCPCBPartsEditor.Partition

Dim parts As MGCPCBPartsEditor.Parts 

Dim part As MGCPCBPartsEditor.Part

Dim cellRefs As MGCPCBPartsEditor.CellReferences

Dim cellRef As MGCPCBPartsEditor.CellReference


Dim symbs As MGCPCBPartsEditor.SymbolReferences

Dim symb As MGCPCBPartsEditor.SymbolReference


Dim props As MGCPCBPartsEditor.Properties 

Dim prop As MGCPCBPartsEditor.Property


'Get the collection of partitions in the parts editor

partitions = docPED.Partitions


'Step through each partition in the parts editor


For Each partition In partitions


'Get the collection of parts in the current partition

parts = partition.Parts


'Step through each part in the parts collection


For Each part In parts


'Collect part information here


'Get the collection of cells for the current part

cellRefs = part.CellReferences


'Step through each cell in the cells collection


For Each cellRef In cellRefs


'Collect cell information here




'Get the collection of symbols for the current part

symbs = part.SymbolReferences


'Step through each symbol in the symbols collection


For Each symb In symbs


'Collect symbol information here




'Get the collection of properties on the current part

props = part.Properties


'Step through each property in the properties collection


For Each prop In props


'Collect properties information here

propList.Add(prop.Name & ": " & prop.Value)





The issue I am having is finding how to collect the properties for the specific part now.  In C# I had to change how I got the collection of symbols and cells which ended up looking like:

symbs = part.get_SymbolReferences();


unfortunately there is no get_properties() call available for MGCPCBPartsEditor.Part


How do I get the collection of properties associated with a part without knowing in advance the names of the properties.