1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Compare commits

...

4 Commits

Author SHA1 Message Date
msv
a56fcdc474 #Temporary changes to force offset make computations on C0 surfaces. 2017-07-31 16:26:00 +03:00
emv
efecdc4ba8 Prototype the possibility to extend the 3D Offset algorithm to set the new face manually. 2017-07-07 16:49:23 +03:00
msv
f07607c16b 0027245: DRAW command to test binary persistence for shapes
- Added new static methods Read and Write in BinTools class to store/retrieve a shape in binary format.
- Added new draw commands "binsave" and "binrestore"
- Added test cases to test the new methods.
- Updated documantation with desription of the new BinTools class methods and corresponding BRepTools class methods.
2017-07-06 10:08:13 +03:00
nbv
8d604081fe 0028492: Boolean common does not produce expected result
Generation of 3D-steps shorter than 3D tolerance has been allowed in the fix to build Walking-line.

Now, 3D-step is limited by Precision::Confusion value.
2017-03-21 16:01:26 +03:00
23 changed files with 469 additions and 98 deletions

View File

@@ -2,6 +2,6 @@ FoundationClasses TKernel TKMath
ModelingData TKG2d TKG3d TKGeomBase TKBRep
ModelingAlgorithms TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing
Visualization TKService TKV3d TKOpenGl TKMeshVS TKIVtk TKD3DHost
ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd FWOSPlugin TKTObj TKBinTObj TKXmlTObj TKVCAF
ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd TKTObj TKBinTObj TKXmlTObj TKVCAF
DataExchange TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF
Draw TKDraw TKTopTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE

View File

@@ -1247,4 +1247,19 @@ For example, in the wire in the image we want to recuperate the edges in the ord
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@subsection occt_modat_5_6 Storage of shapes
**BRepTools** and **BinTools** packages contain methods *Read* and *Write* allowing to read and write a Shape to/from a stream or a file.
The methods provided by **BRepTools** package use ASCII storage format; **BinTools** package use binary format.
Each of these methods has two arguments:
- a *TopoDS_Shape* object to be read/written;
- a stream object or a file name to read from/write to.
The following sample code reads a shape from ASCII file and writes it to a binary one:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
TopoDS_Shape aShape;
if (BRepTools::Read (aShape, "source_file.txt")) {
BinTools::Write (aShape, "result_file.bin");
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -1386,6 +1386,7 @@ void BRepOffset_Inter2d::Compute (const Handle(BRepAlgo_AsDes)& AsDes,
void BRepOffset_Inter2d::ConnexIntByInt
(const TopoDS_Face& FI,
BRepOffset_Offset& OFI,
const TopoDS_Face& FIO,
TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build,
const Handle(BRepAlgo_AsDes)& AsDes,
@@ -1415,22 +1416,20 @@ void BRepOffset_Inter2d::ConnexIntByInt
if (YaBuild) {
for (itL.Initialize(L); itL.More(); itL.Next()) {
const TopoDS_Edge& EI = TopoDS::Edge(itL.Value());
TopoDS_Shape aLocalShape = OFI.Generated(EI);
const TopoDS_Edge& OE = TopoDS::Edge(aLocalShape);
// const TopoDS_Edge& OE = TopoDS::Edge(OFI.Generated(EI));
if (!MES.IsBound(OE) && !Build.IsBound(EI)) {
// Modified by skv - Fri Dec 26 16:59:52 2003 OCC4455 Begin
// ExtentEdge(OE,NE);
ExtentEdge(OE,NE, Offset);
// Modified by skv - Fri Dec 26 16:59:54 2003 OCC4455 End
MES.Bind (OE,NE);
if (!Build.IsBound(EI)) {
TopoDS_Shape aLocalShape = OFI.Generated(EI);
const TopoDS_Edge& OE = TopoDS::Edge(aLocalShape);
if (!MES.IsBound(OE)) {
ExtentEdge(OE,NE, Offset);
MES.Bind (OE,NE);
}
}
}
}
}
TopoDS_Face FIO = TopoDS::Face(OFI.Face());
if (MES.IsBound(FIO)) FIO = TopoDS::Face(MES(FIO));
//TopoDS_Face FIO = TopoDS::Face(OFI.Face());
//if (MES.IsBound(FIO)) FIO = TopoDS::Face(MES(FIO));
//
TopTools_MapOfShape aME;
const TopTools_ListOfShape& aLE = AsDes->Descendant(FIO);
@@ -1470,34 +1469,48 @@ void BRepOffset_Inter2d::ConnexIntByInt
gp_Pnt Pref = BRep_Tool::Pnt(Vref);
//IFV------------
TopoDS_Shape aLocalShape = OFI.Generated(CurE);
TopoDS_Edge CEO = TopoDS::Edge(aLocalShape);
aLocalShape = OFI.Generated(NextE);
TopoDS_Edge NEO = TopoDS::Edge(aLocalShape);
// TopoDS_Edge CEO = TopoDS::Edge(OFI.Generated(CurE));
// TopoDS_Edge NEO = TopoDS::Edge(OFI.Generated(NextE));
//------------------------------------------
// Inter processing of images of CurE NextE.
//------------------------------------------
TopTools_ListOfShape LV1,LV2;
Standard_Boolean DoInter = 1;
TopoDS_Shape NE1,NE2;
Standard_Boolean DoInter = 0;
if (Build.IsBound(CurE) && Build.IsBound(NextE)) {
NE1 = Build(CurE );
NE2 = Build(NextE);
}
else if (Build.IsBound(CurE) && MES.IsBound(NEO)) {
NE1 = Build(CurE);
NE2 = MES (NEO);
}
else if (Build.IsBound(NextE) && MES.IsBound(CEO)) {
NE1 = Build(NextE);
NE2 = MES(CEO);
DoInter = 1;
}
else {
DoInter = 0;
TopoDS_Shape aLocalShape = OFI.Generated(CurE);
TopoDS_Edge CEO = TopoDS::Edge(aLocalShape);
aLocalShape = OFI.Generated(NextE);
TopoDS_Edge NEO = TopoDS::Edge(aLocalShape);
//
if (Build.IsBound(CurE) && MES.IsBound(NEO)) {
NE1 = Build(CurE);
NE2 = MES (NEO);
DoInter = 1;
}
else if (Build.IsBound(NextE) && MES.IsBound(CEO)) {
NE1 = Build(NextE);
NE2 = MES(CEO);
DoInter = 1;
}
else {
if (MES.IsBound(CEO)) {
TopoDS_Vertex V = CommonVertex(CEO,NEO);
UpdateVertex (V,CEO,TopoDS::Edge(MES(CEO)),Tol);
AsDes2d->Add (MES(CEO),V);
}
else if (MES.IsBound(NEO)) {
TopoDS_Vertex V = CommonVertex(CEO,NEO);
UpdateVertex (V,NEO,TopoDS::Edge(MES(NEO)),Tol);
AsDes2d->Add (MES(NEO),V);
}
}
}
//
if (DoInter) {
//------------------------------------
// NE1,NE2 can be a compound of Edges.
@@ -1531,18 +1544,18 @@ void BRepOffset_Inter2d::ConnexIntByInt
}
}
}
else {
if (MES.IsBound(CEO)) {
TopoDS_Vertex V = CommonVertex(CEO,NEO);
UpdateVertex (V,CEO,TopoDS::Edge(MES(CEO)),Tol);
AsDes2d->Add (MES(CEO),V);
}
else if (MES.IsBound(NEO)) {
TopoDS_Vertex V = CommonVertex(CEO,NEO);
UpdateVertex (V,NEO,TopoDS::Edge(MES(NEO)),Tol);
AsDes2d->Add (MES(NEO),V);
}
}
//else {
// if (MES.IsBound(CEO)) {
// TopoDS_Vertex V = CommonVertex(CEO,NEO);
// UpdateVertex (V,CEO,TopoDS::Edge(MES(CEO)),Tol);
// AsDes2d->Add (MES(CEO),V);
// }
// else if (MES.IsBound(NEO)) {
// TopoDS_Vertex V = CommonVertex(CEO,NEO);
// UpdateVertex (V,NEO,TopoDS::Edge(MES(NEO)),Tol);
// AsDes2d->Add (MES(NEO),V);
// }
//}
CurE = NextE;
}
}

View File

@@ -59,6 +59,7 @@ public:
//! theDMVV contains the vertices that should be fused.
Standard_EXPORT static void ConnexIntByInt (const TopoDS_Face& FI,
BRepOffset_Offset& OFI,
const TopoDS_Face& FIO,
TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build,
const Handle(BRepAlgo_AsDes)& AsDes,

View File

@@ -420,7 +420,7 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
void BRepOffset_Inter3d::ConnexIntByInt
(const TopoDS_Shape& SI,
const BRepOffset_DataMapOfShapeOffset& MapSF,
const TopTools_DataMapOfShapeShape& MapSF,
const BRepOffset_Analyse& Analyse,
TopTools_DataMapOfShapeShape& MES,
TopTools_DataMapOfShapeShape& Build,
@@ -543,8 +543,8 @@ void BRepOffset_Inter3d::ConnexIntByInt
F1 = TopoDS::Face(itF1.Value());
F2 = TopoDS::Face(itF2.Value());
//
OF1 = TopoDS::Face(MapSF(F1).Face());
OF2 = TopoDS::Face(MapSF(F2).Face());
OF1 = TopoDS::Face(MapSF.Find(F1));
OF2 = TopoDS::Face(MapSF.Find(F2));
if (!MES.IsBound(OF1)) {
Standard_Boolean enlargeU = Standard_True;
Standard_Boolean enlargeVfirst = Standard_True, enlargeVlast = Standard_True;

View File

@@ -53,7 +53,7 @@ public:
Standard_EXPORT void ConnexIntByArc (const TopTools_ListOfShape& SetOfFaces, const TopoDS_Shape& ShapeInit, const BRepOffset_Analyse& Analyse, const BRepAlgo_Image& InitOffsetFace);
Standard_EXPORT void ConnexIntByInt (const TopoDS_Shape& SI, const BRepOffset_DataMapOfShapeOffset& MapSF, const BRepOffset_Analyse& A, TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& Build, TopTools_ListOfShape& Failed, const Standard_Boolean bIsPlanar = Standard_False);
Standard_EXPORT void ConnexIntByInt (const TopoDS_Shape& SI, const TopTools_DataMapOfShapeShape& MapSF, const BRepOffset_Analyse& A, TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& Build, TopTools_ListOfShape& Failed, const Standard_Boolean bIsPlanar = Standard_False);
Standard_EXPORT void ContextIntByInt (const TopTools_IndexedMapOfShape& ContextFaces, const Standard_Boolean ExtentContext, const BRepOffset_DataMapOfShapeOffset& MapSF, const BRepOffset_Analyse& A, TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& Build, TopTools_ListOfShape& Failed, const Standard_Boolean bIsPlanar = Standard_False);

View File

@@ -670,6 +670,21 @@ void BRepOffset_MakeOffset::SetOffsetOnFace(const TopoDS_Face& F,
myFaceOffset.Bind(F,Off);
}
//=======================================================================
//function : SetOffsetFace
//purpose :
//=======================================================================
void BRepOffset_MakeOffset::SetOffsetFace(const TopoDS_Face& F,
const TopoDS_Face& OF)
{
// Check the orientation of the offset face and make
// it oriented the same way as original
Handle(IntTools_Context) aCtx = new IntTools_Context;
Standard_Boolean bToReverse = BOPTools_AlgoTools::IsSplitToReverse(F, OF, aCtx);
TopoDS_Face anOffsetFace = bToReverse ? TopoDS::Face(OF.Reversed()) : OF;
myMapFaceOffsetFace.Bind(F, anOffsetFace);
}
//=======================================================================
//function : RemoveCorks
//purpose :
@@ -1113,6 +1128,9 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
#endif
BRepOffset_DataMapOfShapeOffset MapSF;
TopTools_DataMapOfShapeShape aMapFaceOffsetFace;
// MES : Map of OffsetShape -> Extended Shapes.
TopTools_DataMapOfShapeShape MES;
TopTools_MapOfShape Done;
Standard_Boolean OffsetOutside = (myOffset > 0.)? Standard_True : Standard_False;
//--------------------------------------------------------
@@ -1127,6 +1145,15 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
TopTools_DataMapOfShapeShape ShapeTgt;
for (itLF.Initialize(LF); itLF.More(); itLF.Next()) {
const TopoDS_Face& F = TopoDS::Face(itLF.Value());
const TopoDS_Shape* pOFace = myMapFaceOffsetFace.Seek(F);
if (pOFace) {
// avoid creation of the new offset face
// if it was already given by the user
aMapFaceOffsetFace.Bind(F, *pOFace);
MES.Bind(*pOFace, *pOFace);
continue;
}
Standard_Real CurOffset = myOffset;
if (myFaceOffset.IsBound(F)) CurOffset = myFaceOffset(F);
BRepOffset_Offset OF(F,CurOffset,ShapeTgt,OffsetOutside,myJoin);
@@ -1161,13 +1188,12 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
}
}
MapSF.Bind(F,OF);
aMapFaceOffsetFace.Bind(F, OF.Face());
}
//--------------------------------------------------------------------
// MES : Map of OffsetShape -> Extended Shapes.
// Build : Map of Initial SS -> OffsetShape build by Inter.
// can be an edge or a compound of edges
//---------------------------------------------------------------------
TopTools_DataMapOfShapeShape MES;
TopTools_DataMapOfShapeShape Build;
TopTools_ListOfShape Failed;
TopAbs_State Side = TopAbs_IN;
@@ -1181,7 +1207,7 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
BRepOffset_Inter3d Inter3 (AsDes,Side,myTol);
// Intersection between parallel faces
Inter3.ConnexIntByInt(myShape,MapSF,myAnalyse,MES,Build,Failed,myIsPlanar);
Inter3.ConnexIntByInt(myShape,aMapFaceOffsetFace,myAnalyse,MES,Build,Failed,myIsPlanar);
// Intersection with caps.
Inter3.ContextIntByInt(myFaces,ExtentContext,MapSF,myAnalyse,MES,Build,Failed,myIsPlanar);
@@ -1195,7 +1221,19 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
{
const TopoDS_Face& FI = TopoDS::Face(Exp.Current());
Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(FI);
BRepOffset_Inter2d::ConnexIntByInt (FI, MapSF(FI), MES, Build,
BRepOffset_Offset OFI;
TopoDS_Face FIO;
if (myMapFaceOffsetFace.IsBound(FI)) {
FIO = TopoDS::Face(myMapFaceOffsetFace.Find(FI));
}
else {
OFI = MapSF(FI);
FIO = TopoDS::Face(OFI.Face());
if (MES.IsBound(FIO)) FIO = TopoDS::Face(MES(FIO));
}
BRepOffset_Inter2d::ConnexIntByInt (FI, OFI, FIO, MES, Build,
AsDes, AsDes2d, myOffset, aCurrFaceTol, aDMVV);
}
//
@@ -1213,7 +1251,7 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
for (Exp.Init(myShape,TopAbs_FACE) ; Exp.More(); Exp.Next()) {
const TopoDS_Face& FI = TopoDS::Face(Exp.Current());
NF = MapSF(FI).Face();
NF = TopoDS::Face(myMapFaceOffsetFace.IsBound(FI) ? myMapFaceOffsetFace.Find(FI) : MapSF(FI).Face());
if (MES.IsBound(NF)) {
NF = TopoDS::Face(MES(NF));
}
@@ -1313,7 +1351,7 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
BRepAlgo_Image IMOE;
for (Exp.Init(myShape,TopAbs_FACE) ; Exp.More(); Exp.Next()) {
const TopoDS_Shape& FI = Exp.Current();
const TopoDS_Shape& OFI = MapSF(FI).Face();
const TopoDS_Shape& OFI = myMapFaceOffsetFace.IsBound(FI) ? myMapFaceOffsetFace.Find(FI) : MapSF(FI).Face();
if (MES.IsBound(OFI)) {
const TopoDS_Face& aLocalFace = TopoDS::Face(MES(OFI));
LFE.Append(aLocalFace);
@@ -1393,7 +1431,8 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
for (Exp.Init(myShape,TopAbs_FACE) ; Exp.More(); Exp.Next()) {
const TopoDS_Shape& FI = Exp.Current();
myInitOffsetFace.SetRoot(FI);
TopoDS_Face OF = MapSF(FI).Face();
TopoDS_Face OF = TopoDS::Face(myMapFaceOffsetFace.IsBound(FI) ? myMapFaceOffsetFace.Find(FI) : MapSF(FI).Face());
// TopoDS_Face OF = MapSF(FI).Face();
if (MES.IsBound(OF)) {
OF = TopoDS::Face(MES(OF));
if (IMOE.HasImage(OF)) {
@@ -4207,6 +4246,24 @@ Standard_Boolean BRepOffset_MakeOffset::CheckInputData()
}
}
if (!isFound)
{
// Check the availability of the user-defined modifications
TopTools_IndexedMapOfShape aMF;
TopExp::MapShapes(myShape, TopAbs_FACE, aMF);
TopTools_DataMapIteratorOfDataMapOfShapeShape anSSIter(myMapFaceOffsetFace);
for (; anSSIter.More(); anSSIter.Next())
{
const TopoDS_Shape& aFace = anSSIter.Key();
const TopoDS_Shape& anOffsetFace = anSSIter.Value();
if (aMF.Contains(aFace) && !anOffsetFace.IsNull())
{
isFound = Standard_True;
break;
}
}
}
//
if (!isFound)
{
// No face with non-null offset found.
@@ -4245,11 +4302,11 @@ Standard_Boolean BRepOffset_MakeOffset::CheckInputData()
BRepTools::UVBounds(aF, aUmin, aUmax, aVmin, aVmax);
// Continuity check.
if (aSurf->Continuity() == GeomAbs_C0)
{
myError = BRepOffset_C0Geometry;
return Standard_False;
}
//if (aSurf->Continuity() == GeomAbs_C0)
//{
// myError = BRepOffset_C0Geometry;
// return Standard_False;
//}
// Get degenerated points, to avoid check them.
NCollection_Vector<gp_Pnt> aBad3dPnts;
@@ -4263,31 +4320,31 @@ Standard_Boolean BRepOffset_MakeOffset::CheckInputData()
}
}
// Geometry grid check.
for(Standard_Integer i = 0; i <= aPntPerDim; i++)
{
Standard_Real aUParam = aUmin + (aUmax - aUmin) * i / aPntPerDim;
for(Standard_Integer j = 0; j <= aPntPerDim; j++)
{
Standard_Real aVParam = aVmin + (aVmax - aVmin) * j / aPntPerDim;
//// Geometry grid check.
//for(Standard_Integer i = 0; i <= aPntPerDim; i++)
//{
// Standard_Real aUParam = aUmin + (aUmax - aUmin) * i / aPntPerDim;
// for(Standard_Integer j = 0; j <= aPntPerDim; j++)
// {
// Standard_Real aVParam = aVmin + (aVmax - aVmin) * j / aPntPerDim;
myError = checkSinglePoint(aUParam, aVParam, aSurf, aBad3dPnts);
if (myError != BRepOffset_NoError)
return Standard_False;
}
}
// myError = checkSinglePoint(aUParam, aVParam, aSurf, aBad3dPnts);
// if (myError != BRepOffset_NoError)
// return Standard_False;
// }
//}
// Vertex list check.
TopExp_Explorer anExpFV(aF, TopAbs_VERTEX);
for( ; anExpFV.More(); anExpFV.Next())
{
const TopoDS_Vertex &aV = TopoDS::Vertex(anExpFV.Current());
aPnt2d = BRep_Tool::Parameters(aV, aF);
//// Vertex list check.
//TopExp_Explorer anExpFV(aF, TopAbs_VERTEX);
//for( ; anExpFV.More(); anExpFV.Next())
//{
// const TopoDS_Vertex &aV = TopoDS::Vertex(anExpFV.Current());
// aPnt2d = BRep_Tool::Parameters(aV, aF);
myError = checkSinglePoint(aPnt2d.X(), aPnt2d.Y(), aSurf, aBad3dPnts);
if (myError != BRepOffset_NoError)
return Standard_False;
}
// myError = checkSinglePoint(aPnt2d.X(), aPnt2d.Y(), aSurf, aBad3dPnts);
// if (myError != BRepOffset_NoError)
// return Standard_False;
//}
}
return Standard_True;

View File

@@ -83,6 +83,9 @@ public:
//! set the offset <Off> on the Face <F>
Standard_EXPORT void SetOffsetOnFace (const TopoDS_Face& F, const Standard_Real Off);
//! Sets the offset face for the face in the shape.
Standard_EXPORT void SetOffsetFace (const TopoDS_Face& F, const TopoDS_Face& OF);
Standard_EXPORT void MakeOffsetShape();
@@ -205,6 +208,7 @@ private:
Standard_Boolean myIsPlanar;
TopoDS_Shape myBadShape;
TopTools_DataMapOfShapeShape myMapFaceOffsetFace; // map of the face - extended offset face
};
#endif // _BRepOffset_MakeOffset_HeaderFile

View File

@@ -528,8 +528,8 @@ void BRepOffset_Offset::Init(const TopoDS_Face& Face,
if ( !Co->Position().Direct()) myOffset *= -1;
}
Handle(Geom_Surface) TheSurf =
BRepOffset::Surface( S, myOffset, myStatus);
Handle(Geom_Surface) TheSurf = fabs(myOffset) > gp::Resolution() ?
BRepOffset::Surface( S, myOffset, myStatus) : S;
//processing offsets of faces with possible degenerated edges
Standard_Boolean UminDegen = Standard_False;

View File

@@ -1116,6 +1116,26 @@ Standard_Integer offsetonface(Draw_Interpretor&, Standard_Integer n, const char*
return 0;
}
//=======================================================================
//function : addoffsetface
//purpose :
//=======================================================================
static Standard_Integer addoffsetface(Draw_Interpretor&, Standard_Integer n, const char** a)
{
if ( n < 3) return 1;
for (Standard_Integer i = 1 ; i < n; i+=2) {
TopoDS_Shape SF = DBRep::Get(a[i],TopAbs_FACE);
if (!SF.IsNull()) {
TopoDS_Shape OF = DBRep::Get(a[i+1],TopAbs_FACE);
if (!OF.IsNull()) {
TheOffset.SetOffsetFace(TopoDS::Face(SF), TopoDS::Face(OF));
}
}
}
return 0;
}
//=======================================================================
//function : offsetperform
//purpose :
@@ -2338,6 +2358,10 @@ void BRepTest::FeatureCommands (Draw_Interpretor& theCommands)
"offsetonface face1 offset1 face2 offset2 ...",
__FILE__,offsetonface,g);
theCommands.Add("addoffsetface",
"addoffsetface face1 offset_face1 face2 offset_face2 ...",
__FILE__,addoffsetface,g);
theCommands.Add("offsetperform",
"offsetperform result",
__FILE__,offsetperform,g);

View File

@@ -15,7 +15,9 @@
#include <BinTools.hxx>
#include <BinTools_ShapeSet.hxx>
#include <FSD_FileHeader.hxx>
#include <OSD_OpenFile.hxx>
#include <Storage_StreamTypeMismatchError.hxx>
//=======================================================================
@@ -129,3 +131,64 @@ Standard_IStream& BinTools::GetBool(Standard_IStream& IS, Standard_Boolean& aVal
aValue = (Standard_Boolean)IS.get();
return IS;
}
//=======================================================================
//function : Write
//purpose :
//=======================================================================
void BinTools::Write (const TopoDS_Shape& theShape, Standard_OStream& theStream)
{
BinTools_ShapeSet aShapeSet(Standard_True);
aShapeSet.SetFormatNb (3);
aShapeSet.Add (theShape);
aShapeSet.Write (theStream);
aShapeSet.Write (theShape, theStream);
}
//=======================================================================
//function : Read
//purpose :
//=======================================================================
void BinTools::Read (TopoDS_Shape& theShape, Standard_IStream& theStream)
{
BinTools_ShapeSet aShapeSet(Standard_True);
aShapeSet.Read (theStream);
aShapeSet.Read (theShape, theStream, aShapeSet.NbShapes());
}
//=======================================================================
//function : Write
//purpose :
//=======================================================================
Standard_Boolean BinTools::Write (const TopoDS_Shape& theShape, const Standard_CString theFile)
{
ofstream aStream;
aStream.precision (15);
OSD_OpenStream (aStream, theFile, ios::out | ios::binary);
if (!aStream.good())
return Standard_False;
Write (theShape, aStream);
aStream.close();
return aStream.good();
}
//=======================================================================
//function : Read
//purpose :
//=======================================================================
Standard_Boolean BinTools::Read (TopoDS_Shape& theShape, const Standard_CString theFile)
{
filebuf aBuf;
OSD_OpenFileBuf (aBuf, theFile, ios::in | ios::binary);
if (!aBuf.is_open())
return Standard_False;
Standard_IStream aStream (&aBuf);
Read (theShape, aStream);
return aStream.good();
}

View File

@@ -20,12 +20,14 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_OStream.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_ExtCharacter.hxx>
#include <Standard_OStream.hxx>
#include <Standard_IStream.hxx>
class TopoDS_Shape;
class BinTools_ShapeSet;
class BinTools_Curve2dSet;
class BinTools_CurveSet;
@@ -56,9 +58,18 @@ public:
Standard_EXPORT static Standard_IStream& GetBool (Standard_IStream& IS, Standard_Boolean& theValue);
Standard_EXPORT static Standard_IStream& GetExtChar (Standard_IStream& IS, Standard_ExtCharacter& theValue);
//! Writes <theShape> on <theStream> in binary format.
Standard_EXPORT static void Write (const TopoDS_Shape& theShape, Standard_OStream& theStream);
//! Reads a shape from <theStream> and returns it in <theShape>.
Standard_EXPORT static void Read (TopoDS_Shape& theShape, Standard_IStream& theStream);
//! Writes <theShape> in <theFile>.
Standard_EXPORT static Standard_Boolean Write (const TopoDS_Shape& theShape, const Standard_CString theFile);
//! Reads a shape from <theFile> and returns it in <theShape>.
Standard_EXPORT static Standard_Boolean Read (TopoDS_Shape& theShape, const Standard_CString theFile);
protected:

View File

@@ -21,6 +21,7 @@
#include <BRepTools.hxx>
#include <BRepTools_ShapeSet.hxx>
#include <BRepTools_WireExplorer.hxx>
#include <BinTools.hxx>
#include <DBRep.hxx>
#include <DBRep_DrawableShape.hxx>
#include <Draw.hxx>
@@ -1274,6 +1275,51 @@ static Standard_Integer XProgress (Draw_Interpretor& di, Standard_Integer argc,
return 0;
}
//=======================================================================
// binsave
//=======================================================================
static Standard_Integer binsave(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if (n <= 2) return 1;
TopoDS_Shape aShape = DBRep::Get (a[1]);
if (aShape.IsNull())
{
di << a[1] << " is not a shape";
return 1;
}
if (!BinTools::Write (aShape, a[2]))
{
di << "Cannot write to the file " << a[2];
return 1;
}
di << a[1];
return 0;
}
//=======================================================================
// binrestore
//=======================================================================
static Standard_Integer binrestore(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if (n <= 2) return 1;
TopoDS_Shape aShape;
if (!BinTools::Read (aShape, a[1]))
{
di << "Cannot read from the file " << a[1];
return 1;
}
DBRep::Set (a[2], aShape);
di << a[2];
return 0;
}
//=======================================================================
//function : BasicCommands
//purpose :
@@ -1326,6 +1372,13 @@ void DBRep::BasicCommands(Draw_Interpretor& theCommands)
// Add command for DRAW-specific ProgressIndicator
theCommands.Add ( "XProgress","XProgress [+|-t] [+|-g]: switch on/off textual and graphical mode of Progress Indicator",XProgress,"DE: General");
theCommands.Add("binsave", "binsave shape filename\n"
"\t\tsave the shape in the binary format file",
__FILE__, binsave, g);
theCommands.Add("binrestore", "binrestore filename shape\n"
"\t\trestore the shape from the binary format file",
__FILE__, binrestore, g);
}
//=======================================================================

View File

@@ -169,11 +169,15 @@ void IntCurveSurface_Polygon::Init(const TheCurve& C,
//ddout << "P1 : " << P1.X() << " " << P1.Y() << " " << P1.Z() << endl;
gp_Pnt P2=ThePnts.Value(i+1);
//ddout << "P2 : " << P2.X() << " " << P2.Y() << " " << P2.Z() << endl;
gp_Lin L(P1,gp_Dir(gp_Vec(P1,P2)));
Standard_Real t=L.Distance(Pm);
//ddout << "Distance " << t << endl;
if(t>TheDeflection) {
TheDeflection = t;
gp_Vec aV12(P1,P2);
if (aV12.SquareMagnitude() > gp::Resolution())
{
gp_Lin L(P1,gp_Dir());
Standard_Real t=L.Distance(Pm);
//ddout << "Distance " << t << endl;
if(t>TheDeflection) {
TheDeflection = t;
}
}
i++;
}

View File

@@ -721,7 +721,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
AddAPoint(line,previousPoint);
//
IntWalk_StatusDeflection Status = IntWalk_OK;
IntWalk_StatusDeflection Status = IntWalk_OK, aPrevStatus = IntWalk_OK;
Standard_Boolean NoTestDeflection = Standard_False;
Standard_Real SvParam[4], f;
Standard_Integer LevelOfEmptyInmyIntersectionOn2S=0;
@@ -736,6 +736,8 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
Arrive = Standard_False;
while(!Arrive) //010
{
aPrevStatus = Status;
LevelOfIterWithoutAppend++;
if(LevelOfIterWithoutAppend>20)
{
@@ -1126,7 +1128,13 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
Param(3)=SvParam[2];
Param(4)=SvParam[3];
LevelOfIterWithoutAppend = 0;
// In order to avoid cyclic changes
// (PasTropGrand --> Decrease step -->
// StepTooSmall --> Increase step --> PasTropGrand...)
// nullify LevelOfIterWithoutAppend only if the condition
// is satisfied:
if (aPrevStatus != IntWalk_PasTropGrand)
LevelOfIterWithoutAppend = 0;
break;
}
@@ -2815,7 +2823,7 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection(const IntImp_ConstIso
SquareDistance(CurrentPoint.Value());
if (aSqDist < tolconf*tolconf) {
if (aSqDist < Precision::SquareConfusion()) {
pasInit[0] = Max(pasInit[0], 5.0*ResoU1);
pasInit[1] = Max(pasInit[1], 5.0*ResoV1);
pasInit[2] = Max(pasInit[2], 5.0*ResoU2);

View File

@@ -3,4 +3,4 @@ tscale s 0 0 0 SCALE
explode s E
blend result s SCALE*2 s_5
checkprops result -s 1.65391e+08 -eps 0.1
checkprops result -s 1.65391e+08

View File

@@ -1,10 +1,8 @@
puts "TODO #22911 ALL: Error : The area of result shape is"
restore [locate_data_file a350] a
restore [locate_data_file b350] b
bop a b
bopfuse result
checkprops result -s 0
checkprops result -s 120.576
checkview -display result -2d -otherwise { a b } -s -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,21 @@
puts "========"
puts "OCC28492"
puts "========"
puts ""
##########################################
## Boolean common does not produce expected result
##########################################
restore [locate_data_file bug28492_case1.brep] a
explode a
bcommon result a_1 a_2
checknbshapes result -wire 2 -face 1 -t
checkprops result -s 1882.29
checkshape result
if {! [regexp "to be valid for BOP" [bopargcheck result] ] } {
puts "Error: bopargcheck failed"
}
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,21 @@
puts "========"
puts "OCC28492"
puts "========"
puts ""
##########################################
## Boolean common does not produce expected result
##########################################
restore [locate_data_file bug28492_case2.brep] a
explode a
bcommon result a_1 a_2
checknbshapes result -wire 1 -face 1 -t
checkprops result -s 77.8077
checkshape result
if {! [regexp "to be valid for BOP" [bopargcheck result] ] } {
puts "Error: bopargcheck failed"
}
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -4,5 +4,7 @@ set chamf_dist_angle [list "0.01 30" "0.008 30" "0.01 60" "0.015 60"
set chamf_dist_dist [list "0.01 0.006" "0.008 0.006" "0.01 0.012" "0.015 0.012" "0.01 0.006" "0.008 0.006" "0.01 0.012" "0.008 0.012"]
set chamf_equal_dist [list "0.01 " "0.008 " "0.01 " "0.015 " "0.01 " "0.008 " "0.01 " "0.008 "]
if { [string compare $command chamf] == 0 } {
puts "TODO OCC22909 All:chamfer is not done. compute of chamfer failed"
if { [string compare $group equal_dist] != 0 } {
puts "TODO OCC22909 All:chamfer is not done. compute of chamfer failed"
}
}

View File

@@ -0,0 +1,25 @@
# test binsave and binrestore commands
pload TOPTEST
set file binpersist.bin
box b 10 20 30 100 200 300
if [regexp "Cannot write to the file $file" [binsave b $file]] {
puts "Error: binsave"
} elseif [regexp "Cannot read from the file $file" [binrestore $file bb]] {
puts "Error: binrestore"
} else {
file delete $file
if {[bounding b] != [bounding bb]} {
puts "Error: restored shape has another bounding box"
}
checkshape bb
checknbshapes bb -ref [nbshapes b]
checkprops bb -l 4800
checkprops bb -s 220000
checkprops bb -v 6000000
}
puts "TEST COMPLETED"

View File

@@ -0,0 +1,25 @@
# test binsave and binrestore commands
pload TOPTEST
set file binpersist.bin
restore [locate_data_file bug23849_segment_2.brep] b
if [regexp "Cannot write to the file $file" [binsave b $file]] {
puts "Error: binsave"
} elseif [regexp "Cannot read from the file $file" [binrestore $file bb]] {
puts "Error: binrestore"
} else {
file delete $file
if {[bounding b] != [bounding bb]} {
puts "Error: restored shape has another bounding box"
}
checkshape bb
checknbshapes bb -ref [nbshapes b]
checkprops bb -l 7703.49
checkprops bb -s 10678.2
checkprops bb -v 67245
}
puts "TEST COMPLETED"

View File

@@ -0,0 +1,26 @@
# test binsave and binrestore commands
pload TOPTEST
set file binpersist.bin
restore [locate_data_file OCC615.brep] b
if [regexp "Cannot write to the file $file" [binsave b $file]] {
puts "Error: binsave"
} elseif [regexp "Cannot read from the file $file" [binrestore $file bb]] {
puts "Error: binrestore"
} else {
file delete $file
if {[bounding b] != [bounding bb]} {
puts "Error: restored shape has another bounding box"
}
checkshape bb
checknbshapes bb -ref [nbshapes b]
checkprops bb -l 5501.4
checkprops bb -s 201237
checkprops bb -v 4.68509e+006
checktrinfo bb -ref [trinfo b]
}
puts "TEST COMPLETED"