1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Compare commits

...

7 Commits

Author SHA1 Message Date
jgv
6a4383a6dc Next version. 2017-10-09 06:38:30 +03:00
jgv
59461231ef Next version. 2017-10-09 06:38:29 +03:00
jgv
0b85d5c5e7 Next version 2017-10-09 06:38:28 +03:00
jgv
7c9e1b2974 Next version. 2017-10-09 06:38:26 +03:00
jgv
73f3d038c8 Fix of exceptions 2017-10-09 06:38:25 +03:00
jgv
b72596ba13 Creation of the test cases for new functionality. 2017-10-09 06:38:24 +03:00
jgv
d27070fd69 0029003: Implementation of the algorithm for replacing faces in shape with new faces based on other surfaces
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).
2017-10-09 06:38:23 +03:00
46 changed files with 1895 additions and 6 deletions

View File

@@ -2865,7 +2865,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 = 2.; //4.;
const Standard_Real TolApex = 1.e-5;
Standard_Boolean SurfaceChange = Standard_False;
@@ -3248,7 +3248,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.
@@ -3270,8 +3271,20 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace
}
S->Bounds (US1,US2,VS1,VS2);
UU1 = VV1 = - TheInfini;
UU2 = VV2 = TheInfini;
if (UseInfini)
{
UU1 = VV1 = - TheInfini;
UU2 = VV2 = TheInfini;
}
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,
@@ -4148,4 +4161,4 @@ void PerformPlanes(const TopoDS_Face& theFace1,
Standard_Boolean IsInf(const Standard_Real theVal)
{
return (theVal > TheInfini*0.9);
}
}

View File

@@ -104,7 +104,14 @@ 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);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,131 @@
// 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);
//! 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;
protected:
private:
Standard_EXPORT void UpdateEdgesAndVertex(const TopoDS_Edge& thePrevEdge,
TopoDS_Edge& thePrevNewEdge,
const TopoDS_Edge& theCurEdge,
TopoDS_Edge& theCurNewEdge,
TopoDS_Vertex& theCurVertex,
const TopoDS_Face& theFace,
const TopoDS_Face& theNewFace,
TopoDS_Face& theBoundedNewFace);
Standard_EXPORT void PutVertexToEdge(const TopoDS_Vertex& theVertex,
//const TopoDS_Vertex& theProVertex,
const TopAbs_Orientation theProVertexOrientation,
TopoDS_Edge& theEdge,
const TopoDS_Edge& theProEdge,
const TopoDS_Face& theFace,
const gp_Pnt2d& Pnt2dOnConstEdge,
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);
TopoDS_Shape myInitialShape;
TopTools_IndexedDataMapOfShapeShape myFacePatchFace;
TopTools_IndexedDataMapOfShapeShape myFaceNewFace;
TopTools_DataMapOfShapeShape myNewFaceBoundedFace;
TopTools_DataMapOfShapeShape myEdgeNewEdge;
//TopTools_DataMapOfOrientedShapeShape myOrientedEdgeNewEdge;
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

@@ -62,6 +62,8 @@
#include <DBRep_DrawableShape.hxx>
#include <BRepTest.hxx>
#include <BRepOffsetAPI_PatchFaces.hxx>
#include <BRepFilletAPI_MakeFillet.hxx>
#include <ChFi3d_FilletShape.hxx>
@@ -2287,6 +2289,36 @@ static Standard_Integer ComputeSimpleOffset(Draw_Interpretor& theCommands,
return 0;
}
//=======================================================================
//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);
BRepOffsetAPI_PatchFaces Builder(aShape);
Builder.AddPatchFace(aFace, aNewFace);
Builder.Build();
TopoDS_Shape Result = Builder.Shape();
DBRep::Set(a[1], Result);
return 0;
}
//=======================================================================
//function : FeatureCommands
//purpose :
@@ -2435,4 +2467,7 @@ void BRepTest::FeatureCommands (Draw_Interpretor& theCommands)
theCommands.Add("offsetshapesimple",
"offsetshapesimple result shape offsetvalue [solid] [tolerance=1e-7]",
__FILE__, ComputeSimpleOffset);
theCommands.Add("patchfaces", "patchfaces res shape face newface",
__FILE__,patchfaces,g);
}

23
tests/patchfaces/begin Normal file
View File

@@ -0,0 +1,23 @@
# To prevent loops limit to 10 minutes
cpulimit 900
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,2 @@
001 replace
002 replace_new

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