Hello, the terminology I used in the subject of this post may be ambiguous/incorrect. I have an automated assembly that updates based on values entered in a spread sheet and facilitated by code in vba. However, I usually have to click "Update Active Level' a few times to complete the model's transfromation even though I have 'Automatic Update' selected . Is there a non-programmatic solution? If not, is it possible to access the Update method programmatically so that the user won't have to click the button?
Solved! Go to Solution.
I would add some sentences to your VBA application.
First, if possible, before changing variables I would activate all the parts:
(oASM is the AssemblyDocument object)
1. After changing variables I would do:
2. If this doesn't work (it should) then you could traverse the occurrences in your ASM and for each one do something like:
(oOcu is the Occurrence object)
For Each oOcu In oASM.Occurrences oOcu.makewritable oDoc = oOcu.OccurrenceDocument oDoc.Recompute Next oASM.UpdateAll() oASM.UpdateDocument()
If you have subassemblies and changes in subOccurrences you might have to do this recursively.
I hope the first solution would be enough
Thank you for your reply. I will be implementing this shortly and will let you know how it goes.
Everything works besides oDoc.Recompute. VBA gives me a run time error '438' saying that the object doesn't support this property or method. In the Solid Edge ST9 SDK Library I don't see any methods for Recompute Occurrence. Maybe this method isn't available for the OccurrenceDocument object?
As you can see in my example, Recompute method applies to PartDocument or SheetMetalDocument object.
NOT in assembly document objects or in occurrences.
When you access from an occurrence you must do it like in my example:
dim oOcc as SolidEdgeassembly.Occurrence
dim oDoc as SolidEdgePart.PartDocument 'For example
oDoc=oOcc.OccurrenceDocument 'Access to the document object from the occurrence
oDoc.Recompute 'Recompute the Part Document
The method does NOT exist for an Occurrence object
oOcc.Recompute 'ERROR. This does not exist.
I checked that Recompute method does exist in ST9.
It is also possible that the error was caused because the Occurrence object would be a subassembly? (Recompute method is for parts, not assemblies)
Thank you for clearing that up. I was able to get my program to use recompute on only the occurences that are parts. I ommitted the oOcu.MakeWritable line because I was being denied permission to certain files.What are the potential consequences of omitting this line from my code? I haven't noticed any effect on my programs performance yet. Thank you for all your help.
I ommitted the oOcu.MakeWritable line because I was being denied permission to certain files.What are the potential consequences of omitting this line from my code? I haven't noticed any effect on my programs performance yet.
In theory, you should be using "MakeWritable" is changes are done inside those files.
Anyway, f you can save the main assembly after running the macro, everything should be all right.
I don't know why you got some files with denied permissions... It's strange.