Tue, 10/08/2019 - 17:27
Hi,
I'm having quite the issue for some days getting the VIS classes to work my way and would greatly appreciate some directions and/or confirmation that it could be an issue with OCCT.
I'm will try to keep it simple and not post walls of source code.
I'm trying to get out of VIS a list of points, triangles indexes and normals to be use as data for an external renderer.
The two first sets of data come out fine. And as the title suggests, the normals "came out" wrong (see attachment for a screenshot of a VTK window showing theses, base model is a simple cube)
I tried with the code snippets from the guides.
Both the high level API way and the low level one.
I tried while using the low level way to fiddle around with the different parameters from the ShapeMesher
const Standard_Real& theDevCoeff = 0.0001,
const Standard_Real& theDevAngle = 12.0 * M_PI / 180.0,
const Standard_Integer theNbUIsos = 1,
const Standard_Integer theNbVIsos =
No success ( but granted that I can't barely understand theses, still no result even with extreme values)
Edit: Here goes some simplified code, I hope it will help to provide some insight :)
//Class cpp file (Simplified)
STEPControl_Reader reader;
IFSelect_ReturnStatus stat = reader.ReadFile(path);
if (stat != IFSelect_ReturnStatus::IFSelect_RetDone) {
std::cout << std::endl << " Failed to load file at path : " << path << std::endl;
return false;
}
reader.NbRootsForTransfer();
reader.TransferRoots();
lastLoadedShape = reader.OneShape();
IVtkOCC_Shape::Handle aShapeImpl = new IVtkOCC_Shape(lastLoadedShape);
IVtkVTK_ShapeData::Handle aDataImpl = new IVtkVTK_ShapeData();
IVtk_IShapeMesher::Handle aMesher = new IVtkOCC_ShapeMesher(0.0001, 6);
aMesher->Build(aShapeImpl, aDataImpl);
//This is a member of the class
currentStateOfData = aDataImpl->getVtkPolyData();
vtkSmartPointer<vtkPolyDataNormals> normalData = vtkSmartPointer<vtkPolyDataNormals>::New();
normalData->SetInputData(data_source);
normalData->ComputePointNormalsOn();
normalData->ComputeCellNormalsOff();
normalData->Update();
currentStateOfData = normalData->GetOutput();
// Next comes the code that invoke a 'VTk Debug window' (see attachement)
Any idea appreciated !
Wed, 10/09/2019 - 15:32
Currently, VIS doesn't use normals from original Geometry - there is an issue on Bugtracker registered to this matter:
https://tracker.dev.opencascade.org/view.php?id=25845
Patches are welcome:
https://dev.opencascade.org/index.php?q=home/get_involved
Wed, 10/09/2019 - 15:43
Damn.
Well thanks a lot for the heads up,
so you're telling me that it's a no-go to get that information with the current state of OCCT ?
(Except with a patch, that I would gladly code, if I had the time and competence :-) )
EDIT: I read the bug report, I must add that even with the vtk filter, It's unusable from my end.
Wed, 10/09/2019 - 15:54
There is no problem to get normals from shape in OCCT (like StdPrs_ShadedShape).
It is just IVtk visualization that doesn't yet fill this information for displaying in VTK viewer.
Fri, 10/11/2019 - 12:30
Thanks a lot for the tip.
I'm currently struggling to take in the whole pipeline, learning from the User guide "Visualization".
I'll try to report back with an example when I'm done later, for people looking for the same use case.
Fri, 10/11/2019 - 17:52
I'll be upfront, I having a pretty hard time finding the simpler way of getting my vertices/triangles/normals list.
I tried instancing a AIS_Shape from my TopoDS_Shape, and then calling
but I quickly have to go down a rabbit hole (PrsMgr_PresentationManager then another and another lower level class).
EDIT :Also tried to
Retuens "NULL" :(
Could anyone point a more precise direction, please ?
Cheers.
Andre