convert vtkpolydata to occt dataType

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 ?



Forum supervisor's picture

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

Minjun Kim's picture

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();


        vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();


        vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();


        actor->GetProperty()->SetColor(colorRGB(0, 0, 255));



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();


but. it didn't work. // TKIVTK.dll error.

Is there any way?

Best regards,

Minjun Kim

1364255742_147980's picture

你好  岳敏君金,

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?

Forum supervisor's picture

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