Status FEM Workbench

About the development of the FEM module/workbench.

Moderator: bernd

ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: Status FEM Workbench

Post by ickby »

Hello,

the assembly workbench has such a global object too. I had implemented a observer class, but reverted it and now handle the object or document deletion in the objects view providers destructor: check if the object is the global one and clear the global variable accordingly on destruction. That should work for all possible cases and needs very little and uncomplicated code.
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Status FEM Workbench

Post by wmayer »

So, I guess you have it as a static member or so, right?

In git 86760cf I have fixed the typo and the undo problem with the analysis object. So, since you have only one active analysis object application-wide I'll adapt Stefan's solution for this problem, too. OK for you?
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: Status FEM Workbench

Post by ickby »

No I stayed with the global variable as I wanted to change as little as possible to jriegels design. So if the global variable is of type AnalysisObject my destructor would look something like this:

Code: Select all

AnalysisObject* ActiveAnalysis = 0; 

ViewProviderAnalysisObject::ViewProviderAnalysisObject~() {

       if( getAnalysisObject() == ActiveAnalysis){
             ActiveAnalysis = NULL;
            //In assembly I emmit a python command here to clear the active assembly
       }
}
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Status FEM Workbench

Post by wmayer »

Ah, OK thanks. However it doesn't make a big difference if a variable is static or global.
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Status FEM Workbench

Post by wmayer »

I have implemented a real observer because in this case we don't only have one global variable but four.
Post Reply