I hope my question is not irrelevant.
I found out that "PythonOCC" doesn't support VTK integration, however, the other package "pyOCCT" does.
The VTK integration in C++ is given HERE
The problem is with
in C++ sources
but in OCP IVtkTools_ShapeDataSource has no parent classes.
https://github.com/CadQuery/OCP-stu...1855288f/OCP-stubs/IVtkTools/__init__.pyi#L83
I found out that "PythonOCC" doesn't support VTK integration, however, the other package "pyOCCT" does.
The VTK integration in C++ is given HERE
Code:
TopoDS_Shape aShape;
IVtkOCC_Shape::Handle aShapeImpl = new IVtkOCC_Shape(aShape);
vtkSmartPointer<IVtkTools_ShapeDataSource> aDS = vtkSmartPointer<IVtkTools_ShapeDataSource>::New();
aDS->SetShape(aShapeImpl);
vtkSmartPointer<vtkPolyDataMapper> Mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
Mapper->SetInputConnection(aDS->GetOutputPort());
vtkSmartPointer<vtkActor> Actor = vtkSmartPointer<vtkActor>::New();
Actor->SetMapper(Mapper);
The problem is with
aDS->GetOutputPort()
becase this class has no GetOutputPort()
function in pyOCCT:in C++ sources
GetOutputPort()
is inherited from vtkAlgorithm
but in OCP IVtkTools_ShapeDataSource has no parent classes.
https://github.com/CadQuery/OCP-stu...1855288f/OCP-stubs/IVtkTools/__init__.pyi#L83
Python:
from OCP.BRepPrimAPI import BRepPrimAPI_MakeBox
from OCP.IVtkOCC import IVtkOCC_Shape
from OCP.IVtkTools import IVtkTools_ShapeDataSource
from vtkmodules.vtkRenderingCore import vtkPolyDataMapper
my_box = BRepPrimAPI_MakeBox(10.0, 20.0, 30.0).Shape()
vo_shape = IVtkOCC_Shape(my_box)
sds = IVtkTools_ShapeDataSource.New_s()
sds.SetShape(vo_shape)
vpdm = vtkPolyDataMapper()
vpdm.SetInputConnection(sds.GetOutput())
Last edited: