List all IDW file in Project and Access iprops

List all IDW file in Project and Access iprops

MarkyTomm
Enthusiast Enthusiast
384 Views
5 Replies
Message 1 of 6

List all IDW file in Project and Access iprops

MarkyTomm
Enthusiast
Enthusiast

Hi anybody that could help

 

I am starting to write a bit of vba or ilogic code with 3 stages - if anybody has done this already thenI would appreciate a point in the right direction.

 

1) Search through the IDW files contained in the project folder (and sub folders but excluding "oldversions" folders) and add the file name to an array. - Filter only filenames that begin with a preset string ie "AB1234"

 

2) As each file is added to the array, read the current value of the iprop.revision number  field and store the value to the array.

 

3) Write the array to a spreadsheet file.

 

Thanks in advance

Mark

0 Likes
385 Views
5 Replies
Replies (5)
Message 2 of 6

Michael.Navara
Advisor
Advisor
  1. For looking for IDW files in some directory is useful Directory.EnumerateFiles Method 
  2. For iProperty reading is the fastest solution the ApprenticeServer. Instead of open drawing in full inventor.
  3. As an output you can use simple text .csv file instead of Excel .xls file.
0 Likes
Message 3 of 6

MarkyTomm
Enthusiast
Enthusiast

Hi Michael,

 

Thanks for taking the time to reply,

 

I could not find reference to the directory.enumeratefiles method in the vba programminbg ref - is this a vb.net method? Could you suggest a similar function withing vba or will I have to learn how to plug this method into vba

 

I would like to keep the code within vba if possible as I have a basic understanding of what is going on, there will only be around 20 files so processing time is not an issue

 

Yes, I agree, a simple csv text file will be more efficient

0 Likes
Message 4 of 6

Michael.Navara
Advisor
Advisor

You can try to use FileSystemObject but switch to VB.NET / iLogic is the right way in my opinion. 

0 Likes
Message 5 of 6

MarkyTomm
Enthusiast
Enthusiast

Hi have been trying to solve stage 1 with this code

 

Private Sub TestForIDW()
Dim oProcessPath As String
oProcessPath = ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath & "\"
Dim oFileNames() As String
'Dim oFileName As Variant
oFileNames() = System.IO.Directory.GetFiles(oProcessPath, "*.idw", SearchOption.AllDirectories)
For Each oFileName In oFileNames
Debug.Print (oFileName)
Next
End Sub

 

but I get and 424  "object required" error on the System.IO call

0 Likes
Message 6 of 6

MarkyTomm
Enthusiast
Enthusiast

And this works Ok but does not recurs sub folders

 

Private Sub TestForIDW2()
Dim oProcessPath As String
oProcessPath = ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath & "\"

Dim oFilename As String
oFilename = Dir(oProcessPath & "*.idw")
Do While oFilename <> ""
Debug.Print oProcessPath & oFilename
oFilename = Dir
Loop
End Sub

0 Likes