- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Quickly open assembly without loading any parts to grab iproperties
Hi,
I am trying to grab descriptions of parts and assemblies we have in our library and write these to an xml file. I am currently doing that by opening each file (using silent operation, screen updating false, etc.) then grabbing the description in this case and closing the file. It is working quickly for .ipts but takes too much time when going through thousands of .iams. Is there a faster way to grab iproperties? Can I open just the .iam and not load any parts to speed this up?
I am currently using inventor VBA, I know apprentice would speed it up a little but I am looking for something that will take a fraction of the time.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Are you making use of the Documents.OpenWithOptions() method, or just the Documents.Open() method? The OpenWithOptions method allows you to open assemblies in Express Mode, Skip All Unresolved Files, & Defer Updates, which might help speed up the process a bit. Also, depending on if you are using 2022 or earlier version, you can specify ModelState or LevelOfDetail, which if a simplified one exists, also helps to not load unnecessary stuff into memory, which might help too.
Wesley Crihfield
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm currently on Inventor 2022 and using openwithoptions.
Do model states need to be set up for each assembly?
Here's my actual code:
' Catch errors and set silent operation back to false
On Error GoTo ERROR_PART_DESCRIPTION
ThisApplication.SilentOperation = True
ThisApplication.ScreenUpdating = False
Dim openOption As NameValueMap
Set openOption = ThisApplication.TransientObjects.CreateNameValueMap
'Call openOption.Add("DeferUpdates", True)
Call openOption.Add("SkipAllUnresolvedFiles", True)
Dim oDoc As Document
Set oDoc = ThisApplication.Documents.OpenWithOptions(File.Path, openOption, False)
'Set oDoc = ThisApplication.Documents.Open(File.Path, False)
Dim SumProp As PropertySet
Set SumProp = oDoc.PropertySets.item("Design Tracking Properties")
Set att = documento.createAttribute("description")
att.nodeValue = SumProp.item("Description").value
Call eCurrentFile.setAttributeNode(att)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I honestly haven't messed with the new ModelStates that much yet, because I didn't use the level of detail settings that much either, in favor of using the design view representations. But basically the main purpose/use of LevelOfDetail representations was to help conserve system/session memory by not loading components into memory when they were set to suppressed in that level of detail. So, essentially you could create a level of detail representation of your main assembly in which most of the components were suppressed, then specify that representation when opening that assembly, and it would be similar to opening the assembly in Express Mode, but even better, because none of those components would be loaded into memory when you opened the assembly. So, since the new ModelStates are the direct replacement of LevelOfDetail representations, I'm assuming they can be used much the same way, but with way more uses/functionality now. In short, yes, if you wanted to take advantage of this scenario, since all new part/assembly documents only have the 'Master' ModelState, you would have to create one just for this purpose in each document. May be too much work for your purposes here, plus it complicates things a bit.
Wesley Crihfield
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Likely the apprentice server and a standalone .exe ran through vb script would be quicker. At least you have full functionality of inventor while it churns away. I will dig out a post I found on this forum tomorrow, it works on Inv 2020 so I am not sure if there is any changes to its functionality since then.
Is task scheduler an option to run while your not using inventor? https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/using-task-scheduler-to-run-ilogic/td-p...
Or if this helped you, please, click (like)
Regards
Alan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Here is the post, message 6 from MechMachineMan uses a vb script to check an assembly via apprentice server for missing files. You can just replace this section with your iproperty retrieval.
Or if this helped you, please, click (like)
Regards
Alan