I made an assembly with 2 parts, and used Occurrence Properties interactively to move the parts about. In my program, I'm calling GetMatrix on the part occurrence and am getting a 0 matrix. (Not even an identity.) What's wrong?
foreach (Occurrence x in doc.Occurrences)
var d = x.OccurrenceDocument;
double docmat = new double;// Array.CreateInstance(typeof(double), 16);
Here is some sample code that should explain everything. I also demonstrated how to leverage extension methods to make the matrix conversion from Array -> double cleaner. Let me know if you have any questions.
static void Main(string args)
var application = SolidEdgeUtils.Connect();
var assemblyDocument = application.GetActiveDocument<SolidEdgeAssembly.AssemblyDocument>();
var occurrences = assemblyDocument.Occurrences;
var occurrence = occurrences.Item(2);
// Demonstrate getting matrix of type Array.
var matrixArray = Array.CreateInstance(typeof(double), 0);
// Demonstrate converting matrix of type Array to double.
var matrix = matrixArray.OfType<double>().ToArray();
// Demonstrate using extension method to get matrix of type double.
matrix = occurrence.GetMatrix();
public static class OccurrenceExtensions
public static double GetMatrix(this SolidEdgeAssembly.Occurrence occurrence)
Array matrix = Array.CreateInstance(typeof(double), 0);