
Thu, 12/03/2020 - 04:03
Hello all
I am upgrading from 6.9.1 to 7.5.0. There are good changes, particularly with new handles. One thing, which looks brocken is the StdPrs_WFDeflectionRestrictedFace::Add (const Handle< Prs3d_Presentation > &aPresentation, const Handle< BRepAdaptor_HSurface > &aFace, const Standard_Boolean DrawUIso, const Standard_Boolean DrawVIso, const Standard_Real Deflection, const Standard_Integer NBUiso, const Standard_Integer NBViso, const Handle< Prs3d_Drawer > &aDrawer, Prs3d_NListOfSequenceOfPnt &Curves)
TopoDS_Face face; // Comes from the prior code
Handle(Prs3d_Presentation) aPresentation;
BRepAdaptor_Surface S(face);
Handle(BRepAdaptor_HSurface) hSurface = new BRepAdaptor_HSurface(S);
Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer;
Prs3d_NListOfSequenceOfPnt curves;
double deflection = 0.02; //Nothing changes if multiplied by 10 several times
StdPrs_WFDeflectionRestrictedFace::Add(aPresentation, hSurface, true/*DrawUIso*/, true, deflection, 1 /*NBUiso*/, 1 /*NBViso*/, aDrawer, curves);
Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
for (anIt.Init(curves); anIt.More(); anIt.Next())
{
const Handle(TColgp_HSequenceOfPnt)& aPoints = anIt.Value();
int m = aPoints->Length(); // 1000001 for the second curve (circle)
//.....
}
It used to generate wire frame curves nicely in 6.9.1. Now for a simplest cylinder of r1=2,r2=1,h=1 dimensions it creates sampling of the curve with 1000000 points. The Deflection parameters does not seem to make any difference. I am using Windows 10 and Visual Studio 2019.
I actually have found last week that this class was removed between the two versions. It was suggesting to use StdPrs_WFShape instead. Now I can not find this statement. I have tried this briefly, but there is no obvious way to get the curves. Which probably means I need to learn how to work with presentations :(
Can anybody shed some light on that?
Thank you
Mon, 12/07/2020 - 14:24
StdPrs_WFDeflectionRestrictedFace have not been removed, but indeed - it is used nowhere else in OCCT, so I cannot say if it works as expected or was broken accidentially at some step (though code of the tool itself was barely modified for a long time).
StdPrs_WFShape should be directly reusable as replacement for building a Wireframe presentation of a shape, though it has a slightly different interface. Could you please point out what actually confuses you in replacing StdPrs_WFDeflectionRestrictedFace with StdPrs_WFShape?
Thu, 12/03/2020 - 14:13
Thank you, Kirill
As you see from the current code I need to get the sampled curves as sets of consecutive points to pass to our renderer. We do not use OCCT's graphics.
I have stopped at this:
I just do not know how to get points out of a group. If you could point me to a place in source with an example it would be great.
Thu, 12/03/2020 - 15:20
OK, I see that you want to skip creation of Prs3d_Presentation and get presentation data to fill in some other structures.
This is what does StdPrs_WFShape::Add() internally - it calls other tools like StdPrs_Isolines::Add() and StdPrs_WFShape::AddAllEdges() to collect an intermediate list of points in Prs3d_NListOfSequenceOfPnt.
So, this would require a little bit of code duplication (~100 lines) as there is no method doing this thing (such a method would probably require code duplication anyway).
Mon, 12/07/2020 - 12:10
I have fixed this.
See the two lines marked with AAA in the attached file.
The problem was that in the second StdPrs_WFDeflectionRestrictedFace::Add(), the redundant line present in v6.9.1:
if ( Orient == TopAbs_FORWARD || Orient == TopAbs_REVERSED ) {
was deleted in v7.5.0 or earlier with wrong closing curly bracket.
I have submitted 0031986 bug for that.