What is the difference between two approaches to get the dataset on the client side?

Hello!

What is the difference between the two ways to get the dataset on the client side?

  auto sourceProxy = pqActiveObjects::instance().activeSource()->getProxy();
  auto algorithm = sourceProxy ? vtkAlgorithm::SafeDownCast(sourceProxy->GetClientSideObject()) : nullptr;
  auto dataset = algorithm ? vtkDataSet::SafeDownCast(algorithm->GetOutputDataObject(0)) : nullptr;

And

  using vtkSrcPrxyPtr = vtkSmartPointer<vtkSMSourceProxy>;
  vtkSrcPrxyPtr filter{};
  vtkSmartPointer<vtkDataSet> dataSet{};
  auto proxyManager = vtkSMProxyManager::GetProxyManager()->GetActiveSessionProxyManager();
  int sourcePortNumber = 0;



  if (source && (filter = vtkSrcPrxyPtr::Take(vtkSMSourceProxy::SafeDownCast(proxyManager->NewProxy("filters", "ClientServerMoveData")))))
  {
    if (auto inputProperty = vtkSMInputProperty::SafeDownCast(filter->GetProperty("Input")))
    {
      inputProperty->RemoveAllProxies();
      inputProperty->AddInputConnection(source, sourcePortNumber);
    }
    vtkSMPropertyHelper{ filter, "OutputDataType" }.Set(VTK_POLY_DATA);
    filter->UpdateVTKObjects();

    //source = filter;
    sourcePortNumber = 0;
  }

  if (filter)
  {
    filter->UpdatePipeline();
    dataSet = vtkDataSet::SafeDownCast(vtkAlgorithm::SafeDownCast(filter->GetClientSideObject())->GetOutputDataObject(sourcePortNumber));
  }

The first is working only in builtin mode or with client side object, the second is working in client/server mode with server side object.

1 Like