For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

convert vtkpolydata to occt dataType

Minjun Kim's picture
Forums: 

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

        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

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