
Thu, 08/08/2019 - 09:06
hi, i'm wondering if i can convert vtkpolydata to some occt dataType such as IVtkVTK_ShapeData
i found that convert occt dataType to vtkpolydata and success that view occt dataType in vtkRenderer
convert vtkpolydata to occt dataType, is it possible ?
Thu, 08/08/2019 - 10:31
Hello Minjun,
Would you, please, explain why you need this kind of conversion?
Do you want to connect some VTK algorithms to OCCT 3D viewer, or vice versa?
You may reply here or write to us using our Contact Form.
Best regards,
Forum supervisor
Thu, 08/08/2019 - 12:05
Hello Administrator. Thank you for your reply.
I want to apply the occt algorithm again to the resulting data from the vtk algorithm. then, i will display mesh data by using ivtk
TopoDS_Shape box1 = boxMaker1.Shape();
IVtkOCC_Shape::Handle aShapeImpl = new IVtkOCC_Shape(box1);
vtkSmartPointer<IVtkTools_ShapeDataSource> DS = vtkSmartPointer<IVtkTools_ShapeDataSource>::New();
DS->SetShape(aShapeImpl);
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConnection(DS->GetOutputPort());
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
actor->GetProperty()->SetColor(colorRGB(0, 0, 255));
actor->GetProperty()->SetOpacity(0.7);
mpMainRenderer->GetRenderer()->AddActor(actor);
The source is perfectly work. so i just want to know how convert vtkpolydata to TopoDS_Shape or other occt dataType.
i found any source.
IVtkOCC_Shape::Handle occShape = IVtkTools_ShapeObject::GetOccShape(actor); // actor is vtkActor instance.
vtkSmartPointer<IVtkTools_ShapeDataSource> DS = vtkSmartPointer<IVtkTools_ShapeDataSource>::New();
DS->SetShape(occShape);
but. it didn't work. // TKIVTK.dll error.
Is there any way?
Best regards,
Minjun Kim
Fri, 11/29/2019 - 16:51
你好 岳敏君金,
can you display mesh data by vtk? why did it occur one mistake when it run to "mapper-> SetInputConnection(DS-> GetOutputPort());"?which version is your vtk?
Mon, 08/12/2019 - 11:49
Hello Minjun,
The fact is that vtkPolyData contains polygonal data while most of Open CASCADE Technology algorithms work on shapes that contain exact geometrical data.
It is possible to convert vtkPolyData into Poly_Triangulation and then to put it into TopoDS_Face to create a triangulation-only Face object, but the amount of operations that could be done with such Face would be very limited.
If you want to work with polygonal data you should better consider our Mesh Framework.
Best regards,
Forum supervisor