Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

RE: How to activate a model in C# V8i

$
0
0

Hi,

a few unsorted comments and thoughts that crossed my mind when I read the discussion:

  • It's not mentioned in documentation if VBA method Activate() is (a)synchronous. My feeling is that it behaves more as asynchronous, so it starts the model activation process, but MicroStation is still busy despite off method is finished. Model activation (opening a model or the whole file) is pretty complex and lengthy process. I think the right time to work with newly opened model is affter EnterIdle event is raised, not earlier.
  • I did not try it, but without waiting for the idle state, I can imagine something can go wrong.
  • Yes, I agree, the workaround with using pause is ugly ;-)
  • I am not sure I remember it right, but loading addin to own domain was discussed in the past and I think it's not officially supported by Bentley despite of it's possible. And some posts describe errors or strange behaviour of some API or MicroStation parts if an addin runs in own domain.
  • In my opinion the usage of C++/CLI is overkill in this situation. I think it should be enough to call mdlModelRef_activateAndDisplay using P/Invoke directly from C# code. I assume MdlModelRefP available in VBA API can be passed to mdlModelRef_activateAndDisplay (but have not tested it).
  • There is a memory leak in your C++/CLI code: You has to free DgnModelRefListP using mdlModelRefList_free.
  • When you iterate model list in MDL, you should test and filter received models from hidden ones. I guess you don't want to use your function for such models, created by MicroStation or other application for a specific purposes.

With regards,

  Jan


Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>