VBA Rebuild All
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi guys, I was wondering if anyone might be able to help explain the difference between the VBA rebuild and rebuild2? I currently run a script that I tie to ctrl+s that's basically rebuild and save using the VBA rebuild method and when I wrote this script it looked like if it was ran from an assembly it would update all the components in that assembly. Unfortunately it seems I misunderstood the rebuild command because last week there were some sub-assemblies that were loaded in a main assembly without the latest changes from the sub-asssembly being reflected in the main assembly but the sub-assembly, when opened, showed parts correctly constrained. I'm thinking my rebuild and save script may need an accompanying script that does a more thorough job of ensuring each sub-assembly gets rebuilt. I've looked at Rebuild and Rebuild2 and from what I gather they pretty much function the same way except Rebuild2 has some small error handling? If that's the case would something that iterates through the assembly, all sub-assemblies, and all parts to ensure everything is up to date essentially need to loop through all the referenced components and run a rebuild? Just a bit irritated that I lost about an hour and a half and some hair over the part where the sub-assembly constraints were right in the sub-assembly but wrong in the main assembly and the rebuild and save script I run didn't get things to change, then happened again on some hole locations and missing cut-outs this morning
The script I'm running for reference
Public Sub RebuildAndSave()
On Error GoTo GetOut
ThisApplication.ActiveDocument.Update2
ThisApplication.ActiveDocument.Rebuild2
ThisApplication.ActiveDocument.Save2
GetOut:
End Sub
Sub Rebuild()
Member of Inventor.Document
Performs compute operations on all of the entities within this Document's scope as if all of the driving entities had been 'dirtied'
Function Rebuild2([AcceptErrorsAndContinue As Boolean = True]) As Boolean
Member of Inventor.Document
Method that performs compute operations on all of the entities within this Document's scope as if all of the driving entities had been 'dirtied', returns False if any errors are encountered during the rebuild