AnsweredAssumed Answered

fully load component model doc without user noticing

Question asked by Jana Stahn on Aug 18, 2020
Latest reply on Sep 15, 2020 by Jana Stahn

I have the following assembly:

I am looking for a way to retrieve level3 via IModelDoc2.Extension.GetObjectByPersistReference3 from the IModelDoc2 of level2 while having level1 the active doc. It seems that this is not possible without loading some more data before making the GetObjectByPersistReference3 call. Even if the IComponent2 for level2 has IsLoaded() = true, it will only return null.


So the question is, what do I need to do in order to have level2's IModelDoc2 fully loaded, but WITHOUT the user noticing?


I tried 3 things:

1. load level2's IModelDoc2 via ISldWorks.OpenDoc6, silently and invisibly. This does not help.

2. load level2's IModelDoc2 via ISldWorks.OpenDoc7, silently and invisibly. This does not help either.

3. make level2's IModelDoc2 visible and then invisible again. This does help, but the user might notice, so I would prefer another way if possible. Also it is quite slow.


The attached macro contains all three methods: Just change the value of the "switch" variable before running it. The model level1.SLDASM must be the active doc for the macro to function.


And ideas what else could fully load the IModelDoc2 of level2?