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.
Status FEM Workbench
Moderator: bernd
Forum rules
and Helpful information for the FEM forum
and Helpful information for the FEM forum
Re: Status FEM Workbench
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?
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?
Re: Status FEM Workbench
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
}
}
Re: Status FEM Workbench
Ah, OK thanks. However it doesn't make a big difference if a variable is static or global.
Re: Status FEM Workbench
I have implemented a real observer because in this case we don't only have one global variable but four.