Hi everyone,
I have a script for one of my assemblies that changes the BOM Structure on supressed items so that my drawing BOMs show correct quanties for the current representation. The assembly I use this on is very large so the script takes a long time to run. To change the BOM structure I have to mark the part as active then change it and deativate it. I think I would gain a lot of speed if I could tell Inventor not to update the screen during this process.
Does anyone know how to do this?
Thanks,
ThisApplication.StatusBarText = "BOMAudit " Dim oDoc As Document = ThisDoc.Document Dim oCompDef As Inventor.ComponentDefinition = oDoc.ComponentDefinition Dim oCompOcc As Inventor.ComponentOccurrence doc = ThisDoc.Document For Each oCompOcc in oCompDef.Occurrences voCompOcc = Component.InventorComponent(oCompOcc.Name) If oCompOcc.Suppressed = True Then 'Check for suppressed files without Default BOM Structure Component.IsActive(oCompOcc.Name) = True oCompOcc.BOMStructure = BOMStructureEnum.kReferenceBOMStructure Component.IsActive(oCompOcc.Name) = False Else Component.IsActive(oCompOcc.Name) = True 'Turn on to allow for update oCompOcc.BOMStructure = BOMStructureEnum.kDefaultBOMStructure End If Next
Solved! Go to Solution.
Solved by adam.nagy. Go to Solution.
Hi there,
There are a few ways that you might be able to speed up your code, including:
StartGlobalTransaction, Application.ScreenUpdating, Application.AssemblyOptions.DeferUpdate
Here is Brian's class on this topic where you can find the above things too:
Cheers,
Thanks Adam!
Using StartGlobalTransaction helped a ton. I combined that with stopping the screen from updating and I was able to take the average run time from 152.812s to 48.008s.
Hi,
You can also check:
InventorApp.UserInterfaceManager().UserInteractionDisabled.
I got very good results disabling user input together with the other options already mentioned in Adam post.
Regards
Fabio