Dear Utkarsh,
I tried to reproduce the error as described in my previous email, but
haven't been able to until now, don't know what happend. The attached code
attaches to a pvserver at localhost:11111 and adds a sphere every half
second. Unfortunately it crashes as soon as I connect ParaView to the same
server.
I guess I'll have to give up programming ParaView and work the old way,
writing VTK files and loading them in ParaView. It is way too complicated.
Peter
2016-06-24 7:08 GMT+02:00 Peter Debuchev <[email protected]>:
> Thank you for the patch. There is still something missing. If I modify the
> custom client such that it adds an object every half second or so, then
> first start this clients and then ParaView after a few seconds, ParaView
> misses one of the objects. ParaView finds those objects that are added
> before ParaView starts and those that are added later. But during ParaView
> startup one of the objects is lost.
> I'll see if I can make this reproducible and send a code example in the
> next days.
>
> Peter
>
> 2016-06-22 17:25 GMT+02:00 Utkarsh Ayachit <[email protected]>:
>
>> > can you give a quick update whether the suggested bug fix is likely to
>> be
>> > solved:
>>
>> Here you go:
>> https://gitlab.kitware.com/paraview/paraview/merge_requests/844
>>
>> Once the dashboards come back clean, this will get merged. If do get
>> around to testing it, I'd suggest getting involved and giving the
>> merge-request a +1 ;).
>>
>> Utkarsh
>>
>
>
#include "vtkSMSession.h"
#include "vtkSMSessionClient.h"
#include "vtkProcessModule.h"
#include "vtkPVOptions.h"
#include "vtkInitializationHelper.h"
#include "vtkSMProxy.h"
#include "vtkSMProxyManager.h"
#include "vtkSMSessionProxyManager.h"
#include "vtkSMProxy.h"
#include "vtkSMPropertyHelper.h"
#include "vtkSMParaViewPipelineController.h"
#include "vtkSMProxy.h"
#include "vtkSMRepresentationProxy.h"
#include "vtkCollection.h"
#include "vtkSMRenderViewProxy.h"
#include "vtkSMCollaborationManager.h"
#include "vtkSMMessage.h"
#include "vtkCommand.h"
#include "vtkNetworkAccessManager.h"
#include "vtkRenderWindowInteractor.h"
#include <sstream>
using namespace std;
vtkSMSessionProxyManager* pxm;
vtkSMRenderViewProxy *view=NULL;
void createView(){
vtkCollection *coll=vtkCollection::New();
// try to find view
pxm->GetProxies("views",coll);
view=vtkSMRenderViewProxy::SafeDownCast(coll->GetItemAsObject(0));
// if not found, create new view
if (view==NULL){
view=vtkSMRenderViewProxy::SafeDownCast(pxm->NewProxy("views","RenderView"));
}
view->UpdateVTKObjects();
pxm->RegisterProxy("views","View1",view);
}
void createObject(int n){
if (view==NULL) return;
vtkSMSourceProxy *sphere=vtkSMSourceProxy::SafeDownCast(pxm->NewProxy("sources","SphereSource"));
double pos[3]={(double)n,0.,0.};
vtkSMPropertyHelper(sphere,"Center").Set(pos,3);
sphere->UpdateVTKObjects();
//vtkSMRepresentationProxy *repr=view->CreateDefaultRepresentation(sphere,0);
vtkSMRepresentationProxy *repr=vtkSMRepresentationProxy::SafeDownCast(pxm->NewProxy("representations","SurfaceRepresentation"));
vtkSMPropertyHelper(repr,"Input").Set(sphere,0);
vtkSMPropertyHelper(view,"Representations").Add(repr);
view->UpdateVTKObjects();
repr->UpdateVTKObjects();
stringstream name;
name<<"Sphere"<<n;
pxm->RegisterProxy("sources",name.str().c_str(),sphere);
name<<"Repr"<<n;
pxm->RegisterProxy("representations",name.str().c_str(),repr);
}
class Callback: public vtkCommand{
private:
int count;
public:
static Callback* New(){
Callback *cb=new Callback;
cb->count=0;
return cb;
}
virtual void Execute(vtkObject* caller, unsigned long event, void* data) {
count++;
if (event==vtkCommand::TimerEvent){ //create new sphere at xyz={count,0.,0.}
createObject(count);
}
while(vtkProcessModule::GetProcessModule()->GetNetworkAccessManager()->ProcessEvents(1)){
}
}
};
int main(int argc, char* argv[]){
vtkPVOptions *options=vtkPVOptions::New();
vtkInitializationHelper::Initialize(argc,argv,vtkProcessModule::PROCESS_CLIENT,options);
vtkSMSessionClient *session=vtkSMSessionClient::New();
session->Connect("cs://localhost:11111");
vtkSMParaViewPipelineController* smcontroller=vtkSMParaViewPipelineController::New();
smcontroller->InitializeSession(session);
pxm = session->GetSessionProxyManager();
//Collaboration:
vtkSMCollaborationManager *collaboration=session->GetCollaborationManager();
collaboration->SetSession(session);
collaboration->UpdateUserInformations();
createView();
createObject(0);
view->MakeRenderWindowInteractor(true);
vtkRenderWindowInteractor *iren=view->GetInteractor();
iren->Initialize();
Callback *timer=Callback::New();
iren->AddObserver(vtkCommand::TimerEvent,timer);
iren->CreateRepeatingTimer(500);
view->GetInteractor()->Start();
cout<<"Closing Session..."<<endl;
session->CloseSession();
vtkInitializationHelper::Finalize();
}
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView
Search the list archives at: http://markmail.org/search/?q=ParaView
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview