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

visualize an OCCT topological shape in VTK viewer

Rui Song's picture

I want to visualize an OCCT topological shape in VTK viewer.

I refer to the tutorial of VIS.However there throw exception in 'Mapper->SetInputConnection(DS->GetOutputPort());'

Here is my code:

// 1 . Create IVtkOCC_Shape instance(VIS wrapper for OCCT shape) and initialize it with TopoDS_Shape object containing the actual geometry.
//TopoDS_Shape aShape = makebottle();
TopoDS_Shape aShape;
BRep_Builder B;
BRepTools::Read(aShape, "D:\\OpenCASCADE7.0.0-vc12-64\\opencascade-7.0.0\\data\\occ\\face.brep",B);

//Initialize aShape variable: e.g. load it from BREP file
IVtkOCC_Shape::Handle aShapeImpl = new IVtkOCC_Shape(aShape);

aShapeImpl = new IVtkOCC_Shape(aShape);

// 2 .Create VTK polygonal data source for the target OCCT topological shape and initialize it with created 
// IVtkOCC_Shape instance. At this stage the faceter is implicitly plugged.
vtkSmartPointer DS = vtkSmartPointer ::New();

// 3. visualize the load shape in usual VTK way starting a pipline from the newly created specific source.
vtkSmartPointer Mapper = vtkSmartPointer::New();
vtkSmartPointer Actor = vtkSmartPointer::New();
vtkSmartPointer renderer = vtkSmartPointer::New();
renderer->SetBackground(0.1, 0.2, 0.4);
vtkSmartPointer renWin = vtkSmartPointer::New();
renWin->SetSize(300, 300);
renWin->SetPosition(300, 300);
// vtkSmartPointer iren = vtkSmartPointer::New();
vtkSmartPointer style = vtkSmartPointer::New();

Heike Broichhausen's picture

Hello Rui,

this is exactly my problem as well. How did you sort this issue?

zz ll's picture

Hello Rui Song ,

I also encountered this problem now, did you solve it? occ730

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.