Hi A.Acheson
Right now I'm using this code:
There is no custom Iproperty for mass in these parts and drawings.
I just want the physical mass next to the name of the part in a excel or cvs.
Right now the code only pulls the name out of the file and onto the .cvs file (which is a good start tbh) but no other information. The cells look like this right now: XTD_ACTUALPARTNAME,,""
Opening each document and updating by code will still be faster then doing this manually.
Thanks for the help
Code Below
Imports System.IO
' Declare the Application object
Dim oApplication As Inventor.Application
' Obtain the Inventor Application object.
' This assumes Inventor is already running.
oApplication = GetObject(, "Inventor.Application")
' FOLDER selection dialog
Dim FilePATH As String = "FilePATH"
Dim dialog As New System.Windows.Forms.FolderBrowserDialog()
dialog.SelectedPath = "R:\Drawings"
dialog.Description = "Select Folder to Pull Drawing Properties From (recursive)"
If dialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
drawingDir = dialog.SelectedPath
Else
MsgBox("canceled!")
End If
' FILE Selection dialog
Dim oFileDlg As Inventor.FileDialog = Nothing
InventorVb.Application.CreateFileDialog(oFileDlg)
oFileDlg.InitialDirectory = oOrigRefName
oFileDlg.CancelError = True
On Error Resume Next
oFileDlg.ShowOpen()
If Err.Number <> 0 Then
Return
ElseIf oFileDlg.FileName <> "" Then
selectedfile = oFileDlg.FileName
End If
'Dim drawingDir = "R:\Drawings"
For Each foundFile As String In My.Computer.FileSystem.GetFiles(drawingDir, FileIO.SearchOption.SearchAllSubDirectories, "*.dwg")
ThisDoc.Launch(foundFile)
' Set a reference to the active document.
' This assumes a document is open.
Dim oDoc As Document
oDoc = oApplication.ActiveDocument
' Obtain the PropertySets collection object
Dim oPropsets As PropertySets
oPropsets = oDoc.PropertySets
PartNo = oPropsets.Item("{32853F0F-3444-11d1-9E93-0060B03C1CA6}").ItemByPropId(kPartNumberDesignTrackingProperties).Value
Revision = oPropsets.Item("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}").ItemByPropId(kRevisionSummaryInformation).Value
Description = oPropsets.Item("{32853F0F-3444-11d1-9E93-0060B03C1CA6}").ItemByPropId(kDescriptionDesignTrackingProperties).Value
'Write data info To CSV File
Dim oAppend As System.IO.StreamWriter
'selectedfile = "C:\temp\Book1.csv"
oAppend = IO.File.AppendText(selectedfile)
oAppend.WriteLine(PartNo & "," & Revision & "," & Chr(34) & Description & Chr(34))
oAppend.Flush()
oAppend.Close()
ThisApplication.Documents.CloseAll()
Next