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

Compare commits

...

6 Commits

Author SHA1 Message Date
msv
5947405c03 Redmine issue 200: Modified face with a seam edge treated incorrectly
When checking if a vertex is already contained by an edge, use IsEqual() instead of IsSame().

Concerned test case is 3_13.
2017-11-16 18:11:07 +03:00
emv
d6edc8f54d Provide possibility to get the modified faces from the BRepOffsetAPI_PatchFaces algorithm.
Two new methods have been added:
- to get the new replaced face - TopoDS_Face GetPatchFace(const TopoDS_Face& theFace) const
- to get the neighboring faces of the replacing face - void GetAdjacentFaces(const TopoDS_Face& theFace, TopTools_ListOfShape& theNeighbors) const

Both methods take as an IN parameter the original face which was intended to be replaced.
First method returns the new face, on which the original one was replaced, updated to fit the resulting model.
Second method returns the faces adjacent to the original one also updated to fit the resulting model.

The new draw commands have been implemented to test these new methods:
- pfgetpatchface
- pfgetadjacentfaces
2017-10-26 14:51:13 +03:00
jgv
c1ca6a0334 Improvements of the algorithm BRepOffsetAPI_PatchFaces:
- Increase the value of extension in EnlargeGeometry to provide proper intersection of adjacent faces.
- Numerous bug fixes in the algorithm.
2017-10-11 13:16:48 +03:00
jgv
9b1856e8d3 Implementation of the algorithm for replacing faces in shape with new faces based on other surfaces - BRepOffsetAPI_PatchFaces.
The algorithm runs the steps similar to 3d Offset algorithm for Join type Intersection (intersection of the faces with neighbors for trimming of the faces by the adjacent faces).

Test cases for new functionality.
2017-08-17 17:19:52 +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
62 changed files with 2505 additions and 23 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

@@ -2817,7 +2817,7 @@ static Standard_Boolean EnlargeGeometry(Handle(Geom_Surface)& S,
const Standard_Boolean GlobalEnlargeVfirst,
const Standard_Boolean GlobalEnlargeVlast)
{
const Standard_Real coeff = 4.;
const Standard_Real coeff = 1.;
const Standard_Real TolApex = 1.e-5;
Standard_Boolean SurfaceChange = Standard_False;
@@ -2865,7 +2865,7 @@ static Standard_Boolean EnlargeGeometry(Handle(Geom_Surface)& S,
{
viso = S->VIso( vf1 );
GeomAdaptor_Curve gac( viso );
du = GCPnts_AbscissaPoint::Length( gac ) / coeff;
du = GCPnts_AbscissaPoint::Length( gac ) * coeff;
uiso1 = S->UIso( uf1 );
uiso2 = S->UIso( uf2 );
if (BRepOffset_Tool::Gabarit( uiso1 ) <= TolApex)
@@ -2886,7 +2886,7 @@ static Standard_Boolean EnlargeGeometry(Handle(Geom_Surface)& S,
{
uiso = S->UIso( uf1 );
GeomAdaptor_Curve gac( uiso );
dv = GCPnts_AbscissaPoint::Length( gac ) / coeff;
dv = GCPnts_AbscissaPoint::Length( gac ) * coeff;
viso1 = S->VIso( vf1 );
viso2 = S->VIso( vf2 );
if (BRepOffset_Tool::Gabarit( viso1 ) <= TolApex)
@@ -2941,7 +2941,7 @@ static Standard_Boolean EnlargeGeometry(Handle(Geom_Surface)& S,
{
viso = S->VIso( v1 );
gac.Load( viso );
du = GCPnts_AbscissaPoint::Length( gac ) / coeff;
du = GCPnts_AbscissaPoint::Length( gac ) * coeff;
uiso1 = S->UIso( u1 );
uiso2 = S->UIso( u2 );
if (BRepOffset_Tool::Gabarit( uiso1 ) <= TolApex)
@@ -2953,7 +2953,7 @@ static Standard_Boolean EnlargeGeometry(Handle(Geom_Surface)& S,
{
uiso = S->UIso( u1 );
gac.Load( uiso );
dv = GCPnts_AbscissaPoint::Length( gac ) / coeff;
dv = GCPnts_AbscissaPoint::Length( gac ) * coeff;
viso1 = S->VIso( v1 );
viso2 = S->VIso( v2 );
if (BRepOffset_Tool::Gabarit( viso1 ) <= TolApex)
@@ -3200,7 +3200,8 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace
const Standard_Boolean UpdatePCurve,
const Standard_Boolean enlargeU,
const Standard_Boolean enlargeVfirst,
const Standard_Boolean enlargeVlast)
const Standard_Boolean enlargeVlast,
const Standard_Boolean UseInfini)
{
//---------------------------
// extension de la geometrie.
@@ -3223,8 +3224,20 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace
}
S->Bounds (US1,US2,VS1,VS2);
UU1 = VV1 = - infini;
UU2 = VV2 = infini;
if (UseInfini)
{
UU1 = VV1 = - infini;
UU2 = VV2 = infini;
}
else
{
Standard_Real FaceDU = UF2 - UF1;
Standard_Real FaceDV = VF2 - VF1;
UU1 = UF1 - FaceDU;
UU2 = UF2 + FaceDU;
VV1 = VF1 - FaceDV;
VV2 = VF2 + FaceDV;
}
if (CanExtentSurface) {
SurfaceChange = EnlargeGeometry( S, UU1, UU2, VV1, VV2, isVV1degen, isVV2degen, UF1, UF2, VF1, VF2,

View File

@@ -92,8 +92,15 @@ public:
//! if <UpdatePCurve> is TRUE, update the pcurves of the
//! edges of <F> on the new surface.if the surface has been changed,
//! Returns True if The Surface of <NF> has changed.
Standard_EXPORT static Standard_Boolean EnLargeFace (const TopoDS_Face& F, TopoDS_Face& NF, const Standard_Boolean ChangeGeom, const Standard_Boolean UpDatePCurve = Standard_False, const Standard_Boolean enlargeU = Standard_True, const Standard_Boolean enlargeVfirst = Standard_True, const Standard_Boolean enlargeVlast = Standard_True);
Standard_EXPORT static Standard_Boolean EnLargeFace (const TopoDS_Face& F,
TopoDS_Face& NF,
const Standard_Boolean ChangeGeom,
const Standard_Boolean UpDatePCurve = Standard_False,
const Standard_Boolean enlargeU = Standard_True,
const Standard_Boolean enlargeVfirst = Standard_True,
const Standard_Boolean enlargeVlast = Standard_True,
const Standard_Boolean UseInfini = Standard_True);
Standard_EXPORT static void ExtentFace (const TopoDS_Face& F, TopTools_DataMapOfShapeShape& ConstShapes, TopTools_DataMapOfShapeShape& ToBuild, const TopAbs_State Side, const Standard_Real TolConf, TopoDS_Face& NF);
//! Via the wire explorer store in <NOnV1> for

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,158 @@
// Created on: 2012-08-06
// Created by: jgv@ROLEX
// Copyright (c) 2012-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BRepOffsetAPI_PatchFaces_HeaderFile
#define _BRepOffsetAPI_PatchFaces_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <Standard_Boolean.hxx>
#include <TopTools_IndexedDataMapOfShapeShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_DataMapOfOrientedShapeShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <BRepBuilderAPI_MakeShape.hxx>
class TopoDS_Shape;
//! Describes functions to replace some faces in a shape
//! by patches
class BRepOffsetAPI_PatchFaces : public BRepBuilderAPI_MakeShape
{
public:
DEFINE_STANDARD_ALLOC
//! General constructor.
Standard_EXPORT BRepOffsetAPI_PatchFaces(const TopoDS_Shape& aShape);
//! Empty constructor.
Standard_EXPORT BRepOffsetAPI_PatchFaces();
//! Sets the model
void SetShape(const TopoDS_Shape& theShape)
{
myInitialShape = theShape;
}
//! Clears the contents from the previous runs
Standard_EXPORT void Clear();
//! Adds the patch face for the face in the shape.
Standard_EXPORT void AddPatchFace (const TopoDS_Face& theFace, const TopoDS_Face& thePatchFace);
Standard_EXPORT virtual void Build() Standard_OVERRIDE;
//! Returns the patched face, updated to fit the model, for the given face <theFace>.
//! If there is no patched faces for the given face, the returned face will be null.
Standard_EXPORT TopoDS_Face GetPatchFace(const TopoDS_Face& theFace) const;
//! Returns the list of the faces, updated to fit the model, adjacent to the given replaced face.
//! If the given face has not been replaced, the list will be empty.
Standard_EXPORT void GetAdjacentFaces(const TopoDS_Face& theFace, TopTools_ListOfShape& theNeighbors) const;
protected:
private:
Standard_EXPORT void UpdateEdgesAndVertex(const TopoDS_Edge& thePrevEdge,
TopoDS_Edge& thePrevNewEdge,
const TopoDS_Edge& theCurEdge,
TopoDS_Edge& theCurNewEdge,
const TopoDS_Vertex& theCurVertex,
const TopoDS_Face& theFace,
const TopoDS_Face& theNewFace,
const TopoDS_Face& theBoundedNewFace);
Standard_EXPORT void PutVertexToEdge(const TopoDS_Vertex& theVertex,
const TopAbs_Orientation theProVertexOrientation,
const TopoDS_Edge& theEdge,
const TopoDS_Edge& theProEdge,
const TopoDS_Face& theFace,
const Standard_Real theParamOnEdge);
Standard_EXPORT void ProjectVertexOnNewEdge_2d(const TopoDS_Vertex& theVertex,
const TopoDS_Edge& theEdge,
const TopoDS_Face& theFace,
const TopoDS_Edge& theNewEdge,
const TopoDS_Face& theNewFace,
Standard_Real& theParamOnConst,
Standard_Real& theParam,
gp_Pnt& thePntOnConst,
gp_Pnt& thePnt,
gp_Pnt& thePntSol,
gp_Pnt2d& thePnt2d,
Standard_Real& theTolReached);
Standard_EXPORT Standard_Boolean IsMoreThan3Edges(const TopoDS_Vertex& theVertex);
Standard_EXPORT Standard_Boolean AreSmoothlyConnected(const TopoDS_Edge& theEdge1,
const TopoDS_Edge& theEdge2,
const TopoDS_Vertex& theVertex,
const TopoDS_Face& theFace,
TopoDS_Edge& theThirdEdge);
Standard_EXPORT void UpdateVertexTol(const TopoDS_Vertex& theVertex,
const TopoDS_Edge& theEdge1,
const TopoDS_Edge& theProEdge1,
const TopAbs_Orientation theOrOfVertexForEdge1,
const TopoDS_Edge& theEdge2,
const TopoDS_Edge& theProEdge2,
const TopoDS_Face& theFace,
TColStd_SequenceOfReal& theIntParamsOnFirst,
TColStd_SequenceOfReal& theIntParamsOnSecond);
Standard_EXPORT void UpdateVertexTolOnAllFaces(const TopoDS_Vertex& theVertex,
const TopoDS_Vertex& theProVertex);
TopoDS_Shape myInitialShape;
TopTools_IndexedDataMapOfShapeShape myFacePatchFace;
TopTools_IndexedDataMapOfShapeShape myFaceNewFace;
TopTools_DataMapOfShapeShape myNewFaceBoundedFace;
TopTools_DataMapOfShapeShape myEdgeNewEdge;
TopTools_DataMapOfShapeShape myVertexNewVertex;
TopTools_MapOfShape myTangentEdges;
TopTools_MapOfShape mySmoothEdges;
TopTools_IndexedDataMapOfShapeListOfShape myEFmap;
TopTools_IndexedDataMapOfShapeListOfShape myVEmap;
TopTools_DataMapOfShapeListOfShape myVFmap;
};
#endif // _BRepOffsetAPI_PatchFaces_HeaderFile

View File

@@ -27,3 +27,5 @@ BRepOffsetAPI_SequenceOfSequenceOfShape.hxx
BRepOffsetAPI_Sewing.hxx
BRepOffsetAPI_ThruSections.cxx
BRepOffsetAPI_ThruSections.hxx
BRepOffsetAPI_PatchFaces.cxx
BRepOffsetAPI_PatchFaces.hxx

View File

@@ -54,6 +54,8 @@
#include <LocOpe_FindEdges.hxx>
#include <LocOpe_FindEdgesInFace.hxx>
#include <BRepOffsetAPI_PatchFaces.hxx>
#include <BRepOffsetAPI_MakeOffsetShape.hxx>
#include <BRepOffsetAPI_MakeThickSolid.hxx>
#include <BRep_Tool.hxx>
@@ -2249,6 +2251,114 @@ static Standard_Integer BOSS(Draw_Interpretor& theCommands,
return 1;
}
static BRepOffsetAPI_PatchFaces aPFBuilder;
//=======================================================================
//function : patchfaces
//purpose :
//=======================================================================
static Standard_Integer patchfaces(Draw_Interpretor& /*di*/,
Standard_Integer n, const char** a)
{
if (n < 5) return 1;
TopoDS_Shape aShape = DBRep::Get(a[2]);
if (aShape.IsNull()) return 1;
TopoDS_Shape aLocalFace = DBRep::Get(a[3], TopAbs_FACE);
if (aLocalFace.IsNull()) return 1;
TopoDS_Face aFace = TopoDS::Face(aLocalFace);
TopoDS_Shape aLocalNewFace = DBRep::Get(a[4], TopAbs_FACE);
if (aLocalNewFace.IsNull()) return 1;
TopoDS_Face aNewFace = TopoDS::Face(aLocalNewFace);
aPFBuilder.Clear();
aPFBuilder.SetShape(aShape);
aPFBuilder.AddPatchFace(aFace, aNewFace);
aPFBuilder.Build();
const TopoDS_Shape& Result = aPFBuilder.Shape();
DBRep::Set(a[1], Result);
return 0;
}
//=======================================================================
//function : pfgetpatchface
//purpose :
//=======================================================================
static Standard_Integer pfgetpatchface(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n != 3)
{
di << di.PrintHelp(a[0]);
return 1;
}
if (!aPFBuilder.IsDone())
{
di << "perform PatchFace operation first\n";
return 1;
}
TopoDS_Shape anInitialFace = DBRep::Get(a[2]);
if (anInitialFace.IsNull())
{
di << "The shape " << a[2] << " is a null shape\n";
return 1;
}
TopoDS_Shape aPatch = aPFBuilder.GetPatchFace(TopoDS::Face(anInitialFace));
DBRep::Set(a[1], aPatch);
return 0;
}
//=======================================================================
//function : pfgetadjacentfaces
//purpose :
//=======================================================================
static Standard_Integer pfgetadjacentfaces(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n != 3)
{
di << di.PrintHelp(a[0]);
return 1;
}
if (!aPFBuilder.IsDone())
{
di << "perform PatchFace operation first\n";
return 1;
}
TopoDS_Shape anInitialFace = DBRep::Get(a[2]);
if (anInitialFace.IsNull())
{
di << "The shape " << a[2] << " is a null shape\n";
return 1;
}
TopTools_ListOfShape aLF;
aPFBuilder.GetAdjacentFaces(TopoDS::Face(anInitialFace), aLF);
BRep_Builder aBB;
TopoDS_Compound aCFN;
aBB.MakeCompound(aCFN);
TopTools_ListIteratorOfListOfShape aIt(aLF);
for (; aIt.More(); aIt.Next())
aBB.Add(aCFN, aIt.Value());
DBRep::Set(a[1], aCFN);
return 0;
}
//=======================================================================
//function : FeatureCommands
@@ -2395,4 +2505,12 @@ void BRepTest::FeatureCommands (Draw_Interpretor& theCommands)
" Perform fillet on top and bottom edges of dprism :bossage dprism result radtop radbottom First/LastShape (1/2)",
__FILE__,BOSS);
theCommands.Add("patchfaces", "patchfaces res shape face newface",
__FILE__,patchfaces,g);
theCommands.Add("pfgetpatchface", "Get the patched face, updated to fit the model, for the given face.\n"
"Usage: pfgetpatchface res face", __FILE__, pfgetpatchface, g);
theCommands.Add("pfgetadjacentfaces", "Returns the list of the faces, updated to fit the model, adjacent to the given replaced face.\n"
"Usage: pfgetadjacentfaces res face", __FILE__, pfgetadjacentfaces, 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

@@ -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

@@ -99,7 +99,55 @@ void TopExp::MapShapesAndAncestors
}
}
//=======================================================================
//function : MapShapesAndUniqueAncestors
//purpose :
//=======================================================================
void TopExp::MapShapesAndUniqueAncestors
(const TopoDS_Shape& S,
const TopAbs_ShapeEnum TS,
const TopAbs_ShapeEnum TA,
TopTools_IndexedDataMapOfShapeListOfShape& M,
const Standard_Boolean useOrientation)
{
TopTools_ListOfShape empty;
// visit ancestors
TopExp_Explorer exa(S,TA);
while (exa.More())
{
// visit shapes
const TopoDS_Shape& anc = exa.Current();
TopExp_Explorer exs(anc,TS);
while (exs.More())
{
Standard_Integer index = M.FindIndex(exs.Current());
if (index == 0)
index = M.Add(exs.Current(),empty);
TopTools_ListOfShape& aList = M(index);
// check if anc already exists in a list
TopTools_ListIteratorOfListOfShape it(aList);
for (; it.More(); it.Next())
if (useOrientation? anc.IsEqual(it.Value()) : anc.IsSame(it.Value()))
break;
if (!it.More())
aList.Append(anc);
exs.Next();
}
exa.Next();
}
// visit shapes not under ancestors
TopExp_Explorer ex(S,TS,TA);
while (ex.More())
{
Standard_Integer index = M.FindIndex(ex.Current());
if (index == 0)
M.Add(ex.Current(),empty);
ex.Next();
}
}
//=======================================================================
//function : FirstVertex

View File

@@ -66,6 +66,18 @@ public:
//! Warning: The map is not cleared at first.
Standard_EXPORT static void MapShapesAndAncestors (const TopoDS_Shape& S, const TopAbs_ShapeEnum TS, const TopAbs_ShapeEnum TA, TopTools_IndexedDataMapOfShapeListOfShape& M);
//! Stores in the map <M> all the subshape of <S> of
//! type <TS> for each one append to the list all
//! unique ancestors of type <TA>. For example map all
//! the edges and bind the list of faces.
//! useOrientation = True : taking account the ancestor orientation
//! Warning: The map is not cleared at first.
Standard_EXPORT static void MapShapesAndUniqueAncestors (const TopoDS_Shape& S,
const TopAbs_ShapeEnum TS,
const TopAbs_ShapeEnum TA,
TopTools_IndexedDataMapOfShapeListOfShape& M,
const Standard_Boolean useOrientation = Standard_False);
//! Returns the Vertex of orientation FORWARD in E. If
//! there is none returns a Null Shape.
//! CumOri = True : taking account the edge orientation

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"

23
tests/patchfaces/begin Normal file
View File

@@ -0,0 +1,23 @@
# To prevent loops limit to 10 minutes
cpulimit 100
if { [array get Draw_Groups "TOPOLOGY Feature commands"] == "" } {
pload TOPTEST
}
if { [array get Draw_Groups "Shape Healing"] == "" } {
pload XSDRAW
}
if { [info exists imagedir] == 0 } {
set imagedir .
}
if { [info exists test_image ] == 0 } {
set test_image photo
}
proc PATCHFACES {i} {
uplevel #0 binrestore [locate_data_file shape_3_$i.bin] s
uplevel #0 tclean s
uplevel #0 removeloc s s
uplevel #0 explode s
uplevel #0 tcopy s_1 InitShape
uplevel #0 patchfaces result s_1 s_2 s_3
}

1
tests/patchfaces/end Normal file
View File

@@ -0,0 +1 @@
puts "TEST COMPLETED"

View File

@@ -0,0 +1 @@
001 replace

View File

@@ -0,0 +1,2 @@
FAILED /\bFaulty\b/ bad shape
OK /Relative error of mass computation/ message from vprops

View File

@@ -0,0 +1,2 @@
checkshape result
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1 @@
PATCHFACES 1

View File

@@ -0,0 +1 @@
PATCHFACES 10

View File

@@ -0,0 +1 @@
PATCHFACES 11

View File

@@ -0,0 +1 @@
PATCHFACES 12

View File

@@ -0,0 +1 @@
PATCHFACES 13

View File

@@ -0,0 +1 @@
PATCHFACES 14

View File

@@ -0,0 +1 @@
PATCHFACES 15

View File

@@ -0,0 +1 @@
PATCHFACES 16

View File

@@ -0,0 +1 @@
PATCHFACES 17

View File

@@ -0,0 +1 @@
PATCHFACES 18

View File

@@ -0,0 +1 @@
PATCHFACES 19

View File

@@ -0,0 +1 @@
PATCHFACES 2

View File

@@ -0,0 +1 @@
PATCHFACES 20

View File

@@ -0,0 +1 @@
PATCHFACES 21

View File

@@ -0,0 +1 @@
PATCHFACES 22

View File

@@ -0,0 +1 @@
PATCHFACES 23

View File

@@ -0,0 +1 @@
PATCHFACES 24

View File

@@ -0,0 +1 @@
PATCHFACES 25

View File

@@ -0,0 +1 @@
PATCHFACES 26

View File

@@ -0,0 +1 @@
PATCHFACES 27

View File

@@ -0,0 +1 @@
PATCHFACES 28

View File

@@ -0,0 +1 @@
PATCHFACES 29

View File

@@ -0,0 +1 @@
PATCHFACES 3

View File

@@ -0,0 +1 @@
PATCHFACES 30

View File

@@ -0,0 +1 @@
PATCHFACES 31

View File

@@ -0,0 +1 @@
PATCHFACES 32

View File

@@ -0,0 +1 @@
PATCHFACES 33

View File

@@ -0,0 +1 @@
PATCHFACES 34

View File

@@ -0,0 +1 @@
PATCHFACES 35

View File

@@ -0,0 +1 @@
PATCHFACES 4

View File

@@ -0,0 +1 @@
PATCHFACES 5

View File

@@ -0,0 +1 @@
PATCHFACES 6

View File

@@ -0,0 +1 @@
PATCHFACES 7

View File

@@ -0,0 +1 @@
PATCHFACES 8

View File

@@ -0,0 +1 @@
PATCHFACES 9