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

Compare commits

..

24 Commits

Author SHA1 Message Date
isn
ed6cbce72b reading of multidomain stl files into separate Poly_Triangulation objects (draft) 2018-06-28 17:46:25 +03:00
abv
a820bd4f13 0029859: Coding - GCC compiler warning -Warray-bounds in IntPatch_InterferencePolyhedron.cxx
Code is corrected to avoid copying uninitialized element of the array
2018-06-14 14:03:14 +03:00
dipts
56cc44e0f5 0029847: Visualization, Image_Diff - Tolerance is not effective for 24/32bit image formats
Image_Color - removed semibroken summ/difference operators.
Image_Diff now uses signed integer for computing differnce between ubyte3 components;
properly compare squared tolerance.

Image_Diff - dropped declaration of Image_ColorXXX24.
RGB color difference is now computed using Chebyshev distance instead of Euclidean distance
Image_PixMap - added methods RawValue()/ChangeRawValue() returning a pointer
to image where specified pixel data is defined.
2018-06-14 14:03:13 +03:00
emv
cf12784f94 0029845: UnifySameDomain does not account the accumulated angle when unifying edges
Check that the accumulated angle does not exceed the given angular tolerance while merging the linear edges.
Test case for the issue.
2018-06-14 14:03:12 +03:00
nds
0c44027cb9 0029841: Test cases from tools/dfbrowser periodically hang on Windows platform
Do not start new thread if the thread has been already started. Restart the thread after the previous has finished.
2018-06-14 14:03:12 +03:00
kgv
bc37935836 0029825: Foundation Classes, NCollection_Vec4 - workaround gcc optimizer issues with xyz() method
Methods of NCollection_Vec3 and NCollection_Vec3 that returned reference to internal buffer as vector of lower dimension (non-const xy(), xyz() etc.) are eliminated.
Use of these methods could led to generation of incorrect binary code by GCC.
Instead added new method SetValues() accepting vector of lower dimension and additional value.

DRAW test command QANColTestVec4 reproducing one situation where the bug occurs is added, along with a test case.
2018-06-14 14:03:11 +03:00
abv
4e73d75b03 0029826: Tests - test case perf/fclasses/strtod is unstable
Check of performance of accelerated Strtod() vs. standard strtod() in the test is relaxed: now test passes if Strtod() is at least 1.5 times faster
2018-06-14 14:03:10 +03:00
vro
bd6f0d2ff9 0029116: [Regression] OCAF attributes insertion order is violated again 2018-06-14 14:03:10 +03:00
kgv
b2d1851c43 0029814: Modeling Data - add method TopoDS_Shape::NbChildren() for simple check of sub-shapes number
TopoDS_Shape::NbChildren() - new method has been introduced.
TopoDS_Shape.lxx, TopoDS_TShape.lxx - inline methods have been moved to hxx.
TopoDS_TShape_Flags has been redeclared as enumeration instead of preprocessor macros.

Cyclic dependency between headers TopoDS_Shape.hxx and TopoDS_TShape.hxx eliminated.

Places where TopoDS_Iterator is used only for calculation of number of sub-shapes are updated to use NbChildren() instead
2018-06-14 14:03:09 +03:00
jgv
e67e482d99 0029511: Section fails for these two faces
Modified method: Approx_ComputeLine::Compute
Check of multicurve is now always unconditional, the procedure of check is modified to avoid infinite loops.

Modified classes: GeomLib_CheckBSplineCurve and GeomLib_Check2dBSplineCurve
Correction of poles at the ends of curve is modified to fit the direction of tangent defined by two first points or two last points of walking line.

Also modified:

BOPAlgo_PaveFiller: modified methods PostTreatFF, RemoveUsedVertices - now unused vertices are included in the list of vertices to be absorbed by other ones.
2018-06-14 14:03:08 +03:00
jgv
d60e8ddedc 0029813: BRepFill_PipeShell algorithm produces invalid result
Modified method: BRepFill_Sweep::BuildShell
case of global closedness of path containing several C0-connected parts is corrected.
2018-06-14 14:03:08 +03:00
ika
f277ba3771 0029821: Data Exchange - Wrong processing of subshapes in ShapeTool
Improve FindSubShape method in ShapeTool.
Update Expand compounds, according to changes in ShapeTool.
Add FindSubShape and AddSubShape commands for Draw.
2018-06-14 14:03:07 +03:00
emv
948fe6ca88 0028747: Incorrect result of the section operation after edge refinement
Implementation of the method for simplification of the result of Boolean Operation on the API level.
The method BRepAlgoAPI_BuilderAlgo::SimplifyResult has been added, so the derived classes such as BooleanOpeation and Splitter can also use this method.
The result shape simplification should be called after the operation is done. The simplification is performed by the means of ShapeUpgrade_UnifySameDomain algorithm.

Draw command "bsimplify" has been added to control the simplification options.
Documentation for new functionality and draw commands controlling the options of Boolean operations.
Test cases for the new functionality.

Side-effect change:
The algorithms in Boolean component have been changed to use the BRepTools_History as a History tool.
Now it became possible to disable the collection of shapes modifications during Boolean Operations, which may be useful for performance sake (in draw the option is controlled by *setfillhistory* command).
Draw command "unifysamedom" has been changed to accept the angular tolerance in degrees instead of radians.
2018-06-14 14:03:06 +03:00
nbv
894dba72a3 0029694: Geom2dGcc_Circ2dTanCenGeo crash
The reason of this issue is in incorrectly interpreted the generic class "TheExtPC" (eliminated after the fix 0024773) as Extrema_ExtPC2d. Correct interpretation must be "Extrema_EPCOfExtPC2d" class.

Now this problem has been fixed in the class Geom2dGcc_Circ2dTanCenGeo.

New testgrid "lowalgos 2dgcc" has been created.
2018-06-14 14:03:06 +03:00
nbv
638ad7f3c5 0029712: Extrema algorithm raises exception
1. Extrema algorithm calls Curve-surface intersector. This intersector returns flag about infinite solution (in spite of extrema's returning not-parallel status correctly - axes of considered cylinder and circle are not parallel). In this case, attempt of obtaining number of intersection points leads to exception.

So, the fix adds check of infinite solution after the intersection algorithm.

2. The methods IsDone(), IsParallel(), NbExt(), SquareDistance() and Points() (of Extrema_* classes) have been corrected to make them consistent to the documentation.

3. Revision of some Extrema_* classes has been made in order to avoid places with uninitialized variables.

4. Currently Extrema does not store any points in case when the arguments are parallel. It stores the distance only.

5. Some cases on Extrema-algo have been moved from "fclasses"-group to "modalg"-group.
2018-06-14 14:03:05 +03:00
msv
395a5977d5 0029777: Foundation Classes - The methods of moving of one NCollection_Sequence to another are unsafe
Make the methods Append, Prepend, InsertBefore and InsertAfter, which take another sequence as an argument, copying the sequence instead of joining if the allocators are different.

Add test cases for collection classes.
2018-06-14 14:03:04 +03:00
nbv
ef33df518a 0029691: Constructor of BRepFill_MultiLine adjusts V-parameter of sphere in the range -PI/2 ... +PI/2 mistakenly.
1. Sphere is not V-periodic surface. See the section "Periodicity concept" written in frame of the fix 0029115. Therefore, applying ElCLib::AdjustPeriodic(...) method is unreasonable.

2. Default U work range of sphere is 0 ... 2*PI. Therefore, adjusting U parameter in range -PI/2 ... +PI/2 is unreasonable.
2018-06-14 14:03:04 +03:00
ifv
7e4ff64898 0029586: Revolution creates solid with degenerated edges shared among faces
Substitution of degenerated edges by their copies is implemented to make edges not shared
in BRepPrimAPI_MakeRevol::Build().
Method BRepPrimAPI_MakeRevol::Generated(...) is changed in order to use history of substitutions.
Test case is added.
2018-06-14 14:03:03 +03:00
drazmyslovich
9f785738a1 0029719: Modeling Algorithms - GeomPlate_BuildPlateSurface has no progress information and is not abortable
The Message_ProgressIndicator handle is added as a parameter to the function LU_Decompose and the the member functions of math_Gauss, Plate_Plate and GeomPlate_BuildPlateSurface classes.
2018-06-14 14:03:02 +03:00
kgv
25c35042b6 0029729: Visualization, Graphic3d_ClipPlane - add support of clipping plane chains
Graphic3d_ClipPlane now can define a Chain of Planes (logical AND).
OpenGl_ShaderManager - added new GLSL sub-programs for clipping plane chains.
Bnd_Range::TrimFrom(), ::TrimTo() - added auxiliary methods for trimming the range.
SelectMgr_ViewClipRange now handles non-continuous clipping range.
Graphic3d_SequenceOfHClipPlane now aggregates NCollection_Sequence instead of inheritance.
OpenGl_CappingPlaneResource - triangulation has been adjusted to make front face following CCW order.
2018-06-14 14:03:02 +03:00
Benjamin Bihler
012264339e 0029765: BOPTools_AlgoTools::MakeSplitEdge Creates Illegal Edge
Method MakeSplitEdge checks arguments order.
This makes the method more generic.
Taking vertex orientation into account.
2018-06-14 14:03:01 +03:00
kgv
e52ba46e3b 0029520: Visualization - drop deprecated V3d_View::Export() functionality and dependency from gl2ps 2018-06-14 14:03:00 +03:00
bugmaster
7775636a15 Switching #define OCC_VERSION_DEVELOPMENT "dev" 2018-06-14 14:03:00 +03:00
bugmaster
ec86d65faf Update version of OCCT up to 7.3.1 2018-06-14 14:02:59 +03:00
406 changed files with 7716 additions and 6880 deletions

View File

@@ -481,7 +481,6 @@ OCCT_IS_PRODUCT_REQUIRED (CSF_FreeImagePlus CAN_USE_FREEIMAGE)
OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL)
OCCT_IS_PRODUCT_REQUIRED (CSF_FREETYPE USE_FREETYPE)
OCCT_IS_PRODUCT_REQUIRED (CSF_OpenGlLibs CAN_USE_GLES2)
OCCT_IS_PRODUCT_REQUIRED (CSF_GL2PS CAN_USE_GL2PS)
OCCT_IS_PRODUCT_REQUIRED (CSF_TBB CAN_USE_TBB)
OCCT_IS_PRODUCT_REQUIRED (CSF_EIGEN CAN_USE_EIGEN)
@@ -609,24 +608,6 @@ else()
OCCT_CHECK_AND_UNSET ("INSTALL_GLES2")
endif()
# GL2PS
if (NOT DEFINED ANDROID AND CAN_USE_GL2PS)
set (USE_GL2PS OFF CACHE BOOL "${USE_GL2PS_DESCR}")
if (USE_GL2PS)
add_definitions (-DHAVE_GL2PS)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gl2ps")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS")
OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS")
endif()
else()
OCCT_CHECK_AND_UNSET ("USE_GL2PS")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS")
OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS")
endif()
# TBB
if (NOT DEFINED ANDROID AND CAN_USE_TBB)
set (USE_TBB OFF CACHE BOOL "${USE_TBB_DESCR}")

View File

@@ -1,17 +1,17 @@
wnt WOKSteps_exec_link DRAWEXE #WOKStep_EXELink(exec.tks)
lin WOKSteps_exec_link DRAWEXE #WOKStep_EXELink(exec.tks)
wnt cmplrs_cxx f -D_CRT_SECURE_NO_DEPRECATE -DHAVE_FREEIMAGE -DHAVE_GL2PS -DHAVE_TBB -DHAVE_OPENCL
wnt cmplrs_cxx b -D_CRT_SECURE_NO_DEPRECATE -DHAVE_FREEIMAGE -DHAVE_GL2PS -DHAVE_TBB -DHAVE_OPENCL
wnt cmplrs_cxx f -D_CRT_SECURE_NO_DEPRECATE -DHAVE_FREEIMAGE -DHAVE_TBB -DHAVE_OPENCL
wnt cmplrs_cxx b -D_CRT_SECURE_NO_DEPRECATE -DHAVE_FREEIMAGE -DHAVE_TBB -DHAVE_OPENCL
wnt cmplrs_cxx Aspect (wnt cmplrs_cxx b) -D_AFXDLL
wnt cmplrs_cxx (wnt cmplrs_cxx b) -D_AFXDLL -D_AFXDLL
wnt cmplrs_c f -D_CRT_SECURE_NO_DEPRECATE -DHAVE_FREEIMAGE -DHAVE_GL2PS -DHAVE_TBB -DHAVE_OPENCL
wnt cmplrs_c b -D_CRT_SECURE_NO_DEPRECATE -DHAVE_FREEIMAGE -DHAVE_GL2PS -DHAVE_TBB -DHAVE_OPENCL
wnt cmplrs_c f -D_CRT_SECURE_NO_DEPRECATE -DHAVE_FREEIMAGE -DHAVE_TBB -DHAVE_OPENCL
wnt cmplrs_c b -D_CRT_SECURE_NO_DEPRECATE -DHAVE_FREEIMAGE -DHAVE_TBB -DHAVE_OPENCL
wnt cmplrs_c NIS (wnt cmplrs_c b) -DSILGL -DSILGL_VRS=50
lin cmplrs_cxx f -DOCC_CONVERT_SIGNALS -D_GNU_SOURCE=1 -DHAVE_FREEIMAGE -DHAVE_GL2PS -DHAVE_TBB -DHAVE_OPENCL
lin cmplrs_cxx b -DOCC_CONVERT_SIGNALS -D_GNU_SOURCE=1 -DHAVE_FREEIMAGE -DHAVE_GL2PS -DHAVE_TBB -DHAVE_OPENCL
lin cmplrs_cxx f -DOCC_CONVERT_SIGNALS -D_GNU_SOURCE=1 -DHAVE_FREEIMAGE -DHAVE_TBB -DHAVE_OPENCL
lin cmplrs_cxx b -DOCC_CONVERT_SIGNALS -D_GNU_SOURCE=1 -DHAVE_FREEIMAGE -DHAVE_TBB -DHAVE_OPENCL
lin cmplrs_c f -D_GNU_SOURCE=1 -fexceptions
lin cmplrs_c b -D_GNU_SOURCE=1 -fexceptions

View File

@@ -277,26 +277,6 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_CSF_NAME LIBRARY_NAME
endif()
endif()
if("${PRODUCT_NAME}" STREQUAL "GL2PS")
get_filename_component(GL2PSLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}} NAME)
if (SINGLE_GENERATOR)
install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR_LIB}" RENAME ${GL2PSLIB}.1)
else()
install (FILES "${ABS_PATH}"
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR_LIB}"
RENAME ${GL2PSLIB}.1)
install (FILES "${ABS_PATH}"
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR_LIB}i"
RENAME ${GL2PSLIB}.1)
install (FILES "${ABS_PATH}"
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR_LIB}d"
RENAME ${GL2PSLIB}.1)
endif()
endif()
endif()
else()
# the library directory for using by the executable

View File

@@ -1,3 +0,0 @@
#GL2PS
THIRDPARTY_PRODUCT("GL2PS" "gl2ps.h" "CSF_GL2PS" "d")

View File

@@ -58,15 +58,6 @@ if (USE_TCL)
endif()
endif()
# GL2PS
if (NOT DEFINED ANDROID)
if (USE_GL2PS)
set (CSF_GL2PS "gl2ps")
else()
set (CSF_GL2PS)
endif()
endif()
if (WIN32)
set (CSF_advapi32 "advapi32.lib")
set (CSF_gdi32 "gdi32.lib")

View File

@@ -40,7 +40,7 @@ Precompiled headers are generated automatically by Cotire tool.")
# install variables
set (INSTALL_DIR_DESCR
"The place where built OCCT libraries, headers, test cases (INSTALL_TEST_CASES variable),
samples (INSTALL_SAMPLES_DESCR variable) and certain 3rdparties (INSTALL_GL2PS, INSTALL_TBB and
samples (INSTALL_SAMPLES_DESCR variable) and certain 3rdparties (INSTALL_TBB and
other similar variables) will be placed during the installation process (building INSTALL project)")
set (INSTALL_DIR_WITH_VERSION_DESCR
@@ -88,7 +88,6 @@ INSTALL_MESSAGE (INSTALL_EIGEN "EIGEN header files")
INSTALL_MESSAGE (INSTALL_EGL "EGL binaries")
INSTALL_MESSAGE (INSTALL_GLES2 "OpenGL ES 2.0 binaries")
INSTALL_MESSAGE (INSTALL_FREETYPE "FreeType binaries")
INSTALL_MESSAGE (INSTALL_GL2PS "GL2PS binaries")
INSTALL_MESSAGE (INSTALL_TBB "TBB binaries")
INSTALL_MESSAGE (INSTALL_TCL "TCL binaries")
INSTALL_MESSAGE (INSTALL_TK "TK binaries")
@@ -165,10 +164,6 @@ set (USE_GLES2_DESCR
"Indicates whether OpenGL ES 2.0 should be used in OCCT visualization
module instead of desktop OpenGL")
set (USE_GL2PS_DESCR
"Indicates whether GL2PS product should be used in OCCT visualization
module for support of vector image formats (PS, EPS etc)")
set (USE_TBB_DESCR
"Indicates whether TBB is used or not. TBB stands for Threading Building Blocks,
the technology of Intel Corp, which comes with different mechanisms and patterns for

View File

@@ -139,9 +139,6 @@ proc wokdep:gui:UpdateList {} {
wokdep:SearchFreeType anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
wokdep:SearchX11 anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
if { "$::HAVE_GLES2" == "true" } {
if { "$::HAVE_GL2PS" == "true" } {
lappend anIncErrs "Error: gl2ps can not be used with OpenGL ES"
}
wokdep:SearchEGL anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
wokdep:SearchGLES anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
}
@@ -151,9 +148,6 @@ proc wokdep:gui:UpdateList {} {
if { "$::HAVE_FFMPEG" == "true" } {
wokdep:SearchFFmpeg anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
}
if { "$::HAVE_GL2PS" == "true" } {
wokdep:SearchStandardLibrary anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs "gl2ps" "gl2ps.h" "gl2ps" {"gl2ps"}
}
if { "$::HAVE_TBB" == "true" } {
wokdep:SearchTBB anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
}
@@ -415,8 +409,6 @@ entry .myFrame.mySrchEntry -textvariable PRODUCTS_PATH -width 80
ttk::button .myFrame.mySrchBrowseBtn -text "Browse" -command wokdep:gui:BrowsePartiesRoot
checkbutton .myFrame.myChecks.myFImageCheck -offvalue "false" -onvalue "true" -variable HAVE_FREEIMAGE -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myFImageLbl -text "Use FreeImage"
checkbutton .myFrame.myChecks.myGl2psCheck -offvalue "false" -onvalue "true" -variable HAVE_GL2PS -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myGl2psLbl -text "Use GL2PS"
checkbutton .myFrame.myChecks.myTbbCheck -offvalue "false" -onvalue "true" -variable HAVE_TBB -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myTbbLbl -text "Use Intel TBB"
if { "$::tcl_platform(os)" != "Darwin" } {
@@ -545,9 +537,6 @@ if { "$::tcl_platform(os)" != "Darwin" } {
grid .myFrame.myChecks.myZLibCheck -row $aCheckRowIter -column 6 -sticky e
grid .myFrame.myChecks.myZLibLbl -row $aCheckRowIter -column 7 -sticky w
grid .myFrame.myChecks.myGl2psCheck -row $aCheckRowIter -column 8 -sticky e
grid .myFrame.myChecks.myGl2psLbl -row $aCheckRowIter -column 9 -sticky w
grid .myFrame.myChecks.myQt4Check -row $aCheckRowIter -column 10 -sticky e
grid .myFrame.myChecks.myQt4Lbl -row $aCheckRowIter -column 11 -sticky w

View File

@@ -65,7 +65,7 @@ if { [info exists ::env(SHORTCUT_HEADERS)] } {
}
# fetch environment variables (e.g. set by custom.sh or custom.bat) and set them as tcl variables with the same name
set THE_ENV_VARIABLES {HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_GL2PS HAVE_ZLIB HAVE_LIBLZMA HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo}
set THE_ENV_VARIABLES {HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_ZLIB HAVE_LIBLZMA HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo}
foreach anEnvIter $THE_ENV_VARIABLES {
set ${anEnvIter} "false"
if { [info exists ::env(${anEnvIter})] } {

View File

@@ -1318,9 +1318,6 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
if { "$::HAVE_FFMPEG" == "true" } {
set aLibsMap(CSF_FFmpeg) "avcodec avformat swscale avutil"
}
if { "$::HAVE_GL2PS" == "true" } {
set aLibsMap(CSF_GL2PS) "gl2ps"
}
if { "$::HAVE_TBB" == "true" } {
set aLibsMap(CSF_TBB) "tbb tbbmalloc"
}

View File

@@ -58,7 +58,6 @@ set (OpenCASCADE_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@)
set (OpenCASCADE_WITH_TCL @USE_TCL@)
set (OpenCASCADE_WITH_FREETYPE @USE_FREETYPE@)
set (OpenCASCADE_WITH_FREEIMAGE @USE_FREEIMAGE@)
set (OpenCASCADE_WITH_GL2PS @USE_GL2PS@)
set (OpenCASCADE_WITH_TBB @USE_TBB@)
set (OpenCASCADE_WITH_VTK @USE_VTK@)
set (OpenCASCADE_WITH_FFMPEG @USE_FFMPEG@)

View File

@@ -11,7 +11,6 @@ if /I "%VCVER%" == "@COMPILER@" (
set "FREEIMAGE_DIR=@3RDPARTY_FREEIMAGE_DLL_DIRS@"
set "EGL_DIR=@3RDPARTY_EGL_DLL_DIRS@"
set "GLES2_DIR=@3RDPARTY_GLES2_DLL_DIRS@"
set "GL2PS_DIR=@3RDPARTY_GL2PS_DLL_DIRS@"
set "TBB_DIR=@3RDPARTY_TBB_DLL_DIR@"
set "VTK_DIR=@3RDPARTY_VTK_DLL_DIR@"
set "FFMPEG_DIR=@3RDPARTY_FFMPEG_DLL_DIR@"

View File

@@ -9,7 +9,6 @@ if [ "$1" == "@BIN_LETTER@" ]; then
export TK_DIR="@3RDPARTY_TK_LIBRARY_DIR@"
export FREETYPE_DIR="@3RDPARTY_FREETYPE_LIBRARY_DIR@"
export FREEIMAGE_DIR="@3RDPARTY_FREEIMAGE_LIBRARY_DIRS@"
export GL2PS_DIR="@3RDPARTY_GL2PS_LIBRARY_DIRS@"
export TBB_DIR="@3RDPARTY_TBB_LIBRARY_DIR@"
export VTK_DIR="@3RDPARTY_VTK_LIBRARY_DIR@"
export FFMPEG_DIR="@3RDPARTY_FFMPEG_LIBRARY_DIR@"

View File

@@ -13,7 +13,6 @@ if /I "%VCVER%" == "@COMPILER@" (
set "FREEIMAGE_DIR=@USED_3RDPARTY_FREEIMAGE_DIRS@"
set "EGL_DIR=@USED_3RDPARTY_EGL_DIRS@"
set "GLES2_DIR=@USED_3RDPARTY_GLES2_DIRS@"
set "GL2PS_DIR=@USED_3RDPARTY_GL2PS_DIRS@"
set "TBB_DIR=@USED_3RDPARTY_TBB_DIR@"
set "VTK_DIR=@USED_3RDPARTY_VTK_DIR@"
set "FFMPEG_DIR=@USED_3RDPARTY_FFMPEG_DIR@"

View File

@@ -9,7 +9,6 @@ if [ "$1" == "@BIN_LETTER@" ]; then
export TK_DIR="@USED_3RDPARTY_TK_DIR@"
export FREETYPE_DIR="@USED_3RDPARTY_FREETYPE_DIR@"
export FREEIMAGE_DIR="@USED_3RDPARTY_FREEIMAGE_DIRS@"
export GL2PS_DIR="@USED_3RDPARTY_GL2PS_DIRS@"
export TBB_DIR="@USED_3RDPARTY_TBB_DIR@"
export VTK_DIR="@USED_3RDPARTY_VTK_DIR@"
export FFMPEG_DIR="@USED_3RDPARTY_FFMPEG_DIR@"

View File

@@ -19,7 +19,6 @@ set "HAVE_TBB=false"
set "HAVE_OPENCL=false"
set "HAVE_FREEIMAGE=false"
set "HAVE_FFMPEG=false"
set "HAVE_GL2PS=false"
set "HAVE_VTK=false"
set "HAVE_GLES2=false"
set "HAVE_D3D=false"
@@ -156,7 +155,6 @@ set "CSF_OPT_CMPL="
set "PRODUCTS_DEFINES="
if ["%HAVE_TBB%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_TBB" & set "CSF_DEFINES=HAVE_TBB;%CSF_DEFINES%"
if ["%HAVE_OPENCL%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_OPENCL" & set "CSF_DEFINES=HAVE_OPENCL;%CSF_DEFINES%"
if ["%HAVE_GL2PS%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_GL2PS" & set "CSF_DEFINES=HAVE_GL2PS;%CSF_DEFINES%"
if ["%HAVE_FREEIMAGE%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FREEIMAGE" & set "CSF_DEFINES=HAVE_FREEIMAGE;%CSF_DEFINES%"
if ["%HAVE_FFMPEG%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FFMPEG" & set "CSF_DEFINES=HAVE_FFMPEG;%CSF_DEFINES%"
if ["%HAVE_VTK%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_VTK" & set "CSF_DEFINES=HAVE_VTK;%CSF_DEFINES%"

View File

@@ -126,7 +126,6 @@ if not ["%FREETYPE_DIR%"] == [""] set "PATH=%FREETYPE_DIR%;%PATH%"
if not ["%FREEIMAGE_DIR%"] == [""] set "PATH=%FREEIMAGE_DIR%;%PATH%"
if not ["%EGL_DIR%"] == [""] set "PATH=%EGL_DIR%;%PATH%"
if not ["%GLES2_DIR%"] == [""] set "PATH=%GLES2_DIR%;%PATH%"
if not ["%GL2PS_DIR%"] == [""] set "PATH=%GL2PS_DIR%;%PATH%"
if not ["%TBB_DIR%"] == [""] set "PATH=%TBB_DIR%;%PATH%"
if not ["%VTK_DIR%"] == [""] set "PATH=%VTK_DIR%;%PATH%"
if not ["%FFMPEG_DIR%"] == [""] set "PATH=%FFMPEG_DIR%;%PATH%"

View File

@@ -11,7 +11,6 @@ export HAVE_TBB="false";
export HAVE_OPENCL="false";
export HAVE_FREEIMAGE="false";
export HAVE_FFMPEG="false";
export HAVE_GL2PS="false";
export HAVE_VTK="false";
export HAVE_GLES2="false";
export HAVE_ZLIB="false";
@@ -96,7 +95,6 @@ if [ "$HAVE_TBB" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -D
if [ "$HAVE_OPENCL" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_OPENCL"; fi
if [ "$HAVE_FREEIMAGE" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_FREEIMAGE"; fi
if [ "$HAVE_FFMPEG" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_FFMPEG"; fi
if [ "$HAVE_GL2PS" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_GL2PS"; fi
if [ "$HAVE_GLES2" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_GLES2"; fi
if [ "$HAVE_VTK" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_VTK"; fi
if [ "$HAVE_ZLIB" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_ZLIB"; fi

View File

@@ -57,10 +57,6 @@ if [ "$FREEIMAGE_DIR" != "" ]; then
THRDPARTY_PATH="${FREEIMAGE_DIR}:${THRDPARTY_PATH}"
fi
if [ "$GL2PS_DIR" != "" ]; then
THRDPARTY_PATH="${GL2PS_DIR}:${THRDPARTY_PATH}"
fi
if [ "$TBB_DIR" != "" ]; then
THRDPARTY_PATH="${TBB_DIR}:${THRDPARTY_PATH}"
fi

View File

@@ -19,7 +19,6 @@ There are two types of third-party products, which are necessary to build OCCT:
* FreeType 2.4.10 - 2.5.3;
* Optional products:
* TBB 3.x - 4.x;
* gl2ps 1.3.5 - 1.3.8;
* FreeImage 3.14.1 - 3.16.0;
* VTK 6.1.0.
@@ -108,32 +107,6 @@ This third-party product is installed with binaries from the archive that can b
Go to the **Download** page, find the release version you need and pick the archive for Linux platform.
To install, unpack the downloaded archive of TBB product.
@subsection dev_guides__building_3rdparty_linux_3_2 gl2ps
Download the necessary archive from http://geuz.org/gl2ps/ and unpack it.
1. Install or build *cmake* product from the source file.
2. Start *cmake* in GUI mode with the directory where the source files of gl2ps are located:
ccmake GL2PS_SRC_DIR
* Press <i>[c]</i> to make the initial configuration;
* Define the necessary options in *CMAKE_INSTALL_PREFIX*
* Press <i>[c]</i> to make the final configuration
* Press <i>[g]</i> to generate Makefile and exit
or just run the following command:
cmake DCMAKE_INSTALL_PREFIX=GL2PS_INSTALL_DIR DCMAKE_BUILD_TYPE=Release
3. Start the building of gl2ps:
make
4. Start the installation of gl2ps. Binaries will be installed according to the *CMAKE_INSTALL_PREFIX* option.
make install
@subsection dev_guides__building_3rdparty_linux_3_3 FreeImage
Download the necessary archive from http://sourceforge.net/projects/freeimage/files/Source%20Distribution/
@@ -221,7 +194,7 @@ Download the necessary archive from http://www.vtk.org/VTK/resources/software.ht
make
4. Start the installation of gl2ps. Binaries will be installed according to the *VTK_INSTALL_PREFIX* option.
4. Start the installation of VTK. Binaries will be installed according to the *VTK_INSTALL_PREFIX* option.
make install
@@ -232,7 +205,7 @@ Download the necessary archive from http://www.vtk.org/VTK/resources/software.ht
All 3rd-party products required for building of OCCT could be installed
from official repositories. You may install them from console using apt-get utility:
sudo apt-get install tcllib tklib tcl-dev tk-dev libfreetype-dev libxt-dev libxmu-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev libfreeimage-dev libtbb-dev libgl2ps-dev
sudo apt-get install tcllib tklib tcl-dev tk-dev libfreetype-dev libxt-dev libxmu-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev libfreeimage-dev libtbb-dev
To launch binaries built with WOK you need to install C shell and 32-bit libraries on x86_64 distributives:

View File

@@ -17,7 +17,6 @@ There are two types of third-party products, which are necessary to build OCCT:
* FreeType 2.4.10 - 2.5.3.
* Optional products:
* TBB 3.x - 4.x;
* gl2ps 1.3.5 - 1.3.8;
* FreeImage 3.14.1 - 3.16.0
@section dev_guides__building_3rdparty_osx_2 Building Mandatory Third-party Products
@@ -106,33 +105,6 @@ Go to the **Download** page, find the release version you need (e.g. *tbb30_018o
and pick the archive for Mac OS X platform.
To install, unpack the downloaded archive of TBB 3.0 product (*tbb30_018oss_osx.tgz*).
@subsection dev_guides__building_3rdparty_osx_3_2 gl2ps 1.3.5
Download the necessary archive from http://geuz.org/gl2ps/ and unpack it.
1. Install or build cmake product from the source file.
2. Start cmake in GUI mode with the directory, where the source files of *fl2ps* are located:
ccmake GL2PS_SRC_DIR
* Press <i>[c]</i> to make the initial configuration;
* Define the necessary options in *CMAKE_INSTALL_PREFIX*;
* Press <i>[c]</i> to make the final configuration;
* Press <i>[g]</i> to generate Makefile and exit.
or just run the following command:
cmake DCMAKE_INSTALL_PREFIX=GL2PS_INSTALL_DIR DCMAKE_BUILD_TYPE=Release
3. Start the building of gl2ps
make
4. Start the installation of gl2ps. Binaries will be installed according to the *CMAKE_INSTALL_PREFIX* option
make install
@subsection dev_guides__building_3rdparty_osx_3_3 FreeImage 3.14.1 or 3.15.x
Download the necessary archive from

View File

@@ -17,7 +17,6 @@ There are two types of third-party products used by OCCT:
* FreeType 2.4.10 -- 2.5.3.
* Optional products:
* TBB 3.x -- 4.x;
* gl2ps 1.3.5 -- 1.3.8;
* FreeImage 3.14.1 -- 3.16.0;
* VTK 6.1.0.
@@ -156,85 +155,6 @@ Unpack the downloaded archive of TBB product into the *3rdparty* folder.
Further in this document, this folder is referred to as *tbb*.
@subsection dev_guides__building_3rdparty_win_3_2 gl2ps
This third-party product should be built as a dynamically loadable library (dll file).
You can download its sources from http://geuz.org/gl2ps/src/.
### The building procedure
1. Unpack the downloaded archive of gl2ps product (e.g. *gl2ps-1.3.5.tgz*) into the *3rdparty* folder.
As a result, you will get a folder named, for example, *3rdparty\\gl2ps-1.3.5-source*.
Rename it into <i>gl2ps-platform-compiler-building mode</i>, where
* **platform** -- *win32* or *win64*;
* **compiler** -- *vc8*, *vc9* or *vc10*;
* **building mode** -- *opt* (for release) or *deb* (for debug).
For example, <i>gl2ps-win64-vc10-deb</i>
Further in this document, this folder is referred to as *gl2ps*.
2. Download (from http://www.cmake.org/cmake/resources/software.html)
and install the *CMake* build system.
3. Edit the file *gl2ps\\CMakeLists.txt*.
After line 113 in *CMakeLists.txt*:
set_target_properties(shared PROPERTIES COMPILE_FLAGS \"-DGL2PSDLL -DGL2PSDLL_EXPORTS\")
add the following line:
add_definitions(-D_USE_MATH_DEFINES)
Attention: If Cygwin was installed on your computer, make sure that there is no path to it in the *PATH* variable to avoid possible conflicts during the configuration.
4. Launch CMake <i>(cmake-gui.exe)</i> using the Program menu.
In CMake:
* Define where the source code is.
This path must point to *gl2ps* folder.
* Define where to build the binaries.
This path must point to the folder where generated gl2ps project binaries will be placed
(for example, *gl2ps\\bin*).
Further in this document, this folder is referred to as *gl2ps_bin*.
* Press **Configure** button.
@figure{/dev_guides/building/3rdparty/images/3rdparty_image004.png}
* Select the generator (the compiler and the target platform -- 32 or 64 bit) in the pop-up window.
@figure{/dev_guides/building/3rdparty/images/3rdparty_image005.png}
* Press **Finish** button to return to the main CMake window.
Expand the ENABLE group and uncheck ENABLE_PNG and ENABLE_ZLIB check boxes.
@figure{/dev_guides/building/3rdparty/images/3rdparty_image006.png}
* Expand the CMAKE group and define *CMAKE_INSTALL_PREFIX* which is the path where you want to install the build results, for example, *c:\\occ3rdparty\\gl2ps-1.3.5*.
@figure{/dev_guides/building/3rdparty/images/3rdparty_image007.png}
* Press **Configure** button again, then press **Generate** button to generate Visual Studio projects. After completion, close CMake application.
5. Open the solution file *gl2ps_bin\\gl2ps.sln* in Visual Studio.
* Select a configuration to build
* Choose **Release** to build Release binaries.
* Choose **Debug** to build Debug binaries.
* Select a platform to build.
* Choose **Win32** to build for a 32 bit platform.
* Choose **x64** to build for a 64 bit platform.
* Build the solution.
* Build the *INSTALL* project.
As a result, you should have the installed gl2ps product in the *CMAKE_INSTALL_PREFIX* path.
@subsection dev_guides__building_3rdparty_win_3_3 FreeImage
This third-party product should be built as a dynamically loadable library (.dll file).

View File

@@ -82,14 +82,12 @@ The following table gives the full list of environment variables used at the con
|----------|------|---------|
| CMAKE_BUILD_TYPE | String | Specifies the build type on single-configuration generators (such as make). Possible values are Debug, Release and RelWithDebInfo |
| USE_FREEIMAGE | Boolean flag | Indicates whether FreeImage product should be used in OCCT visualization module for support of popular graphics image formats (PNG, BMP, etc.) |
| USE_GL2PS | Boolean flag | Indicates whether GL2PS product should be used in OCCT visualization module for support of vector image formats (PS, EPS, etc.) |
| USE_TBB | Boolean flag | Indicates whether TBB 3rd party is used or not. TBB stands for Threading Building Blocks, the technology of Intel Corp, which comes with different mechanisms and patterns for injecting parallelism into your application. OCCT remains parallel even without TBB product |
| USE_VTK | Boolean flag | Indicates whether VTK 3rd party is used or not. VTK stands for Visualization ToolKit, the technology of Kitware Inc intended for general-purpose scientific visualization. OCCT comes with a bridge between CAD data representation and VTK by means of its dedicated VIS component (VTK Integration Services). You may skip this 3rd party unless you are planning to use VTK visualization for OCCT geometry. See the official documentation @ref occt_user_guides__vis for the details on VIS |
| 3RDPARTY_DIR | Path | Defines the root directory where all required 3rd party products will be searched. Once you define this path it is very convenient to click "Configure" button in order to let CMake automatically detect all necessary products|
| 3RDPARTY_FREETYPE_* | Path | Path to Freetype binaries |
| 3RDPARTY_TCL_* 3RDPARTY_TK_* | Path | Path to Tcl/Tk binaries |
| 3RDPARTY_FREEIMAGE* | Path | Path to Freeimage binaries |
| 3RDPARTY_GL2PS_* | Path | Path to GL2PS binaries |
| 3RDPARTY_TBB* | Path | Path to TBB binaries |
| 3RDPARTY_VTK_* | Path | Path to VTK binaries |
| BUILD_MODULE_<MODULE>| Boolean flag | Indicates whether the corresponding OCCT module should be built or not. It should be noted that some toolkits of a module can be built even if this module is not checked (this happens if some other modules depend on these toolkits). The main modules and their descriptions can be found in @ref user_guides |
@@ -117,7 +115,6 @@ The following table gives the full list of environment variables used at the con
| INSTALL_DIR_DOC | Path | Relative path to the documentation installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_DOC}) |
| INSTALL_FREETYPE | Boolean flag | Indicates whether Freetype binaries should be installed into the installation directory |
| INSTALL_FREEIMAGE* | Boolean flag | Indicates whether Freeimage binaries should be installed into the installation directory |
| INSTALL_GL2PS | Boolean flag | Indicates whether GL2PS binaries should be installed into the installation directory |
| INSTALL_TBB | Boolean flag | Indicates whether TBB binaries should be installed into the installation directory |
| INSTALL_VTK | Boolean flag | Indicates whether VTK binaries should be installed into the installation directory |
| INSTALL_TCL | Boolean flag | Indicates whether TCL binaries should be installed into the installation directory |

View File

@@ -26,7 +26,7 @@ The environment is defined in the file *custom.sh* (on Linux and OS X) or *custo
* "HardLink* - hard links to headers located in *src* will be created.
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
~~~~~
export HAVE_GL2PS=false
export HAVE_FREEIMAGE=false
~~~~~
Alternatively, or when *custom.sh* or *custom.bat* does not exist, you can launch **genconf** tool to configure environment interactively:

View File

@@ -27,7 +27,7 @@ The environment is defined in the file *custom.sh* which can be edited directly:
* "HardLink* - hard links to headers located in *src* will be created.
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
~~~~~
export HAVE_GL2PS=false
export HAVE_FREEIMAGE=false
~~~~~
Alternatively, or when *custom.sh* does not exist, you can launch *genconf.sh* to configure environment interactively:

View File

@@ -1546,6 +1546,8 @@ Since the new version, the method *BRepAdaptor_CompCurve::IsPeriodic()* will alw
@subsection upgrade_730_removed Removed features
* The methods *SetDeflection*, *SetEpsilonT*, *SetDiscretize* of the class *IntTools_EdgeFace* have been removed as redundant.
* Deprecated functionality *V3d_View::Export()*, related enumerations Graphic3d_ExportFormat, Graphic3d_SortType
as well as optional dependency from gl2ps library have been removed.
@subsection upgrade_730_BuilderSolid Boolean Operations - Solid Builder algorithm
@@ -1576,3 +1578,22 @@ Class *Message_PrinterOStream* can be used instead of *CDM_COutMessageDriver* to
If custom driver class is used in the application, that class shall be reimplemented inheriting from *Message_Printer* instead of *CDM_MessageDriver*.
Method *Send()* should be redefined instead of method *Write()* of *CDM_MessageDriver*.
To use the custom printer in OCAF, it can be either added to default messenger or set into the custom *Message_Messenger* object created in the method *MessageDriver()* of a class inheriting *CDF_Application*.
@section upgrade_occt740 Upgrade to OCCT 7.4.0
@subsection upgrade_740_BRepPrimAPI_MakeRevol Changes in BRepPrimAPI_MakeRevol algorithm
Previously the algorithm could create a shape with the same degenerated edge shared between some faces. Now it is prevented. The algorithm creates the different copy of this edge for each face. The method *Generated(...)* has been changed in order to apply restriction to the input shape: input shape can be only of type VERTEX, EDGE, FACE or SOLID. For input shape of another type the method always returns empty list.
@subsection upgrade_740_extremaalgo Changes in behavior of Extrema algorithms
Since OCCT 7.4.0 exception is thrown on the attempt of taking points in case of infinite number of solution (IsParallel status). Request of distances is available as before. Method NbExt() always returns 1 in such cases.
@subsection upgrade_740_removed Removed features
* The following methods of the class *BRepAlgoAPI_BooleanOperation* have been removed as obsolete or replaced:
- *BuilderCanWork* can be replaced with *IsDone* or *HasErrors* method.
- *FuseEdges* removed as obsolete.
- *RefineEdges* replaced with new method *SimplifyResult*.
* The method *ImagesResult* of the class *BOPAlgo_BuilderShape* has been removed as unused. The functionality of this method can be completely replaced by the history methods *Modified* and *IsDeleted*.
* The method *TrackHistory* of the classes *BOPAlgo_RemoveFeatures* and *BRepAlgoAPI_Defeaturing* has been renamed to *SetToFillHistory*.
* The method *GetHistory* of the class *BRepAlgoAPI_Defeaturing* has been renamed to *History*.

View File

@@ -90,10 +90,6 @@ the copyright allows you to use, modify, and redistribute Tcl/Tk for any purpose
explicit license agreement and without paying any license fees or royalties.
To use Tcl/Tk, please refer to the Licensing Terms (https://www.tcl.tk/software/tcltk/license.html).
**GL2PS** is developed by Christophe Geuzaine and others. It is optionally used by OCCT to
export content of OpenGL scene to vector graphics formats (PS, PDF, EMF, SVG).
The library is licensed under GL2PS license (http://www.geuz.org/gl2ps/COPYING.GL2PS).
**FreeType 2** is developed by Antoine Leca, David Turner, Werner Lemberg and others.
It is a software font engine that is designed to be small, efficient, highly customizable and
portable while capable of producing high-quality output (glyph images). This product
@@ -226,7 +222,6 @@ for which OCCT is certified to work.
| Freetype (for text rendering) | FreeType 2.4.11-2.7.1 https://sourceforge.net/projects/freetype/files/ |
| FreeImage (optional, for support of common 2D graphic formats) | FreeImage 3.17.0+ https://sourceforge.net/projects/freeimage/files |
| FFmpeg (optional, for video recording) | FFmpeg 3.1+ https://www.ffmpeg.org/download.html |
| gl2ps (optional, for export contents of OCCT viewer to vector formats) | gl2ps-1.3.8+ http://geuz.org/gl2ps/ |
| Intel TBB (optional, for multithreaded algorithms) | TBB 4.x or 5.x https://www.threadingbuildingblocks.org/ |
| VTK (for VTK Integration Services | VTK 6.1+ http://www.vtk.org/download/ |
| Doxygen (optional for building documentation) | Doxygen 1.8.5+ https://www.stack.nl/~dimitri/doxygen/download.html |

View File

@@ -3070,6 +3070,50 @@ generated gf2 com_hist f2
~~~~
@section occt_algorithms_simplification BOP result simplification
The API algorithms implementing Boolean Operations provide possibility to simplify the result shape by unification of the connected tangential edges and faces.
This simplification is performed by the method *SimplifyResult* which is implemented in the class *BRepAlgoAPI_BuilderAlgo* (General Fuse operation).
It makes it available for users of the classes *BRepAlgoAPI_BooleanOperation* (all Boolean Operations) and *BRepAlgoAPI_Splitter* (split operation).
The simplification is performed by the means of *ShapeUpgrade_UnifySameDom* algorithm. The result of operation is overwritten with the simplified result.
The simplification is performed without creation of the Internal shapes, i.e. shapes connections will never be broken. It is performed on the whole result shape.
Thus, if the input shapes contained connected tangent edges or faces unmodified during the operation they will also be unified.
History of the simplification is merged into the main history of operation, thus it will be accounted when asking for Modified, Generated and Deleted shapes.
Some options of the main operation are passed into the Unifier:
- Fuzzy tolerance of the operation is given to the Unifier as the linear tolerance.
- Non destructive mode here controls the safe input mode in Unifier.
For controlling this possibility in DRAW the command **bsimplify** has been implemented. Please see the @ref occt_draw_bop_options "Boolean Operations options" chapter in draw user guide.
@subsection occt_algorithms_simplification_examples Examples
Here is the simple example of simplification of the result of Fuse operation of two boxes:
~~~~
bsimplify -f 1
box b1 10 10 15
box b2 3 7 0 10 10 15
bclearobjects
bcleartools
baddobjects b1
baddtools b2
bfillds
bapibop r 1
~~~~
<table align="center">
<tr>
<td>@figure{/user_guides/boolean_operations/images/bop_simple_001.png, "Not simplified result", 420}</td>
<td>@figure{/user_guides/boolean_operations/images/bop_simple_002.png, "Simplified result", 420}</td>
</tr>
</table>
@section occt_algorithms_11b Usage

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -5684,18 +5684,33 @@ projponf f pnt
Syntax:
~~~~~
cirtang cname curve/point/radius curve/point/radius curve/point/radius
cirtang result [-t <Tolerance>] -c <curve> -p <point> -r <Radius>...
~~~~~
Builds all circles satisfying the three constraints which are either a curve (the circle must be tangent to that curve), a point (the circle must pass through that point), or a radius for the circle. Only one constraint can be a radius. The solutions will be stored in variables *name_1*, *name_2*, etc.
Builds all circles satisfying the condition:
1. the circle must be tangent to every given curve;
2. the circle must pass through every given point;
3. the radius of the circle must be equal to the requested one.
Only following set of input data is supported: Curve-Curve-Curve, Curve-Curve-Point, Curve-Curve-Radius, Curve-Point-Point, Curve-Point-Radius, Point-Point-Point, Point-Point-Radius. The solutions will be stored in variables *result_1*, *result_2*, etc.
**Example:**
~~~~~
# a point, a line and a radius. 2 solutions
# a point, a line and a radius. 2 solutions of type Curve-Point-Radius (C-P-R)
point p 0 0
line 1 10 0 -1 1
cirtang c p 1 4
== c_1 c_2
line l 10 0 -1 1
cirtang c -p p -c l -r 4
== Solution of type C-P-R is: c_1 c_2
~~~~~
Additionally it is possible to create a circle(s) with given center and tangent to the given curve (Curve-Point type).
**Example:**
~~~~~
point pp 1 1
2dbsplinecurve cc 1 2 0 2 1 2 -10 -5 1 10 -5 1
cirtang r -p pp -c cc
== Solution of type C-P is: r_1 r_2
~~~~~
@subsubsection occt_draw_6_10_2 lintan
@@ -6861,7 +6876,10 @@ tscale c1 0 0 0 0.5
@subsubsection occt_draw_7_6_1 fuse, cut, common
Syntax:
These commands are no longer supported, so the result may be unpredictable.
Please use the commands bfuse, bcut, bcommon instead.
Syntax:
~~~~~
fuse name shape1 shape2
cut name shape1 shape2
@@ -6897,6 +6915,9 @@ ttranslate s4 0 -40 0
@subsubsection occt_draw_7_6_2 section, psection
These commands are no longer supported, so the result may be unpredictable.
Please use the command bsection instead.
Syntax:
~~~~~
section result shape1 shape2
@@ -6940,187 +6961,15 @@ whatis sr
sr is a shape COMPOUND FORWARD Free Modified
~~~~~
@subsection occt_draw_7_7 New Topological operations
@subsection occt_draw_7_7 New Topological operations
The new algorithm of Boolean operations avoids a large number of weak points and limitations presented in the old Boolean operation algorithm.
It also provides wider range of options and diagnostics.
The algorithms of Boolean component are fully described in the @ref occt_algorithms_1 "Boolean Operations" of boolean operation user guide.
The new algorithm of Boolean operations avoids a large number of weak points and limitations presented in the old boolean operation algorithm.
For the Draw commands to perform operations in Boolean component please read the dedicated section @ref occt_draw_bop "Boolean operations commands"
@subsubsection occt_draw_7_7_1 bparallelmode
* **bparallelmode** enable or disable parallel mode for boolean operations. Sequential computing is used by default.
Syntax:
~~~~~
bparallelmode [1/0]
~~~~~
Without arguments, bparallelmode shows current state of parallel mode for boolean operations.
* *0* Disable parallel mode,
* *1* Enable parallel mode
**Example:**
~~~~~
# Enable parallel mode for boolean operations.
bparallelmode 1
# Show state of parallel mode for boolean operations.
bparallelmode
~~~~~
@subsubsection occt_draw_7_7_2 bop, bopfuse, bopcut, boptuc, bopcommon
* **bop** defines *shape1* and *shape2* subject to ulterior Boolean operations
* **bopfuse** creates a new shape by a boolean operation on two existing shapes. The new shape contains both originals intact.
* **bopcut** creates a new shape which contains all parts of the second shape but only the first shape without the intersection of the two shapes.
* **boptuc** is a reverced **bopcut**.
* **bopcommon** creates a new shape which contains only whatever is in common between the two original shapes in their intersection.
Syntax:
~~~~~
bop shape1 shape2
bopcommon result
bopfuse result
bopcut result
boptuc result
~~~~~
These commands have short variants:
~~~~~
bcommon result shape1 shape2
bfuse result shape1 shape2
bcut result shape1 shape2
~~~~~
**bop** fills data structure (DS) of boolean operation for *shape1* and *shape2*.
**bopcommon, bopfuse, bopcut, boptuc** commands are used after **bop** command. After one **bop** command it is possible to call several commands from the list above. For example:
~~~~~
bop S1 S2
bopfuse R
~~~~~
**Example:**
Let us produce all four boolean operations on a box and a cylinder:
~~~~~
box b 0 -10 5 20 20 10
pcylinder c 5 20
# fills data structure
bop b c
bopfuse s1
ttranslate s1 40 0 0
bopcut s2
ttranslate s2 -40 0 0
boptuc s3
ttranslate s3 0 40 0
bopcommon s4
ttranslate s4 0 -40 0
~~~~~
Now use short variants of the commands:
~~~~~
bfuse s11 b c
ttranslate s11 40 0 100
bcut s12 b c
ttranslate s12 -40 0 100
bcommon s14 b c
ttranslate s14 0 -40 100
~~~~~
@subsubsection occt_draw_7_7_3 bopsection
Syntax:
~~~~~
bop shape1 shape2
bopsection result
~~~~~
* **bopsection** -- creates a compound object consisting of the edges for the intersection curves on the faces of two shapes.
* **bop** -- fills data structure (DS) of boolean operation for *shape1* and *shape2*.
* **bopsection** -- is used after **bop** command.
Short variant syntax:
~~~~~
bsection result shape1 shape2 [-2d/-2d1/-2s2] [-a]
~~~~~
* <i>-2d</i> -- PCurves are computed on both parts.
* <i>-2d1</i> -- PCurves are computed on first part.
* <i>-2d2</i> -- PCurves are computed on second part.
* <i>-a</i> -- built geometries are approximated.
**Example:**
Let us build a section line between a cylinder and a box
~~~~~
pcylinder c 10 20
box b 0 0 5 15 15 15
trotate b 0 0 0 1 1 1 20
bop b c
bopsection s
# Short variant:
bsection s2 b c
~~~~~
@subsubsection occt_draw_7_7_4 bopcheck, bopargshape
Syntax:
~~~~~
bopcheck shape
bopargcheck shape1 [[shape2] [-F/O/C/T/S/U] [/R|F|T|V|E|I|P]] [#BF]
~~~~~
**bopcheck** checks a shape for self-interference.
**bopargcheck** checks the validity of argument(s) for boolean operations.
* Boolean Operation -- (by default a section is made) :
* **F** (fuse)
* **O** (common)
* **C** (cut)
* **T** (cut21)
* **S** (section)
* **U** (unknown)
* Test Options -- (by default all options are enabled) :
* **R** (disable small edges (shrink range) test)
* **F** (disable faces verification test)
* **T** (disable tangent faces searching test)
* **V** (disable test possibility to merge vertices)
* **E** (disable test possibility to merge edges)
* **I** (disable self-interference test)
* **P** (disable shape type test)
* Additional Test Options :
* **B** (stop test on first faulty found) -- by default it is off;
* **F** (full output for faulty shapes) -- by default the output is made in a short format.
**Note** that Boolean Operation and Test Options are used only for a couple of argument shapes, except for <b>I</b> and <b>P</b> options that are always used to test a couple of shapes as well as a single shape.
**Example:**
~~~~~
# checks a shape on self-interference
box b1 0 0 0 1 1 1
bopcheck b1
# checks the validity of argument for boolean cut operations
box b2 0 0 0 10 10 10
bopargcheck b1 b2 -C
~~~~~
@subsection occt_draw_7_8 Drafting and blending
Drafting is creation of a new shape by tilting faces through an angle.
@@ -8036,10 +7885,44 @@ Options:
Draw module for @ref occt_modalg_hist "History Information support" includes the command to save history of modifications performed by Boolean operation or sibling commands into a drawable object and the actual history commands:
* *savehistory*;
* *isdeleted*;
* *modified*;
* *generated*.
* **setfillhistory**;
* **savehistory**;
* **isdeleted**;
* **modified**;
* **generated**.
@subsubsection occt_draw_hist_set setfillhistory
*setfillhistory* command controls if the history is needed to be filled in the supported algorithms and saved into the session after the algorithm is done.
By default it is TRUE, i.e. the history is filled and saved.
Syntax:
~~~~
setfillhistory : Controls the history collection by the algorithms and its saving into the session after algorithm is done.
Usage: setfillhistory [flag]
w/o arguments prints the current state of the option;
flag == 0 - history will not be collected and saved;
flag != 0 - history will be collected and saved into the session (default).
~~~~
Example:
~~~~
box b1 10 10 10
box b2 10 10 10
setfillhistory 0
bfuse r b1 b2
savehistory h
# No history has been prepared yet.
setfillhistory 1
bfuse r b1 b2
savehistory h
dump h
# *********** Dump of h *************
# History contains:
# - 2 Deleted shapes;
# - 52 Modified shapes;
# - 0 Generated shapes.
~~~~
@subsubsection occt_draw_hist_save savehistory
@@ -8180,16 +8063,23 @@ aSplitter.SetNonDestructive(BOPTest_Objects::NonDestructive());
aSplitter.SetGlue(BOPTest_Objects::Glue());
aSplitter.SetCheckInverted(BOPTest_Objects::CheckInverted());
aSplitter.SetUseOBB(BOPTest_Objects::UseOBB());
aSplitter.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
// performing operation
aSplitter.Build();
// Store the history for the Objects (overwrites the history in the session)
BRepTest_Objects::SetHistory(BOPTest_Objects::Shapes(), aSplitter);
// Add the history for the Tools
BRepTest_Objects::AddHistory(BOPTest_Objects::Tools(), aSplitter);
if (BRepTest_Objects::IsHistoryNeeded())
{
// Store the history for the Objects (overwrites the history in the session)
BRepTest_Objects::SetHistory(BOPTest_Objects::Shapes(), aSplitter);
// Add the history for the Tools
BRepTest_Objects::AddHistory(BOPTest_Objects::Tools(), aSplitter);
}
~~~~
The method *BRepTest_Objects::IsHistoryNeeded()* controls if the history is needed to be filled in the algorithm and saved into the session after the algorithm is done (*setfillhistory* command controls this option in DRAW).
@subsection occt_draw_7_12 Texture Mapping to a Shape
Texture mapping allows you to map textures on a shape. Textures are texture image files and several are predefined. You can control the number of occurrences of the texture on a face, the position of a texture and the scale factor of the texture.
@@ -8261,39 +8151,467 @@ The defaults are:
* *UScale = VScale = 1* texture covers 100% of the face
@section occt_draw_20 General Fuse Algorithm commands
This chapter describes existing commands of Open CASCADE Draw Test Harness that are used for debugging of General Fuse Algorithm (GFA). It is also applicable for all General Fuse based algorithms such as Boolean Operations Algorithm (BOA), Splitter Algorithm (SPA), Cells Builder Algorithm etc.
@section occt_draw_bop Boolean Operations Commands
This chapter describes existing commands of Open CASCADE Draw Test Harness that are used for performing, analyzing, debugging the algorithm in Boolean Component.
See @ref occt_user_guides__boolean_operations "Boolean operations" user's guide for the description of these algorithms.
@subsection occt_draw_20_1 Definitions
@subsection occt_draw_bop_two Boolean Operations on two operands
The following terms and definitions are used in this document:
* **Objects** -- list of shapes that are arguments of the algorithm.
* **Tools** -- list of shapes that are arguments of the algorithm. Difference between Objects and Tools is defined by specific requirements of the operations (Boolean Operations, Splitting Operation).
All commands in this section perform Boolean operations on two shapes. One of them is considered as object, and the other as a tool.
@subsubsection occt_draw_bop_two_bop bop, bopfuse, bopcut, boptuc, bopcommon, bopsection
These commands perform Boolean operations on two shapes:
* **bop** performs intersection of given shapes and stores the intersection results into internal Data Structure.
* **bopfuse** creates a new shape representing the union of two shapes.
* **bopcut** creates a new shape representing a subtraction of a second argument from the first one.
* **boptuc** creates a new shape representing a subtraction of a first argument from the second one.
* **bopcommon** creates a new shape representing the intersection of two shapes.
* **bopsection** creates a new shape representing the intersection edges and vertices between shapes.
These commands allow intersecting the shapes only once for building all types of Boolean operations. After *bop* command is done, the other commands in this category use the intersection results prepared by *bop*.
It may be very useful as the intersection part is usually most time-consuming part of the operation.
Syntax:
~~~~~
bop shape1 shape2
bopcommon result
bopfuse result
bopcut result
boptuc result
~~~~~
**Example:**
Let's produce all four boolean operations on a box and a cylinder performing intersection only once:
~~~~~
box b 0 -10 5 20 20 10
pcylinder c 5 20
# intersect the shape, storing results into data structure
bop b c
# fuse operation
bopfuse s1
# cut operation
bopcut s2
# opposite cut operation
boptuc s3
# common operation
bopcommon s4
# section operation
bopsection s5
~~~~~
@subsubsection occt_draw_bop_two_bapi bfuse, bcut, btuc, bcommon, bsection
These commands also perform Boolean operations on two shapes. These are the short variants of the bop* commands.
Each of these commands performs both intersection and building the result and may be useful if you need only the result of a single boolean operation.
Syntax:
~~~~~
bcommon result shape1 shape2
bfuse result shape1 shape2
bcut result shape1 shape2
btuc result shape1 shape2
~~~~~
**bection** command has some additional options for faces intersection:
~~~~
bsection result shape1 shape2 [-n2d/-n2d1/-n2d2] [-na]
Where:
result - result of the operation
shape1, shape2 - arguments of the operation
-n2d - disables PCurve construction on both objects
-n2d1 - disables PCurve construction on first object
-n2d2 - disables PCurve construction on second object
-na - disables approximation of the section curves
~~~~
@subsection occt_draw_bop_multi Boolean Operations on multiple arguments
The modern Boolean Operations algorithm available in Open CASCADE Technology is capable of performing a Boolean Operations not only on two shapes, but on arbitrary number of shapes.
In terms of Boolean Operations these arguments are divided on two groups **Objects** and **Tools**. The meaning of these groups is similar to the single object and tool of Boolean Operations on two shapes.
The Boolean operations are based on the General Fuse operation (see @ref occt_algorithms_7 "General Fuse algorithm") which splits all input shapes basing on the intersection results.
Depending on the type of Boolean operation the BOP algorithm choses the necessary splits of the arguments.
@subsection occt_draw_bop_general_com General commands for working with multiple arguments
The algorithms based on General Fuse operation are using the same commands for adding and clearing the arguments list and for performing intersection of these arguments.
@subsubsection occt_draw_bop_general_com_add Adding arguments of operation
The following commands are used to add the objects and tools for Boolean operations:
* **baddobjects** *S1 S2...Sn* -- adds shapes *S1, S2, ... Sn* as Objects;
* **baddtools** *S1 S2...Sn* -- adds shapes *S1, S2, ... Sn* as Tools;
The following commands are used to clear the objects and tools:
* **bclearobjects** -- clears the list of Objects;
* **bcleartools** -- clears the list of Tools;
So, when running subsequent operation in one Draw session, make sure you cleared the Objects and Tools from previous operation. Otherwise, the new arguments will be added to the current ones.
@subsubsection occt_draw_bop_general_com_fill Intersection of the arguments
The command **bfillds** performs intersection of the arguments (**Objects** and **Tools**) and stores the intersection results into internal Data Structure.
@subsection occt_draw_bop_build Building the result of operations
@subsubsection occt_draw_bop_build_BOP Boolean operation
The command **bbop** is used for building the result of Boolean Operation. It has to be used after **bfillds** command.
Syntax:
~~~~
bbop result iOp
Where:
result - result of the operation
iOp - type of Boolean Operation. It could have the following values:
0 - COMMON operation
1 - FUSE operation
2 - CUT operation
3 - CUT21 (opposite CUT, i.e. objects and tools are swapped) operation
4 - SECTION operation
~~~~
**Example**
~~~~
box b1 10 10 10
box b2 5 5 5 10 10 10
box b3 -5 -5 -5 10 10 10
# Clear objects and tools from previous runs
bclearobjects
bcleartools
# add b1 as object
baddobjects b1
# add b2 and b3 as tools
baddtools b2 b3
# perform intersection
bfillds
# build result
bbop rcom 0
bbop rfuse 1
bbop rcut 2
bbop rtuc 3
bbop rsec 4
~~~~
@subsubsection occt_draw_bop_build_GF General Fuse operation
The command **bbuild** is used for building the result of General Fuse Operation. It has to be used after **bfillds** command.
General Fuse operation does not make the difference between Objects and Tools considering both as objects.
Syntax:
~~~~
bbuild result
~~~~
**Example**
~~~~
box b1 10 10 10
box b2 5 5 5 10 10 10
box b3 -5 -5 -5 10 10 10
# Clear objects and tools from previous runs
bclearobjects
bcleartools
# add b1 as object
baddobjects b1
# add b2 and b3 as tools
baddtools b2 b3
# perform intersection
bfillds
# build result
bbuild result
~~~~
@subsubsection occt_draw_bop_build_Split Split operation
Split operation splits the **Objects** by the **Tools**.
The command **bsplit** is used for building the result of Split operation. It has to be used after **bfillds** command.
**Example**
~~~~
box b1 10 10 10
box b2 5 5 5 10 10 10
box b3 -5 -5 -5 10 10 10
# Clear objects and tools from previous runs
bclearobjects
bcleartools
# add b1 as object
baddobjects b1
# add b2 and b3 as tools
baddtools b2 b3
# perform intersection
bfillds
# build result
bsplit result
~~~~
@subsubsection occt_draw_bop_build_CB Cells Builder
Please see the @ref occt_algorithms_10c_Cells_1 "Cells Builder Usage" for the Draw usage of Cells Builder algorithm.
@subsubsection occt_draw_bop_build_API Building result through API
The following commands are used to perform the operation using API implementation of the algorithms:
* **bapibuild** -- to perform API general fuse operation.
* **bapibop** -- to perform API Boolean operation.
* **bapisplit** -- to perform API Split operation.
These commands have the same syntax as the analogical commands described above.
@subsection occt_draw_bop_options Setting options for the operation
The algorithms in Boolean component have a wide range of options.
To see the current state of all option the command **boptions** should be used.
It has the following syntax:
~~~~
boptions [-default]
-default - allows to set all options to default state.
~~~~
To have an effect the options should be set before the operation (before *bfillds* command).
@subsubsection occt_draw_bop_options_par Parallel processing mode
**brunparallel** command enables/disables the parallel processing mode of the operation.
Syntax:
~~~~
brunparallel flag
Where:
flag is the boolean flag controlling the mode:
flag == 0 - parallel processing mode is off.
flag != 0 - parallel processing mode is on.
~~~~
The command is applicable for all commands in the component.
@subsubsection occt_draw_bop_options_safe Safe processing mode
**bnondestructive** command enables/disables the safe processing mode in which the input arguments are protected from modification.
Syntax:
~~~~
bnondestructive flag
Where:
flag is the boolean flag controlling the mode:
flag == 0 - safe processing mode is off.
flag != 0 - safe processing mode is on.
~~~~
The command is applicable for all commands in the component.
@subsubsection occt_draw_bop_options_fuzzy Fuzzy option
**bfuzzyvalue** command sets the additional tolerance for operations.
Syntax:
~~~~
bfuzzyvalue value
~~~~
The command is applicable for all commands in the component.
@subsubsection occt_draw_bop_options_glue Gluing option
**bglue** command sets the gluing mode for the BOP algorithms.
Syntax:
~~~~
bglue 0/1/2
Where:
0 - disables gluing mode.
1 - enables the Shift gluing mode.
2 - enables the Full gluing mode.
~~~~
The command is applicable for all commands in the component.
@subsubsection occt_draw_bop_options_checkinv Check inversion of input solids
**bcheckinverted** command enables/disables the check of the input solids on inverted status in BOP algorithms.
Syntax:
~~~~
bcheckinverted 0 (off) / 1 (on)
~~~~
The command is applicable for all commands in the component.
@subsubsection occt_draw_bop_options_obb OBB usage
**buseobb** commannd enables/disables the usage of OBB in BOP algorithms.
Syntax:
~~~~
buseobb 0 (off) / 1 (on)
~~~~
The command is applicable for all commands in the component.
@subsubsection occt_draw_bop_options_simplify Result simplification
**bsimplify** command enables/disables the result simplification after BOP. The command is applicable only to the API variants of GF, BOP and Split operations.
Syntax:
~~~~
bsimplify [-e 0/1] [-f 0/1] [-a tol]
Where:
-e 0/1 - enables/disables edges unification
-f 0/1 - enables/disables faces unification
-a tol - changes default angular tolerance of unification algo.
~~~~
@subsubsection occt_draw_bop_options_warn Drawing warning shapes
**bdrawwarnshapes** command enables/disables drawing of waring shapes of BOP algorithms.
Syntax:
~~~~
bdrawwarnshapes 0 (do not draw) / 1 (draw warning shapes)
~~~~
The command is applicable for all commands in the component.
@subsection occt_draw_bop_check Check commands
The following commands are analyzing the given shape on the validity of Boolean operation.
@subsubsection occt_draw_bop_check_1 bopcheck
Syntax:
~~~~
bopcheck shape [level of check: 0 - 9]
~~~~
It checks the given shape for self-interference. The optional level of check allows limiting the check to certain intersection types. Here are the types of interferences that will be checked for given level of check:
* 0 - only V/V;
* 1 - V/V and V/E;
* 2 - V/V, V/E and E/E;
* 3 - V/V, V/E, E/E and V/F;
* 4 - V/V, V/E, E/E, V/F and E/F;
* 5 - V/V, V/E, E/E, V/F, E/F and F/F;
* 6 - V/V, V/E, E/E, V/F, E/F, F/F and V/S;
* 7 - V/V, V/E, E/E, V/F, E/F, F/F, V/S and E/S;
* 8 - V/V, V/E, E/E, V/F, E/F, F/F, V/S, E/S and F/S;
* 9 - V/V, V/E, E/E, V/F, E/F, F/F, V/S, E/S, F/S and S/S - all interferences (Default value)
**Example:**
~~~~
box b1 10 10 10
box b2 3 3 3 4 4 4
compound b1 b2 c
bopcheck c
~~~~
In this example one box is completely included into other box. So the output shows that all sub-shapes of b2 interfering with the solid b1.
**bopcheck** command does not modifies the input shape, thus can be safely used.
@subsubsection occt_draw_bop_check_2 bopargcheck
**bopargcheck** syntax:
~~~~
bopargcheck Shape1 [[Shape2] [-F/O/C/T/S/U] [/R|F|T|V|E|I|P|C|S]] [#BF]
-<Boolean Operation>
F (fuse)
O (common)
C (cut)
T (cut21)
S (section)
U (unknown)
For example: "bopargcheck s1 s2 -F" enables checking for Fuse operation
default - section
/<Test Options>
R (disable small edges (shrank range) test)
F (disable faces verification test)
T (disable tangent faces searching test)
V (disable test possibility to merge vertices)
E (disable test possibility to merge edges)
I (disable self-interference test)
P (disable shape type test)
C (disable test for shape continuity)
S (disable curve on surface check)
For example: "bopargcheck s1 s2 /RI" disables small edge detection and self-intersection detection
default - all options are enabled
#<Additional Test Options>
B (stop test on first faulty found); default OFF
F (full output for faulty shapes); default - output in a short format
NOTE: <Boolean Operation> and <Test Options> are used only for couple of argument shapes, except I and P options that are always used for couple of shapes as well as for single shape test.
~~~~
As you can see *bopargcheck* performs more extended check of the given shapes than *bopcheck*.
**Example:**
Let's make an edge with big vertices:
~~~~
vertex v1 0 0 0
settolerance v1 0.5
vertex v2 1 0 0
settolerance v2 0.5
edge e v1 v2
top; don e; fit
tolsphere e
bopargcheck e
~~~~
Here is the output of this command:
~~~~
Made faulty shape: s1si_1
Made faulty shape: s1se_1
Faulties for FIRST shape found : 2
---------------------------------
Shapes are not suppotrted by BOP: NO
Self-Intersections : YES Cases(1) Total shapes(2)
Check for SI has been aborted : NO
Too small edges : YES Cases(1) Total shapes(1)
Bad faces : NO
Too close vertices : DISABLED
Too close edges : DISABLED
Shapes with Continuity C0 : NO
Invalid Curve on Surface : NO
Faulties for SECOND shape found : 0
~~~~
@subsection occt_draw_bop_debug Debug commands
The following terms and definitions are used in this chapter:
* **DS** -- internal data structure used by the algorithm (*BOPDS_DS* object).
* **PaveFiller** -- intersection part of the algorithm (*BOPAlgo_PaveFiller* object).
* **Builder** -- builder part of the algorithm (*BOPAlgo_Builder* object).
* **IDS Index** -- the index of the vector *myLines*.
@subsection occt_draw_20_2 General commands
* **bclearobjects** -- clears the list of Objects;
* **bcleartools** -- clears the list of Tools;
* **baddobjects** *S1 S2...Sn* -- adds shapes *S1, S2, ... Sn* as Objects;
* **baddtools** *S1 S2...Sn* -- adds shapes *S1, S2, ... Sn* as Tools;
* **bfillds** -- performs the Intersection Part of the Algorithm;
* **bbuild** *r* -- performs the Building Part of the Algorithm (General Fuse operation); *r* is the resulting shape;
* **bsplit** *r* -- performs the Splitting operation; *r* is the resulting shape;
* **bbop** *r* *iOp* -- performs the Boolean operation; *r* is the resulting shape; *iOp* - type of the operation (0 - COMMON; 1 - FUSE; 2 - CUT; 3 - CUT21; 4 - SECTION);
* **bcbuild** *rx* -- performs initialization of the *Cells Builder* algorithm (see @ref occt_algorithms_10c_Cells_1 "Usage of the Cells Builder algorithm" for more details).
@subsection occt_draw_20_3 Commands for Intersection Part
@subsubsection occt_draw_bop_debug_int Intersection Part commands
All commands listed below are available when the Intersection Part of the algorithm is done (i.e. after the command *bfillds*).
@subsubsection occt_draw_20_3_1 bopds
**bopds**
Syntax:
~~~~
@@ -8306,12 +8624,11 @@ Displays:
* <i>-e</i> : only edges of arguments that are in the DS;
* <i>-f</i> : only faces of arguments that are in the DS.
@subsubsection occt_draw_20_3_2 bopdsdump
**bopdsdump**
Prints contents of the DS.
Example:
~~~~
Draw[28]> bopdsdump
*** DS ***
@@ -8335,7 +8652,8 @@ Example:
* *SOLID* -- type of the shape;
* <i>{ 1 }</i> -- a DS index of the successors.
@subsubsection occt_draw_20_3_3 bopindex
**bopindex**
Syntax:
~~~~
@@ -8343,7 +8661,8 @@ bopindex S
~~~~
Prints DS index of shape *S*.
@subsubsection occt_draw_20_3_4 bopiterator
**bopiterator**
Syntax:
~~~~~
@@ -8372,7 +8691,7 @@ Example:
* *z58 z12* -- DS indices of intersecting edge and face.
@subsubsection occt_draw_20_3_5 bopinterf
**bopinterf**
Syntax:
~~~~
@@ -8397,7 +8716,8 @@ Here, record <i>(58, 12, 68)</i> means:
* *12* -- a DS index of the face;
* *68* -- a DS index of the new vertex.
@subsubsection occt_draw_20_3_6 bopsp
**bopsp**
Displays split edges.
@@ -8415,7 +8735,7 @@ Example:
* *edge 58* -- 58 is a DS index of the original edge.
* *z58_74 z58_75* -- split edges, where 74, 75 are DS indices of the split edges.
@subsubsection occt_draw_20_3_7 bopcb
**bopcb**
Syntax:
~~~~
@@ -8444,10 +8764,9 @@ This command dumps common blocks for the source edge with index 17.
* *Faces: 36* -- 36 is a DS index of the face the common block belongs to.
@subsubsection occt_draw_20_3_8 bopfin
**bopfin**
Syntax:
~~~~
bopfin nF
~~~~
@@ -8467,7 +8786,7 @@ Example:
* <i>PB:{ E:71 orE:17 Pave1: { 68 3.000 } Pave2: { 18 10.000 } }</i> -- information about the Pave Block;
* <i>vrts In ... 18 </i> -- a DS index of the vertex IN the face.
@subsubsection occt_draw_20_3_9 bopfon
**bopfon**
Syntax:
~~~~
@@ -8490,7 +8809,7 @@ Example:
* <i>PB:{ E:72 orE:38 Pave1: { 69 0.000 } Pave2: { 68 10.000 } }</i> -- information about the Pave Block;
* <i>vrts On: ... 68 69 70 71</i> -- DS indices of the vertices ON the face.
@subsubsection occt_draw_20_3_10 bopwho
**bopwho**
Syntax:
~~~~
@@ -8521,7 +8840,7 @@ This means that shape 68 is a result of the following interferences:
* *FF curves: (12, 56)* -- edge from the intersection curve between faces 12 and 56
* *FF curves: (12, 64)* -- edge from the intersection curve between faces 12 and 64
@subsubsection occt_draw_20_3_11 bopnews
**bopnews**
Syntax:
~~~~
@@ -8531,14 +8850,13 @@ bopnews -v [-e]
* <i>-v</i> -- displays all new vertices produced during the operation;
* <i>-e</i> -- displays all new edges produced during the operation.
@subsection occt_draw_20_4 Commands for the Building Part
@subsubsection occt_draw_bop_debug_build Building Part commands
The commands listed below are available when the Building Part of the algorithm is done (i.e. after the command *bbuild*).
@subsubsection occt_draw_20_4_1 bopim
**bopim**
Syntax:
~~~~
bopim S
~~~~

View File

@@ -2055,7 +2055,7 @@ TopoDS_Solid R2 = BRepPrimAPI_MakeRevol(F,axis,ang);
@section occt_modalg_5 Boolean Operations
Boolean operations are used to create new shapes from the combinations of two shapes.
Boolean operations are used to create new shapes from the combinations of two groups of shapes.
| Operation | Result |
| :---- | :------ |
@@ -3172,7 +3172,7 @@ and the options available from base class (*BOPAlgo_Options*):
Note that the other options of the base class are not supported here and will have no effect.
<b>History support</b> allows tracking modification of the input shape in terms of Modified, IsDeleted and Generated. By default, the history is collected, but it is possible to disable it using the method *TrackHistory(false)*.
<b>History support</b> allows tracking modification of the input shape in terms of Modified, IsDeleted and Generated. By default, the history is collected, but it is possible to disable it using the method *SetToFillHistory(false)*.
On the low-level the history information is collected by the history tool *BRepTools_History*, which can be accessed through the method *BOPAlgo_RemoveFeatures::History()*.
<b>Error/Warning reporting system</b> allows obtaining the extended overview of the Errors/Warnings occurred during the operation. As soon as any error appears, the algorithm stops working. The warnings allow continuing the job and informing the user that something went wrong. The algorithm returns the following errors/warnings:
@@ -3216,7 +3216,7 @@ BRepAlgoAPI_Defeaturing aDF; // Defeaturing algorithm
aDF.SetShape(aSolid); // Set the shape
aDF.AddFacesToRemove(aFaces); // Add faces to remove
aDF.SetRunParallel(bRunParallel); // Define the processing mode (parallel or single)
aDF.TrackHistory(isHistoryNeeded); // Define whether to track the shapes modifications
aDF.SetToFillHistory(isHistoryNeeded); // Define whether to track the shapes modifications
aDF.Build(); // Perform the operation
if (!aDF.IsDone()) // Check for the errors
{

View File

@@ -8,7 +8,6 @@
#include "OCC_3dBaseDoc.h"
#include <res\OCC_Resource.h>
#include <Graphic3d_ExportFormat.hxx>
#include <Graphic3d_Camera.hxx>
#include <OpenGl_GraphicDriver.hxx>

View File

@@ -55,7 +55,6 @@
#include <Graphic3d_HorizontalTextAlignment.hxx>
#include <Graphic3d_VerticalTextAlignment.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_ExportFormat.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_AspectText3d.hxx>

View File

@@ -23,7 +23,6 @@
#include <Standard_WarningsRestore.hxx>
#include <Graphic3d_ExportFormat.hxx>
#include <Graphic3d_GraphicDriver.hxx>
#include <Graphic3d_TextureEnv.hxx>

View File

@@ -48,7 +48,6 @@
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>

View File

@@ -65,8 +65,6 @@
#include <StdSelect_DisplayMode.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Iterator.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AIS_Shape,AIS_InteractiveObject)
@@ -112,12 +110,9 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
aPrs->SetDisplayPriority(TheType+2);
}
// Shape vide -> Assemblage vide.
if (myshape.ShapeType() == TopAbs_COMPOUND) {
TopoDS_Iterator anExplor (myshape);
if (!anExplor.More()) {
return;
}
if (myshape.ShapeType() == TopAbs_COMPOUND && myshape.NbChildren() == 0)
{
return;
}
if (IsInfinite())
@@ -227,8 +222,7 @@ void AIS_Shape::computeHlrPresentation (const Handle(Prs3d_Projector)& theProjec
}
case TopAbs_COMPOUND:
{
TopoDS_Iterator anExplor (theShape);
if (!anExplor.More())
if (theShape.NbChildren() == 0)
{
return;
}
@@ -293,11 +287,10 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer aMode)
{
if(myshape.IsNull()) return;
if (myshape.ShapeType() == TopAbs_COMPOUND) {
TopoDS_Iterator anExplor (myshape);
if (!anExplor.More()) // empty Shape -> empty Assembly.
return;
if (myshape.ShapeType() == TopAbs_COMPOUND && myshape.NbChildren() == 0)
{
// empty Shape -> empty Assembly.
return;
}
TopAbs_ShapeEnum TypOfSel = AIS_Shape::SelectionType(aMode);
@@ -982,13 +975,11 @@ void AIS_Shape::LoadRecomputable(const Standard_Integer TheMode)
const Bnd_Box& AIS_Shape::BoundingBox()
{
if (myshape.ShapeType() == TopAbs_COMPOUND) {
TopoDS_Iterator anExplor (myshape);
if (!anExplor.More()) { // empty Shape -> empty Assembly.
myBB.SetVoid();
return myBB;
}
if (myshape.ShapeType() == TopAbs_COMPOUND && myshape.NbChildren() == 0)
{
// empty Shape -> empty Assembly.
myBB.SetVoid ();
return myBB;
}
if(myCompBB) {

View File

@@ -46,7 +46,6 @@
#include <SelectMgr_Selection.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_Type.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>

View File

@@ -181,7 +181,6 @@ private:
AppParCurves_Constraint myfirstC;
AppParCurves_Constraint mylastC;
Standard_Integer myMultiLineNb;
Standard_Integer myNbPlusOnePoint;
Standard_Boolean myIsClear;

View File

@@ -133,6 +133,8 @@ static Standard_Boolean CheckMultiCurve(const AppParCurves_MultiCurve& theMultiC
{
const Standard_Integer nbp3d = LineTool::NbP3d(theLine);
const Standard_Integer nbp2d = LineTool::NbP2d(theLine);
const Standard_Real coeff = 4.; //2*2
if (nbp3d > 1) //only simple cases are analysed
return Standard_True;
@@ -207,6 +209,15 @@ static Standard_Boolean CheckMultiCurve(const AppParCurves_MultiCurve& theMultiC
//Check: may be it is a real loop
if (LoopFound)
{
#ifdef DRAW
for (Standard_Integer ipoint = theIndfirst; ipoint <= theIndlast; ipoint++)
{
LineTool::Value(theLine, ipoint, tabP);
gp_Pnt aPnt = tabP(1);
sprintf(name, "p%d", ipoint);
DrawTrSurf::Set(name, aPnt);
}
#endif
for (Standard_Integer FirstInd = theIndfirst;
FirstInd <= theIndlast - 2; FirstInd++)
{
@@ -243,6 +254,7 @@ static Standard_Boolean CheckMultiCurve(const AppParCurves_MultiCurve& theMultiC
{
//search <indbad>
Standard_Real MaxSqDist = 0.;
Standard_Real MinSqDist = RealLast();
for (Standard_Integer k = theIndfirst+1; k <= theIndlast; k++)
{
LineTool::Value(theLine, k-1, tabP);
@@ -255,24 +267,31 @@ static Standard_Boolean CheckMultiCurve(const AppParCurves_MultiCurve& theMultiC
MaxSqDist = aSqDist;
indbads[1] = k;
}
if (aSqDist > gp::Resolution() &&
aSqDist < MinSqDist)
MinSqDist = aSqDist;
}
for (Standard_Integer indcur = 2; indcur <= NbCur; indcur++)
{
MaxSqDist = 0.;
for (Standard_Integer k = theIndfirst+1; k <= theIndlast; k++)
Standard_Real Relation = MaxSqDist / MinSqDist;
if (Relation < coeff)
LoopFound = Standard_False;
else
for (Standard_Integer indcur = 2; indcur <= NbCur; indcur++)
{
LineTool::Value(theLine, k-1, tabP2d);
gp_Pnt2d PrevPnt = tabP2d(indcur-1);
LineTool::Value(theLine, k, tabP2d);
gp_Pnt2d CurPnt = tabP2d(indcur-1);
Standard_Real aSqDist = PrevPnt.SquareDistance(CurPnt);
if (aSqDist > MaxSqDist)
MaxSqDist = 0.;
for (Standard_Integer k = theIndfirst+1; k <= theIndlast; k++)
{
MaxSqDist = aSqDist;
indbads[indcur] = k;
LineTool::Value(theLine, k-1, tabP2d);
gp_Pnt2d PrevPnt = tabP2d(indcur-1);
LineTool::Value(theLine, k, tabP2d);
gp_Pnt2d CurPnt = tabP2d(indcur-1);
Standard_Real aSqDist = PrevPnt.SquareDistance(CurPnt);
if (aSqDist > MaxSqDist)
{
MaxSqDist = aSqDist;
indbads[indcur] = k;
}
}
}
}
}
} //if (myNbP3d == 1)
else //2d case
@@ -307,6 +326,15 @@ static Standard_Boolean CheckMultiCurve(const AppParCurves_MultiCurve& theMultiC
//Check: may be it is a real loop
if (LoopFound)
{
#ifdef DRAW
for (Standard_Integer ipoint = theIndfirst; ipoint <= theIndlast; ipoint++)
{
LineTool::Value(theLine, ipoint, tabP2d);
gp_Pnt2d aPnt2d = tabP2d(1);
sprintf(name, "p%d", ipoint);
DrawTrSurf::Set(name, aPnt2d);
}
#endif
for (Standard_Integer FirstInd = theIndfirst;
FirstInd <= theIndlast - 2; FirstInd++)
{
@@ -345,6 +373,7 @@ static Standard_Boolean CheckMultiCurve(const AppParCurves_MultiCurve& theMultiC
for (Standard_Integer indcur = 1; indcur <= NbCur; indcur++)
{
Standard_Real MaxSqDist = 0.;
Standard_Real MinSqDist = RealLast();
for (Standard_Integer k = theIndfirst+1; k <= theIndlast; k++)
{
LineTool::Value(theLine, k-1, tabP2d);
@@ -357,21 +386,27 @@ static Standard_Boolean CheckMultiCurve(const AppParCurves_MultiCurve& theMultiC
MaxSqDist = aSqDist;
indbads[indcur] = k;
}
if (aSqDist > gp::Resolution() &&
aSqDist < MinSqDist)
MinSqDist = aSqDist;
}
Standard_Real Relation = MaxSqDist / MinSqDist;
if (Relation < coeff)
LoopFound = Standard_False;
}
}
}
//Define <indbad>
if (indbads[1] != 0 && indbads[2] != 0)
{
if (indbads[1] != indbads[2])
LoopFound = Standard_False;
else if (indbads[3] != 0 && indbads[1] != indbads[3])
LoopFound = Standard_False;
}
if (LoopFound)
theIndbad = indbads[1];
for (Standard_Integer i = 1; i <= 3; i++)
if (indbads[i] != 0)
{
theIndbad = indbads[i];
break;
}
if (!LoopFound)
theIndbad = 0;
return (!LoopFound);
}
@@ -650,7 +685,6 @@ Approx_ComputeLine::Approx_ComputeLine
const Standard_Boolean cutting,
const Standard_Boolean Squares)
: myMultiLineNb (0),
myNbPlusOnePoint (0),
myIsClear (Standard_False)
{
myfirstParam = new TColStd_HArray1OfReal(Parameters.Lower(),
@@ -684,7 +718,6 @@ Approx_ComputeLine::Approx_ComputeLine
const Standard_Boolean cutting,
const Standard_Boolean Squares)
: myMultiLineNb (0),
myNbPlusOnePoint (0),
myIsClear (Standard_False)
{
myfirstParam = new TColStd_HArray1OfReal(Parameters.Lower(),
@@ -716,7 +749,6 @@ Approx_ComputeLine::Approx_ComputeLine
const Approx_ParametrizationType parametrization,
const Standard_Boolean Squares)
: myMultiLineNb (0),
myNbPlusOnePoint (0),
myIsClear (Standard_False)
{
myConstraints = new AppParCurves_HArray1OfConstraintCouple(1, 2);
@@ -745,7 +777,6 @@ Approx_ComputeLine::Approx_ComputeLine
const Approx_ParametrizationType parametrization,
const Standard_Boolean Squares)
: myMultiLineNb (0),
myNbPlusOnePoint (0),
myIsClear (Standard_False)
{
myConstraints = new AppParCurves_HArray1OfConstraintCouple(1, 2);
@@ -778,7 +809,6 @@ void Approx_ComputeLine::Perform(const MultiLine& Line)
Tolers3d.Clear();
Tolers2d.Clear();
myMultiLineNb = 0;
//myNbPlusOnePoint = 0;
}
else myIsClear = Standard_False;
@@ -825,7 +855,6 @@ void Approx_ComputeLine::Perform(const MultiLine& Line)
{
myIsClear = Standard_True;
//++myMultiLineNb;
myNbPlusOnePoint++;
Perform(anOtherLine0);
alldone = Standard_True;
}
@@ -927,7 +956,6 @@ void Approx_ComputeLine::Perform(const MultiLine& Line)
{
myIsClear = Standard_True;
//++myMultiLineNb;
myNbPlusOnePoint++;
Par = SavePar;
Perform(anOtherLine2);
Ok = Standard_True;
@@ -955,7 +983,6 @@ void Approx_ComputeLine::Perform(const MultiLine& Line)
{
myIsClear = Standard_True;
//++myMultiLineNb;
myNbPlusOnePoint++;
Perform (anOtherLine2);
Ok = Standard_True;
}
@@ -997,7 +1024,6 @@ void Approx_ComputeLine::Perform(const MultiLine& Line)
{
myIsClear = Standard_True;
//++myMultiLineNb;
myNbPlusOnePoint++;
Perform(anOtherLine3);
myfirstpt = mylastpt;
mylastpt = Thelastpt;
@@ -1108,22 +1134,8 @@ void Approx_ComputeLine::Perform(const MultiLine& Line)
}
TheMultiCurve = AppParCurves_MultiCurve();
MultiLine anOtherLine4;
Standard_Boolean isOtherLine4Made = Standard_False;
Standard_Integer indbad = 0;
Ok = Compute(Line, myfirstpt, mylastpt, Param, thetol3d, thetol2d, indbad);
if (indbad != 0)
{
isOtherLine4Made = LineTool::MakeMLOneMorePoint (Line, myfirstpt, mylastpt, indbad, anOtherLine4);
}
if (isOtherLine4Made)
{
myIsClear = Standard_True;
//++myMultiLineNb;
myNbPlusOnePoint++;
Perform (anOtherLine4);
Ok = Standard_True;
}
if (myfirstpt == Thelastpt)
{
Finish = Standard_True;
@@ -1310,8 +1322,7 @@ Standard_Boolean Approx_ComputeLine::Compute(const MultiLine& Line,
#ifdef OCCT_DEBUG
if (mydebug) DUMP(mySCU);
#endif
if (myNbPlusOnePoint != 0 &&
!CheckMultiCurve(mySCU, Line,
if (!CheckMultiCurve(mySCU, Line,
fpt, lpt,
indbad))
{

View File

@@ -27,10 +27,8 @@
#include <Geom2d_BSplineCurve.hxx>
#include <Geom2dAdaptor_HCurve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <GeomAdaptor_HCurve.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <GeomConvert.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <Precision.hxx>
@@ -302,10 +300,6 @@ void Approx_CurveOnSurface_Eval2d::Evaluate (Standard_Integer *Dimension,
}
}
//=============================================================================
//function : Approx_CurveOnSurface
//purpose : Constructor
//=============================================================================
Approx_CurveOnSurface::Approx_CurveOnSurface(const Handle(Adaptor2d_HCurve2d)& C2D,
const Handle(Adaptor3d_HSurface)& Surf,
const Standard_Real First,
@@ -316,75 +310,14 @@ void Approx_CurveOnSurface_Eval2d::Evaluate (Standard_Integer *Dimension,
const Standard_Integer MaxSegments,
const Standard_Boolean only3d,
const Standard_Boolean only2d)
: myC2D(C2D),
mySurf(Surf),
myFirst(First),
myLast(Last),
myTol(Tol),
myIsDone(Standard_False),
myHasResult(Standard_False),
myError3d(0.0),
myError2dU(0.0),
myError2dV(0.0)
{
Perform(MaxSegments, MaxDegree, S, only3d, only2d);
}
//=============================================================================
//function : Approx_CurveOnSurface
//purpose : Constructor
//=============================================================================
Approx_CurveOnSurface::Approx_CurveOnSurface(const Handle(Adaptor2d_HCurve2d)& theC2D,
const Handle(Adaptor3d_HSurface)& theSurf,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Real theTol)
: myC2D(theC2D),
mySurf(theSurf),
myFirst(theFirst),
myLast(theLast),
myTol(theTol),
myIsDone(Standard_False),
myHasResult(Standard_False),
myError3d(0.0),
myError2dU(0.0),
myError2dV(0.0)
{
}
//=============================================================================
//function : Perform
//purpose :
//=============================================================================
void Approx_CurveOnSurface::Perform(const Standard_Integer theMaxSegments,
const Standard_Integer theMaxDegree,
const GeomAbs_Shape theContinuity,
const Standard_Boolean theOnly3d,
const Standard_Boolean theOnly2d)
{
myIsDone = Standard_False;
myHasResult = Standard_False;
myError2dU = 0.0;
myError2dV = 0.0;
myError3d = 0.0;
if(only3d && only2d) throw Standard_ConstructionError();
GeomAbs_Shape Order = S;
if(theOnly3d && theOnly2d) throw Standard_ConstructionError();
Handle( Adaptor2d_HCurve2d ) TrimmedC2D = C2D->Trim( First, Last, Precision::PConfusion() );
Handle( Adaptor2d_HCurve2d ) TrimmedC2D = myC2D->Trim( myFirst, myLast, Precision::PConfusion() );
Standard_Boolean isU, isForward;
Standard_Real aParam;
if (theOnly3d && isIsoLine(TrimmedC2D, isU, aParam, isForward))
{
if (buildC3dOnIsoLine(TrimmedC2D, isU, aParam, isForward))
{
myIsDone = Standard_True;
myHasResult = Standard_True;
return;
}
}
Adaptor3d_CurveOnSurface COnS( TrimmedC2D, mySurf );
Adaptor3d_CurveOnSurface COnS( TrimmedC2D, Surf );
Handle(Adaptor3d_HCurveOnSurface) HCOnS = new Adaptor3d_HCurveOnSurface();
HCOnS->Set(COnS);
@@ -394,34 +327,37 @@ void Approx_CurveOnSurface::Perform(const Standard_Integer theMaxSegments,
Handle(TColStd_HArray1OfReal) ThreeDTol;
// create evaluators and choose appropriate one
Approx_CurveOnSurface_Eval3d Eval3dCvOnSurf (HCOnS, myFirst, myLast);
Approx_CurveOnSurface_Eval2d Eval2dCvOnSurf ( TrimmedC2D, myFirst, myLast);
Approx_CurveOnSurface_Eval EvalCvOnSurf (HCOnS, TrimmedC2D, myFirst, myLast);
Approx_CurveOnSurface_Eval3d Eval3dCvOnSurf (HCOnS, First, Last);
Approx_CurveOnSurface_Eval2d Eval2dCvOnSurf ( TrimmedC2D, First, Last);
Approx_CurveOnSurface_Eval EvalCvOnSurf (HCOnS, TrimmedC2D, First, Last);
AdvApprox_EvaluatorFunction* EvalPtr;
if ( theOnly3d ) EvalPtr = &Eval3dCvOnSurf;
else if ( theOnly2d ) EvalPtr = &Eval2dCvOnSurf;
if ( only3d ) EvalPtr = &Eval3dCvOnSurf;
else if ( only2d ) EvalPtr = &Eval2dCvOnSurf;
else EvalPtr = &EvalCvOnSurf;
// Initialization for 2d approximation
if(!theOnly3d) {
if(!only3d) {
Num1DSS = 2;
OneDTol = new TColStd_HArray1OfReal(1,Num1DSS);
Standard_Real TolU, TolV;
TolU = mySurf->UResolution(myTol)/2;
TolV = mySurf->VResolution(myTol)/2;
TolU = Surf->UResolution(Tol)/2;
TolV = Surf->VResolution(Tol)/2;
OneDTol->SetValue(1,TolU);
OneDTol->SetValue(2,TolV);
}
if(!theOnly2d) {
if(!only2d) {
Num3DSS=1;
ThreeDTol = new TColStd_HArray1OfReal(1,Num3DSS);
ThreeDTol->Init(myTol/2);
ThreeDTol->Init(Tol/2);
}
myError2dU = 0;
myError2dV = 0;
myError3d = 0;
Standard_Integer NbInterv_C2 = HCOnS->NbIntervals(GeomAbs_C2);
TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2 + 1);
@@ -433,8 +369,8 @@ void Approx_CurveOnSurface::Perform(const Standard_Integer theMaxSegments,
AdvApprox_PrefAndRec CutTool(CutPnts_C2,CutPnts_C3);
AdvApprox_ApproxAFunction aApprox (Num1DSS, Num2DSS, Num3DSS,
OneDTol, TwoDTolNul, ThreeDTol,
myFirst, myLast, theContinuity,
theMaxDegree, theMaxSegments,
First, Last, Order,
MaxDegree, MaxSegments,
*EvalPtr, CutTool);
myIsDone = aApprox.IsDone();
@@ -445,14 +381,14 @@ void Approx_CurveOnSurface::Perform(const Standard_Integer theMaxSegments,
Handle(TColStd_HArray1OfInteger) Mults = aApprox.Multiplicities();
Standard_Integer Degree = aApprox.Degree();
if(!theOnly2d)
if(!only2d)
{
TColgp_Array1OfPnt Poles(1,aApprox.NbPoles());
aApprox.Poles(1,Poles);
myCurve3d = new Geom_BSplineCurve(Poles, Knots->Array1(), Mults->Array1(), Degree);
myError3d = aApprox.MaxError(3, 1);
}
if(!theOnly3d)
if(!only3d)
{
TColgp_Array1OfPnt2d Poles2d(1,aApprox.NbPoles());
TColStd_Array1OfReal Poles1dU(1,aApprox.NbPoles());
@@ -468,6 +404,8 @@ void Approx_CurveOnSurface::Perform(const Standard_Integer theMaxSegments,
}
}
// }
}
Standard_Boolean Approx_CurveOnSurface::IsDone() const
@@ -505,161 +443,3 @@ void Approx_CurveOnSurface::Perform(const Standard_Integer theMaxSegments,
return myError2dV;
}
//=============================================================================
//function : isIsoLine
//purpose :
//=============================================================================
Standard_Boolean Approx_CurveOnSurface::isIsoLine(const Handle(Adaptor2d_HCurve2d) theC2D,
Standard_Boolean& theIsU,
Standard_Real& theParam,
Standard_Boolean& theIsForward) const
{
// These variables are used to check line state (vertical or horizontal).
Standard_Boolean isAppropriateType = Standard_False;
gp_Pnt2d aLoc2d;
gp_Dir2d aDir2d;
// Test type.
const GeomAbs_CurveType aType = theC2D->GetType();
if (aType == GeomAbs_Line)
{
gp_Lin2d aLin2d = theC2D->Line();
aLoc2d = aLin2d.Location();
aDir2d = aLin2d.Direction();
isAppropriateType = Standard_True;
}
else if (aType == GeomAbs_BSplineCurve)
{
Handle(Geom2d_BSplineCurve) aBSpline2d = theC2D->BSpline();
if (aBSpline2d->Degree() != 1 || aBSpline2d->NbPoles() != 2)
return Standard_False; // Not a line or uneven parameterization.
aLoc2d = aBSpline2d->Pole(1);
// Vector should be non-degenerated.
gp_Vec2d aVec2d(aBSpline2d->Pole(1), aBSpline2d->Pole(2));
if (aVec2d.SquareMagnitude() < Precision::Confusion())
return Standard_False; // Degenerated spline.
aDir2d = aVec2d;
isAppropriateType = Standard_True;
}
else if (aType == GeomAbs_BezierCurve)
{
Handle(Geom2d_BezierCurve) aBezier2d = theC2D->Bezier();
if (aBezier2d->Degree() != 1 || aBezier2d->NbPoles() != 2)
return Standard_False; // Not a line or uneven parameterization.
aLoc2d = aBezier2d->Pole(1);
// Vector should be non-degenerated.
gp_Vec2d aVec2d(aBezier2d->Pole(1), aBezier2d->Pole(2));
if (aVec2d.SquareMagnitude() < Precision::Confusion())
return Standard_False; // Degenerated spline.
aDir2d = aVec2d;
isAppropriateType = Standard_True;
}
if (!isAppropriateType)
return Standard_False;
// Check line to be vertical or horizontal.
if (aDir2d.IsParallel(gp::DX2d(), Precision::Angular()))
{
// Horizontal line. V = const.
theIsU = Standard_False;
theParam = aLoc2d.Y();
theIsForward = aDir2d.Dot(gp::DX2d()) > 0.0;
return Standard_True;
}
else if (aDir2d.IsParallel(gp::DY2d(), Precision::Angular()))
{
// Vertical line. U = const.
theIsU = Standard_True;
theParam = aLoc2d.X();
theIsForward = aDir2d.Dot(gp::DY2d()) > 0.0;
return Standard_True;
}
return Standard_False;
}
#include <GeomLib.hxx>
//=============================================================================
//function : buildC3dOnIsoLine
//purpose :
//=============================================================================
Standard_Boolean Approx_CurveOnSurface::buildC3dOnIsoLine(const Handle(Adaptor2d_HCurve2d) theC2D,
const Standard_Boolean theIsU,
const Standard_Real theParam,
const Standard_Boolean theIsForward)
{
// Convert adapter to the appropriate type.
Handle(GeomAdaptor_HSurface) aGeomAdapter = Handle(GeomAdaptor_HSurface)::DownCast(mySurf);
if (aGeomAdapter.IsNull())
return Standard_False;
if (mySurf->GetType() == GeomAbs_Sphere)
return Standard_False;
// Extract isoline
Handle(Geom_Surface) aSurf = aGeomAdapter->ChangeSurface().Surface();
Handle(Geom_Curve) aC3d;
gp_Pnt2d aF2d = theC2D->Value(theC2D->FirstParameter());
gp_Pnt2d aL2d = theC2D->Value(theC2D->LastParameter());
if (theIsU)
{
aC3d = aSurf->UIso(theParam);
aC3d = new Geom_TrimmedCurve(aC3d, aF2d.Y(), aL2d.Y());
}
else
{
aC3d = aSurf->VIso(theParam);
aC3d = new Geom_TrimmedCurve(aC3d, aF2d.X(), aL2d.X());
}
// Convert arbitrary curve type to the b-spline.
myCurve3d = GeomConvert::CurveToBSplineCurve(aC3d, Convert_QuasiAngular);
if (!theIsForward)
myCurve3d->Reverse();
// Rebuild parameterization for the 3d curve to have the same parameterization with
// a two-dimensional curve.
TColStd_Array1OfReal aKnots = myCurve3d->Knots();
BSplCLib::Reparametrize(theC2D->FirstParameter(), theC2D->LastParameter(), aKnots);
myCurve3d->SetKnots(aKnots);
// Evaluate error.
myError3d = 0.0;
const Standard_Real aParF = myFirst;
const Standard_Real aParL = myLast;
const Standard_Integer aNbPnt = 23;
for(Standard_Integer anIdx = 0; anIdx <= aNbPnt; ++anIdx)
{
const Standard_Real aPar = aParF + ((aParL - aParF) * anIdx) / aNbPnt;
const gp_Pnt2d aPnt2d = theC2D->Value(aPar);
const gp_Pnt aPntC3D = myCurve3d->Value(aPar);
const gp_Pnt aPntC2D = mySurf->Value(aPnt2d.X(), aPnt2d.Y());
const Standard_Real aSqDeviation = aPntC3D.SquareDistance(aPntC2D);
myError3d = Max(aSqDeviation, myError3d);
}
myError3d = Sqrt(myError3d);
// Target tolerance is not obtained. This situation happens for isolines on the sphere.
// OCCT is unable to convert it keeping original parameterization, while the geometric
// form of the result is entirely identical. In that case, it is better to utilize
// a general-purpose approach.
if (myError3d > myTol)
return Standard_False;
return Standard_True;
}

View File

@@ -40,22 +40,9 @@ public:
DEFINE_STANDARD_ALLOC
//! This constructor calls perform method. This constructor is deprecated.
Standard_DEPRECATED("This constructor is deprecated. Use other constructor and perform method instead.")
Standard_EXPORT Approx_CurveOnSurface(const Handle(Adaptor2d_HCurve2d)& C2D, const Handle(Adaptor3d_HSurface)& Surf, const Standard_Real First, const Standard_Real Last, const Standard_Real Tol, const GeomAbs_Shape Continuity, const Standard_Integer MaxDegree, const Standard_Integer MaxSegments, const Standard_Boolean Only3d = Standard_False, const Standard_Boolean Only2d = Standard_False);
//! This constructor does not call perform method.
//! @param theC2D 2D Curve to be approximated in 3D.
//! @param theSurf Surface where 2D curve is located.
//! @param theFirst First parameter of resulting curve.
//! @param theFirst Last parameter of resulting curve.
//! @param theTol Computation tolerance.
Standard_EXPORT Approx_CurveOnSurface(const Handle(Adaptor2d_HCurve2d)& theC2D,
const Handle(Adaptor3d_HSurface)& theSurf,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Real theTol);
Standard_EXPORT Standard_Boolean IsDone() const;
Standard_EXPORT Standard_Boolean HasResult() const;
@@ -72,64 +59,18 @@ public:
//! 2d Curve
Standard_EXPORT Standard_Real MaxError2dV() const;
//! Constructs the 3d curve. Input parameters are ignored when the input curve is
//! U-isoline or V-isoline.
//! @param theMaxSegments Maximal number of segments in the resulting spline.
//! @param theMaxDegree Maximal degree of the result.
//! @param theContinuity Resulting continuity.
//! @param theOnly3d Determines building only 3D curve.
//! @param theOnly2d Determines building only 2D curve.
Standard_EXPORT void Perform(const Standard_Integer theMaxSegments,
const Standard_Integer theMaxDegree,
const GeomAbs_Shape theContinuity,
const Standard_Boolean theOnly3d = Standard_False,
const Standard_Boolean theOnly2d = Standard_False);
protected:
//! Checks whether the 2d curve is a isoline. It can be represented by b-spline, bezier,
//! or geometric line. This line should have natural parameterization.
//! @param theC2D Trimmed curve to be checked.
//! @param theIsU Flag indicating that line is u const.
//! @param theParam Line parameter.
//! @param theIsForward Flag indicating forward parameterization on a isoline.
//! @return Standard_True when 2d curve is a line and Standard_False otherwise.
Standard_Boolean isIsoLine(const Handle(Adaptor2d_HCurve2d) theC2D,
Standard_Boolean& theIsU,
Standard_Real& theParam,
Standard_Boolean& theIsForward) const;
//! Builds 3D curve for a isoline. This method takes corresponding isoline from
//! the input surface.
//! @param theC2D Trimmed curve to be approximated.
//! @param theIsU Flag indicating that line is u const.
//! @param theParam Line parameter.
//! @param theIsForward Flag indicating forward parameterization on a isoline.
//! @return Standard_True when 3d curve is built and Standard_False otherwise.
Standard_Boolean buildC3dOnIsoLine(const Handle(Adaptor2d_HCurve2d) theC2D,
const Standard_Boolean theIsU,
const Standard_Real theParam,
const Standard_Boolean theIsForward);
private:
Approx_CurveOnSurface& operator= (const Approx_CurveOnSurface&);
private:
//! Input curve.
const Handle(Adaptor2d_HCurve2d) myC2D;
//! Input surface.
const Handle(Adaptor3d_HSurface) mySurf;
//! First parameter of the result.
const Standard_Real myFirst;
//! Last parameter of the result.
const Standard_Real myLast;
//! Tolerance.
Standard_Real myTol;
Handle(Geom2d_BSplineCurve) myCurve2d;
Handle(Geom_BSplineCurve) myCurve3d;

View File

@@ -39,7 +39,6 @@
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Solid.hxx>

View File

@@ -95,7 +95,7 @@ BOPAlgo_Builder::~BOPAlgo_Builder()
//=======================================================================
void BOPAlgo_Builder::Clear()
{
BOPAlgo_Algo::Clear();
BOPAlgo_BuilderShape::Clear();
myArguments.Clear();
myMapFence.Clear();
myImages.Clear();
@@ -167,7 +167,6 @@ void BOPAlgo_Builder::Prepare()
// 1. myShape is empty compound
aBB.MakeCompound(aC);
myShape=aC;
myFlagHistory=Standard_True;
}
//=======================================================================
//function : Perform

View File

@@ -174,21 +174,10 @@ public: //! @name Performing the operation
Standard_EXPORT virtual void PerformWithFiller (const BOPAlgo_PaveFiller& theFiller);
public: //! @name History methods
//! Returns the list of shapes generated from the shape theS.
Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& theS) Standard_OVERRIDE;
//! Returns the list of shapes modified from the shape theS.
Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& theS) Standard_OVERRIDE;
//! Returns true if the shape theS has been deleted.
Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& theS) Standard_OVERRIDE;
protected: //! @name History methods
//! Prepare information for history support.
Standard_EXPORT virtual void PrepareHistory() Standard_OVERRIDE;
Standard_EXPORT void PrepareHistory();
//! Prepare history information for the input shapes taking into account possible
//! operation-specific modifications.
@@ -209,6 +198,10 @@ protected: //! @name History methods
//! Thus, here the method returns only splits (if any) contained in this map.
Standard_EXPORT virtual const TopTools_ListOfShape* LocModified(const TopoDS_Shape& theS);
//! Returns the list of shapes generated from the shape theS.
//! Similarly to *LocModified* must be redefined for specific operations,
//! obtaining Generated elements differently.
Standard_EXPORT virtual const TopTools_ListOfShape& LocGenerated(const TopoDS_Shape& theS);
public: //! @name Images/Origins

View File

@@ -1,141 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 2010-2014 OPEN CASCADE SAS
// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
// EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// 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.
#include <BOPAlgo_BuilderShape.hxx>
#include <TopoDS_Shape.hxx>
//=======================================================================
//function :
//purpose :
//=======================================================================
BOPAlgo_BuilderShape::BOPAlgo_BuilderShape()
:
BOPAlgo_Algo()
{
myHasDeleted=Standard_False;
myHasGenerated=Standard_False;
myHasModified=Standard_False;
myFlagHistory=Standard_False;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
BOPAlgo_BuilderShape::BOPAlgo_BuilderShape(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_Algo(theAllocator)
{
myHasDeleted=Standard_False;
myHasGenerated=Standard_False;
myHasModified=Standard_False;
myFlagHistory=Standard_False;
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
BOPAlgo_BuilderShape::~BOPAlgo_BuilderShape()
{
}
//=======================================================================
//function : Shape
//purpose :
//=======================================================================
const TopoDS_Shape& BOPAlgo_BuilderShape::Shape() const
{
return myShape;
}
//
//=======================================================================
//function : Generated
//purpose :
//=======================================================================
const TopTools_ListOfShape& BOPAlgo_BuilderShape::Generated(const TopoDS_Shape& )
{
myHistShapes.Clear();
return myHistShapes;
}
//=======================================================================
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape& BOPAlgo_BuilderShape::Modified(const TopoDS_Shape& )
{
myHistShapes.Clear();
return myHistShapes;
}
//=======================================================================
//function : IsDeleted
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_BuilderShape::IsDeleted(const TopoDS_Shape& theS)
{
Standard_Boolean bRet;
//
bRet=!myMapShape.Contains(theS);
return bRet;
}
//=======================================================================
//function : HasDeleted
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_BuilderShape::HasDeleted()const
{
return myHasDeleted;
}
//=======================================================================
//function : HasGenerated
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_BuilderShape::HasGenerated()const
{
return myHasGenerated;
}
//=======================================================================
//function : HasModified
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_BuilderShape::HasModified()const
{
return myHasModified;
}
//=======================================================================
//function : PrepareHistory
//purpose :
//=======================================================================
void BOPAlgo_BuilderShape::PrepareHistory()
{
myHistShapes.Clear();
myMapShape.Clear();
myImagesResult.Clear();
myHasDeleted=Standard_False;
myHasGenerated=Standard_False;
myHasModified=Standard_False;
myFlagHistory=Standard_False;
}
//=======================================================================
//function : ImagesResult
//purpose :
//=======================================================================
const TopTools_IndexedDataMapOfShapeListOfShape&
BOPAlgo_BuilderShape::ImagesResult()const
{
return myImagesResult;
}

View File

@@ -21,9 +21,12 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
#include <BOPAlgo_Algo.hxx>
#include <BRepTools_History.hxx>
#include <Standard_Boolean.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
@@ -31,71 +34,120 @@
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
class TopoDS_Shape;
//! Root class for algorithms that has shape as result.<br>
//! Root class for algorithms that has shape as result.
//!
//! The class provides the History mechanism, which allows
//! tracking the modification of the input shapes during
//! the operation.
class BOPAlgo_BuilderShape : public BOPAlgo_Algo
//! the operation. It uses the *BRepTools_History* tool
//! as a storer for history objects.
class BOPAlgo_BuilderShape : public BOPAlgo_Algo
{
public:
DEFINE_STANDARD_ALLOC
public: //! @name Getting the result
//! Returns the result of algorithm
Standard_EXPORT const TopoDS_Shape& Shape() const;
//! Returns the list of shapes generated from the
//! shape theS.
Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& theS);
//! Returns the list of shapes modified from the
//! shape theS.
Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& theS);
const TopoDS_Shape& Shape() const { return myShape; }
public: //! @name History methods
//! Returns the list of shapes Modified from the shape theS.
const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS)
{
if (myFillHistory && myHistory)
return myHistory->Modified(theS);
myHistShapes.Clear();
return myHistShapes;
}
//! Returns the list of shapes Generated from the shape theS.
const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS)
{
if (myFillHistory && myHistory)
return myHistory->Generated(theS);
myHistShapes.Clear();
return myHistShapes;
}
//! Returns true if the shape theS has been deleted.
Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& theS);
//! Returns true if the at least one shape(or subshape)
//! of arguments has been deleted.
Standard_EXPORT Standard_Boolean HasDeleted() const;
//! Returns true if the at least one shape(or subshape)
//! of arguments has generated shapes.
Standard_EXPORT Standard_Boolean HasGenerated() const;
//! Returns true if the at least one shape(or subshape)
//! of arguments has modified shapes.
Standard_EXPORT Standard_Boolean HasModified() const;
Standard_EXPORT const TopTools_IndexedDataMapOfShapeListOfShape& ImagesResult() const;
//! In this case the shape will have no Modified elements,
//! but can have Generated elements.
Standard_Boolean IsDeleted(const TopoDS_Shape& theS)
{
return (myFillHistory && myHistory ? myHistory->IsRemoved(theS) : Standard_False);
}
//! Returns true if any of the input shapes has been modified during operation.
Standard_Boolean HasModified() const
{
return (myFillHistory && myHistory ? myHistory->HasModified() : Standard_False);
}
//! Returns true if any of the input shapes has generated shapes during operation.
Standard_Boolean HasGenerated() const
{
return (myFillHistory && myHistory ? myHistory->HasGenerated() : Standard_False);
}
//! Returns true if any of the input shapes has been deleted during operation.
Standard_Boolean HasDeleted() const
{
return (myFillHistory && myHistory ? myHistory->HasRemoved() : Standard_False);
}
//! History Tool
Handle(BRepTools_History) History() const
{
return myFillHistory ? myHistory : NULL;
}
public: //! @name Enabling/Disabling the history collection.
//! Allows disabling the history collection
void SetToFillHistory(const Standard_Boolean theHistFlag) { myFillHistory = theHistFlag; }
//! Returns flag of history availability
Standard_Boolean HasHistory() const { return myFillHistory; }
protected: //! @name Constructors
//! Empty constructor
BOPAlgo_BuilderShape()
:
BOPAlgo_Algo(),
myFillHistory(Standard_True)
{}
//! Constructor with allocator
BOPAlgo_BuilderShape(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_Algo(theAllocator),
myFillHistory(Standard_True)
{}
protected: //! @name Clearing
//! Clears the content of the algorithm.
virtual void Clear() Standard_OVERRIDE
{
BOPAlgo_Algo::Clear();
myHistory.Nullify();
myMapShape.Clear();
}
protected:
protected: //! @name Fields
Standard_EXPORT BOPAlgo_BuilderShape();
Standard_EXPORT virtual ~BOPAlgo_BuilderShape();
Standard_EXPORT BOPAlgo_BuilderShape(const Handle(NCollection_BaseAllocator)& theAllocator);
//! Prepare information for history support
Standard_EXPORT virtual void PrepareHistory();
TopoDS_Shape myShape; //!< Result of the operation
TopTools_ListOfShape myHistShapes; //!< Storer for the history shapes
TopTools_MapOfShape myMapShape; //!< Cashed map of all arguments shapes
TopoDS_Shape myShape;
TopTools_ListOfShape myHistShapes;
TopTools_MapOfShape myMapShape;
Standard_Boolean myHasDeleted;
Standard_Boolean myHasGenerated;
Standard_Boolean myHasModified;
TopTools_IndexedDataMapOfShapeListOfShape myImagesResult;
Standard_Boolean myFlagHistory;
private:
Standard_Boolean myFillHistory; //!< Controls the history filling
Handle(BRepTools_History) myHistory; //!< History tool
};

View File

@@ -29,7 +29,6 @@
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Compound.hxx>
//

View File

@@ -19,19 +19,16 @@
#include <BOPAlgo_Builder.hxx>
#include <BOPDS_DS.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools3D.hxx>
#include <IntTools_Context.hxx>
#include <TopExp.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
//=======================================================================
//function : Generated
//function : LocGenerated
//purpose :
//=======================================================================
const TopTools_ListOfShape& BOPAlgo_Builder::Generated
const TopTools_ListOfShape& BOPAlgo_Builder::LocGenerated
(const TopoDS_Shape& theS)
{
// The rules for Generated shapes are these:
@@ -43,9 +40,6 @@ const TopTools_ListOfShape& BOPAlgo_Builder::Generated
myHistShapes.Clear();
if (!myHasGenerated)
return myHistShapes;
if (theS.IsNull())
return myHistShapes;
@@ -141,72 +135,6 @@ const TopTools_ListOfShape& BOPAlgo_Builder::Generated
return myHistShapes;
}
//=======================================================================
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape& BOPAlgo_Builder::Modified
(const TopoDS_Shape& theS)
{
myHistShapes.Clear();
if (!myHasModified)
// No modified elements
return myHistShapes;
const TopTools_ListOfShape* pLSp = myImagesResult.Seek(theS);
if (!pLSp || pLSp->IsEmpty())
// No track in the result -> no modified
return myHistShapes;
// For modification check if the shape is not linked to itself
if (pLSp->Extent() == 1)
{
if (theS.IsSame(pLSp->First()) && !myImages.IsBound(theS))
// Shape is not modified
return myHistShapes;
}
// Iterate on all splits and save them with proper orientation into the result list
TopTools_ListIteratorOfListOfShape aIt(*pLSp);
for (; aIt.More(); aIt.Next())
{
TopoDS_Shape aSp = aIt.Value();
// Use the orientation of the input shape
TopAbs_ShapeEnum aType = aSp.ShapeType();
if (aType == TopAbs_VERTEX || aType == TopAbs_SOLID)
aSp.Orientation(theS.Orientation());
else if (BOPTools_AlgoTools::IsSplitToReverse(aSp, theS, myContext))
aSp.Reverse();
myHistShapes.Append(aSp);
}
return myHistShapes;
}
//=======================================================================
//function : IsDeleted
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_Builder::IsDeleted(const TopoDS_Shape& theS)
{
// The shape is considered as Deleted if it has participated in the
// operation and the result shape does not contain the shape itself
// and none of its splits.
if (!myHasDeleted)
// Non of the shapes have been deleted during the operation
return Standard_False;
const TopTools_ListOfShape *pImages = myImagesResult.Seek(theS);
if (!pImages)
// No track about the shape, i.e. the shape has not participated
// in operation -> Not deleted
return Standard_False;
// Check if any parts of the shape has been kept in the result
return pImages->IsEmpty();
}
//=======================================================================
//function : LocModified
//purpose :
//=======================================================================
@@ -220,91 +148,72 @@ const TopTools_ListOfShape* BOPAlgo_Builder::LocModified(const TopoDS_Shape& the
//=======================================================================
void BOPAlgo_Builder::PrepareHistory()
{
if (!myFlagHistory)
{
// Clearing
BOPAlgo_BuilderShape::PrepareHistory();
if (!HasHistory())
return;
}
// Clearing from previous operations
BOPAlgo_BuilderShape::PrepareHistory();
myFlagHistory = Standard_True;
// Initializing history tool
myHistory = new BRepTools_History;
// Map the result shape
myMapShape.Clear();
TopExp::MapShapes(myShape, myMapShape);
// Among all input shapes find those that have any trace in the result
// and save them into myImagesResult map with connection to parts
// kept in the result shape. If the input shape has no trace in the
// result shape, link it to the empty list in myImagesResult meaning
// that the shape has been removed.
//
// Also, set the proper values to the history flags:
// - myHasDeleted for Deleted shapes;
// - myHasModified for Modified shapes;
// - myHasGenerated for Generated shapes.
// Among all input shapes find:
// - Shapes that have been modified (split). Add the splits kept in the result
// shape as Modified from the shape;
// - Shapes that have created new geometries (i.e. generated new shapes). Add
// the generated elements kept in the result shape as Generated from the shape;
// - Shapes that have no trace in the result shape. Add them as Deleted
// during the operation.
Standard_Integer aNbS = myDS->NbSourceShapes();
for (Standard_Integer i = 0; i < aNbS; ++i)
{
const TopoDS_Shape& aS = myDS->Shape(i);
// History information is only available for the shapes of type
// VERTEX, EDGE, FACE and SOLID. Skip all shapes of different type.
TopAbs_ShapeEnum aType = aS.ShapeType();
if (!(aType == TopAbs_VERTEX ||
aType == TopAbs_EDGE ||
aType == TopAbs_FACE ||
aType == TopAbs_SOLID))
// Check if History information is available for this kind of shape.
if (!BRepTools_History::IsSupportedType(aS))
continue;
// Track the modification of the shape
TopTools_ListOfShape* pImages = &myImagesResult(myImagesResult.Add(aS, TopTools_ListOfShape()));
Standard_Boolean isModified = Standard_False;
// Check if the shape has any splits
const TopTools_ListOfShape* pLSp = LocModified(aS);
if (!pLSp)
{
// No splits, check if the result shape contains the shape itself
if (myMapShape.Contains(aS))
// Shape has passed into result without modifications -> link the shape to itself
pImages->Append(aS);
else
// No trace of the shape in the result -> Deleted element is found
myHasDeleted = Standard_True;
}
else
if (pLSp)
{
// Find all splits of the shape which are kept in the result
TopTools_ListIteratorOfListOfShape aIt(*pLSp);
for (; aIt.More(); aIt.Next())
{
const TopoDS_Shape& aSp = aIt.Value();
TopoDS_Shape aSp = aIt.Value();
// Check if the result shape contains the split
if (myMapShape.Contains(aSp))
{
// Link the shape to the split
pImages->Append(aSp);
// Add modified shape with proper orientation
TopAbs_ShapeEnum aType = aSp.ShapeType();
if (aType == TopAbs_VERTEX || aType == TopAbs_SOLID)
aSp.Orientation(aS.Orientation());
else if (BOPTools_AlgoTools::IsSplitToReverse(aSp, aS, myContext))
aSp.Reverse();
myHistory->AddModified(aS, aSp);
isModified = Standard_True;
}
}
if (!pImages->IsEmpty())
// Modified element is found
myHasModified = Standard_True;
else
// Deleted element is found
myHasDeleted = Standard_True;
}
// Until first found, check if the shape has Generated elements
if (!myHasGenerated)
// Check if the shape has Generated elements
const TopTools_ListOfShape& aGenShapes = LocGenerated(aS);
TopTools_ListIteratorOfListOfShape aIt(aGenShapes);
for (; aIt.More(); aIt.Next())
{
// Temporarily set the HasGenerated flag to TRUE to look for the shapes generated from aS.
// Otherwise, the method Generated will always be returning an empty list, assuming that the
// operation has no generated elements at all.
myHasGenerated = Standard_True;
myHasGenerated = (Generated(aS).Extent() > 0);
const TopoDS_Shape& aG = aIt.Value();
if (myMapShape.Contains(aG))
myHistory->AddGenerated(aS, aG);
}
// Check if the shape has been deleted, i.e. it is not contained in the result
// and has no Modified shapes.
if (!isModified && !myMapShape.Contains(aS))
myHistory->Remove(aS);
}
}

View File

@@ -98,36 +98,30 @@ const TopoDS_Shape& BOPAlgo_CellsBuilder::GetAllParts() const
return myAllParts;
}
//=======================================================================
//function : Prepare
//purpose :
//=======================================================================
void BOPAlgo_CellsBuilder::Prepare()
{
BOPAlgo_Builder::Prepare();
//
myFlagHistory=Standard_False;
}
//=======================================================================
//function : PerformInternal1
//purpose :
//=======================================================================
void BOPAlgo_CellsBuilder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller)
{
// Avoid filling history after GF operation as later
// in this method the result shape will be nullified
Standard_Boolean isHistory = HasHistory();
SetToFillHistory(Standard_False);
// Perform splitting of the arguments
BOPAlgo_Builder::PerformInternal1(theFiller);
//
if (HasErrors()) {
return;
}
//
// index all the parts to its origins
IndexParts();
//
// and nullify <myShape> for building the result;
RemoveAllFromResult();
//
myFlagHistory = Standard_True;
// Restore user's history settings
SetToFillHistory(isHistory);
}
//=======================================================================

View File

@@ -242,10 +242,6 @@ class BOPAlgo_CellsBuilder : public BOPAlgo_Builder
//! local modification map of unified elements - myMapModified.
Standard_EXPORT virtual const TopTools_ListOfShape* LocModified(const TopoDS_Shape& theS) Standard_OVERRIDE;
//! Redefined method Prepare - no need to prepare history
//! information on the default result as it is empty compound.
Standard_EXPORT virtual void Prepare() Standard_OVERRIDE;
//! Redefined method PerformInternal1 - makes all split parts,
//! nullifies the result <myShape>, and index all parts.
Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF) Standard_OVERRIDE;

View File

@@ -341,7 +341,7 @@ protected:
//! Removes indices of vertices that are already on the
//! curve <theNC> from the map <theMV>.
//! It is used in PutEFPavesOnCurve and PutStickPavesOnCurve methods.
Standard_EXPORT void RemoveUsedVertices (BOPDS_Curve& theNC, TColStd_MapOfInteger& theMV);
Standard_EXPORT void RemoveUsedVertices (const BOPDS_Curve& theNC, TColStd_MapOfInteger& theMV);
//! Puts the pave nV on the curve theNC.

View File

@@ -781,11 +781,45 @@ void BOPAlgo_PaveFiller::PostTreatFF
aPF.SetNonDestructive(myNonDestructive);
//
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
Standard_Integer aNbFF = aFFs.Length();
//
//Find unused vertices
TopTools_IndexedMapOfShape VertsUnused;
TColStd_MapOfInteger IndMap;
for (Standard_Integer i = 0; i < aNbFF; i++)
{
BOPDS_InterfFF& aFF = aFFs(i);
Standard_Integer nF1, nF2;
aFF.Indices(nF1, nF2);
TColStd_MapOfInteger aMV, aMVEF, aMI;
GetStickVertices(nF1, nF2, aMV, aMVEF, aMI);
BOPDS_VectorOfCurve& aVC = aFF.ChangeCurves();
Standard_Integer aNbC = aVC.Length();
for (j = 0; j < aNbC; j++)
{
BOPDS_Curve& aNC = aVC.ChangeValue(j);
RemoveUsedVertices(aNC, aMV);
}
TColStd_MapIteratorOfMapOfInteger itmap(aMV);
for(; itmap.More(); itmap.Next())
{
Standard_Integer indV = itmap.Value();
const TopoDS_Shape& aVertex = myDS->Shape(indV);
if (IndMap.Add(indV))
VertsUnused.Add(aVertex);
else
VertsUnused.RemoveKey(aVertex);
}
}
/////////////////////
Standard_Integer aNbME = theMicroEdges.Extent();
Standard_Integer aNbVOnRPB = theVertsOnRejectedPB.Extent();
// 0
if (aNbS==1 && (aNbME == 0) && (aNbVOnRPB == 0)) {
if (aNbS==1 && (aNbME == 0) && (aNbVOnRPB == 0) && VertsUnused.IsEmpty()) {
const TopoDS_Shape& aS=theMSCPB.FindKey(1);
const BOPDS_CoupleOfPaveBlocks &aCPB=theMSCPB.FindFromIndex(1);
//
@@ -887,16 +921,22 @@ void BOPAlgo_PaveFiller::PostTreatFF
// Add vertices put on the real section curves to unify them with the
// vertices of the edges, by which these sections curves have been rejected
for (Standard_Integer i = 1; i <= aNbVOnRPB; ++i)
// and with unused vertices
const TopTools_IndexedMapOfShape* VerMap [2] = {&theVertsOnRejectedPB, &VertsUnused};
for (Standard_Integer imap = 0; imap < 2; imap++)
{
TopoDS_Shape aVer = theVertsOnRejectedPB(i);
Standard_Integer iVer = myDS->Index(aVer);
const Standard_Integer* pSD = aDMNewSD.Seek(iVer);
if (pSD)
aVer = myDS->Shape(*pSD);
if (anAddedSD.Add(aVer))
aLS.Append(aVer);
Standard_Integer NbVer = VerMap[imap]->Extent();
for (Standard_Integer i = 1; i <= NbVer; ++i)
{
TopoDS_Shape aVer = VerMap[imap]->FindKey(i);
Standard_Integer iVer = myDS->Index(aVer);
const Standard_Integer* pSD = aDMNewSD.Seek(iVer);
if (pSD)
aVer = myDS->Shape(*pSD);
if (anAddedSD.Add(aVer))
aLS.Append(aVer);
}
}
//
// 2 Fuse shapes
@@ -2091,23 +2131,24 @@ void BOPAlgo_PaveFiller::GetFullShapeMap(const Standard_Integer nF,
// function: RemoveUsedVertices
// purpose:
//=======================================================================
void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
void BOPAlgo_PaveFiller::RemoveUsedVertices(const BOPDS_Curve& aNC,
TColStd_MapOfInteger& aMV)
{
if (!aMV.Extent()) {
return;
}
Standard_Integer nV;
BOPDS_Pave aPave;
BOPDS_ListIteratorOfListOfPave aItLP;
//
Handle(BOPDS_PaveBlock)& aPB=aNC.ChangePaveBlock1();
const BOPDS_ListOfPave& aLP = aPB->ExtPaves();
aItLP.Initialize(aLP);
for (;aItLP.More();aItLP.Next()) {
aPave = aItLP.Value();
nV = aPave.Index();
aMV.Remove(nV);
const BOPDS_ListOfPaveBlock& aLPBC = aNC.PaveBlocks();
BOPDS_ListIteratorOfListOfPaveBlock itPB(aLPBC);
for (; itPB.More(); itPB.Next())
{
const BOPDS_ListOfPave& aLP = itPB.Value()->ExtPaves();
BOPDS_ListIteratorOfListOfPave aItLP(aLP);
for (;aItLP.More();aItLP.Next()) {
BOPDS_Pave aPave = aItLP.Value();
Standard_Integer nV = aPave.Index();
aMV.Remove(nV);
}
}
}

View File

@@ -130,7 +130,7 @@ void BOPAlgo_RemoveFeatures::Perform()
{
OCC_CATCH_SIGNALS
if (myTrackHistory)
if (HasHistory())
myHistory = new BRepTools_History();
// Check the input data
@@ -225,7 +225,7 @@ void BOPAlgo_RemoveFeatures::CheckData()
myShape = aCS;
if (myTrackHistory)
if (HasHistory())
{
// Make non solid shapes removed in the history
MakeRemoved(anOtherShapes, *myHistory.get());
@@ -494,7 +494,7 @@ private: //! @name Private methods performing the operation
anIntResult = aGFInter.Shape();
myHistory->Merge<BOPAlgo_Builder>(aGFInter.Arguments(), aGFInter);
myHistory->Merge(aGFInter.History());
}
else
anIntResult = aGFInter.Arguments().First();
@@ -679,7 +679,7 @@ private: //! @name Private methods performing the operation
}
// Update history after intersection of the extended face with bounds
myHistory->Merge<BOPAlgo_Builder>(aGFTrim.Arguments(), aGFTrim);
myHistory->Merge(aGFTrim.History());
// Update history with all removed shapes
BRepTools_History aHistRem;
@@ -782,7 +782,7 @@ void BOPAlgo_RemoveFeatures::RemoveFeatures()
// No need to fill the history for solids if the history is not
// requested and the current feature is the last one.
Standard_Boolean isSolidsHistoryNeeded = myTrackHistory || (i < (aNbF - 1));
Standard_Boolean isSolidsHistoryNeeded = HasHistory() || (i < (aNbF - 1));
// Perform removal of the single feature
RemoveFeature(aFG.Feature(), aFG.Solids(), aFG.FeatureFacesMap(),
@@ -895,7 +895,7 @@ void BOPAlgo_RemoveFeatures::RemoveFeature
aFacesToBeKept.Add(anAdjF);
}
if (myTrackHistory)
if (HasHistory())
{
// Look for internal edges in the original adjacent faces
const TopoDS_Shape& aFOr = theAdjFaces.FindKey(i);
@@ -990,9 +990,9 @@ void BOPAlgo_RemoveFeatures::RemoveFeature
// History of adjacent faces reconstruction
myHistory->Merge(theAdjFacesHistory);
// History of intersection
myHistory->Merge<BOPAlgo_MakerVolume>(aMV.Arguments(), aMV);
myHistory->Merge(aMV.History());
if (myTrackHistory)
if (HasHistory())
{
// Map the result to check if the shape is removed
TopTools_IndexedMapOfShape aMSRes;
@@ -1037,11 +1037,12 @@ void BOPAlgo_RemoveFeatures::RemoveFeature
//=======================================================================
void BOPAlgo_RemoveFeatures::UpdateHistory()
{
if (!myTrackHistory)
if (!HasHistory())
return;
// Map the result
TopExp::MapShapes(myShape, myResultMap);
myMapShape.Clear();
TopExp::MapShapes(myShape, myMapShape);
// Update the history
BRepTools_History aHistory;
@@ -1060,14 +1061,14 @@ void BOPAlgo_RemoveFeatures::UpdateHistory()
const TopTools_ListOfShape& aLSIm = myHistory->Modified(aS);
if (aLSIm.IsEmpty())
{
if (!myResultMap.Contains(aS))
if (!myMapShape.Contains(aS))
aHistory.Remove(aS);
}
TopTools_ListIteratorOfListOfShape itLSIm(aLSIm);
for (; itLSIm.More(); itLSIm.Next())
{
if (!myResultMap.Contains(itLSIm.Value()))
if (!myMapShape.Contains(itLSIm.Value()))
aHistory.Remove(itLSIm.Value());
}
}
@@ -1089,20 +1090,20 @@ void BOPAlgo_RemoveFeatures::SimplifyResult()
// Do not allow producing internal edges
aSDTool.AllowInternalEdges(Standard_False);
// Avoid removal of the input edges and vertices
if (myResultMap.IsEmpty())
TopExp::MapShapes(myShape, myResultMap);
if (myMapShape.IsEmpty())
TopExp::MapShapes(myShape, myMapShape);
const Standard_Integer aNbS = myInputsMap.Extent();
for (Standard_Integer i = 1; i <= aNbS; ++i)
{
if (myResultMap.Contains(myInputsMap(i)))
if (myMapShape.Contains(myInputsMap(i)))
aSDTool.KeepShape(myInputsMap(i));
}
// Perform unification
aSDTool.Build();
myShape = aSDTool.Shape();
if (myTrackHistory)
if (HasHistory())
myHistory->Merge(aSDTool.History());
}

View File

@@ -19,7 +19,7 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BOPAlgo_Options.hxx>
#include <BOPAlgo_BuilderShape.hxx>
#include <BRepTools_History.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
@@ -79,7 +79,7 @@
//! available through the methods of the history tool *BRepTools_History*,
//! which can be accessed here through the method *History()*.
//! By default, the history is collected, but it is possible to disable it
//! using the method *TrackHistory(false)*;
//! using the method *SetToFillHistory(false)*;
//!
//! <b>Error/Warning reporting system</b> - allows obtaining the extended overview
//! of the Errors/Warnings occurred during the operation. As soon as any error
@@ -124,7 +124,7 @@
//! aRF.SetShape(aSolid); // Set the shape
//! aRF.AddFacesToRemove(aFaces); // Add faces to remove
//! aRF.SetRunParallel(bRunParallel); // Define the processing mode (parallel or single)
//! aRF.TrackHistory(isHistoryNeeded); // Define whether to track the shapes modifications
//! aRF.SetToFillHistory(isHistoryNeeded); // Define whether to track the shapes modifications
//! aRF.Perform(); // Perform the operation
//! if (aRF.HasErrors()) // Check for the errors
//! {
@@ -144,7 +144,7 @@
//! When all possible features are removed, the shape is simplified by
//! removing extra edges and vertices, created during operation, from the result shape.
//!
class BOPAlgo_RemoveFeatures: public BOPAlgo_Options
class BOPAlgo_RemoveFeatures: public BOPAlgo_BuilderShape
{
public:
DEFINE_STANDARD_ALLOC
@@ -154,10 +154,8 @@ public: //! @name Constructors
//! Empty constructor
BOPAlgo_RemoveFeatures()
:
BOPAlgo_Options(),
myTrackHistory(Standard_True)
{
}
BOPAlgo_BuilderShape()
{}
public: //! @name Setting input data for the algorithm
@@ -203,47 +201,21 @@ public: //! @name Setting input data for the algorithm
public: //! @name Performing the operation
//! Performs the operation
Standard_EXPORT void Perform();
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
public: //! @name Clearing the contents of the algorithm
//! Clears the contents of the algorithm from previous run,
//! allowing reusing it for following removals.
void Clear()
virtual void Clear() Standard_OVERRIDE
{
BOPAlgo_Options::Clear();
myHistory.Nullify();
BOPAlgo_BuilderShape::Clear();
myInputShape.Nullify();
myShape.Nullify();
myFacesToRemove.Clear();
myFeatures.Clear();
myInputsMap.Clear();
myResultMap.Clear();
}
public: //! @name History support
//! Defines whether to track the modification of the shapes or not
void TrackHistory(const Standard_Boolean theFlag)
{
myTrackHistory = theFlag;
}
//! Gets the History object
Handle(BRepTools_History) History()
{
return (myTrackHistory ? myHistory : NULL);
}
public: //! @name Obtaining the results
//! Returns the resulting shape
const TopoDS_Shape& Shape() const
{
return myShape;
}
@@ -254,7 +226,7 @@ protected: //! @name Protected methods performing the removal
//! If the input shape is not a solid, the method looks for the solids
//! in <myInputShape> and uses only them. All other shapes are simply removed.
//! If no solids were found, the Error of unsupported type is returned.
Standard_EXPORT void CheckData();
Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
//! Prepares the faces to remove:
//! - Gets only faces contained in the input solids;
@@ -298,18 +270,11 @@ protected: //! @name Fields
// Inputs
TopoDS_Shape myInputShape; //!< Input shape
TopTools_ListOfShape myFacesToRemove; //!< Faces to remove
Standard_Boolean myTrackHistory; //!< Defines whether to track the history of shapes
//! modifications or not (true by default)
// Intermediate
TopTools_ListOfShape myFeatures; //!< List of not connected features to remove
//! (each feature is a compound of faces)
TopTools_IndexedMapOfShape myInputsMap; //!< Map of all sub-shapes of the input shape
TopTools_MapOfShape myResultMap; //!< Map of all sub-shapes of the result shape
// Results
TopoDS_Shape myShape; //!< Result shape
Handle(BRepTools_History) myHistory; //!< History tool
};
#endif // _BOPAlgo_RemoveFeatures_HeaderFile

View File

@@ -712,8 +712,7 @@ Standard_Boolean BOPAlgo_Tools::WiresToFaces(const TopoDS_Shape& theWires,
BOPTools_AlgoTools::CorrectShapeTolerances(aRFaces, aMEmpty, Standard_False);
//
theFaces = aRFaces;
TopoDS_Iterator aItF(theFaces);
return aItF.More();
return theFaces.NbChildren() > 0;
}
//=======================================================================

View File

@@ -25,7 +25,6 @@
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>

View File

@@ -17,7 +17,6 @@ BOPAlgo_BuilderArea.cxx
BOPAlgo_BuilderArea.hxx
BOPAlgo_BuilderFace.cxx
BOPAlgo_BuilderFace.hxx
BOPAlgo_BuilderShape.cxx
BOPAlgo_BuilderShape.hxx
BOPAlgo_BuilderSolid.cxx
BOPAlgo_BuilderSolid.hxx

View File

@@ -128,13 +128,16 @@ Standard_Integer bapibop(Draw_Interpretor& di,
pBuilder->SetGlue(aGlue);
pBuilder->SetCheckInverted(BOPTest_Objects::CheckInverted());
pBuilder->SetUseOBB(BOPTest_Objects::UseOBB());
pBuilder->SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
//
pBuilder->Build();
pBuilder->Build();
pBuilder->SimplifyResult(BOPTest_Objects::UnifyEdges(),
BOPTest_Objects::UnifyFaces(),
BOPTest_Objects::Angular());
// Store the history for the Objects (overwrites the history in the session)
BRepTest_Objects::SetHistory(BOPTest_Objects::Shapes(), *pBuilder);
// Add the history for the Tools
BRepTest_Objects::AddHistory(BOPTest_Objects::Tools(), *pBuilder);
// Store the history of operation into the session
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(pBuilder->History());
if (pBuilder->HasWarnings()) {
Standard_SStream aSStream;
@@ -192,13 +195,16 @@ Standard_Integer bapibuild(Draw_Interpretor& di,
aBuilder.SetGlue(aGlue);
aBuilder.SetCheckInverted(BOPTest_Objects::CheckInverted());
aBuilder.SetUseOBB(BOPTest_Objects::UseOBB());
aBuilder.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
//
aBuilder.Build();
aBuilder.Build();
aBuilder.SimplifyResult(BOPTest_Objects::UnifyEdges(),
BOPTest_Objects::UnifyFaces(),
BOPTest_Objects::Angular());
// Store the history for the Objects (overwrites the history in the session)
BRepTest_Objects::SetHistory(BOPTest_Objects::Shapes(), aBuilder);
// Add the history for the Tools
BRepTest_Objects::AddHistory(BOPTest_Objects::Tools(), aBuilder);
// Store the history of operation into the session
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(aBuilder.History());
if (aBuilder.HasWarnings()) {
Standard_SStream aSStream;
@@ -248,14 +254,17 @@ Standard_Integer bapisplit(Draw_Interpretor& di,
aSplitter.SetGlue(BOPTest_Objects::Glue());
aSplitter.SetCheckInverted(BOPTest_Objects::CheckInverted());
aSplitter.SetUseOBB(BOPTest_Objects::UseOBB());
aSplitter.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
//
// performing operation
aSplitter.Build();
aSplitter.SimplifyResult(BOPTest_Objects::UnifyEdges(),
BOPTest_Objects::UnifyFaces(),
BOPTest_Objects::Angular());
// Store the history for the Objects (overwrites the history in the session)
BRepTest_Objects::SetHistory(BOPTest_Objects::Shapes(), aSplitter);
// Add the history for the Tools
BRepTest_Objects::AddHistory(BOPTest_Objects::Tools(), aSplitter);
// Store the history of operation into the session
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(aSplitter.History());
// check warning status
if (aSplitter.HasWarnings()) {

View File

@@ -256,12 +256,14 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
aBOP.SetOperation(aOp);
aBOP.SetRunParallel (bRunParallel);
aBOP.SetCheckInverted(BOPTest_Objects::CheckInverted());
aBOP.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
//
aBOP.PerformWithFiller(*pPF);
BOPTest::ReportAlerts(aBOP.GetReport());
// Store the history of Boolean operation into the session
BRepTest_Objects::SetHistory(pPF->Arguments(), aBOP);
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(aBOP.History());
if (aBOP.HasErrors()) {
return 0;
@@ -321,12 +323,14 @@ Standard_Integer bopsection(Draw_Interpretor& di,
aBOP.AddArgument(aS2);
aBOP.SetRunParallel (bRunParallel);
aBOP.SetCheckInverted(BOPTest_Objects::CheckInverted());
aBOP.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
//
aBOP.PerformWithFiller(*pPF);
BOPTest::ReportAlerts(aBOP.GetReport());
// Store the history of Section operation into the session
BRepTest_Objects::SetHistory(pPF->Arguments(), aBOP);
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(aBOP.History());
if (aBOP.HasErrors()) {
return 0;
@@ -445,7 +449,8 @@ Standard_Integer bsection(Draw_Interpretor& di,
aSec.Build();
// Store the history of Section operation into the session
BRepTest_Objects::SetHistory(aSec.DSFiller()->Arguments(), aSec);
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(aSec.History());
//
if (aSec.HasWarnings()) {
@@ -530,12 +535,14 @@ Standard_Integer bsmt (Draw_Interpretor& di,
aBOP.SetOperation(aOp);
aBOP.SetRunParallel(bRunParallel);
aBOP.SetCheckInverted(BOPTest_Objects::CheckInverted());
//
aBOP.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
//
aBOP.PerformWithFiller(aPF);
BOPTest::ReportAlerts(aBOP.GetReport());
// Store the history of Boolean operation into the session
BRepTest_Objects::SetHistory(aPF.Arguments(), aBOP);
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(aPF.Arguments(), aBOP);
if (aBOP.HasErrors()) {
return 0;
@@ -842,12 +849,14 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
aMV.SetAvoidInternalShapes(bAvoidInternal);
aMV.SetGlue(aGlue);
aMV.SetUseOBB(BOPTest_Objects::UseOBB());
aMV.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
//
aMV.Perform();
BOPTest::ReportAlerts(aMV.GetReport());
// Store the history of Volume Maker into the session
BRepTest_Objects::SetHistory(aLS, aMV);
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(aLS, aMV);
if (aMV.HasErrors()) {
return 0;

View File

@@ -114,12 +114,14 @@ Standard_Integer bcbuild(Draw_Interpretor& di,
aCBuilder.SetGlue(aGlue);
aCBuilder.SetCheckInverted(BOPTest_Objects::CheckInverted());
aCBuilder.SetUseOBB(BOPTest_Objects::UseOBB());
aCBuilder.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
//
aCBuilder.PerformWithFiller(aPF);
BOPTest::ReportAlerts(aCBuilder.GetReport());
// Store the history of the Cells Builder into the session
BRepTest_Objects::SetHistory(aCBuilder.Arguments(), aCBuilder);
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(aCBuilder.Arguments(), aCBuilder);
if (aCBuilder.HasErrors()) {
return 0;
@@ -172,7 +174,8 @@ Standard_Integer bcaddall(Draw_Interpretor& di,
const TopoDS_Shape& aR = aCBuilder.Shape();
// Update the history of the Cells Builder
BRepTest_Objects::SetHistory(aCBuilder.Arguments(), aCBuilder);
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(aCBuilder.Arguments(), aCBuilder);
DBRep::Set(a[1], aR);
return 0;
@@ -196,7 +199,8 @@ Standard_Integer bcremoveall(Draw_Interpretor& di,
aCBuilder.RemoveAllFromResult();
// Update the history of the Cells Builder
BRepTest_Objects::SetHistory(aCBuilder.Arguments(), aCBuilder);
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(aCBuilder.Arguments(), aCBuilder);
return 0;
}
@@ -262,7 +266,8 @@ Standard_Integer bcadd(Draw_Interpretor& di,
const TopoDS_Shape& aR = aCBuilder.Shape();
// Update the history of the Cells Builder
BRepTest_Objects::SetHistory(aCBuilder.Arguments(), aCBuilder);
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(aCBuilder.Arguments(), aCBuilder);
DBRep::Set(a[1], aR);
return 0;
@@ -311,7 +316,8 @@ Standard_Integer bcremove(Draw_Interpretor& di,
const TopoDS_Shape& aR = aCBuilder.Shape();
// Update the history of the Cells Builder
BRepTest_Objects::SetHistory(aCBuilder.Arguments(), aCBuilder);
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(aCBuilder.Arguments(), aCBuilder);
DBRep::Set(a[1], aR);
return 0;
@@ -339,7 +345,8 @@ Standard_Integer bcremoveint(Draw_Interpretor& di,
const TopoDS_Shape& aR = aCBuilder.Shape();
// Update the history of the Cells Builder
BRepTest_Objects::SetHistory(aCBuilder.Arguments(), aCBuilder);
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(aCBuilder.Arguments(), aCBuilder);
DBRep::Set(a[1], aR);
return 0;

View File

@@ -51,13 +51,7 @@ class BOPTest_Session {
myBuilderDefault=new BOPAlgo_Builder(pA2);
//
myBuilder=myBuilderDefault;
myRunParallel=Standard_False;
myNonDestructive = Standard_False;
myFuzzyValue = Precision::Confusion();
myGlue = BOPAlgo_GlueOff;
myDrawWarnShapes = Standard_False;
myCheckInverted = Standard_True;
myUseOBB = Standard_False;
SetDefaultOptions();
};
//
// Clear
@@ -104,6 +98,20 @@ class BOPTest_Session {
TopTools_ListOfShape& Tools() {
return myTools;
}
// Resets all options to default values
void SetDefaultOptions()
{
myRunParallel = Standard_False;
myNonDestructive = Standard_False;
myFuzzyValue = Precision::Confusion();
myGlue = BOPAlgo_GlueOff;
myDrawWarnShapes = Standard_False;
myCheckInverted = Standard_True;
myUseOBB = Standard_False;
myUnifyEdges = Standard_False;
myUnifyFaces = Standard_False;
myAngTol = Precision::Angular();
}
//
void SetRunParallel(const Standard_Boolean bFlag) {
myRunParallel=bFlag;
@@ -160,6 +168,22 @@ class BOPTest_Session {
Standard_Boolean UseOBB() const {
return myUseOBB;
};
// Controls the Unification of Edges after BOP
void SetUnifyEdges(const Standard_Boolean bUE) { myUnifyEdges = bUE; }
// Returns flag of Edges unification
Standard_Boolean UnifyEdges() const { return myUnifyEdges; }
// Controls the Unification of Faces after BOP
void SetUnifyFaces(const Standard_Boolean bUF) { myUnifyFaces = bUF; }
// Returns flag of Faces unification
Standard_Boolean UnifyFaces() const { return myUnifyFaces; }
// Sets angular tolerance for Edges and Faces unification
void SetAngular(const Standard_Real theAngTol) { myAngTol = theAngTol; }
// Returns angular tolerance
Standard_Real Angular() const { return myAngTol; }
protected:
//
BOPTest_Session(const BOPTest_Session&);
@@ -180,6 +204,9 @@ protected:
Standard_Boolean myDrawWarnShapes;
Standard_Boolean myCheckInverted;
Standard_Boolean myUseOBB;
Standard_Boolean myUnifyEdges;
Standard_Boolean myUnifyFaces;
Standard_Real myAngTol;
};
//
//=======================================================================
@@ -310,6 +337,14 @@ TopTools_ListOfShape& BOPTest_Objects::Tools()
return GetSession().Tools();
}
//=======================================================================
//function : SetDefaultOptions
//purpose :
//=======================================================================
void BOPTest_Objects::SetDefaultOptions()
{
GetSession().SetDefaultOptions();
}
//=======================================================================
//function : SetRunParallel
//purpose :
//=======================================================================
@@ -422,6 +457,54 @@ Standard_Boolean BOPTest_Objects::UseOBB()
return GetSession().UseOBB();
}
//=======================================================================
//function : SetUnifyEdges
//purpose :
//=======================================================================
void BOPTest_Objects::SetUnifyEdges(const Standard_Boolean bUE)
{
GetSession().SetUnifyEdges(bUE);
}
//=======================================================================
//function : UnifyEdges
//purpose :
//=======================================================================
Standard_Boolean BOPTest_Objects::UnifyEdges()
{
return GetSession().UnifyEdges();
}
//=======================================================================
//function : SetUnifyFaces
//purpose :
//=======================================================================
void BOPTest_Objects::SetUnifyFaces(const Standard_Boolean bUF)
{
GetSession().SetUnifyFaces(bUF);
}
//=======================================================================
//function : UnifyFaces
//purpose :
//=======================================================================
Standard_Boolean BOPTest_Objects::UnifyFaces()
{
return GetSession().UnifyFaces();
}
//=======================================================================
//function : SetAngular
//purpose :
//=======================================================================
void BOPTest_Objects::SetAngular(const Standard_Real theAngTol)
{
GetSession().SetAngular(theAngTol);
}
//=======================================================================
//function : Angular
//purpose :
//=======================================================================
Standard_Real BOPTest_Objects::Angular()
{
return GetSession().Angular();
}
//=======================================================================
//function : Allocator1
//purpose :
//=======================================================================

View File

@@ -66,7 +66,9 @@ public:
Standard_EXPORT static void SetBuilder (const BOPAlgo_PBuilder& theBuilder);
Standard_EXPORT static void SetBuilderDefault();
Standard_EXPORT static void SetDefaultOptions();
Standard_EXPORT static void SetRunParallel (const Standard_Boolean theFlag);
Standard_EXPORT static Standard_Boolean RunParallel();
@@ -95,6 +97,15 @@ public:
Standard_EXPORT static Standard_Boolean UseOBB();
Standard_EXPORT static void SetUnifyEdges(const Standard_Boolean bUE);
Standard_EXPORT static Standard_Boolean UnifyEdges();
Standard_EXPORT static void SetUnifyFaces(const Standard_Boolean bUF);
Standard_EXPORT static Standard_Boolean UnifyFaces();
Standard_EXPORT static void SetAngular(const Standard_Real bAngTol);
Standard_EXPORT static Standard_Real Angular();
protected:
private:

View File

@@ -29,6 +29,7 @@ static Standard_Integer bGlue(Draw_Interpretor&, Standard_Integer, const char**)
static Standard_Integer bdrawwarnshapes(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer bcheckinverted(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer buseobb(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer bsimplify(Draw_Interpretor&, Standard_Integer, const char**);
//=======================================================================
//function : OptionCommands
@@ -42,18 +43,45 @@ void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
// Chapter's name
const char* g = "BOPTest commands";
// Commands
theCommands.Add("boptions", "use boptions, shows current value of BOP options" , __FILE__, boptions, g);
theCommands.Add("brunparallel", "use brunparallel [0/1]" , __FILE__, brunparallel, g);
theCommands.Add("bnondestructive", "use bnondestructive [0/1]", __FILE__, bnondestructive, g);
theCommands.Add("bfuzzyvalue", "use bfuzzyvalue value", __FILE__, bfuzzyvalue, g);
theCommands.Add("bglue", "use bglue [0 (off) / 1 (shift) / 2 (full)]", __FILE__, bGlue, g);
theCommands.Add("bdrawwarnshapes", "Defines whether to draw warning shapes or not\n"
"Usage: bdrawwarnshapes [0 (do not draw) / 1 (draw warning shapes)",
theCommands.Add("boptions", "Usage: boptions [-default]\n"
"\t\tw/o arguments shows current value of BOP options\n"
"\t\t-default - allows setting all options to default values",
__FILE__, boptions, g);
theCommands.Add("brunparallel", "Enables/Disables parallel processing mode.\n"
"\t\tUsage: brunparallel 0/1",
__FILE__, brunparallel, g);
theCommands.Add("bnondestructive", "Enables/Disables the safe processing mode.\n"
"\t\tUsage: bnondestructive 0/1",
__FILE__, bnondestructive, g);
theCommands.Add("bfuzzyvalue", "Sets the additional tolerance for BOP algorithms.\n"
"\t\tUsage: bfuzzyvalue value",
__FILE__, bfuzzyvalue, g);
theCommands.Add("bglue", "Sets the gluing mode for the BOP algorithms.\n"
"\t\tUsage: bglue [0 (off) / 1 (shift) / 2 (full)]",
__FILE__, bGlue, g);
theCommands.Add("bdrawwarnshapes", "Enables/Disables drawing of waring shapes of BOP algorithms.\n"
"\t\tUsage: bdrawwarnshapes 0 (do not draw) / 1 (draw warning shapes)",
__FILE__, bdrawwarnshapes, g);
theCommands.Add("bcheckinverted", "Defines whether to check the input solids on inverted status or not\n"
"Usage: bcheckinverted [0 (off) / 1 (on)]", __FILE__, bcheckinverted, g);
theCommands.Add("buseobb", "Enables/disables the usage of OBB\n"
"Usage: buseobb [0 (off) / 1 (on)]", __FILE__, buseobb, g);
theCommands.Add("bcheckinverted", "Enables/Disables the check of the input solids on inverted status in BOP algorithms\n"
"\t\tUsage: bcheckinverted 0 (off) / 1 (on)",
__FILE__, bcheckinverted, g);
theCommands.Add("buseobb", "Enables/disables the usage of OBB in BOP algorithms\n"
"\t\tUsage: buseobb 0 (off) / 1 (on)",
__FILE__, buseobb, g);
theCommands.Add("bsimplify", "Enables/Disables the result simplification after BOP\n"
"\t\tUsage: bsimplify [-e 0/1] [-f 0/1] [-a tol]\n"
"\t\t-e 0/1 - enables/disables edges unification\n"
"\t\t-f 0/1 - enables/disables faces unification\n"
"\t\t-a tol - changes default angular tolerance of unification algo (accepts value in degrees).",
__FILE__, bsimplify, g);
}
//=======================================================================
//function : boptions
@@ -61,40 +89,60 @@ void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
//=======================================================================
Standard_Integer boptions(Draw_Interpretor& di,
Standard_Integer n,
const char** )
const char** a)
{
if (n!=1) {
di << " use boptions\n";
if (n > 2)
{
di.PrintHelp(a[0]);
return 1;
}
if (n == 2)
{
if (strcmp(a[1], "-default"))
{
di.PrintHelp(a[0]);
return 1;
}
// Set all options to default values
BOPTest_Objects::SetDefaultOptions();
return 0;
}
//
char buf[128];
Standard_Boolean bRunParallel, bNonDestructive;
Standard_Real aFuzzyValue;
BOPAlgo_GlueEnum aGlue;
BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue();
//
bRunParallel=BOPTest_Objects::RunParallel();
bNonDestructive = BOPTest_Objects::NonDestructive();
aFuzzyValue = BOPTest_Objects::FuzzyValue();
aGlue = BOPTest_Objects::Glue();
Standard_Boolean bDrawWarnShapes = BOPTest_Objects::DrawWarnShapes();
Standard_Boolean bCheckInverted = BOPTest_Objects::CheckInverted();
Standard_Boolean bUseOBB = BOPTest_Objects::UseOBB();
//
Sprintf(buf, " RunParallel: %d\n", bRunParallel);
Sprintf(buf, " RunParallel: %s \t\t(%s)\n", BOPTest_Objects::RunParallel() ? "Yes" : "No",
"use \"brunparallel\" command to change");
di << buf;
Sprintf(buf, " NonDestructive: %d\n", bNonDestructive);
Sprintf(buf, " NonDestructive: %s \t\t(%s)\n", BOPTest_Objects::NonDestructive() ? "Yes" : "No",
"use \"bnondestructive\" command to change");
di << buf;
Sprintf(buf, " FuzzyValue: %lf\n", aFuzzyValue);
Sprintf(buf, " FuzzyValue: %g \t\t(%s)\n", BOPTest_Objects::FuzzyValue(),
"use \"bfuzzyvalue\" command to change");
di << buf;
Sprintf(buf, " GlueOption: %s\n", ((aGlue == BOPAlgo_GlueOff) ? "Off" :
((aGlue == BOPAlgo_GlueFull) ? "Full" : "Shift")));
Sprintf(buf, " GlueOption: %s \t\t(%s)\n", ((aGlue == BOPAlgo_GlueOff) ? "Off" :
((aGlue == BOPAlgo_GlueFull) ? "Full" : "Shift")),
"use \"bglue\" command to change");
di << buf;
Sprintf(buf, " Draw Warning Shapes: %s\n", bDrawWarnShapes ? "Yes" : "No");
Sprintf(buf, " Draw Warning Shapes: %s \t(%s)\n", BOPTest_Objects::DrawWarnShapes() ? "Yes" : "No",
"use \"bdrawwarnshapes\" command to change");
di << buf;
Sprintf(buf, " Check for inverted solids: %s\n", bCheckInverted ? "Yes" : "No");
Sprintf(buf, " Check for invert solids: %s \t(%s)\n", BOPTest_Objects::CheckInverted() ? "Yes" : "No",
"use \"bcheckinverted\" command to change");
di << buf;
Sprintf(buf, " Use OBB: %s\n", bUseOBB ? "Yes" : "No");
Sprintf(buf, " Use OBB: %s \t\t\t(%s)\n", BOPTest_Objects::UseOBB() ? "Yes" : "No",
"use \"buseobb\" command to change");
di << buf;
Sprintf(buf, " Unify Edges: %s \t\t(%s)\n", BOPTest_Objects::UnifyEdges() ? "Yes" : "No",
"use \"bsimplify -e\" command to change");
di << buf;
Sprintf(buf, " Unify Faces: %s \t\t(%s)\n", BOPTest_Objects::UnifyFaces() ? "Yes" : "No",
"use \"bsimplify -f\" command to change");
di << buf;
Sprintf(buf, " Angular: %g \t\t(%s)\n", BOPTest_Objects::Angular(),
"use \"bsimplify -a\" command to change");
di << buf;
//
return 0;
@@ -106,22 +154,15 @@ Standard_Integer boptions(Draw_Interpretor& di,
Standard_Integer bfuzzyvalue(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n!=2) {
di << " use bfuzzyvalue value\n";
return 0;
{
if (n != 2)
{
di.PrintHelp(a[0]);
return 1;
}
//
Standard_Real aFuzzyValue;
//
aFuzzyValue=Draw::Atof(a[1]);
if (aFuzzyValue<0.) {
di << " Wrong value.\n";
return 0;
}
//
Standard_Real aFuzzyValue = Draw::Atof(a[1]);
BOPTest_Objects::SetFuzzyValue(aFuzzyValue);
//
return 0;
}
//=======================================================================
@@ -129,26 +170,17 @@ Standard_Integer bfuzzyvalue(Draw_Interpretor& di,
//purpose :
//=======================================================================
Standard_Integer brunparallel(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n!=2) {
di << " use brunparallel [0/1]\n";
return 0;
Standard_Integer n,
const char** a)
{
if (n != 2)
{
di.PrintHelp(a[0]);
return 1;
}
//
Standard_Integer iX;
Standard_Boolean bRunParallel;
//
iX=Draw::Atoi(a[1]);
if (iX<0 || iX>1) {
di << " Wrong value.\n";
return 0;
}
//
bRunParallel = (iX != 0);
BOPTest_Objects::SetRunParallel(bRunParallel);
//
Standard_Integer iRunParallel = Draw::Atoi(a[1]);
BOPTest_Objects::SetRunParallel(iRunParallel != 0);
return 0;
}
//=======================================================================
@@ -156,26 +188,17 @@ Standard_Integer brunparallel(Draw_Interpretor& di,
//purpose :
//=======================================================================
Standard_Integer bnondestructive(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
Standard_Integer n,
const char** a)
{
if (n != 2) {
di << " use bnondestructive [0/1]\n";
return 0;
if (n != 2)
{
di.PrintHelp(a[0]);
return 1;
}
//
Standard_Integer iX;
Standard_Boolean bNonDestructive;
//
iX = Draw::Atoi(a[1]);
if (iX<0 || iX>1) {
di << " Wrong value.\n";
return 0;
}
//
bNonDestructive = (iX != 0);
BOPTest_Objects::SetNonDestructive(bNonDestructive);
//
Standard_Integer iNonDestructive = Draw::Atoi(a[1]);
BOPTest_Objects::SetNonDestructive(iNonDestructive != 0);
return 0;
}
@@ -184,23 +207,25 @@ Standard_Integer bnondestructive(Draw_Interpretor& di,
//purpose :
//=======================================================================
Standard_Integer bGlue(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
Standard_Integer n,
const char** a)
{
if (n != 2) {
di << " use bglue [0 (off) / 1 (shift) / 2 (full)]\n";
if (n != 2)
{
di.PrintHelp(a[0]);
return 1;
}
//
Standard_Integer iGlue = Draw::Atoi(a[1]);
if (iGlue < 0 || iGlue > 2) {
di << " Wrong value. Use bglue [0 (off) / 1 (shift) / 2 (full)]\n";
if (iGlue < 0 || iGlue > 2)
{
di << "Wrong value.\n";
di.PrintHelp(a[0]);
return 1;
}
//
BOPAlgo_GlueEnum aGlue = BOPAlgo_GlueEnum(iGlue);
BOPTest_Objects::SetGlue(aGlue);
//
return 0;
}
@@ -209,14 +234,15 @@ Standard_Integer bGlue(Draw_Interpretor& di,
//purpose :
//=======================================================================
Standard_Integer bdrawwarnshapes(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
Standard_Integer n,
const char** a)
{
if (n != 2) {
di << " use bdrawwarnshapes [0 (do not draw) / 1 (draw warning shapes)\n";
if (n != 2)
{
di.PrintHelp(a[0]);
return 1;
}
//
Standard_Integer iDraw = Draw::Atoi(a[1]);
BOPTest_Objects::SetDrawWarnShapes(iDraw != 0);
return 0;
@@ -230,11 +256,12 @@ Standard_Integer bcheckinverted(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n != 2) {
if (n != 2)
{
di.PrintHelp(a[0]);
return 1;
}
//
Standard_Integer iCheck = Draw::Atoi(a[1]);
BOPTest_Objects::SetCheckInverted(iCheck != 0);
return 0;
@@ -253,8 +280,49 @@ Standard_Integer buseobb(Draw_Interpretor& di,
di.PrintHelp(a[0]);
return 1;
}
//
Standard_Integer iUse = Draw::Atoi(a[1]);
BOPTest_Objects::SetUseOBB(iUse != 0);
return 0;
}
//=======================================================================
//function : bsimplify
//purpose :
//=======================================================================
Standard_Integer bsimplify(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n == 1 || n%2 == 0)
{
di.PrintHelp(a[0]);
return 1;
}
for (Standard_Integer i = 1; i < n - 1; ++i)
{
if (!strcmp(a[i], "-e"))
{
Standard_Integer iUnifyEdges = Draw::Atoi(a[++i]);
BOPTest_Objects::SetUnifyEdges(iUnifyEdges != 0);
}
else if (!strcmp(a[i], "-f"))
{
Standard_Integer iUnifyFaces = Draw::Atoi(a[++i]);
BOPTest_Objects::SetUnifyFaces(iUnifyFaces != 0);
}
else if (!strcmp(a[i], "-a"))
{
Standard_Real anAngTol = Draw::Atof(a[++i]) * (M_PI / 180.0);
BOPTest_Objects::SetAngular(anAngTol);
}
else
{
di << "Wrong key option.\n";
di.PrintHelp(a[0]);
return 1;
}
}
return 0;
}

View File

@@ -191,6 +191,7 @@ Standard_Integer bbuild(Draw_Interpretor& di,
}
aBuilder.SetRunParallel(bRunParallel);
aBuilder.SetCheckInverted(BOPTest_Objects::CheckInverted());
aBuilder.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
//
//
OSD_Timer aTimer;
@@ -200,7 +201,8 @@ Standard_Integer bbuild(Draw_Interpretor& di,
BOPTest::ReportAlerts(aBuilder.GetReport());
// Set history of GF operation into the session
BRepTest_Objects::SetHistory(aPF.Arguments(), aBuilder);
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(aPF.Arguments(), aBuilder);
if (aBuilder.HasErrors()) {
return 0;
@@ -306,6 +308,7 @@ Standard_Integer bbop(Draw_Interpretor& di,
//
pBuilder->SetRunParallel(bRunParallel);
pBuilder->SetCheckInverted(BOPTest_Objects::CheckInverted());
pBuilder->SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
//
OSD_Timer aTimer;
aTimer.Start();
@@ -314,7 +317,8 @@ Standard_Integer bbop(Draw_Interpretor& di,
BOPTest::ReportAlerts(pBuilder->GetReport());
// Set history of Boolean operation into the session
BRepTest_Objects::SetHistory(aPF.Arguments(), *pBuilder);
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(aPF.Arguments(), *pBuilder);
if (pBuilder->HasErrors()) {
return 0;
@@ -376,6 +380,7 @@ Standard_Integer bsplit(Draw_Interpretor& di,
pSplitter->SetNonDestructive(BOPTest_Objects::NonDestructive());
pSplitter->SetFuzzyValue(BOPTest_Objects::FuzzyValue());
pSplitter->SetCheckInverted(BOPTest_Objects::CheckInverted());
pSplitter->SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
//
// measure the time of the operation
OSD_Timer aTimer;
@@ -388,7 +393,8 @@ Standard_Integer bsplit(Draw_Interpretor& di,
BOPTest::ReportAlerts(pSplitter->GetReport());
// Set history of Split operation into the session
BRepTest_Objects::SetHistory(aPF.Arguments(), *pSplitter);
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(aPF.Arguments(), *pSplitter);
if (pSplitter->HasErrors()) {
return 0;

View File

@@ -43,12 +43,11 @@ void BOPTest::RemoveFeaturesCommands(Draw_Interpretor& theCommands)
// Chapter's name
const char* group = "BOPTest commands";
// Commands
theCommands.Add("removefeatures", "removefeatures result shape f1 f2 ... [-nohist] [-parallel]\n"
theCommands.Add("removefeatures", "removefeatures result shape f1 f2 ... [-parallel]\n"
"\t\tRemoves user-defined features (faces) from the shape.\n"
"\t\tresult - result of the operation;\n"
"\t\tshape - the shape to remove the features from;\n"
"\t\tf1, f2 - features to remove from the shape;\n"
"\t\tnohist - disables the history collection;\n"
"\t\tparallel - enables the parallel processing mode.",
__FILE__, RemoveFeatures, group);
}
@@ -84,13 +83,7 @@ Standard_Integer RemoveFeatures(Draw_Interpretor& theDI,
TopoDS_Shape aF = DBRep::Get(theArgv[i]);
if (aF.IsNull())
{
// Check for the options
if (!strcmp(theArgv[i], "-nohist"))
{
// disable the history collection
aRF.TrackHistory(Standard_False);
}
else if (!strcmp(theArgv[i], "-parallel"))
if (!strcmp(theArgv[i], "-parallel"))
{
// enable the parallel processing mode
aRF.SetRunParallel(Standard_True);
@@ -104,14 +97,16 @@ Standard_Integer RemoveFeatures(Draw_Interpretor& theDI,
aRF.AddFaceToRemove(aF);
}
aRF.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
// Perform the removal
aRF.Build();
// Check for the errors/warnings
BOPTest::ReportAlerts(aRF.GetReport());
if (aRF.HasHistory())
BRepTest_Objects::SetHistory(aRF.GetHistory());
if (BRepTest_Objects::IsHistoryNeeded())
BRepTest_Objects::SetHistory(aRF.History());
if (aRF.HasErrors())
return 0;

View File

@@ -162,12 +162,29 @@ void BOPTools_AlgoTools::MakeSplitEdge(const TopoDS_Edge& aE,
//
BRep_Builder BB;
if (!aV1.IsNull()) {
BB.Add (E, aV1);
if (aP1 < aP2) {
BB.Add (E, TopoDS::Vertex(aV1.Oriented(TopAbs_FORWARD)));
}
else {
BB.Add (E, TopoDS::Vertex(aV1.Oriented(TopAbs_REVERSED)));
}
}
if (!aV2.IsNull()) {
BB.Add (E, aV2);
if (aP1 < aP2) {
BB.Add (E, TopoDS::Vertex(aV2.Oriented(TopAbs_REVERSED)));
}
else {
BB.Add (E, TopoDS::Vertex(aV2.Oriented(TopAbs_FORWARD)));
}
}
BB.Range(E, aP1, aP2);
if (aP1 < aP2) {
BB.Range(E, aP1, aP2);
}
else {
BB.Range(E, aP2, aP1);
}
aNewEdge=E;
aNewEdge.Orientation(aE.Orientation());
}

View File

@@ -23,7 +23,7 @@
#include <BRep_TEdge.hxx>
#include <Standard_Type.hxx>
#include <TopAbs.hxx>
#include <TopoDS_TShape.hxx>
#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRep_TEdge,TopoDS_TEdge)

View File

@@ -21,7 +21,7 @@
#include <Standard_Type.hxx>
#include <TopAbs.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS_TShape.hxx>
#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRep_TFace,TopoDS_TFace)

View File

@@ -19,7 +19,7 @@
#include <gp_Pnt.hxx>
#include <Standard_Type.hxx>
#include <TopAbs.hxx>
#include <TopoDS_TShape.hxx>
#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRep_TVertex,TopoDS_TVertex)

View File

@@ -366,8 +366,9 @@ void BRepAlgo_NormalProjection::SetDefaultParams()
#ifdef OCCT_DEBUG_CHRONO
InitChron(chr_approx);
#endif
Approx_CurveOnSurface appr(HPCur, hsur, Udeb, Ufin, myTol3d);
appr.Perform(myMaxSeg, myMaxDegree, myContinuity, Only3d, Only2d);
Approx_CurveOnSurface appr(HPCur, hsur, Udeb, Ufin, myTol3d,
myContinuity, myMaxDegree, myMaxSeg,
Only3d, Only2d);
#ifdef OCCT_DEBUG_CHRONO
ResultChron(chr_approx,t_approx);
approx_count++;

View File

@@ -15,39 +15,24 @@
// commercial license or contractual agreement.
#include <BRepAlgoAPI_BooleanOperation.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPAlgo_BOP.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Section.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPDS_Curve.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_Interf.hxx>
#include <BOPDS_ListOfPaveBlock.hxx>
#include <BOPDS_PDS.hxx>
#include <BOPDS_VectorOfCurve.hxx>
#include <BRepAlgoAPI_BooleanOperation.hxx>
#include <BRepAlgoAPI_Check.hxx>
#include <BRepLib_FuseEdges.hxx>
#include <BRepTools.hxx>
#include <OSD_Environment.hxx>
#include <OSD_File.hxx>
#include <TCollection_AsciiString.hxx>
#include <TopExp.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_DataMapOfIntegerListOfShape.hxx>
#include <TopTools_DataMapOfIntegerShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <stdio.h>
///XXXXXXXXXX
//XXXXXXXXXX
//XXXX
//=======================================================================
//class : BRepAlgoAPI_DumpOper
//purpose :
//purpose : Dumps the arguments ad script to perform operation in DRAW
//=======================================================================
class BRepAlgoAPI_DumpOper {
public:
@@ -96,538 +81,146 @@ class BRepAlgoAPI_DumpOper {
Standard_Boolean myIsDumpRes;
Standard_CString myPath;
};
//XXXX
//=======================================================================
//function : BRepAlgoAPI_BooleanOperation
//purpose :
//=======================================================================
BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation()
:
BRepAlgoAPI_BuilderAlgo(),
myOperation(BOPAlgo_UNKNOWN),
myBuilderCanWork(Standard_False),
myFuseEdges(Standard_False)
{
myEntryType=1;
}
//=======================================================================
//function : BRepAlgoAPI_BooleanOperation
//purpose :
//=======================================================================
BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
(const BOPAlgo_PaveFiller& aPF)
:
BRepAlgoAPI_BuilderAlgo(aPF),
myOperation(BOPAlgo_UNKNOWN),
myBuilderCanWork(Standard_False),
myFuseEdges(Standard_False)
{
myEntryType=0;
}
//=======================================================================
//function : BRepAlgoAPI_BooleanOperation
//purpose :
//=======================================================================
BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
(const TopoDS_Shape& aS1,
const TopoDS_Shape& aS2,
const BOPAlgo_Operation anOp)
:
BRepAlgoAPI_BuilderAlgo(),
myOperation(anOp),
myBuilderCanWork(Standard_False),
myFuseEdges(Standard_False)
myOperation(BOPAlgo_UNKNOWN)
{
myEntryType=1;
//
myArguments.Append(aS1);
myTools.Append(aS2);
}
//=======================================================================
//function : BRepAlgoAPI_BooleanOperation
//purpose :
//=======================================================================
BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
(const TopoDS_Shape& aS1,
const TopoDS_Shape& aS2,
const BOPAlgo_PaveFiller& aPF,
const BOPAlgo_Operation anOp)
:
BRepAlgoAPI_BuilderAlgo(aPF),
myOperation(anOp),
myBuilderCanWork(Standard_False),
myFuseEdges(Standard_False)
{
myEntryType=0;
//
myArguments.Append(aS1);
myTools.Append(aS2);
//
myDSFiller=(BOPAlgo_PaveFiller*)&aPF;
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
BRepAlgoAPI_BooleanOperation::~BRepAlgoAPI_BooleanOperation()
{
Clear();
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::Clear()
{
BRepAlgoAPI_BuilderAlgo::Clear();
//
myModifFaces.Clear();
myEdgeMap.Clear();
}
//=======================================================================
//function : SetTools
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::SetTools
(const TopTools_ListOfShape& theLS)
{
myTools=theLS;
}
//=======================================================================
//function : Tools
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Tools()const
{
return myTools;
}
//=======================================================================
//function : SetOperation
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::SetOperation
(const BOPAlgo_Operation anOp)
{
myOperation=anOp;
}
//=======================================================================
//function : Operation
//purpose :
//=======================================================================
BOPAlgo_Operation BRepAlgoAPI_BooleanOperation::Operation()const
{
return myOperation;
}
//=======================================================================
//function : Shape1
//purpose :
//=======================================================================
const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape1() const
{
return myArguments.First();
}
//=======================================================================
//function : Shape2
//purpose :
//=======================================================================
const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape2() const
{
return myTools.First();
}
//=======================================================================
//function : BuilderCanWork
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::BuilderCanWork() const
{
return myBuilderCanWork;
}
//=======================================================================
//function : FuseEdges
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::FuseEdges ()const
{
return myFuseEdges;
}
//=======================================================================
//function : SetAttributes
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::SetAttributes()
(const BOPAlgo_PaveFiller& thePF)
:
BRepAlgoAPI_BuilderAlgo(thePF),
myOperation(BOPAlgo_UNKNOWN)
{
}
//=======================================================================
//function : Build2
//function : BRepAlgoAPI_BooleanOperation
//purpose : obsolete
//=======================================================================
BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
const BOPAlgo_Operation theOp)
:
BRepAlgoAPI_BuilderAlgo(),
myOperation(theOp)
{
myArguments.Append(theS1);
myTools.Append(theS2);
}
//=======================================================================
//function : BRepAlgoAPI_BooleanOperation
//purpose :
//=======================================================================
BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
const BOPAlgo_PaveFiller& thePF,
const BOPAlgo_Operation theOp)
:
BRepAlgoAPI_BuilderAlgo(thePF),
myOperation(theOp)
{
myArguments.Append(theS1);
myTools.Append(theS2);
}
//=======================================================================
//function : Build
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::Build()
{
GetReport()->Clear();
Standard_Integer aNbArgs, aNbTools;
BRepAlgoAPI_DumpOper aDumpOper;
//
myBuilderCanWork=Standard_False;
// Set Not Done status by default
NotDone();
//
aNbArgs=myArguments.Extent();
aNbTools=myTools.Extent();
if (aNbArgs<1 && aNbTools<1) {
// Clear from previous runs
Clear();
// Check for availability of arguments and tools
// Both should be present
if (myArguments.IsEmpty() || myTools.IsEmpty())
{
AddError (new BOPAlgo_AlertTooFewArguments);
return;
}
if (myOperation==BOPAlgo_UNKNOWN) {
// Check if the operation is set
if (myOperation == BOPAlgo_UNKNOWN)
{
AddError (new BOPAlgo_AlertBOPNotSet);
return;
}
//
//-----------------------------------------------
TopTools_ListOfShape aLS;
TopTools_ListIteratorOfListOfShape aIt;
//
aIt.Initialize(myArguments);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
aLS.Append(aS);
}
aIt.Initialize(myTools);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
aLS.Append(aS);
}
//-----------------------------------------------
//
if (myEntryType) {
if (myDSFiller) {
delete myDSFiller;
// DEBUG option for dumping shapes and scripts
BRepAlgoAPI_DumpOper aDumpOper;
{
if (aDumpOper.IsDump()) {
BRepAlgoAPI_Check aChekArgs(myArguments.First(), myTools.First(), myOperation);
aDumpOper.SetIsDumpArgs(!aChekArgs.IsValid());
}
myDSFiller=new BOPAlgo_PaveFiller(myAllocator);
//
myDSFiller->SetArguments(aLS);
//
myDSFiller->SetRunParallel(myRunParallel);
myDSFiller->SetProgressIndicator(myProgressIndicator);
myDSFiller->SetFuzzyValue(myFuzzyValue);
myDSFiller->SetNonDestructive(myNonDestructive);
myDSFiller->SetGlue(myGlue);
myDSFiller->SetUseOBB(myUseOBB);
//
SetAttributes();
//
myDSFiller->Perform();
//
GetReport()->Merge (myDSFiller->GetReport());
}
// If necessary perform intersection of the argument shapes
if (myIsIntersectionNeeded)
{
// Combine Objects and Tools into a single list for intersection
TopTools_ListOfShape aLArgs = myArguments;
for (TopTools_ListOfShape::Iterator it(myTools); it.More(); it.Next())
aLArgs.Append(it.Value());
// Perform intersection
IntersectShapes(aLArgs);
if (HasErrors())
{
if (aDumpOper.IsDump())
{
aDumpOper.SetIsDumpRes(Standard_False);
aDumpOper.Dump(myArguments.First(), myTools.First(), TopoDS_Shape(), myOperation);
}
return;
}
}// if (myEntryType) {
//
//XXXX
const TopoDS_Shape& aS1 = myArguments.First();
const TopoDS_Shape& aS2 = myTools.First();
if (aDumpOper.IsDump()) {
BRepAlgoAPI_Check aChekArgs(aS1, aS2, myOperation);
aDumpOper.SetIsDumpArgs(!aChekArgs.IsValid());
}
//XXXX
//
if (myBuilder) {
delete myBuilder;
myBuilder = NULL;
}
//
BOPAlgo_BOP *pBOP;
//
if(myOperation==BOPAlgo_SECTION) {
myBuilder=new BOPAlgo_Section(myAllocator);
myBuilder->SetArguments(aLS);
}
else{
pBOP=new BOPAlgo_BOP(myAllocator);
pBOP->SetArguments(myArguments);
pBOP->SetTools(myTools);
pBOP->SetOperation(myOperation);
myBuilder=pBOP;
}
//
myBuilder->SetRunParallel(myRunParallel);
myBuilder->SetProgressIndicator(myProgressIndicator);
myBuilder->SetCheckInverted(myCheckInverted);
//
myBuilder->PerformWithFiller(*myDSFiller);
//
GetReport()->Merge (myBuilder->GetReport());
if (HasErrors())
// Builder Initialization
if (myOperation == BOPAlgo_SECTION)
{
return;
myBuilder = new BOPAlgo_Section(myAllocator);
myBuilder->SetArguments(myDSFiller->Arguments());
}
//
myShape=myBuilder->Shape();
//
myBuilderCanWork=Standard_True;
Done();
//
//XXXX
else
{
myBuilder = new BOPAlgo_BOP(myAllocator);
myBuilder->SetArguments(myArguments);
((BOPAlgo_BOP*)myBuilder)->SetTools(myTools);
((BOPAlgo_BOP*)myBuilder)->SetOperation(myOperation);
}
// Build the result
BuildResult();
if (aDumpOper.IsDump()) {
BRepAlgoAPI_Check aCheckRes(myShape);
aDumpOper.SetIsDumpRes(!aCheckRes.IsValid());
aDumpOper.Dump(aS1, aS2, myShape,myOperation);
}
//XXXX
}
//=======================================================================
//function : RefineEdges
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::RefineEdges ()
{
if(myFuseEdges) {
return; //Edges have been refined
}
//
TopTools_IndexedMapOfShape mapOldEdges;
TopTools_ListOfShape aLS;
TopTools_ListIteratorOfListOfShape aIt;
//
aIt.Initialize(myArguments);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
aLS.Append(aS);
}
aIt.Initialize(myTools);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
aLS.Append(aS);
}
//
aIt.Initialize(aLS);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
TopExp::MapShapes (aS, TopAbs_EDGE, mapOldEdges);
}
//----------------------------------------------
BRepLib_FuseEdges FE(myShape);
FE.SetConcatBSpl(Standard_True);
FE.AvoidEdges (mapOldEdges);
//
// Get List of edges that have been fused
myFuseEdges = Standard_False;
myModifFaces.Clear();
myEdgeMap.Clear();
TopTools_DataMapOfIntegerListOfShape aFusedEdges;
FE.Edges(aFusedEdges);
Standard_Integer nle = aFusedEdges.Extent();
if (nle != 0) {
FE.Perform();
myShape = FE.Shape();
TopTools_DataMapOfIntegerShape aResultEdges;
FE.ResultEdges(aResultEdges);
FE.Faces(myModifFaces);
myFuseEdges = Standard_True;
Standard_Integer i;
for(i = 1; i <= nle; ++i) {
const TopoDS_Shape& aNewE = aResultEdges(i);
const TopTools_ListOfShape& aListOfOldEdges = aFusedEdges(i);
TopTools_ListIteratorOfListOfShape anIter(aListOfOldEdges);
for(; anIter.More(); anIter.Next()) {
myEdgeMap.Bind(anIter.Value(), aNewE);
}
}
Standard_Boolean isDumpRes = myShape.IsNull() ||
!BRepAlgoAPI_Check(myShape).IsValid();
aDumpOper.SetIsDumpRes(isDumpRes);
aDumpOper.Dump(myArguments.First(), myTools.First(), myShape, myOperation);
}
}
//=======================================================================
//function : RefinedList
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::RefinedList
(const TopTools_ListOfShape& theL)
{
myGenerated.Clear();
TopTools_MapOfShape aMap;
TopTools_ListIteratorOfListOfShape anIter(theL);
for(; anIter.More(); anIter.Next()) {
const TopoDS_Shape& anS = anIter.Value();
if(anS.ShapeType() == TopAbs_EDGE) {
if(myEdgeMap.IsBound(anS)) {
const TopoDS_Shape& aNewEdge = myEdgeMap.Find(anS);
if(aMap.Add(aNewEdge)) {
myGenerated.Append(aNewEdge);
}
}
else {
myGenerated.Append(anS);
}
}
else if (anS.ShapeType() == TopAbs_FACE) {
if(myModifFaces.IsBound(anS)) {
myGenerated.Append(myModifFaces.Find(anS));
}
else {
myGenerated.Append(anS);
}
}
else {
myGenerated.Append(anS);
}
}
return myGenerated;
}
//=======================================================================
//function : SectionEdges
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::SectionEdges()
{
if (myBuilder==NULL) {
myGenerated.Clear();
return myGenerated;
}
//
Standard_Integer aNb, i, j, aNbCurves, nE;
BOPDS_ListIteratorOfListOfPaveBlock anIt;
//
const BOPDS_PDS& pDS = myDSFiller->PDS();
BOPDS_VectorOfInterfFF& aFFs=pDS->InterfFF();
myGenerated.Clear();
//
aNb=aFFs.Length();
for (i = 0; i < aNb; i++) {
BOPDS_InterfFF& aFFi=aFFs(i);
const BOPDS_VectorOfCurve& aSeqOfCurve=aFFi.Curves();
//
aNbCurves=aSeqOfCurve.Length();
for (j=0; j<aNbCurves; j++) {
const BOPDS_Curve& aCurve=aSeqOfCurve(j);
const BOPDS_ListOfPaveBlock& aSectEdges = aCurve.PaveBlocks();
//
anIt.Initialize(aSectEdges);
for(; anIt.More(); anIt.Next()) {
const Handle(BOPDS_PaveBlock)& aPB = anIt.Value();
nE = aPB->Edge();
const TopoDS_Shape& aE = pDS->Shape(nE);
myGenerated.Append(aE);
}
}
}
//
if(myFuseEdges) {
TopTools_ListOfShape theLS;
theLS.Assign(myGenerated);
//
RefinedList(theLS);
}
//
return myGenerated;
}
//=======================================================================
//function : Generated
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Generated
(const TopoDS_Shape& S)
{
if (myBuilder==NULL) {
myGenerated.Clear();
return myGenerated;
}
//
if(myFuseEdges) {
const TopTools_ListOfShape& aL = myBuilder->Generated(S);
return RefinedList(aL);
}
return myBuilder->Generated(S);
}
//=======================================================================
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified
(const TopoDS_Shape& aS)
{
if (myBuilder==NULL) {
myGenerated.Clear();
return myGenerated;
}
else {
myGenerated = myBuilder->Modified(aS);
if(myFuseEdges) {
TopTools_ListOfShape theLS;
theLS.Assign(myGenerated);
//
RefinedList(theLS);
}
return myGenerated;
}
}
//=======================================================================
//function : IsDeleted
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::IsDeleted
(const TopoDS_Shape& aS)
{
Standard_Boolean bDeleted = Standard_True;
if (myBuilder != NULL) {
bDeleted=myBuilder->IsDeleted(aS);
}
return bDeleted;
}
//=======================================================================
//function : HasModified
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::HasModified() const
{
if (myBuilder==NULL) {
return Standard_False;
}
return myBuilder->HasModified();
}
//=======================================================================
//function : HasGenerated
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::HasGenerated() const
{
if (myBuilder==NULL) {
return Standard_False;
}
return myBuilder->HasGenerated();
}
//=======================================================================
//function : HasDeleted
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::HasDeleted() const
{
if (myBuilder==NULL) {
return Standard_False;
}
return myBuilder->HasDeleted();
}
//XXXX
//=======================================================================
//function : Dump
//purpose :
//purpose : DEBUG: Dumping the shapes and script of the operation
//=======================================================================
void BRepAlgoAPI_DumpOper::Dump (const TopoDS_Shape& theShape1,
const TopoDS_Shape& theShape2,
const TopoDS_Shape& theResult,
BOPAlgo_Operation theOperation)
void BRepAlgoAPI_DumpOper::Dump(const TopoDS_Shape& theShape1,
const TopoDS_Shape& theShape2,
const TopoDS_Shape& theResult,
BOPAlgo_Operation theOperation)
{
if (!(myIsDumpArgs && myIsDumpRes)) {
return;

View File

@@ -21,150 +21,120 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BOPAlgo_Operation.hxx>
#include <Standard_Boolean.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <BRepAlgoAPI_BuilderAlgo.hxx>
class BOPAlgo_PaveFiller;
class TopoDS_Shape;
//! The abstract class BooleanOperation is the root
//! class of Boolean Operations (see Overview).
//! Boolean Operations algorithm is divided onto two parts:<br>
//! - The first one is computing interference between arguments;<br>
//! - The second one is building the result of operation;<br>
//! The class BooleanOperation provides API level of both parts.<br>
//! The root API class for performing Boolean Operations on arbitrary shapes.
//!
//! Additionally to the errors of the parent class the algorithm
//! returns the following Error statuses:<br>
//! - 0 - in case of success;<br>
//! The arguments of the operation are divided in two groups - *Objects* and *Tools*.
//! Each group can contain any number of shapes, but each shape should be valid
//! in terms of *BRepCheck_Analyzer* and *BOPAlgo_ArgumentAnalyzer*.
//! The algorithm builds the splits of the given arguments using the intersection
//! results and combines the result of Boolean Operation of given type:
//! - *FUSE* - union of two groups of objects;
//! - *COMMON* - intersection of two groups of objects;
//! - *CUT* - subtraction of one group from the other;
//! - *SECTION* - section edges and vertices of all arguments;
//!
//! The rules for the arguments and type of the operation are the following:
//! - For Boolean operation *FUSE* all arguments should have equal dimensions;
//! - For Boolean operation *CUT* the minimal dimension of *Tools* should not be
//! less than the maximal dimension of *Objects*;
//! - For Boolean operation *COMMON* the arguments can have any dimension.
//! - For Boolean operation *SECTION* the arguments can be of any type.
//!
//! Additionally to the errors of the base class the algorithm returns
//! the following Errors:<br>
//! - *BOPAlgo_AlertBOPNotSet* - in case the type of Boolean Operation is not set.<br>
//!
class BRepAlgoAPI_BooleanOperation : public BRepAlgoAPI_BuilderAlgo
{
public:
DEFINE_STANDARD_ALLOC
//! Returns the first argument involved in this Boolean operation.
//! Obsolete
Standard_EXPORT const TopoDS_Shape& Shape1() const;
//! Returns the second argument involved in this Boolean operation.
//! Obsolete
Standard_EXPORT const TopoDS_Shape& Shape2() const;
//! Sets the tools
Standard_EXPORT void SetTools (const TopTools_ListOfShape& theLS);
//! Gets the tools
Standard_EXPORT const TopTools_ListOfShape& Tools() const;
//! Sets the type of Boolean operation
Standard_EXPORT void SetOperation (const BOPAlgo_Operation anOp);
//! Returns the type of Boolean Operation
Standard_EXPORT BOPAlgo_Operation Operation() const;
Standard_EXPORT virtual ~BRepAlgoAPI_BooleanOperation();
//! Performs the algorithm
//! Filling interference Data Structure (if it is necessary)
//! Building the result of the operation.
Standard_EXPORT virtual void Build() Standard_OVERRIDE;
//! Returns True if there was no errors occured
//! obsolete
Standard_EXPORT Standard_Boolean BuilderCanWork() const;
//! Returns the flag of edge refining
Standard_EXPORT Standard_Boolean FuseEdges() const;
//! Fuse C1 edges
Standard_EXPORT void RefineEdges();
//! Returns a list of section edges.
//! The edges represent the result of intersection between arguments of
//! Boolean Operation. They are computed during operation execution.
Standard_EXPORT const TopTools_ListOfShape& SectionEdges();
//! Returns the list of shapes modified from the shape <S>.
Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& aS) Standard_OVERRIDE;
//! Returns true if the shape S has been deleted. The
//! result shape of the operation does not contain the shape S.
Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& aS) Standard_OVERRIDE;
//! Returns the list of shapes generated from the shape <S>.
//! For use in BRepNaming.
Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
//! Returns true if there is at least one modified shape.
//! For use in BRepNaming.
Standard_EXPORT virtual Standard_Boolean HasModified() const Standard_OVERRIDE;
//! Returns true if there is at least one generated shape.
//! For use in BRepNaming.
Standard_EXPORT virtual Standard_Boolean HasGenerated() const Standard_OVERRIDE;
//! Returns true if there is at least one deleted shape.
//! For use in BRepNaming.
Standard_EXPORT virtual Standard_Boolean HasDeleted() const Standard_OVERRIDE;
public: //! @name Constructors
protected:
//! Empty constructor
Standard_EXPORT BRepAlgoAPI_BooleanOperation();
//! Empty constructor
//! <PF> - PaveFiller object that is carried out
Standard_EXPORT BRepAlgoAPI_BooleanOperation(const BOPAlgo_PaveFiller& PF);
//! Constructor with two arguments
//! <S1>, <S2> -arguments
//! <anOperation> - the type of the operation
//! Constructor with precomputed intersections of arguments.
Standard_EXPORT BRepAlgoAPI_BooleanOperation(const BOPAlgo_PaveFiller& thePF);
public: //! @name Setting/getting arguments
//! Returns the first argument involved in this Boolean operation.
//! Obsolete
Standard_EXPORT BRepAlgoAPI_BooleanOperation(const TopoDS_Shape& S1, const TopoDS_Shape& S2, const BOPAlgo_Operation anOperation);
//! Constructor with two arguments
//! <S1>, <S2> -arguments
//! <anOperation> - the type of the operation
//! <PF> - PaveFiller object that is carried out
const TopoDS_Shape& Shape1() const
{
return myArguments.First();
}
//! Returns the second argument involved in this Boolean operation.
//! Obsolete
Standard_EXPORT BRepAlgoAPI_BooleanOperation(const TopoDS_Shape& S1, const TopoDS_Shape& S2, const BOPAlgo_PaveFiller& PF, const BOPAlgo_Operation anOperation);
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
Standard_EXPORT virtual void SetAttributes();
//! Returns the list of shapes generated from the shape <S>.
//! For use in BRepNaming.
Standard_EXPORT const TopTools_ListOfShape& RefinedList (const TopTools_ListOfShape& theL);
const TopoDS_Shape& Shape2() const
{
return myTools.First();
}
//! Sets the Tool arguments
void SetTools(const TopTools_ListOfShape& theLS)
{
myTools = theLS;
}
//! Returns the Tools arguments
const TopTools_ListOfShape& Tools() const
{
return myTools;
}
TopTools_ListOfShape myTools;
BOPAlgo_Operation myOperation;
Standard_Boolean myBuilderCanWork;
public: //! @name Setting/Getting the type of Boolean operation
//! Sets the type of Boolean operation
void SetOperation(const BOPAlgo_Operation theBOP)
{
myOperation = theBOP;
}
//! Returns the type of Boolean Operation
BOPAlgo_Operation Operation() const
{
return myOperation;
}
private:
public: //! @name Performing the operation
//! Performs the Boolean operation.
Standard_EXPORT virtual void Build() Standard_OVERRIDE;
protected: //! @name Constructors
Standard_Boolean myFuseEdges;
TopTools_DataMapOfShapeShape myModifFaces;
TopTools_DataMapOfShapeShape myEdgeMap;
//! Constructor to perform Boolean operation on only two arguments.
//! Obsolete
Standard_EXPORT BRepAlgoAPI_BooleanOperation(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
const BOPAlgo_Operation theOperation);
//! Constructor to perform Boolean operation on only two arguments
//! with precomputed intersection results.
//! Obsolete
Standard_EXPORT BRepAlgoAPI_BooleanOperation(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
const BOPAlgo_PaveFiller& thePF,
const BOPAlgo_Operation theOperation);
protected: //! @name Fields
TopTools_ListOfShape myTools; //!< Tool arguments of operation
BOPAlgo_Operation myOperation; //!< Type of Boolean Operation
};
#endif // _BRepAlgoAPI_BooleanOperation_HeaderFile

View File

@@ -13,41 +13,44 @@
// commercial license or contractual agreement.
#include <BRepAlgoAPI_BuilderAlgo.hxx>
#include <BOPAlgo_Builder.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BRepAlgoAPI_BuilderAlgo.hxx>
#include <BOPDS_DS.hxx>
#include <ShapeUpgrade_UnifySameDomain.hxx>
#include <TopoDS_Shape.hxx>
//=======================================================================
// function:
// function: BRepAlgoAPI_BuilderAlgo
// purpose:
//=======================================================================
BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo()
:
BRepAlgoAPI_Algo(),
myEntryType(1),
myDSFiller(NULL),
myBuilder(NULL),
myNonDestructive(Standard_False),
myGlue(BOPAlgo_GlueOff),
myCheckInverted(Standard_True)
myCheckInverted(Standard_True),
myFillHistory(Standard_True),
myIsIntersectionNeeded(Standard_True),
myDSFiller(NULL),
myBuilder(NULL)
{}
//=======================================================================
// function:
// function: BRepAlgoAPI_BuilderAlgo
// purpose:
//=======================================================================
BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo
(const BOPAlgo_PaveFiller& aPF)
BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo(const BOPAlgo_PaveFiller& aPF)
:
BRepAlgoAPI_Algo(),
myEntryType(0),
myBuilder(NULL),
myNonDestructive(Standard_False),
myGlue(BOPAlgo_GlueOff),
myCheckInverted(Standard_True)
myCheckInverted(Standard_True),
myFillHistory(Standard_True),
myIsIntersectionNeeded(Standard_False),
myBuilder(NULL)
{
BOPAlgo_PaveFiller* pPF=(BOPAlgo_PaveFiller*)&aPF;
myDSFiller=pPF;
myDSFiller = (BOPAlgo_PaveFiller*)&aPF;
}
//=======================================================================
// function: ~
@@ -58,69 +61,27 @@ BRepAlgoAPI_BuilderAlgo::~BRepAlgoAPI_BuilderAlgo()
Clear();
}
//=======================================================================
//function : SetNonDestructive
//purpose :
//=======================================================================
void BRepAlgoAPI_BuilderAlgo::SetNonDestructive(const Standard_Boolean theFlag)
{
myNonDestructive = theFlag;
}
//=======================================================================
//function : NonDestructive
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BuilderAlgo::NonDestructive() const
{
return myNonDestructive;
}
//=======================================================================
//function : SetGlue
//purpose :
//=======================================================================
void BRepAlgoAPI_BuilderAlgo::SetGlue(const BOPAlgo_GlueEnum theGlue)
{
myGlue=theGlue;
}
//=======================================================================
//function : Glue
//purpose :
//=======================================================================
BOPAlgo_GlueEnum BRepAlgoAPI_BuilderAlgo::Glue() const
{
return myGlue;
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void BRepAlgoAPI_BuilderAlgo::Clear()
{
BRepAlgoAPI_Algo::Clear();
if (myDSFiller && myEntryType) {
if (myDSFiller && myIsIntersectionNeeded)
{
delete myDSFiller;
myDSFiller=NULL;
myDSFiller = NULL;
}
if (myBuilder) {
if (myBuilder)
{
delete myBuilder;
myBuilder=NULL;
}
}
//=======================================================================
//function : SetArguments
//purpose :
//=======================================================================
void BRepAlgoAPI_BuilderAlgo::SetArguments
(const TopTools_ListOfShape& theLS)
{
myArguments=theLS;
}
//=======================================================================
//function : Arguments
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Arguments()const
{
return myArguments;
if (myHistory)
myHistory.Nullify();
if (mySimplifierHistory)
mySimplifierHistory.Nullify();
}
//=======================================================================
//function : Build
@@ -128,93 +89,143 @@ const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Arguments()const
//=======================================================================
void BRepAlgoAPI_BuilderAlgo::Build()
{
// Setting not done status
NotDone();
//
// Destroy the tools if necessary
Clear();
//
if (myEntryType) {
if (myDSFiller) {
delete myDSFiller;
}
myDSFiller=new BOPAlgo_PaveFiller(myAllocator);
//
myDSFiller->SetArguments(myArguments);
//
myDSFiller->SetRunParallel(myRunParallel);
myDSFiller->SetProgressIndicator(myProgressIndicator);
myDSFiller->SetFuzzyValue(myFuzzyValue);
myDSFiller->SetNonDestructive(myNonDestructive);
myDSFiller->SetGlue(myGlue);
myDSFiller->SetUseOBB(myUseOBB);
//
myDSFiller->Perform();
//
GetReport()->Merge (myDSFiller->GetReport());
if (HasErrors())
{
return;
}
}// if (myEntryType) {
//
if (myBuilder) {
delete myBuilder;
myBuilder = NULL;
}
myBuilder=new BOPAlgo_Builder(myAllocator);
//
// If necessary perform intersection of the argument shapes
IntersectShapes(myArguments);
if (HasErrors())
return;
// Initialization of the Building tool
myBuilder = new BOPAlgo_Builder(myAllocator);
// Set arguments to builder
myBuilder->SetArguments(myArguments);
//
// Build the result basing on intersection results
BuildResult();
}
//=======================================================================
//function : IntersectShapes
//purpose : Intersects the given shapes with the intersection tool
//=======================================================================
void BRepAlgoAPI_BuilderAlgo::IntersectShapes(const TopTools_ListOfShape& theArgs)
{
if (!myIsIntersectionNeeded)
return;
if (myDSFiller)
delete myDSFiller;
// Create new Filler
myDSFiller = new BOPAlgo_PaveFiller(myAllocator);
// Set arguments for intersection
myDSFiller->SetArguments(theArgs);
// Set options for intersection
myDSFiller->SetRunParallel(myRunParallel);
myDSFiller->SetProgressIndicator(myProgressIndicator);
myDSFiller->SetFuzzyValue(myFuzzyValue);
myDSFiller->SetNonDestructive(myNonDestructive);
myDSFiller->SetGlue(myGlue);
myDSFiller->SetUseOBB(myUseOBB);
// Set Face/Face intersection options to the intersection algorithm
SetAttributes();
// Perform intersection
myDSFiller->Perform();
// Check for the errors during intersection
GetReport()->Merge(myDSFiller->GetReport());
}
//=======================================================================
//function : BuildResult
//purpose : Builds the result shape
//=======================================================================
void BRepAlgoAPI_BuilderAlgo::BuildResult()
{
// Set options to the builder
myBuilder->SetRunParallel(myRunParallel);
myBuilder->SetProgressIndicator(myProgressIndicator);
myBuilder->SetCheckInverted(myCheckInverted);
//
myBuilder->SetToFillHistory(myFillHistory);
// Perform building of the result with pre-calculated intersections
myBuilder->PerformWithFiller(*myDSFiller);
//
GetReport()->Merge (myBuilder->GetReport());
//
// Merge the warnings of the Building part
GetReport()->Merge(myBuilder->GetReport());
// Check for the errors
if (myBuilder->HasErrors())
return;
// Set done status
Done();
myShape=myBuilder->Shape();
// Get the result shape
myShape = myBuilder->Shape();
// Fill history
if (myFillHistory)
{
myHistory = new BRepTools_History;
myHistory->Merge(myBuilder->History());
}
}
//=======================================================================
//function : Generated
//function : SimplifyResult
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Generated
(const TopoDS_Shape& aS)
void BRepAlgoAPI_BuilderAlgo::SimplifyResult(const Standard_Boolean theUnifyEdges,
const Standard_Boolean theUnifyFaces,
const Standard_Real theAngularTol)
{
if (myBuilder==NULL) {
myGenerated.Clear();
return myGenerated;
}
myGenerated = myBuilder->Generated(aS);
return myGenerated;
if (HasErrors())
return;
if (!theUnifyEdges && !theUnifyFaces)
return;
// Simplification tool
ShapeUpgrade_UnifySameDomain anUnifier(myShape, theUnifyEdges, theUnifyFaces, Standard_True);
// Pass options
anUnifier.SetLinearTolerance(myFuzzyValue);
anUnifier.SetAngularTolerance(theAngularTol);
anUnifier.SetSafeInputMode(myNonDestructive);
anUnifier.AllowInternalEdges(Standard_False);
// Perform simplification
anUnifier.Build();
// Overwrite result with simplified shape
myShape = anUnifier.Shape();
// Keep simplification history
mySimplifierHistory = anUnifier.History();
if (myFillHistory)
// Merge simplification history into result history
myHistory->Merge(mySimplifierHistory);
}
//=======================================================================
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Modified
(const TopoDS_Shape& aS)
const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Modified(const TopoDS_Shape& theS)
{
if (myBuilder==NULL) {
myGenerated.Clear();
return myGenerated;
}
myGenerated = myBuilder->Modified(aS);
if (myFillHistory && myHistory)
return myHistory->Modified(theS);
myGenerated.Clear();
return myGenerated;
}
//=======================================================================
//function : Generated
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Generated(const TopoDS_Shape& theS)
{
if (myFillHistory && myHistory)
return myHistory->Generated(theS);
myGenerated.Clear();
return myGenerated;
}
//=======================================================================
//function : IsDeleted
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BuilderAlgo::IsDeleted
(const TopoDS_Shape& aS)
Standard_Boolean BRepAlgoAPI_BuilderAlgo::IsDeleted(const TopoDS_Shape& theS)
{
Standard_Boolean bDeleted = Standard_True;
if (myBuilder != NULL) {
bDeleted=myBuilder->IsDeleted(aS);
}
return bDeleted;
return (myFillHistory && myHistory ? myHistory->IsRemoved(theS) : Standard_False);
}
//=======================================================================
//function : HasModified
@@ -222,10 +233,7 @@ Standard_Boolean BRepAlgoAPI_BuilderAlgo::IsDeleted
//=======================================================================
Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasModified() const
{
if (myBuilder==NULL) {
return Standard_False;
}
return myBuilder->HasModified();
return (myFillHistory && myHistory ? myHistory->HasModified() : Standard_False);
}
//=======================================================================
//function : HasGenerated
@@ -233,10 +241,7 @@ Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasModified() const
//=======================================================================
Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasGenerated() const
{
if (myBuilder==NULL) {
return Standard_False;
}
return myBuilder->HasGenerated();
return (myFillHistory && myHistory ? myHistory->HasGenerated() : Standard_False);
}
//=======================================================================
//function : HasDeleted
@@ -244,8 +249,66 @@ Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasGenerated() const
//=======================================================================
Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasDeleted() const
{
if (myBuilder==NULL) {
return Standard_False;
}
return myBuilder->HasDeleted();
return (myFillHistory && myHistory ? myHistory->HasRemoved() : Standard_False);
}
//=======================================================================
//function : SectionEdges
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::SectionEdges()
{
myGenerated.Clear();
if (myBuilder == NULL)
return myGenerated;
// Fence map to avoid duplicated section edges in the result list
TopTools_MapOfShape aMFence;
// Intersection results
const BOPDS_PDS& pDS = myDSFiller->PDS();
// Iterate on all Face/Face interferences and take section edges
BOPDS_VectorOfInterfFF& aFFs = pDS->InterfFF();
const Standard_Integer aNbFF = aFFs.Length();
for (Standard_Integer i = 0; i < aNbFF; ++i)
{
BOPDS_InterfFF& aFFi = aFFs(i);
// Section curves between pair of faces
const BOPDS_VectorOfCurve& aSectionCurves = aFFi.Curves();
const Standard_Integer aNbC = aSectionCurves.Length();
for (Standard_Integer j = 0; j < aNbC; ++j)
{
const BOPDS_Curve& aCurve = aSectionCurves(j);
// Section edges created from the curve
const BOPDS_ListOfPaveBlock& aSectionEdges = aCurve.PaveBlocks();
BOPDS_ListIteratorOfListOfPaveBlock aItPB(aSectionEdges);
for (; aItPB.More(); aItPB.Next())
{
const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value();
const TopoDS_Shape& aSE = pDS->Shape(aPB->Edge());
if (!aMFence.Add(aSE))
continue;
// Take into account simplification of the result shape
if (mySimplifierHistory)
{
if (mySimplifierHistory->IsRemoved(aSE))
continue;
const TopTools_ListOfShape& aLSEIm = mySimplifierHistory->Modified(aSE);
if (!aLSEIm.IsEmpty())
{
TopTools_ListIteratorOfListOfShape aItLEIm(aLSEIm);
for (; aItLEIm.More(); aItLEIm.Next())
{
if (aMFence.Add(aItLEIm.Value()))
myGenerated.Append(aItLEIm.Value());
}
}
else
myGenerated.Append(aSE);
}
else
myGenerated.Append(aSE);
}
}
}
return myGenerated;
}

View File

@@ -19,17 +19,15 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <BOPAlgo_GlueEnum.hxx>
#include <BOPAlgo_PPaveFiller.hxx>
#include <BOPAlgo_PBuilder.hxx>
#include <BOPAlgo_GlueEnum.hxx>
#include <BRepAlgoAPI_Algo.hxx>
#include <BRepTools_History.hxx>
#include <Precision.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BRepAlgoAPI_Algo.hxx>
#include <Standard_Boolean.hxx>
class BOPAlgo_PaveFiller;
class TopoDS_Shape;
//! The class contains API level of the General Fuse algorithm.<br>
//!
@@ -43,6 +41,8 @@ class TopoDS_Shape;
//! for inverted status (holes in the space). The default value is TRUE,
//! i.e. the check is performed. Setting this flag to FALSE for inverted solids,
//! most likely will lead to incorrect results.
//! - *Disabling history collection* - allows disabling the collection of the history
//! of shapes modifications during the operation.
//!
//! It returns the following Error statuses:<br>
//! - 0 - in case of success;<br>
@@ -52,35 +52,74 @@ class TopoDS_Shape;
//!
//! Warnings statuses from underlying DS Filler and Builder algorithms
//! are collected in the report.
//!
//! The class provides possibility to simplify the resulting shape by unification
//! of the tangential edges and faces. It is performed by the method *SimplifyResult*.
//! See description of this method for more details.
//!
class BRepAlgoAPI_BuilderAlgo : public BRepAlgoAPI_Algo
{
public:
DEFINE_STANDARD_ALLOC
public: //! @name Constructors
//! Empty constructor
Standard_EXPORT BRepAlgoAPI_BuilderAlgo();
Standard_EXPORT virtual ~BRepAlgoAPI_BuilderAlgo();
//! Empty constructor
Standard_EXPORT virtual ~BRepAlgoAPI_BuilderAlgo();
//! Constructor with prepared Filler object
Standard_EXPORT BRepAlgoAPI_BuilderAlgo(const BOPAlgo_PaveFiller& thePF);
public: //! @name Setting/Getting data for the algorithm
//! Sets the arguments
void SetArguments (const TopTools_ListOfShape& theLS)
{
myArguments = theLS;
}
//! Gets the arguments
const TopTools_ListOfShape& Arguments() const
{
return myArguments;
}
public: //! @name Setting options
//! Sets the flag that defines the mode of treatment.
//! In non-destructive mode the argument shapes are not modified. Instead
//! a copy of a sub-shape is created in the result if it is needed to be updated.
Standard_EXPORT void SetNonDestructive(const Standard_Boolean theFlag);
void SetNonDestructive(const Standard_Boolean theFlag)
{
myNonDestructive = theFlag;
}
//! Returns the flag that defines the mode of treatment.
//! In non-destructive mode the argument shapes are not modified. Instead
//! a copy of a sub-shape is created in the result if it is needed to be updated.
Standard_EXPORT Standard_Boolean NonDestructive() const;
Standard_Boolean NonDestructive() const
{
return myNonDestructive;
}
//! Sets the glue option for the algorithm,
//! which allows increasing performance of the intersection
//! of the input shapes.
void SetGlue(const BOPAlgo_GlueEnum theGlue)
{
myGlue = theGlue;
}
//! Sets the glue option for the algorithm
Standard_EXPORT void SetGlue(const BOPAlgo_GlueEnum theGlue);
//! Returns the glue option of the algorithm
Standard_EXPORT BOPAlgo_GlueEnum Glue() const;
BOPAlgo_GlueEnum Glue() const
{
return myGlue;
}
//! Enables/Disables the check of the input solids for inverted status
void SetCheckInverted(const Standard_Boolean theCheck)
@@ -95,42 +134,93 @@ Standard_EXPORT virtual ~BRepAlgoAPI_BuilderAlgo();
return myCheckInverted;
}
//! Sets the arguments
Standard_EXPORT void SetArguments (const TopTools_ListOfShape& theLS);
//! Gets the arguments
Standard_EXPORT const TopTools_ListOfShape& Arguments() const;
public: //! @name Performing the operation
//! Performs the algorithm
//!
//! H I S T O R Y
Standard_EXPORT virtual void Build() Standard_OVERRIDE;
//! Returns the list of shapes modified from the shape <S>.
Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& aS) Standard_OVERRIDE;
//! Returns true if the shape S has been deleted. The
//! result shape of the operation does not contain the shape S.
Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& aS) Standard_OVERRIDE;
//! Returns the list of shapes generated from the shape <S>.
//! For use in BRepNaming.
Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
//! Returns true if there is at least one modified shape.
//! For use in BRepNaming.
Standard_EXPORT virtual Standard_Boolean HasModified() const;
//! Returns true if there is at least one generated shape.
//! For use in BRepNaming.
Standard_EXPORT virtual Standard_Boolean HasGenerated() const;
//! Returns true if there is at least one deleted shape.
//! For use in BRepNaming.
public: //! @name Result simplification
//! Simplification of the result shape is performed by the means of
//! *ShapeUpgrade_UnifySameDomain* algorithm. The result of the operation will
//! be overwritten with the simplified result.
//!
//! protected methods
//! The simplification is performed without creation of the Internal shapes,
//! i.e. shapes connections will never be broken.
//!
//! Simplification is performed on the whole result shape. Thus, if the input
//! shapes contained connected tangent edges or faces unmodified during the operation
//! they will also be unified.
//!
//! After simplification, the History of result simplification is merged into the main
//! history of operation. So, it is taken into account when asking for Modified,
//! Generated and Deleted shapes.
//!
//! Some options of the main operation are passed into the Unifier:
//! - Fuzzy tolerance of the operation is given to the Unifier as the linear tolerance.
//! - Non destructive mode here controls the safe input mode in Unifier.
//!
//! @param theUnifyEdges Controls the edges unification. TRUE by default.
//! @param theUnifyFaces Controls the faces unification. TRUE by default.
//! @param theAngularTol Angular criteria for tangency of edges and faces.
//! Precision::Angular() by default.
Standard_EXPORT void SimplifyResult(const Standard_Boolean theUnifyEdges = Standard_True,
const Standard_Boolean theUnifyFaces = Standard_True,
const Standard_Real theAngularTol = Precision::Angular());
public: //! @name History support
//! Returns the shapes modified from the shape <theS>.
//! If any, the list will contain only those splits of the
//! given shape, contained in the result.
Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) Standard_OVERRIDE;
//! Returns the list of shapes generated from the shape <theS>.
//! In frames of Boolean Operations algorithms only Edges and Faces
//! could have Generated elements, as only they produce new elements
//! during intersection:
//! - Edges can generate new vertices;
//! - Faces can generate new edges and vertices.
Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) Standard_OVERRIDE;
//! Checks if the shape <theS> has been completely removed from the result,
//! i.e. the result does not contain the shape itself and any of its splits.
//! Returns TRUE if the shape has been deleted.
Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& aS) Standard_OVERRIDE;
//! Returns true if any of the input shapes has been modified during operation.
Standard_EXPORT virtual Standard_Boolean HasModified() const;
//! Returns true if any of the input shapes has generated shapes during operation.
Standard_EXPORT virtual Standard_Boolean HasGenerated() const;
//! Returns true if any of the input shapes has been deleted during operation.
//! Normally, General Fuse operation should not have Deleted elements,
//! but all derived operation can have.
Standard_EXPORT virtual Standard_Boolean HasDeleted() const;
public: //! @name Enabling/Disabling the history collection.
//! Allows disabling the history collection
void SetToFillHistory(const Standard_Boolean theHistFlag) { myFillHistory = theHistFlag; }
//! Returns flag of history availability
Standard_Boolean HasHistory() const { return myFillHistory; }
public: //! @name Getting the section edges
//! Returns a list of section edges.
//! The edges represent the result of intersection between arguments of operation.
Standard_EXPORT const TopTools_ListOfShape& SectionEdges();
public: //! @name Getting tools performing the job
//! Returns the Intersection tool
const BOPAlgo_PPaveFiller& DSFiller() const
{
@@ -143,20 +233,57 @@ Standard_EXPORT virtual ~BRepAlgoAPI_BuilderAlgo();
return myBuilder;
}
protected:
//! History tool
Handle(BRepTools_History) History() const
{
return myFillHistory ? myHistory : NULL;
}
protected: //! @name Setting options to the Intersection tool
//! Sets options (available in child classes) for the intersection tool.
//! Here it does nothing.
virtual void SetAttributes() {}
protected: //! @name Protected methods for shapes intersection and building result
//! Intersects the given shapes with the intersection tool
Standard_EXPORT void IntersectShapes(const TopTools_ListOfShape& theArgs);
//! Builds the resulting shape
Standard_EXPORT void BuildResult();
protected: //! @name Clearing the contents of the algorithm
//! Clears the algorithm from previous runs
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
Standard_Integer myEntryType;
BOPAlgo_PPaveFiller myDSFiller;
BOPAlgo_PBuilder myBuilder;
Standard_Boolean myNonDestructive;
TopTools_ListOfShape myArguments;
BOPAlgo_GlueEnum myGlue;
Standard_Boolean myCheckInverted;
private:
protected: //! @name Fields
// Inputs
TopTools_ListOfShape myArguments; //!< Arguments of the operation
// Options
Standard_Boolean myNonDestructive; //!< Non-destructive mode management
BOPAlgo_GlueEnum myGlue; //!< Gluing mode management
Standard_Boolean myCheckInverted; //!< Check for inverted solids management
Standard_Boolean myFillHistory; //!< Controls the history collection
// Tools
Standard_Boolean myIsIntersectionNeeded; //!< Flag to control whether the intersection
//! of arguments should be performed or not
BOPAlgo_PPaveFiller myDSFiller; //!< Intersection tool performs intersection of the
//! argument shapes.
BOPAlgo_PBuilder myBuilder; //!< Building tool performs construction of the result
//! basing on the results of intersection
Handle(BRepTools_History) myHistory; //!< General History tool, containing all History of
//! shapes modifications during the operation
//! (including result simplification)
Handle(BRepTools_History) mySimplifierHistory; //!< History of result shape simplification
};
#endif // _BRepAlgoAPI_BuilderAlgo_HeaderFile

View File

@@ -32,7 +32,7 @@ void BRepAlgoAPI_Defeaturing::Build()
// Set the inputs to BOPAlgo_RemoveFeatures algorithm
myFeatureRemovalTool.SetShape(myInputShape);
myFeatureRemovalTool.AddFacesToRemove(myFacesToRemove);
myFeatureRemovalTool.TrackHistory(myTrackHistory);
myFeatureRemovalTool.SetToFillHistory(myFillHistory);
myFeatureRemovalTool.SetRunParallel(myRunParallel);
// Perform the features removal
@@ -57,10 +57,7 @@ void BRepAlgoAPI_Defeaturing::Build()
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_Defeaturing::Modified(const TopoDS_Shape& theS)
{
myGenerated.Clear();
if (!myFeatureRemovalTool.History().IsNull())
myGenerated = myFeatureRemovalTool.History()->Modified(theS);
return myGenerated;
return myFeatureRemovalTool.Modified(theS);
}
//=======================================================================
@@ -69,10 +66,7 @@ const TopTools_ListOfShape& BRepAlgoAPI_Defeaturing::Modified(const TopoDS_Shape
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_Defeaturing::Generated(const TopoDS_Shape& theS)
{
myGenerated.Clear();
if (!myFeatureRemovalTool.History().IsNull())
myGenerated = myFeatureRemovalTool.History()->Generated(theS);
return myGenerated;
return myFeatureRemovalTool.Generated(theS);
}
//=======================================================================
@@ -81,6 +75,32 @@ const TopTools_ListOfShape& BRepAlgoAPI_Defeaturing::Generated(const TopoDS_Shap
//=======================================================================
Standard_Boolean BRepAlgoAPI_Defeaturing::IsDeleted(const TopoDS_Shape& theS)
{
return (!myFeatureRemovalTool.History().IsNull() ?
myFeatureRemovalTool.History()->IsRemoved(theS) : Standard_False);
return myFeatureRemovalTool.IsDeleted(theS);
}
//=======================================================================
//function : HasModified
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_Defeaturing::HasModified() const
{
return myFeatureRemovalTool.HasModified();
}
//=======================================================================
//function : HasGenerated
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_Defeaturing::HasGenerated() const
{
return myFeatureRemovalTool.HasGenerated();
}
//=======================================================================
//function : HasDeleted
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_Defeaturing::HasDeleted() const
{
return myFeatureRemovalTool.HasDeleted();
}

View File

@@ -77,7 +77,7 @@
//! aDF.SetShape(aSolid); // Set the shape
//! aDF.AddFacesToRemove(aFaces); // Add faces to remove
//! aDF.SetRunParallel(bRunParallel); // Define the processing mode (parallel or single)
//! aDF.TrackHistory(isHistoryNeeded); // Define whether to track the shapes modifications
//! aDF.SetToFillHistory(isHistoryNeeded); // Define whether to track the shapes modifications
//! aDF.Build(); // Perform the operation
//! if (!aDF.IsDone()) // Check for the errors
//! {
@@ -110,7 +110,7 @@ public: //! @name Constructors
BRepAlgoAPI_Defeaturing()
:
BRepAlgoAPI_Algo(),
myTrackHistory(Standard_True)
myFillHistory(Standard_True)
{}
@@ -163,13 +163,13 @@ public: //! @name Performing the operation
public: //! @name History Methods
//! Defines whether to track the modification of the shapes or not.
void TrackHistory(const Standard_Boolean theFlag)
void SetToFillHistory(const Standard_Boolean theFlag)
{
myTrackHistory = theFlag;
myFillHistory = theFlag;
}
//! Returns whether the history was requested or not.
Standard_Boolean HasHistory() const { return myTrackHistory; }
Standard_Boolean HasHistory() const { return myFillHistory; }
//! Returns the list of shapes modified from the shape <theS> during the operation.
Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) Standard_OVERRIDE;
@@ -182,8 +182,17 @@ public: //! @name History Methods
//! Otherwise it returns false.
Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& theS) Standard_OVERRIDE;
//! Returns true if any of the input shapes has been modified during operation.
Standard_EXPORT virtual Standard_Boolean HasModified() const;
//! Returns true if any of the input shapes has generated shapes during operation.
Standard_EXPORT virtual Standard_Boolean HasGenerated() const;
//! Returns true if any of the input shapes has been deleted during operation.
Standard_EXPORT virtual Standard_Boolean HasDeleted() const;
//! Returns the History of shapes modifications
Handle(BRepTools_History) GetHistory()
Handle(BRepTools_History) History()
{
return myFeatureRemovalTool.History();
}
@@ -202,7 +211,7 @@ protected: //! @name Fields
TopoDS_Shape myInputShape; //!< Input shape to remove the features from
TopTools_ListOfShape myFacesToRemove; //!< Features to remove from the shape
Standard_Boolean myTrackHistory; //!< Defines whether to track the history of
Standard_Boolean myFillHistory; //!< Defines whether to track the history of
//! shapes modifications or not (true by default)
BOPAlgo_RemoveFeatures myFeatureRemovalTool; //!< Tool for the features removal

View File

@@ -14,9 +14,8 @@
#include <BRepAlgoAPI_Splitter.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Splitter.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPAlgo_Splitter.hxx>
//=======================================================================
// function: Empty constructor
@@ -26,108 +25,49 @@ BRepAlgoAPI_Splitter::BRepAlgoAPI_Splitter()
: BRepAlgoAPI_BuilderAlgo() {}
//=======================================================================
// function: Constructor with already filled PaveFiller
// function: Constructor with already prepared PaveFiller
// purpose:
//=======================================================================
BRepAlgoAPI_Splitter::BRepAlgoAPI_Splitter(const BOPAlgo_PaveFiller& thePF)
: BRepAlgoAPI_BuilderAlgo(thePF) {}
//=======================================================================
// function: Destructor
// purpose:
//=======================================================================
BRepAlgoAPI_Splitter::~BRepAlgoAPI_Splitter()
{
}
//=======================================================================
// function: SetTools
// purpose:
//=======================================================================
void BRepAlgoAPI_Splitter::SetTools(const TopTools_ListOfShape& theLS)
{
myTools = theLS;
}
//=======================================================================
// function: Tools
// purpose:
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_Splitter::Tools() const
{
return myTools;
}
//=======================================================================
// function: Build
// purpose:
//=======================================================================
void BRepAlgoAPI_Splitter::Build()
{
// Set Not Done status by default
NotDone();
//
// Clear the contents
Clear();
//
// Check for availability of arguments and tools
if (myArguments.IsEmpty() ||
(myArguments.Extent() + myTools.Extent()) < 2) {
(myArguments.Extent() + myTools.Extent()) < 2)
{
AddError (new BOPAlgo_AlertTooFewArguments);
return;
}
//
if (myEntryType) {
if (myDSFiller) {
delete myDSFiller;
}
myDSFiller = new BOPAlgo_PaveFiller(myAllocator);
//
TopTools_ListOfShape aLArgs;
TopTools_ListIteratorOfListOfShape aItLA(myArguments);
for (; aItLA.More(); aItLA.Next()) {
aLArgs.Append(aItLA.Value());
}
//
aItLA.Initialize(myTools);
for (; aItLA.More(); aItLA.Next()) {
aLArgs.Append(aItLA.Value());
}
//
myDSFiller->SetArguments(aLArgs);
//
myDSFiller->SetRunParallel(myRunParallel);
myDSFiller->SetProgressIndicator(myProgressIndicator);
myDSFiller->SetFuzzyValue(myFuzzyValue);
myDSFiller->SetNonDestructive(myNonDestructive);
myDSFiller->SetGlue(myGlue);
myDSFiller->SetUseOBB(myUseOBB);
//
myDSFiller->Perform();
//
GetReport()->Merge (myDSFiller->GetReport());
if (HasErrors())
{
return;
}
}
//
if (myBuilder) {
delete myBuilder;
}
//
// If necessary perform intersection of the argument shapes
if (myIsIntersectionNeeded)
{
BOPAlgo_Splitter *pSplitter = new BOPAlgo_Splitter(myAllocator);
pSplitter->SetArguments(myArguments);
pSplitter->SetTools(myTools);
myBuilder = pSplitter;
// Combine Arguments and Tools for intersection into a single list
TopTools_ListOfShape aLArgs = myArguments;
for (TopTools_ListOfShape::Iterator it(myTools); it.More(); it.Next())
aLArgs.Append(it.Value());
// Perform intersection
IntersectShapes(aLArgs);
if (HasErrors())
return;
}
//
myBuilder->SetRunParallel(myRunParallel);
myBuilder->SetProgressIndicator(myProgressIndicator);
myBuilder->SetCheckInverted(myCheckInverted);
//
myBuilder->PerformWithFiller(*myDSFiller);
//
GetReport()->Merge (myBuilder->GetReport());
//
Done();
myShape = myBuilder->Shape();
// Initialization of the building tool
myBuilder = new BOPAlgo_Splitter(myAllocator);
myBuilder->SetArguments(myArguments);
((BOPAlgo_Splitter*)myBuilder)->SetTools(myTools);
// Build result shape basing on the intersection results
BuildResult();
}

View File

@@ -53,30 +53,42 @@ public:
DEFINE_STANDARD_ALLOC
public: //! @name Constructors
//! Empty constructor
Standard_EXPORT BRepAlgoAPI_Splitter();
Standard_EXPORT virtual ~BRepAlgoAPI_Splitter();
//! Constructor with already filled PaveFiller
//! Constructor with already prepared intersection tool - PaveFiller
Standard_EXPORT BRepAlgoAPI_Splitter(const BOPAlgo_PaveFiller& thePF);
//! Performs the algorithm.<br>
//! Performs the intersection of the objects with tools and build the result of the operation.
public: //! @name Setters/Getters for the Tools
//! Sets the Tool arguments
void SetTools (const TopTools_ListOfShape& theLS)
{
myTools = theLS;
}
//! Returns the Tool arguments
const TopTools_ListOfShape& Tools() const
{
return myTools;
}
public: //! @name Performing the operation
//! Performs the Split operation.
//! Performs the intersection of the argument shapes (both objects and tools)
//! and splits objects by the tools.
Standard_EXPORT virtual void Build() Standard_OVERRIDE;
//! Sets the tools
Standard_EXPORT void SetTools (const TopTools_ListOfShape& theLS);
//! Gets the tools
Standard_EXPORT const TopTools_ListOfShape& Tools() const;
protected:
protected: //! @name Fields
//! Tools arguments of the operation
TopTools_ListOfShape myTools;
private:
TopTools_ListOfShape myTools; //!< Tool arguments of the operation
};
#endif // _BRepAlgoAPI_BuilderAlgo_HeaderFile
#endif // _BRepAlgoAPI_Splitter_HeaderFile

View File

@@ -179,7 +179,6 @@ private:
AppParCurves_Constraint myfirstC;
AppParCurves_Constraint mylastC;
Standard_Integer myMultiLineNb;
Standard_Integer myNbPlusOnePoint;
Standard_Boolean myIsClear;

View File

@@ -22,7 +22,6 @@
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Wire.hxx>
//=======================================================================

View File

@@ -83,35 +83,43 @@ Standard_Boolean BRepClass3d_BndBoxTreeSelectorLine::Accept (const Standard_Inte
if (sht == TopAbs_EDGE)
{
const TopoDS_Edge& E = TopoDS::Edge(shp);
Standard_Real EdgeTSq = BRep_Tool::Tolerance(E);
Standard_Real EdgeTSq = BRep_Tool::Tolerance(E);
EdgeTSq *= EdgeTSq;
Standard_Real f, l;
BRepAdaptor_Curve C(E);
BRep_Tool::Range(E,f,l);
BRep_Tool::Range(E, f, l);
// Edge-Line interference.
Extrema_ExtCC ExtCC(C, myLC, f, l, myLC.FirstParameter(), myLC.LastParameter());
if (ExtCC.IsDone() && ExtCC.NbExt() > 0)
{
Standard_Boolean IsInside = Standard_False;
for (Standard_Integer i = 1; i <= ExtCC.NbExt(); i++)
if (ExtCC.IsDone())
{
if (ExtCC.IsParallel())
{
if (ExtCC.SquareDistance(i) < EdgeTSq)
{
Extrema_POnCurv P1, P2;
ExtCC.Points(i,P1, P2);
EdgeParam EP;
EP.myE = E;
EP.myParam = P1.Parameter(); // Original curve is the first parameter.
EP.myLParam = P2.Parameter(); // Linear curve is the second parameter.
myEP.Append(EP);
IsInside = Standard_True;
}
// Tangent case is invalid for classification
myIsValid = Standard_False;
}
else if (ExtCC.NbExt() > 0)
{
Standard_Boolean IsInside = Standard_False;
for (Standard_Integer i = 1; i <= ExtCC.NbExt(); i++)
{
if (ExtCC.SquareDistance(i) < EdgeTSq)
{
Extrema_POnCurv P1, P2;
ExtCC.Points(i, P1, P2);
EdgeParam EP;
EP.myE = E;
EP.myParam = P1.Parameter(); // Original curve is the first parameter.
EP.myLParam = P2.Parameter(); // Linear curve is the second parameter.
myEP.Append(EP);
IsInside = Standard_True;
}
}
if (IsInside)
return Standard_True;
}
if (IsInside)
return Standard_True;
}
}
else if (sht == TopAbs_VERTEX)

View File

@@ -83,7 +83,9 @@ public:
public:
BRepClass3d_BndBoxTreeSelectorLine(const TopTools_IndexedMapOfShape& theMapOfShape)
: BRepClass3d_BndBoxTreeSelectorLine::Selector(), myMapOfShape (theMapOfShape)
: BRepClass3d_BndBoxTreeSelectorLine::Selector(),
myMapOfShape(theMapOfShape),
myIsValid(Standard_True)
{}
Standard_Boolean Reject (const Bnd_Box& theBox) const
@@ -135,6 +137,13 @@ public:
{
myEP.Clear();
myVP.Clear();
myIsValid = Standard_True;
}
//! Returns TRUE if correct classification is possible
Standard_Boolean IsCorrect() const
{
return myIsValid;
}
private:
@@ -147,6 +156,7 @@ private:
NCollection_Sequence<EdgeParam> myEP; //output result (edge vs line)
NCollection_Sequence<VertParam> myVP; //output result (vertex vs line)
GeomAdaptor_Curve myLC;
Standard_Boolean myIsValid;
};
#endif

View File

@@ -285,6 +285,14 @@ void BRepClass3d_SClassifier::Perform(BRepClass3d_SolidExplorer& SolidExplorer,
aSelectorLine.SetCurrentLine(L, Par);
Standard_Integer SelsEVL = 0;
SelsEVL = aTree.Select(aSelectorLine); //SelsEE > 0 => Line/Edges & Line/Vertex intersection
if (!aSelectorLine.IsCorrect())
{
// Go to the next segment
isFaultyLine = Standard_True;
continue;
}
if (SelsEVL > 0 )
{
// Line and edges / vertices interference.

View File

@@ -175,8 +175,6 @@
aBB.MakeCompound(aC);
myShape=aC;
//
myFlagHistory=Standard_True;
//
FillRemoved();
}

View File

@@ -227,16 +227,6 @@ BRepFill_MultiLine::BRepFill_MultiLine(const TopoDS_Face& Face1,
Precision::PConfusion(),
Vmin, Vmax);
}
if (GAS1.GetType() == GeomAbs_Sphere) {
if (myIsoU1)
ElCLib::AdjustPeriodic(-M_PI/2.,M_PI/2.,
Precision::PConfusion(),
Umin, Umax);
else
ElCLib::AdjustPeriodic(-M_PI/2.,M_PI/2.,
Precision::PConfusion(),
Vmin, Vmax);
}
// end try duplication
myU1 = Geom2dAdaptor_Curve(GeomProjLib::Curve2d(UU1, BasisPlane),
@@ -343,16 +333,6 @@ BRepFill_MultiLine::BRepFill_MultiLine(const TopoDS_Face& Face1,
Precision::PConfusion(),
Vmin, Vmax);
}
if (GAS2.GetType() == GeomAbs_Sphere) {
if (myIsoU2)
ElCLib::AdjustPeriodic(-M_PI/2.,M_PI/2.,
Precision::PConfusion(),
Umin, Umax);
else
ElCLib::AdjustPeriodic(-M_PI/2.,M_PI/2.,
Precision::PConfusion(),
Vmin, Vmax);
}
// end try duplication
myU2 = Geom2dAdaptor_Curve(GeomProjLib::Curve2d(UU2, BasisPlane),

View File

@@ -329,9 +329,8 @@ static Standard_Boolean SameParameter(TopoDS_Edge& E,
if (!HasPCurves(E))
{
Handle(Geom2dAdaptor_HCurve) HC2d = new Geom2dAdaptor_HCurve( Pcurv );
Approx_CurveOnSurface AppCurve(HC2d, S, HC2d->FirstParameter(), HC2d->LastParameter(),
Precision::Confusion());
AppCurve.Perform(10, 10, GeomAbs_C1, Standard_True);
Approx_CurveOnSurface AppCurve(HC2d, S, HC2d->FirstParameter(), HC2d->LastParameter(),
Precision::Confusion(), GeomAbs_C1, 10, 10, Standard_True);
if (AppCurve.IsDone() && AppCurve.HasResult())
{
C3d = AppCurve.Curve3d();
@@ -2093,11 +2092,11 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
BRep_Builder B;
Standard_Integer NbPath = ILast - IFirst;
Standard_Integer NbLaw = mySec->NbLaw();
Standard_Boolean uclose, vclose, constSection, hasdegen = Standard_False;
Standard_Boolean uclose, vclose, global_vclose, constSection, hasdegen = Standard_False;
constSection = mySec->IsConstant();
uclose = mySec->IsUClosed();
vclose = (mySec->IsVClosed() && myLoc->IsClosed()) &&
(NbPath == myLoc->NbLaw()) && (myLoc->IsG1(0, myTol3d)>= 0);
global_vclose = (myLoc->IsClosed()) && (myLoc->IsG1(0, myTol3d)>= 0);
vclose = global_vclose && (mySec->IsVClosed()) && (NbPath == myLoc->NbLaw());
Error = 0.;
// (1) Construction of all surfaces
@@ -2676,7 +2675,10 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
myTol3d);
else
{
if (ipath != NbPath || vclose)
if (ipath != NbPath ||
vclose ||
(global_vclose && ILast == myLoc->NbLaw()+1))
UpdateEdge(TopoDS::Edge(VEdge(isec, ipath+1)),
S, exuv, VLast);
else //ipath == NbPath && !vclose => rebuild last edge

View File

@@ -2182,15 +2182,12 @@ static Standard_Real ComputeAveragePlaneAndMaxDeviation(const TopoDS_Shape& aWir
gp_Pln& thePlane,
Standard_Boolean& IsSingular)
{
Standard_Integer N = 40, nedges = 0;
TopoDS_Iterator iter( aWire );
for (; iter.More(); iter.Next())
nedges++;
Standard_Integer N = 40;
Standard_Integer nedges = aWire.NbChildren();
TColgp_Array1OfPnt Pnts( 1, nedges*N );
Standard_Integer ind = 1, i;
for (iter.Initialize(aWire); iter.More(); iter.Next())
for (TopoDS_Iterator iter (aWire); iter.More(); iter.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge( iter.Value() );
BRepAdaptor_Curve aCurve(anEdge);

View File

@@ -110,8 +110,7 @@ static Standard_Real surfaceProperties(const TopoDS_Shape& S, GProp_GProps& Prop
}
BF.Load(F);
TopoDS_Iterator aWIter(F);
Standard_Boolean IsNatRestr = !aWIter.More();
Standard_Boolean IsNatRestr = (F.NbChildren() == 0);
if(!IsNatRestr) BD.Init(F);
if(Eps < 1.0) {
G.Perform(BF, BD, Eps);
@@ -199,8 +198,7 @@ static Standard_Real volumeProperties(const TopoDS_Shape& S, GProp_GProps& Props
if (isFwd || isRvs){
BF.Load(F);
TopoDS_Iterator aWIter(F);
Standard_Boolean IsNatRestr = !aWIter.More();
Standard_Boolean IsNatRestr = (F.NbChildren () == 0);
if(!IsNatRestr) BD.Init(F);
if(Eps < 1.0) {
G.Perform(BF, BD, Eps);
@@ -348,8 +346,7 @@ static Standard_Real volumePropertiesGK(const TopoDS_Shape &theShape,
if (isFwd || isRvs){
aPropFace.Load(aFace);
TopoDS_Iterator aWIter(aFace);
Standard_Boolean IsNatRestr = !aWIter.More();
Standard_Boolean IsNatRestr = (aFace.NbChildren () == 0);
if(IsNatRestr)
aLocalError = aVProps.Perform(aPropFace, aTol, CGFlag, IFlag);
else {
@@ -496,8 +493,7 @@ static Standard_Real volumePropertiesGK(const TopoDS_Shape &theShape,
if (isFwd || isRvs){
aPropFace.Load(aFace);
TopoDS_Iterator aWIter(aFace);
Standard_Boolean IsNatRestr = !aWIter.More();
Standard_Boolean IsNatRestr = (aFace.NbChildren () == 0);
if(IsNatRestr)
aLocalError = aVProps.Perform(aPropFace, thePln, aTol, CGFlag, IFlag);
else {

View File

@@ -585,8 +585,7 @@ Standard_Real BRepGProp_Gauss::Compute(
//
const Standard_Integer NumSubs = SUBS_POWER;
const TopoDS_Face& aF = theSurface.GetFace();
TopoDS_Iterator aWIter(aF);
const Standard_Boolean isNaturalRestriction = !aWIter.More(); //theSurface.NaturalRestriction();
const Standard_Boolean isNaturalRestriction = (aF.NbChildren () == 0); //theSurface.NaturalRestriction();
Standard_Real CIx, CIy, CIz, CIxy, CIxz, CIyz;
Standard_Real CDim[2], CIxx[2], CIyy[2], CIzz[2];

View File

@@ -2229,36 +2229,30 @@ void BRepOffset_MakeOffset::CorrectConicalFaces()
}
}
}
TopoDS_Iterator anIt(Sol);
Standard_Boolean SolIsNull = !anIt.More();
Standard_Integer nbs = Sol.NbChildren();
Standard_Boolean SolIsNull = (nbs == 0);
//Checking solid
if(!SolIsNull)
if (nbs > 1)
{
Standard_Integer nbs = 0;
while(anIt.More()) {anIt.Next(); ++nbs;}
if(nbs > 1)
BRepCheck_Analyzer aCheck (Sol, Standard_False);
if (!aCheck.IsValid ())
{
BRepCheck_Analyzer aCheck(Sol, Standard_False);
if(!aCheck.IsValid())
TopTools_ListOfShape aSolList;
CorrectSolid (Sol, aSolList);
if (!aSolList.IsEmpty ())
{
TopTools_ListOfShape aSolList;
CorrectSolid(Sol, aSolList);
if(!aSolList.IsEmpty())
BB.Add (NC, Sol);
TopTools_ListIteratorOfListOfShape aSLIt (aSolList);
for (; aSLIt.More (); aSLIt.Next ())
{
BB.Add(NC, Sol);
TopTools_ListIteratorOfListOfShape aSLIt(aSolList);
for(; aSLIt.More(); aSLIt.Next())
{
BB.Add(NC, aSLIt.Value());
}
SolIsNull = Standard_True;
BB.Add (NC, aSLIt.Value ());
}
SolIsNull = Standard_True;
}
}
}
//
anIt.Initialize(NC);
Standard_Boolean NCIsNull = !anIt.More();
Standard_Boolean NCIsNull = (NC.NbChildren() == 0);
if((!SolIsNull) && (!NCIsNull))
{
BB.Add(NC, Sol);
@@ -3072,35 +3066,29 @@ void BRepOffset_MakeOffset::MakeSolid ()
}
}
}
TopoDS_Iterator anIt(Sol);
Standard_Boolean SolIsNull = !anIt.More();
Standard_Integer nbs = Sol.NbChildren();
Standard_Boolean SolIsNull = (nbs == 0);
//Checking solid
if(!SolIsNull)
if (nbs > 1)
{
Standard_Integer nbs = 0;
while(anIt.More()) {anIt.Next(); ++nbs;}
if(nbs > 1)
BRepCheck_Analyzer aCheck (Sol, Standard_False);
if (!aCheck.IsValid ())
{
BRepCheck_Analyzer aCheck(Sol, Standard_False);
if(!aCheck.IsValid())
TopTools_ListOfShape aSolList;
CorrectSolid (Sol, aSolList);
if (!aSolList.IsEmpty ())
{
TopTools_ListOfShape aSolList;
CorrectSolid(Sol, aSolList);
if(!aSolList.IsEmpty())
B.Add (NC, Sol);
TopTools_ListIteratorOfListOfShape aSLIt (aSolList);
for (; aSLIt.More (); aSLIt.Next ())
{
B.Add(NC, Sol);
TopTools_ListIteratorOfListOfShape aSLIt(aSolList);
for(; aSLIt.More(); aSLIt.Next())
{
B.Add(NC, aSLIt.Value());
}
SolIsNull = Standard_True;
B.Add (NC, aSLIt.Value ());
}
SolIsNull = Standard_True;
}
}
}
anIt.Initialize(NC);
Standard_Boolean NCIsNull = !anIt.More();
Standard_Boolean NCIsNull = (NC.NbChildren() == 0);
if((!SolIsNull) && (!NCIsNull))
{
B.Add(NC, Sol);

View File

@@ -2386,9 +2386,7 @@ Standard_Boolean CheckInvertedBlock(const TopoDS_Shape& theCB,
{
// For possible removal of the block:
// 1. There should be more than just one face in the block
TopoDS_Iterator aItF(theCB);
aItF.Next();
if (!aItF.More()) {
if (theCB.NbChildren() < 2) {
return Standard_False;
}
//

View File

@@ -398,9 +398,7 @@ void BRepOffsetAPI_ThruSections::Build()
if (Georges.IsDegeneratedFirstSection())
IndFirstSec = 2;
TopoDS_Shape aWorkingSection = WorkingSections(IndFirstSec);
TopoDS_Iterator itw(aWorkingSection);
for (; itw.More(); itw.Next())
myNbEdgesInSection++;
myNbEdgesInSection += aWorkingSection.NbChildren();
for (Standard_Integer ii = 1; ii <= myWires.Length(); ii++)
{
TopExp_Explorer Explo(myWires(ii), TopAbs_EDGE);
@@ -419,7 +417,7 @@ void BRepOffsetAPI_ThruSections::Build()
{
const TopoDS_Edge& aNewEdge = TopoDS::Edge(itl.Value());
Standard_Integer inde = 1;
for (itw.Initialize(aWorkingSection); itw.More(); itw.Next(),inde++)
for (TopoDS_Iterator itw (aWorkingSection); itw.More(); itw.Next(), inde++)
{
const TopoDS_Shape& aWorkingEdge = itw.Value();
if (aWorkingEdge.IsSame(aNewEdge))

View File

@@ -24,7 +24,8 @@
#include <gp_Ax1.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <BRepTools_ReShape.hxx>
// perform checks on the argument
static const TopoDS_Shape& check(const TopoDS_Shape& S)
{
@@ -83,19 +84,131 @@ void BRepPrimAPI_MakeRevol::Build()
BRepLib::UpdateInnerTolerances(myShape);
Done();
// Modified by skv - Fri Mar 4 15:50:09 2005 Begin
myHist.Nullify();
myDegenerated.Clear();
TopTools_DataMapOfShapeListOfShape aDegE;
BRep_Builder aBB;
TopExp_Explorer anExp(myShape, TopAbs_EDGE);
//Problem is that some degenerated edges can be shared by different faces.
//It is not valid for correct shape.
//To solve problem it is possible to copy shared degenerated edge for each face, which has it, and
//replace shared edge by its copy
for (; anExp.More(); anExp.Next()) {
const TopoDS_Shape &anEdge = anExp.Current();
Handle(BRep_TEdge) aTEdge = Handle(BRep_TEdge)::DownCast(anEdge.TShape());
if (aTEdge->Degenerated())
myDegenerated.Append(anEdge);
{
TopTools_ListOfShape* anL = aDegE.ChangeSeek(anEdge);
if (anL)
{
//Make the copy if degenerated edge occurs more then once
TopoDS_Shape aCopyE = anEdge.EmptyCopied();
aCopyE.Orientation(TopAbs_FORWARD);
TopoDS_Iterator aVIter(anEdge.Oriented(TopAbs_FORWARD), Standard_False);
for (; aVIter.More(); aVIter.Next())
{
aBB.Add(aCopyE, aVIter.Value());
}
aCopyE.Orientation(anEdge.Orientation());
anL->Append(aCopyE);
myDegenerated.Append(aCopyE);
}
else
{
anL = aDegE.Bound(anEdge, TopTools_ListOfShape());
anL->Append(anEdge);
myDegenerated.Append(anEdge);
}
}
}
if (!myDegenerated.IsEmpty())
{
BRepTools_ReShape aSubs;
TopTools_DataMapOfShapeListOfShape aDegF;
Standard_Boolean isReplaced = Standard_False;
anExp.Init(myShape, TopAbs_FACE);
//Replace degenerated edge by its copies for different faces
//First, for each face list of d.e. is created
for (; anExp.More(); anExp.Next())
{
const TopoDS_Shape& aF = anExp.Current();
TopExp_Explorer anExpE(aF, TopAbs_EDGE);
for (; anExpE.More(); anExpE.Next())
{
const TopoDS_Shape &anE = anExpE.Current();
if (BRep_Tool::Degenerated(TopoDS::Edge(anE)))
{
TopTools_ListOfShape* anL = aDegF.ChangeSeek(aF);
if (!anL)
{
anL = aDegF.Bound(aF, TopTools_ListOfShape());
}
anL->Append(anE);
}
}
}
//
//Second, replace edges by copies using ReShape
BRepTools_ReShape aSubsF;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aFIter(aDegF);
for (; aFIter.More(); aFIter.Next())
{
aSubs.Clear();
isReplaced = Standard_False;
const TopoDS_Shape& aF = aFIter.Key();
const TopTools_ListOfShape& aDEL = aFIter.ChangeValue();
TopTools_ListIteratorOfListOfShape anEIter(aDEL);
for (; anEIter.More(); anEIter.Next())
{
const TopoDS_Shape& anE = anEIter.Value();
if (aDegE.IsBound(anE))
{
TopTools_ListOfShape& aCEL = aDegE.ChangeFind(anE);
TopTools_ListIteratorOfListOfShape anIt(aCEL);
for (; anIt.More(); anIt.Next())
{
if (anIt.Value().IsEqual(anE))
{
//First occurence of initial deg. edge is not replaced
aCEL.Remove(anIt);
break;
}
if (anIt.Value().Orientation() == anE.Orientation())
{
//All other occurences of anE are replaced by any copy
//with suitable orientation
isReplaced = Standard_True;
aSubs.Replace(anE, anIt.Value());
aCEL.Remove(anIt);
break;
}
}
}
}
if (isReplaced)
{
TopoDS_Shape aNF = aSubs.Apply(aF);
aSubsF.Replace(aF, aNF);
if (myHist.IsNull())
{
myHist = aSubs.History();
}
else
{
myHist->Merge(aSubs.History());
}
myShape = aSubsF.Apply(myShape);
myHist->Merge(aSubsF.History());
//Pair aF->aNF is in history after first replacing of edge by aNF = aSubs.Apply(aF)
//After merging history for replacing faces, modified list for aF contains two exemplar of aNF
//So, using ReplaceModified clears modified list for aF and leaves only one exemplar of aNF
myHist->ReplaceModified(aF, aNF);
aSubsF.Clear();
}
}
}
// Modified by skv - Fri Mar 4 15:50:09 2005 End
}
@@ -120,23 +233,47 @@ TopoDS_Shape BRepPrimAPI_MakeRevol::LastShape()
return myRevol.LastShape();
}
//=======================================================================
//function : Generated
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepPrimAPI_MakeRevol::Generated (const TopoDS_Shape& S)
{
myGenerated.Clear();
if (!myRevol.Shape (S).IsNull())
myGenerated.Append (myRevol.Shape (S));
TopoDS_Shape aGS = myRevol.Shape(S);
if (!aGS.IsNull())
{
if (BRepTools_History::IsSupportedType(aGS))
{
if (myHist.IsNull())
{
myGenerated.Append(aGS);
return myGenerated;
}
if (myHist->Modified(aGS).IsEmpty())
{
myGenerated.Append(aGS);
return myGenerated;
}
//
TopTools_ListIteratorOfListOfShape anIt(myHist->Modified(aGS));
for (; anIt.More(); anIt.Next())
{
myGenerated.Append(anIt.Value());
}
if (aGS.ShapeType() == TopAbs_EDGE)
{
if (BRep_Tool::Degenerated(TopoDS::Edge(aGS)))
{
//Append initial common deg. edge
myGenerated.Append(aGS);
}
}
}
}
return myGenerated;
}
// Modified by skv - Fri Mar 4 15:50:09 2005 Begin
//=======================================================================
//function : FirstShape
//purpose : This method returns the shape of the beginning of the revolution,
@@ -180,4 +317,4 @@ const TopTools_ListOfShape& BRepPrimAPI_MakeRevol::Degenerated () const
{
return myDegenerated;
}
// Modified by skv - Fri Mar 4 15:50:09 2005 End

View File

@@ -24,6 +24,7 @@
#include <BRepSweep_Revol.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BRepPrimAPI_MakeSweep.hxx>
#include <BRepTools_History.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
class TopoDS_Shape;
@@ -90,6 +91,9 @@ public:
//! Returns the TopoDS Shape of the end of the revol.
Standard_EXPORT TopoDS_Shape LastShape() Standard_OVERRIDE;
//! Returns list of shape generated from shape S
//! Warning: shape S must be shape of type VERTEX, EDGE, FACE, SOLID.
//! For shapes of other types method always returns empty list
Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
//! Returns the TopoDS Shape of the beginning of the revolution,
@@ -106,8 +110,6 @@ public:
Standard_EXPORT const TopTools_ListOfShape& Degenerated() const;
protected:
@@ -120,6 +122,7 @@ private:
BRepSweep_Revol myRevol;
TopTools_ListOfShape myDegenerated;
Handle(BRepTools_History) myHist;
};

View File

@@ -39,7 +39,6 @@
#include <TopExp_Explorer.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>

View File

@@ -2238,9 +2238,12 @@ static Standard_Integer BOSS(Draw_Interpretor& theCommands,
dout.Flush();
// Save history for fillet
TopTools_ListOfShape anArg;
anArg.Append(V);
BRepTest_Objects::SetHistory(anArg, *Rakk);
if (BRepTest_Objects::IsHistoryNeeded())
{
TopTools_ListOfShape anArg;
anArg.Append(V);
BRepTest_Objects::SetHistory(anArg, *Rakk);
}
return 0;
}

View File

@@ -179,9 +179,12 @@ static Standard_Integer BLEND(Draw_Interpretor& di, Standard_Integer narg, const
if(!Rakk->IsDone()) return 1;
// Save history for fillet
TopTools_ListOfShape anArg;
anArg.Append(V);
BRepTest_Objects::SetHistory(anArg, *Rakk);
if (BRepTest_Objects::IsHistoryNeeded())
{
TopTools_ListOfShape anArg;
anArg.Append(V);
BRepTest_Objects::SetHistory(anArg, *Rakk);
}
TopoDS_Shape res = Rakk->Shape();
DBRep::Set(a[1],res);

View File

@@ -26,10 +26,11 @@
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
static Standard_Integer SaveHistory(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer Modified (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer Generated (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer IsDeleted (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer SetFillHistory(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer SaveHistory (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer Modified (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer Generated (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer IsDeleted (Draw_Interpretor&, Standard_Integer, const char**);
//=======================================================================
//function : HistoryCommands
@@ -44,6 +45,13 @@ void BRepTest::HistoryCommands(Draw_Interpretor& theCommands)
const char* group = "History commands";
// Commands
theCommands.Add("setfillhistory" , "Controls the history collection by the algorithms and its saving into the session after algorithm is done.\n"
"\t\tUsage: setfillhistory [flag]\n"
"\t\tw/o arguments prints the current state of the option;\n"
"\t\tflag == 0 - history will not be collected and saved;\n"
"\t\tflag != 0 - history will be collected and saved into the session (default).",
__FILE__, SetFillHistory , group);
theCommands.Add("savehistory" , "savehistory name\n"
"\t\tSaves the history from the session into a drawable object with the name <name>.",
__FILE__, SaveHistory , group);
@@ -61,6 +69,33 @@ void BRepTest::HistoryCommands(Draw_Interpretor& theCommands)
__FILE__, IsDeleted, group);
}
//=======================================================================
//function : SetFillHistory
//purpose :
//=======================================================================
Standard_Integer SetFillHistory(Draw_Interpretor& theDI,
Standard_Integer theArgc,
const char** theArgv)
{
if (theArgc > 2)
{
theDI.PrintHelp(theArgv[0]);
return 1;
}
if (theArgc == 1)
{
theDI << "Filling of the history is " <<
(BRepTest_Objects::IsHistoryNeeded() ? "enabled." : "disabled.");
}
else
{
Standard_Integer iHist = Draw::Atoi(theArgv[1]);
BRepTest_Objects::SetToFillHistory(iHist != 0);
}
return 0;
}
//=======================================================================
//function : SaveHistory
//purpose :

View File

@@ -24,7 +24,16 @@ class BRepTest_Session
public:
//! Empty constructor
BRepTest_Session() {}
BRepTest_Session()
{
SetDefaultValues();
}
//! Sets the default values for the options
void SetDefaultValues()
{
myFillHistory = Standard_True;
}
//! Sets the History in the session
void SetHistory(const Handle(BRepTools_History)& theHistory)
@@ -46,9 +55,19 @@ public:
return myHistory;
}
//! Enables/Disables the history saving
void SetToFillHistory(const Standard_Boolean theFillHist)
{
myFillHistory = theFillHist;
}
//! Returns the flag controlling the history saving
Standard_Boolean IsHistoryNeeded() const { return myFillHistory; }
private:
Handle(BRepTools_History) myHistory;
Standard_Boolean myFillHistory;
};
//=======================================================================
@@ -87,3 +106,21 @@ Handle(BRepTools_History) BRepTest_Objects::History()
{
return GetSession().History();
}
//=======================================================================
//function : SetToFillHistory
//purpose :
//=======================================================================
void BRepTest_Objects::SetToFillHistory(const Standard_Boolean theFillHist)
{
return GetSession().SetToFillHistory(theFillHist);
}
//=======================================================================
//function : IsHistoryNeeded
//purpose :
//=======================================================================
Standard_Boolean BRepTest_Objects::IsHistoryNeeded()
{
return GetSession().IsHistoryNeeded();
}

View File

@@ -47,6 +47,13 @@ public:
//! Returns the history from the session.
Standard_EXPORT static Handle(BRepTools_History) History();
//! Enables/Disables the history saving
Standard_EXPORT static void SetToFillHistory(const Standard_Boolean theFillHist);
//! Returns the flag controlling the history collection
Standard_EXPORT static Standard_Boolean IsHistoryNeeded();
};
#endif

Some files were not shown because too many files have changed in this diff Show More