Wed, 08/18/2021 - 18:41
Forums:
Hello, I'm trying to get the shape's side view after reading it from the .step file, but the HLRBRep_PolyHLRToShape object doesn't create hidden and visible edges.
Code example:
STEPControl_Reader reader;
reader.ReadFile(file);
Standard_Integer roots = reader.NbRootsForTransfer();
Standard_Integer trans = reader.TransferRoots();
TopoDS_Shape shape = reader.OneShape();
gp_Pnt org(0, 0, 0);
gp_Dir z(0, 0, 1);
gp_Ax2 viewAxis(org , z);
// Prepare projector.
HLRAlgo_Projector projector(viewAxis);
// Prepare polygonal HLR algorithm which is known to be more reliable than
// the "curved" version of HLR.
Handle(HLRBRep_PolyAlgo) polyAlgo = new HLRBRep_PolyAlgo;
polyAlgo->Projector(projector);
polyAlgo->Load(shape);
polyAlgo->Update();
// Create topological entities.
HLRBRep_PolyHLRToShape HLRToShape;
HLRToShape.Update(polyAlgo);
// Prepare one compound shape to store HLR results.
TopoDS_Compound hlrShape;
BRep_Builder().MakeCompound(hlrShape);
//HLRToShape.HCompound() - always Null
//HLRToShape.OutLineHCompound() - always Null
//HLRToShape.Rg1LineHCompound() - always Null
//HLRToShape.RgNLineHCompound() - always Null
//HLRToShape.VCompound().IsNull() - always Null
//HLRToShape.OutLineVCompound().IsNull() - always Null
//HLRToShape.Rg1LineVCompound().IsNull() - always Null
//HLRToShape.RgNLineVCompound().IsNull() - always Null
I'd appreciate all the help I can get.
Mon, 08/23/2021 - 18:15
You have to triangulate the shape you load into polyAlgo. You can use BRepMesh_IncrementalMesh.
For example:
...
//- Added
BRepMesh_IncrementalMesh myTriangulator;
//-
// Prepare polygonal HLR algorithm which is known to be more reliable than
// the "curved" version of HLR.
Handle(HLRBRep_PolyAlgo) polyAlgo = new HLRBRep_PolyAlgo;
polyAlgo->Projector(projector);
//- Added
myTriangulator.SetShape(shape);
myTriangulator.Perform();
//-
polyAlgo->Load(shape);
polyAlgo->Update();