
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am trying to develop a bit of code for a plug-in that will iterate through a directory and open all .ipt or .iam files that were created after a certain time.
The current document would always be a file that meets this criteria.
The end goal would be to open each .ipt and .iam file and remove iProperty Fields, then close them all (not including the file that is currently open).
Here is where I am at right now. I have commented out my ideas of what I think should happen, but I am also open to ideas to make this more efficient too. I was thinking if the directory could be sorted by date, maybe it would be easier to a Do While that checks if the oParts/oAssys Creation Date >= oTime.
Dim oTime As String = DateTime.Now()
Dim oActDoc As Inventor.Document = g_inventorApplication.ActiveDocument
Dim oCurrFile = ThisApplication.ActiveDocument.FullFileName
Dim oCurrDir = System.IO.Path.GetDirectoryName(oCurrFile)
Dim NewFilename As String = oActDoc.FullFileName
Dim oFiles = System.IO.Directory.GetFiles(oCurrDir, "*.ipt", System.IO.SearchOption.TopDirectoryOnly)
Dim oAssys = System.IO.Directory.GetFiles(oCurrDir, "*.iam", System.IO.SearchOption.TopDirectoryOnly)
'Get an Array List of all oFiles and oAssys that have a creation date made later than the oTime
'Iterate through array list of all oFiles and oAssys (Skip file if it is oCurrFile)
'System.IO.File.Open(oFiles or oAssys)?
oPropSet = oActDoc.PropertySets("Design Tracking Properties")
oProp = oPropSet.Item("Stock Number")
oProp.Value = ""
oProp = oPropSet.Item("Project")
oProp.Value = ""
'Systems.IO.File.Close(oFiles or oAssys)?
'End Iteration
Would this be doable? Let me know if I need to clarify. Thanks!
Solved! Go to Solution.