Cancel
Showing results for 
Search instead for 
Did you mean: 

Is there an API for the 'Update Active Level' method in the tools tab? If so, how do I access it?

Pioneer
Pioneer

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? 

 

Thank you!

6 REPLIES 6

Re: Is there an API for the 'Update Active Level' method in the tools tab? If so, how do I access it

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

Hi,

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)

oASM.ActivateAll

 

1. After changing variables I would do:

oASM.UpdateAll

oAsm.Updatedocument

 

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

Regards,

Julian

Julian Guillo
Pixel Sistemas SL
Spain

Re: Is there an API for the 'Update Active Level' method in the tools tab? If so, how do I access it

Pioneer
Pioneer

Julian,

 

Thank you for your reply. I will be implementing this shortly and will let you know how it goes. 

Re: Is there an API for the 'Update Active Level' method in the tools tab? If so, how do I access it

Pioneer
Pioneer

Julian,

 

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? 

Re: Is there an API for the 'Update Active Level' method in the tools tab? If so, how do I access it

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

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)

Julian Guillo
Pixel Sistemas SL
Spain

Re: Is there an API for the 'Update Active Level' method in the tools tab? If so, how do I access it

Pioneer
Pioneer

Julian,

 

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.

Re: Is there an API for the 'Update Active Level' method in the tools tab? If so, how do I access it

Solution Partner Genius Solution Partner Genius
Solution Partner Genius


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. 

Hi,

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.

Regards,

Julian

Julian Guillo
Pixel Sistemas SL
Spain