I've come across a "bug" I can't explain and about which I would appreciate further info (cf code below). I'm trying to run an API at the end of which FEMAP will be closed with no user interaction.
If I do only step 1 and 4 it works fine
If I do step 1, 2 and 4 then FEMAP crashes
If I add step 3 it works
So it seams there is some kind of a handle left open when dealing with the view object.
My questions are:
- why? or rather is this normal?
- are there other FEMAP API objects for which this is true (which I need to "kill" to avoid crashing)? I need to apply this principle to a bunch of macros, which deal with many different FEMAP objects. I've tested with feNode for example and there is no crash.
Thanks for your help,
Sub Main Dim App As femap.model Set App = feFemap() 'step1 Dim l1 As Long App.feAppGetActiveView(l1) 'step2 Dim v As femap.View Set v = App.feView v.Get(l1) 'step3 Set v = Nothing 'step4 App.feFileClose(False) App.feFileExit End Sub
Solved! Go to Solution.
Yes this is a "bug"... it only happens though if you are calling feFileExit from the API with the View object "loaded". The problem is that internally the View object references a Set object and since you did not "destroy" the View, the internal Set was not cleaned up until too late in the exiting process. This will be corrected in v11.2.1. Of course setting the view to "Nothing" will also solve the problem.
There are other object types like this where Set objects are referenced, but since the fix for v11.2.1 actually applied to the Set object and not the View, it should apply to all of those types.