Interface of HLRAppli_ReflectLines has been modified.
New Draw command "hlrin3d" has been added.
void HLRAppli_ReflectLines::Perform()
{
- Handle(HLRBRep_Algo) aHLRAlgo = new HLRBRep_Algo();
- aHLRAlgo->Add( myShape, 0 );
- aHLRAlgo->Projector( myProjector );
- aHLRAlgo->Update();
- aHLRAlgo->Hide();
+ myHLRAlgo = new HLRBRep_Algo();
+ myHLRAlgo->Add( myShape, 0 );
+ myHLRAlgo->Projector( myProjector );
+ myHLRAlgo->Update();
+ myHLRAlgo->Hide();
+
+ /*
HLRBRep_HLRToShape aHLRToShape( aHLRAlgo );
myCompound = aHLRToShape.OutLineVCompound3d();
BRepLib::SameParameter(myCompound,Precision::PConfusion(),Standard_False);
+ */
+}
+
+//=======================================================================
+//function : GetCompoundOf3dEdges
+//purpose :
+//=======================================================================
+
+TopoDS_Shape HLRAppli_ReflectLines::GetCompoundOf3dEdges(const HLRBRep_TypeOfResultingEdge type,
+ const Standard_Boolean visible)
+{
+ HLRBRep_HLRToShape aHLRToShape( myHLRAlgo );
+
+ TopoDS_Shape theCompound = aHLRToShape.CompoundOfEdges(type, visible, Standard_True);
+
+ BRepLib::SameParameter(theCompound,Precision::PConfusion(),Standard_False);
+
+ return theCompound;
}
//=======================================================================
//purpose :
//=======================================================================
-TopoDS_Shape HLRAppli_ReflectLines::GetResult() const
+TopoDS_Shape HLRAppli_ReflectLines::GetResult()
{
- return myCompound;
+ return GetCompoundOf3dEdges(HLRBRep_OutLine, Standard_True);
}
#include <Standard_Handle.hxx>
#include <HLRAlgo_Projector.hxx>
+#include <HLRBRep_Algo.hxx>
+#include <HLRBRep_TypeOfResultingEdge.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Real.hxx>
class TopoDS_Shape;
//! returns resulting compound of reflect lines
//! represented by edges in 3d
- Standard_EXPORT TopoDS_Shape GetResult() const;
+ Standard_EXPORT TopoDS_Shape GetResult();
+ //! returns resulting compound of lines
+ //! of specified type and visibility
+ //! represented by edges in 3d
+ Standard_EXPORT TopoDS_Shape GetCompoundOf3dEdges(const HLRBRep_TypeOfResultingEdge type,
+ const Standard_Boolean visible);
HLRAlgo_Projector myProjector;
+ Handle(HLRBRep_Algo) myHLRAlgo;
TopoDS_Shape myShape;
- TopoDS_Shape myCompound;
+ //TopoDS_Shape myCompound;
};
#include <HLRTopoBRep_OutLiner.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TopoDS_Shape.hxx>
+#include <TopoDS_Compound.hxx>
+#include <BRep_Builder.hxx>
static Handle(HLRBRep_Algo) hider;
#ifdef _WIN32
return 0;
}
+//=======================================================================
+//function : hlrin3d
+//purpose :
+//=======================================================================
+
+static Standard_Integer hlrin3d(Draw_Interpretor& , Standard_Integer n, const char** a)
+{
+ if (n < 6)
+ return 1;
+
+ TopoDS_Shape aShape = DBRep::Get(a[2]);
+ if (aShape.IsNull())
+ return 1;
+
+ Standard_Real anAISViewProjX = atof(a[3]);
+ Standard_Real anAISViewProjY = atof(a[4]);
+ Standard_Real anAISViewProjZ = atof(a[5]);
+
+ gp_Pnt anOrigin(0.,0.,0.);
+ gp_Dir aNormal(anAISViewProjX, anAISViewProjY, anAISViewProjZ);
+ gp_Ax2 theAxes(anOrigin, aNormal);
+ gp_Dir aDX = theAxes.XDirection();
+
+ HLRAppli_ReflectLines Reflector(aShape);
+
+ Reflector.SetAxes(aNormal.X(), aNormal.Y(), aNormal.Z(),
+ anOrigin.X(), anOrigin.Y(), anOrigin.Z(),
+ aDX.X(), aDX.Y(), aDX.Z());
+
+ Reflector.Perform();
+
+ TopoDS_Compound Result;
+ BRep_Builder BB;
+ BB.MakeCompound(Result);
+
+ TopoDS_Shape SharpEdges = Reflector.GetCompoundOf3dEdges(HLRBRep_Sharp, Standard_True);
+ BB.Add(Result, SharpEdges);
+ TopoDS_Shape OutLines = Reflector.GetCompoundOf3dEdges(HLRBRep_OutLine, Standard_True);
+ BB.Add(Result, OutLines);
+ TopoDS_Shape SmoothEdges = Reflector.GetCompoundOf3dEdges(HLRBRep_Rg1Line, Standard_True);
+ BB.Add(Result, SmoothEdges);
+
+ DBRep::Set(a[1], Result);
+
+ return 0;
+}
+
//=======================================================================
//function : Commands
//purpose :
"reflectlines res shape proj_X proj_Y proj_Z",
__FILE__, reflectlines, g);
+ theCommands.Add("hlrin3d",
+ "hlrin3d res shape proj_X proj_Y proj_Z",
+ __FILE__, hlrin3d, g);
+
hider = new HLRBRep_Algo();
}
--- /dev/null
+puts "============"
+puts "OCC27280"
+puts "============"
+puts ""
+###########################################################################################################
+# HLR algorithms taking seam edges into account
+###########################################################################################################
+
+restore [locate_data_file bug27280_SeamTest0_modified.brep] a
+fit
+hlrin3d result a 0.57735026918962573 -0.57735026918962573 0.57735026918962584
+donly result
+
+checkshape result
+
+checknbshapes result -compound 4 -edge 7 -vertex 6