Good morning, i have a little problem to studies a tree's assembly. By VB.net I want to write in a txt's file all component name of my assembly but after differents tests i didn't do this. Can you help me to resolve this problem?! Thank you very much and good job
Excuse me for my explanation imprecise. Now as an assembly can not print the paths of all the top-level components parts or assemblies that are. But if I wanted to capture the information also subassemblies and print the paths of their components ?!
This is the code that I have done so far for printing
Private Sub Button1_Click (ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim objApplication As SolidEdgeFramework.Application = Nothing Dim objAssembly As SolidEdgeAssembly.AssemblyDocument = Nothing Dim objRelations3d As SolidEdgeAssembly.Relations3d = Nothing Dim obj () As Object Dim objOcc As SolidEdgeAssembly.Occurrences Dim path (0) As String Try 'Connect to a running instance of Solid Edge objApplication = Marshal.GetActiveObject ("SolidEdge.Application") 'Get a reference to the active document objAssembly = objApplication.ActiveDocument objOcc = objAssembly.Occurrences Dim str As String = objOcc.Application.ActiveEnvironment path (0) = objOcc.Parent.FullName CounterObj Dim As Integer = objOcc.Count ReDim Preserve obj (counterObj) ReDim Preserve path (counterObj + 1) For i As Integer = 1 To counterObj Step 1 obj (i) = objOcc.Item (i) path (s) = obj (i) .PartFileName Next
For Each foundFile As String In path foundFile = foundFile & vbCrLf My.Computer.FileSystem.WriteAllText ( "C: \ temp \ test.txt", foundFile, True) Next
MsgBox ("Finish") Catch ex As Exception MsgBox ("Error" & vbCrLf & ex.Message) End Try