Export spreadsheet containing certain expressions and in a certain format

Hello,

I've been struggling with recording and coding a journal in VB that will export an entire assembly's expressions to an excel spreadsheet in a certain format.

The expressions are scattered across the assembly structure and describe hole location and diameter, but they are all unique and numbered sequentially: H1, D1, X1, Y1, Z1, H2, D2, X2, Y2, Z2, H3, ... and so forth.

H1 is a string value of either "L" or "R"
X1, Y1, Z1 and D1 are all integer of measurement length

For the time being, I'd like to create a journal that can export the expressions to a spreadsheet grouping the numbers sequentially in rows top-to-bottom. The columns should contain from left to right X, Y, Z, H, D - values.

I've only gotten as far as figuring out recursive functions to run through the assembly before realising this is a bit larger than anticipated.

Can anyone help me, please?

Cheers.

Will various components have expressions with the same name? For example, if component A has expressions H1, D1, X1, etc. will any other component have expressions also named H1, D1, etc.? Or are the expression names unique across the assembly (only 1 expression named H1)?

The main problem is going to be finding the holes. Here is some code that does this, stolen from the SNAP Reference Guide

Imports Snap, Snap.Create, Snap.Topology
Imports System.Drawing.Color

Public Class MyProgram

Public Shared Sub Main()

' Build a sample part
Dim base As Snap.NX.Body = Block({0, 0, 0}, 8, 4, 2)
Dim boss As Snap.NX.Body = Cylinder({2, 2, 1}, Snap.Vector.AxisZ, 2.0, 2.0).Body
Dim hole As Snap.NX.Body = Cylinder({6, 2, 1}, Snap.Vector.AxisZ, 2.0, 2.0).Body
Dim temp As Snap.NX.Body = Unite(base, boss).Body
Dim part As Snap.NX.Body = Subtract(temp, hole).Body

' Use face senses to identify holes and bosses
For Each face As NX.Face In part.Faces
If face.ObjectSubType = NX.ObjectTypes.SubType.FaceCylinder Then
If face.Sense = Sense.Positive Then face.Color = Red ' A boss; color it red
If face.Sense = Sense.Negative Then face.Color = Green ' A hole; color it green
End If
Next

End Sub
End Class

Once you find a hole, you can write its info to a text file in CSV format, and then open the CSV file in Excel.