Merge with OCC_development_01

This commit is contained in:
admin 2005-01-20 06:24:17 +00:00
parent 6101c76143
commit ca429d817a
148 changed files with 14474 additions and 1916 deletions

View File

@ -169,7 +169,11 @@ tree_block.png \
subblock.png \
group_new.png \
group_edit.png \
glue.png
glue.png \
check_blocks_compound.png \
free_faces.png \
propagate.png
BIN_SCRIPT= \
VERSION

200
doc/salome/tui/GEOM/doxyfile_py Executable file
View File

@ -0,0 +1,200 @@
# Doxyfile 1.3-rc1
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "SALOME - GEOM - v.2.1.0"
PROJECT_NUMBER = id#1.1
OUTPUT_DIRECTORY = ../
OUTPUT_LANGUAGE = English
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = NO
ALWAYS_DETAILED_SEC = YES
INLINE_INHERITED_MEMB = YES
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
INTERNAL_DOCS = YES
CASE_SENSE_NAMES = YES
SHORT_NAMES = NO
HIDE_SCOPE_NAMES = NO
VERBATIM_HEADERS = YES
SHOW_INCLUDE_FILES = YES
JAVADOC_AUTOBRIEF = YES
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = NO
DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 5
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ALIASES =
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 25
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = YES
SHOW_USED_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE = log.txt
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = list_py_files_to_process
FILE_PATTERNS =
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH = ../sources/
INPUT_FILTER =
FILTER_SOURCE_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = ../GEOM/geompy_doc
HTML_FILE_EXTENSION = .html
HTML_HEADER = ../sources/myheader_py2.html
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = YES
TOC_EXPAND = YES
DISABLE_INDEX = YES
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_SCHEMA =
XML_DTD =
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = NO
#---------------------------------------------------------------------------
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = YES
CLASS_GRAPH = YES
COLLABORATION_GRAPH = NO
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DOT_IMAGE_FORMAT = jpg
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1200
GENERATE_LEGEND = NO
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
CGI_NAME = search.cgi
CGI_URL =
DOC_URL =
DOC_ABSPATH =
BIN_ABSPATH = /usr/local/bin/
EXT_DOC_PATHS =

View File

@ -0,0 +1,24 @@
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.73 [en] (WinNT; I) [Netscape]">
<title>Main Page</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head>
<body>
&nbsp;
<center><table WIDTH="96%" >
<tr>
<td><a href="http://www.opencascade.com"><img src="../sources/logocorp.gif" BORDER=0 height=46 width=122></a></td>
<td>
<div align=right><a href="http://www.opencascade.org/SALOME/"><img src="../sources/application.gif" BORDER=0 height=46 width=108></a></div>
</td>
</tr>
</table></center>
</body>
</html>

View File

@ -44,5 +44,16 @@ aux1 = insFld(foldersTree, gFld("Namespace List", "", "namespaces.html"))
aux1 = insFld(foldersTree, gFld("IDL/Python mapping", ""))
insDoc(aux1, gLnk("Mapping of GEOMETRY IDL definitions to Python language", "", "page2.html"))
/*!aux1 = insFld(foldersTree, gFld("Python Commands", "", "geompy_doc/main.html"))
insDoc(aux1, gLnk("Package geompy", "", "geompy_doc/namespacegeompy.html"))
insDoc(aux1, gLnk("Namespace Members", "", "geompy_doc/namespacemembers.html"))
insDoc(aux1, gLnk("File geompy.py", "", "geompy_doc/geompy_8py.html"))
*/
aux1 = insFld(foldersTree, gFld("Python Commands", "", "geompy_doc/main.html"))
insDoc(aux1, gLnk("Package List", "", "geompy_doc/namespaces.html"))
insDoc(aux1, gLnk("Namespace Members", "", "geompy_doc/namespacemembers.html"))
insDoc(aux1, gLnk("File List", "", "geompy_doc/files.html"))
/*! insDoc(foldersTree, gLnk("Graphical Class Hierarchy", "", "inherits.html"))
*/

View File

@ -16,13 +16,31 @@ doxygen=@DOXYGEN@
@COMMENCE@
PYTHON_SCRIPTS = \
geompy.py \
GEOM_TestMeasures.py
#PYTHON_SCRIPTS_PY2 = py2/geompy.py py2/GEOM_TestMeasures.py
docs:
cp -fr $(srcdir)/GEOM ./INPUT; \
cp -fr $(srcdir)/GEOM ./INPUT
cd INPUT; \
sed 's|../../../share/salome|$(root_srcdir)|' ./doxyfile > ./doxyfile1; \
mv -f doxyfile1 doxyfile; \
$(doxygen) ./doxyfile; \
cd ..; \
mkdir py1; mkdir py2; \
cd ..
for file in $(PYTHON_SCRIPTS) dummy; do \
if [ $$file != "dummy" ]; then \
cp $(root_srcdir)/src/GEOM_SWIG/$$file INPUT/py1/; \
fi ; \
done
cd INPUT; \
python $(KERNEL_ROOT_DIR)/doc/salome/tui/KERNEL/pythfilter.py ./py1 ./py2; \
sed 's|list_py_files_to_process|$(PYTHON_SCRIPTS)|' ./doxyfile_py > py2/doxyfile_py; \
cd py2; \
$(doxygen) ./doxyfile_py; \
cd ../..; \
cp -fr $(srcdir)/GEOM/sources/static/*.* ./GEOM/
cp -fr $(srcdir)/GEOM/sources/ GEOM/
cp -fr $(srcdir)/GEOM/HTML/ GEOM/

View File

@ -814,6 +814,20 @@ module GEOM
in long theShapeType,
in boolean isSorted);
/*!
* Explode a shape on subshapes of a given type.
* Does the same, as the above method, but returns IDs of sub-shapes,
* not GEOM_Objects. It works faster.
* \param theShape Shape to be exploded.
* \param theShapeType Type of sub-shapes to be retrieved.
* \param isSorted If this parameter is TRUE, sub-shapes will be
* sorted by coordinates of their gravity centers.
* \return List of IDs of sub-shapes of type theShapeType, contained in theShape.
*/
ListOfLong SubShapeAllIDs (in GEOM_Object theShape,
in long theShapeType,
in boolean isSorted);
/*!
* Get a sub shape defined by its unique ID inside \a theMainShape
* \note The sub shape GEOM_Objects can has ONLY ONE function.
@ -842,6 +856,76 @@ module GEOM
* \return The reversed copy of theShape.
*/
GEOM_Object ChangeOrientation (in GEOM_Object theShape);
/*!
* Retrieve all free faces from the given shape.
* Free face is a face, which is not shared between two shells of the shape.
* \param theShape Shape to find free faces in.
* \return List of IDs of all free faces, contained in theShape.
*/
ListOfLong GetFreeFacesIDs (in GEOM_Object theShape);
/*!
* Get all sub-shapes of theShape1 of the given type, shared with theShape2.
* \param theShape1 Shape to find sub-shapes in.
* \param theShape2 Shape to find shared sub-shapes with.
* \param theShapeType Type of sub-shapes to be retrieved.
* \return List of sub-shapes of theShape1, shared with theShape2.
*/
ListOfGO GetSharedShapes (in GEOM_Object theShape1,
in GEOM_Object theShape2,
in long theShapeType);
/*!
* Get sub-shapes of theShape of the given type,
* laying on the specified plane.
* \param theShape Shape to find sub-shapes of.
* \param theShapeType Type of sub-shapes to be retrieved.
* \param thePlane Face, specifying the plane to find shapes on.
* \return Group of all found sub-shapes.
*/
GEOM_Object GetShapesOnPlane (in GEOM_Object theShape,
in long theShapeType,
in GEOM_Object thePlane);
/*!
* Get sub-shape of theShape of the given type,
* laying on the specified cylinder.
* \param theShape Shape to find sub-shapes of.
* \param theShapeType Type of sub-shapes to be retrieved.
* \param theAxis Vector (or line, or linear edge), specifying
* axis of the cylinder to find shapes on.
* \param theRadius Radius of the cylinder to find shapes on.
* \return Group of all found sub-shapes.
*/
GEOM_Object GetShapesOnCylinder (in GEOM_Object theShape,
in long theShapeType,
in GEOM_Object theAxis,
in double theRadius);
/*!
* Get sub-shape of theShape of the given type,
* laying on the specified sphere.
* \param theShape Shape to find sub-shapes of.
* \param theShapeType Type of sub-shapes to be retrieved.
* \param theCenter Point, specifying center of the sphere to find shapes on.
* \param theRadius Radius of the sphere to find shapes on.
* \return Group of all found sub-shapes.
*/
GEOM_Object GetShapesOnSphere (in GEOM_Object theShape,
in long theShapeType,
in GEOM_Object theCenter,
in double theRadius);
/*!
* Get sub-shape(s) of theShapeWhere, which are
* coincident with \a theShapeWhat or could be a part of it.
* \param theShapeWhere Shape to find sub-shapes of.
* \param theShapeWhat Shape, specifying what to find.
* \return Group of all found sub-shapes or a single found sub-shape.
*/
GEOM_Object GetInPlace (in GEOM_Object theShapeWhere,
in GEOM_Object theShapeWhat);
};
/*!
@ -1017,10 +1101,20 @@ module GEOM
*/
enum BCErrorType
{
NOT_BLOCK, /* Each element of the compound should be a Block */
INVALID_CONNECTION, /* A connection between two Blocks should be an entire face or an entire edge */
NOT_CONNECTED, /* The compound should be connexe */
NOT_GLUED /* The glue between two quadrangle faces should be applied */
/* Each element of the compound should be a Block */
NOT_BLOCK,
/* An element is a potential block, but has degenerated and/or seam edge(s). */
EXTRA_EDGE,
/* A connection between two Blocks should be an entire face or an entire edge */
INVALID_CONNECTION,
/* The compound should be connexe */
NOT_CONNECTED,
/* The glue between two quadrangle faces should be applied */
NOT_GLUED
};
/*!
@ -1045,6 +1139,7 @@ module GEOM
* - A connection between two Blocks should be an entire quadrangle face or an entire edge.
* - The compound should be connexe.
* - The glue between two quadrangle faces should be applied.
* \note Single block is also accepted as a valid compound of blocks.
* \param theCompound The compound to check.
* \return TRUE, if the given shape is a compound of blocks.
* \return theErrors Structure, containing discovered errors and incriminated sub-shapes.
@ -1062,6 +1157,23 @@ module GEOM
string PrintBCErrors (in GEOM_Object theCompound,
in BCErrors theErrors);
/*!
* Remove all seam and degenerated edges from \a theShape.
* Unite faces and edges, sharing one surface.
* \param theShape The compound or single solid to remove irregular edges from.
* \return Improved shape.
*/
GEOM_Object RemoveExtraEdges (in GEOM_Object theShape);
/*!
* Check, if the given shape is a blocks compound.
* Fix all detected errors.
* \note Single block can be also fixed by this method.
* \param theCompound The compound to check and improve.
* \return Improved compound.
*/
GEOM_Object CheckAndImprove (in GEOM_Object theCompound);
/*!
* Get all the blocks, contained in the given compound.
* \param theCompound The compound to explode.
@ -1137,6 +1249,20 @@ module GEOM
in long theDirFace1V,
in long theDirFace2V,
in long theNbTimesV);
/*!
* Special operation - propagation
*/
/*!
* Build all possible propagation groups.
* Propagation group is a set of all edges, opposite to one (main)
* edge of this group directly or through other opposite edges.
* Notion of Opposite Edge make sence only on quadrangle face.
* \param theShape Shape to build propagation groups on.
* \return List of GEOM_Objects, each of them is a propagation group.
*/
ListOfGO Propagate (in GEOM_Object theShape);
};
/*!

View File

@ -56,7 +56,7 @@
<endsubmenu />
<submenu label-id="Generation" item-id="403" pos-id="3">
<popup-item item-id="4031" pos-id="" label-id="Extrusion" icon-id="prism.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="4032" pos-id="" label-id="Revolution" icon-id="revol.png"tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="4032" pos-id="" label-id="Revolution" icon-id="revol.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="4033" pos-id="" label-id="Filling" icon-id="filling.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="4034" pos-id="" label-id="Pipe creation" icon-id="pipe.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
@ -99,7 +99,7 @@
<popup-item item-id="5011" pos-id="" label-id="Fuse" icon-id="fuse.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5012" pos-id="" label-id="Common" icon-id="common.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5013" pos-id="" label-id="Cut" icon-id="cut.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5014" pos-id="" label-id="Section" icon-id="section.png"tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5014" pos-id="" label-id="Section" icon-id="section.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
<submenu label-id="Transformation" item-id="502" pos-id="2">
@ -126,6 +126,7 @@
<submenu label-id="Blocks" item-id="510" pos-id="">
<popup-item item-id="9998" pos-id="" label-id="Multi-transformation" icon-id="multirotation.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="9995" pos-id="" label-id="Explode on Blocks" icon-id="subshape.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="99991" pos-id="" label-id="Propagate" icon-id="propagate.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
@ -144,6 +145,7 @@
<popup-item item-id="602" pos-id="" label-id="Glue faces" icon-id="glue.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="608" pos-id="" label-id="Add point on edge" icon-id="pointonedge.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="609" pos-id="" label-id="Check free boundaries" icon-id="free_bound.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="610" pos-id="" label-id="Check free faces" icon-id="free_faces.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item>
@ -165,6 +167,7 @@
<separator pos-id=""/>
<popup-item item-id="706" pos-id="" label-id="Whatis" icon-id="whatis.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="707" pos-id="" label-id="Check" icon-id="check.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="7072" pos-id="" label-id="Check Compound of Blocks" icon-id="check_blocks_compound.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item>
<!-- ********************************* Tools (menubar) ************************************ -->
@ -244,7 +247,7 @@
</toolbar>
<toolbar label-id="Transformation">
<toolbutton-item item-id="5021" label-id="Translation" icon-id="translationVector.png" tooltip-id="Translate a shape"accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5021" label-id="Translation" icon-id="translationVector.png" tooltip-id="Translate a shape" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5022" label-id="Rotation" icon-id="rotate.png" tooltip-id="Rotate a shape" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5023" label-id="Location" icon-id="position2.png" tooltip-id="Modify The Location" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5024" label-id="Mirror image" icon-id="mirrorPlane.png" tooltip-id="Mirror a shape" accel-id="" toggle-id="" execute-action=""/>

View File

@ -62,7 +62,7 @@
<endsubmenu />
<submenu label-id="Generation" item-id="403" pos-id="3">
<popup-item item-id="4031" pos-id="" label-id="Extrusion" icon-id="prism.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="4032" pos-id="" label-id="Revolution" icon-id="revol.png"tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="4032" pos-id="" label-id="Revolution" icon-id="revol.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="4033" pos-id="" label-id="Filling" icon-id="filling.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="4034" pos-id="" label-id="Pipe" icon-id="pipe.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
@ -90,7 +90,7 @@
<popup-item item-id="5011" pos-id="" label-id="Union" icon-id="fuse.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5012" pos-id="" label-id="Commun" icon-id="common.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5013" pos-id="" label-id="Couper" icon-id="cut.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5014" pos-id="" label-id="Section" icon-id="section.png"tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5014" pos-id="" label-id="Section" icon-id="section.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
<submenu label-id="Transformation" item-id="502" pos-id="2">
@ -110,6 +110,13 @@
<separator pos-id=""/>
<popup-item item-id="505" pos-id="" label-id="Congé" icon-id="fillet.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="506" pos-id="" label-id="Chanfrein" icon-id="chamfer.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<submenu label-id="Blocks" item-id="510" pos-id="">
<popup-item item-id="9998" pos-id="" label-id="Multi-transformation" icon-id="multirotation.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="9995" pos-id="" label-id="Explode on Blocks" icon-id="subshape.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="99991" pos-id="" label-id="Propagate" icon-id="propagate.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
</menu-item>
@ -119,6 +126,7 @@
<popup-item item-id="602" pos-id="" label-id="Orientation" icon-id="orientation.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="603" pos-id="" label-id="Suppression de faces" icon-id="supressface.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="604" pos-id="" label-id="Suppression de trou" icon-id="supresshole.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="610" pos-id="" label-id="Check free faces" icon-id="free_faces.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item>
@ -139,6 +147,7 @@
<separator pos-id=""/>
<popup-item item-id="706" pos-id="" label-id="Whatis" icon-id="whatis.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="707" pos-id="" label-id="Check" icon-id="check.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="7072" pos-id="" label-id="Check Compound of Blocks" icon-id="check_blocks_compound.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item>
<!-- ********************************* Tools (menubar) ************************************ -->
@ -212,7 +221,7 @@
</toolbar>
<toolbar label-id="Transformation">
<toolbutton-item item-id="5021" label-id="Translation" icon-id="translationVector.png" tooltip-id="Translation d'une shape"accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5021" label-id="Translation" icon-id="translationVector.png" tooltip-id="Translation d'une shape" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5022" label-id="Rotation" icon-id="rotate.png" tooltip-id="Rotation d'une shape" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5023" label-id="Location" icon-id="position2.png" tooltip-id="Mise en position" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5024" label-id="Symétrie" icon-id="mirrorPlane.png" tooltip-id="Symétrie" accel-id="" toggle-id="" execute-action=""/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

BIN
resources/free_faces.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

BIN
resources/propagate.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

View File

@ -32,6 +32,7 @@
#include "BlocksGUI_TrsfDlg.h"
//#include "BlocksGUI_CheckMultiBlockDlg.h"
#include "BlocksGUI_ExplodeDlg.h"
#include "BlocksGUI_PropagateDlg.h"
#include "SALOMEGUI_QtCatchCorbaException.hxx"
@ -107,6 +108,9 @@ bool BlocksGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent )
case 9995:
aDlg = new BlocksGUI_ExplodeDlg (parent, Sel);
break;
case 99991:
aDlg = new BlocksGUI_PropagateDlg (parent, "", Sel);
break;
default:
parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));

View File

@ -0,0 +1,312 @@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : BlocksGUI_PropagateDlg.cxx
// Author : VKN
// Module : GEOM
// $Header$
using namespace std;
#include "BlocksGUI_PropagateDlg.h"
#include "QAD_Desktop.h"
#include "GEOMImpl_Types.hxx"
//=================================================================================
// class : BlocksGUI_PropagateDlg()
// purpose : Constructs a BlocksGUI_PropagateDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
BlocksGUI_PropagateDlg::BlocksGUI_PropagateDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl)
:GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_PROPAGATE")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
setCaption(tr("GEOM_PROPAGATE_TITLE"));
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_PROPAGATE_TITLE"));
RadioButton1->setPixmap(image0);
RadioButton2->close(TRUE);
RadioButton3->close(TRUE);
QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_SELECTED_SHAPE" ), this );
QGroupBox* aSelGrp = new QGroupBox(3, Qt::Horizontal, aMainGrp);
aSelGrp->setFrameStyle(QFrame::NoFrame);
aSelGrp->setInsideMargin(0);
new QLabel(tr("GEOM_OBJECT"), aSelGrp);
mySelBtn = new QPushButton(aSelGrp);
mySelBtn->setPixmap(image1);
mySelName = new QLineEdit(aSelGrp);
mySelName->setReadOnly(true);
Layout1->addWidget(aMainGrp, 1, 0);
/***************************************************************/
Init();
}
//=================================================================================
// function : ~BlocksGUI_PropagateDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
BlocksGUI_PropagateDlg::~BlocksGUI_PropagateDlg()
{
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void BlocksGUI_PropagateDlg::Init()
{
/* init variables */
myObject = GEOM::GEOM_Object::_nil();
ResultName->setText( "" );
myGeomGUI->SetState( 0 );
/* signals and slots connections */
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(mySelBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(mySelName, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
activateSelection();
}
//=================================================================================
// function : ClickOnOk()
// purpose : Same than click on apply but close this dialog.
//=================================================================================
void BlocksGUI_PropagateDlg::ClickOnOk()
{
if ( ClickOnApply() )
ClickOnCancel();
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
bool BlocksGUI_PropagateDlg::ClickOnApply()
{
if ( !onAccept() )
return false;
initName();
mySelName->setText("");
myObject = GEOM::GEOM_Object::_nil();
activateSelection();
return true;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void BlocksGUI_PropagateDlg::ClickOnCancel()
{
GEOMBase_Skeleton::ClickOnCancel();
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection
//=================================================================================
void BlocksGUI_PropagateDlg::SelectionIntoArgument()
{
mySelName->setText("");
myObject = GEOM::GEOM_Object::_nil();
if ( mySelection->IObjectCount() == 1 ) {
Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
Standard_Boolean aRes;
myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
if ( aRes )
mySelName->setText( GEOMBase::GetName( myObject ) );
}
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void BlocksGUI_PropagateDlg::SetEditCurrentArgument()
{
const QObject* send = sender();
if ( send == mySelBtn ) {
mySelName->setFocus();
}
activateSelection();
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void BlocksGUI_PropagateDlg::LineEditReturnPressed()
{
const QObject* send = sender();
if( send == mySelName ) {
GEOMBase_Skeleton::LineEditReturnPressed();
}
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void BlocksGUI_PropagateDlg::DeactivateActiveDialog()
{
myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::DeactivateActiveDialog();
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void BlocksGUI_PropagateDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
mySelName->setText("");
myObject = GEOM::GEOM_Object::_nil();
myGeomGUI->SetState( 0 );
activateSelection();
}
//=================================================================================
// function : enterEvent()
// purpose : Mouse enter onto the dialog to activate it
//=================================================================================
void BlocksGUI_PropagateDlg::enterEvent(QEvent* e)
{
if ( !GroupConstructors->isEnabled() )
ActivateThisDialog();
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void BlocksGUI_PropagateDlg::closeEvent(QCloseEvent* e)
{
myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e );
}
//=================================================================================
// function : createOperation
// purpose :
//=================================================================================
GEOM::GEOM_IOperations_ptr BlocksGUI_PropagateDlg::createOperation()
{
return getGeomEngine()->GetIBlocksOperations( getStudyId() );
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
bool BlocksGUI_PropagateDlg::isValid( QString& msg )
{
return !myObject->_is_nil() ;
}
//=================================================================================
// function : execute
// purpose :
//=================================================================================
bool BlocksGUI_PropagateDlg::execute( ObjectList& objects )
{
GEOM::ListOfGO_var aList = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->Propagate( myObject );
ResultName->setText( "" );
if ( !aList->length() )
return false;
for ( int i = 0, n = aList->length(); i < n; i++ )
{
objects.push_back(aList[i]._retn());
}
return objects.size() ? true : false;
}
//=================================================================================
// function : activateSelection
// purpose : Activate selection
//=================================================================================
void BlocksGUI_PropagateDlg::activateSelection()
{
TColStd_MapOfInteger aMap;
aMap.Add( GEOM_SOLID );
aMap.Add( GEOM_COMPOUND );
globalSelection( aMap );
if (myObject->_is_nil()) {
SelectionIntoArgument();
}
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
}
//================================================================
// Function : getFather
// Purpose : Get father object for object to be added in study
// ( called with addInStudy method )
//================================================================
GEOM::GEOM_Object_ptr BlocksGUI_PropagateDlg::getFather (GEOM::GEOM_Object_ptr)
{
return myObject;
}

View File

@ -0,0 +1,80 @@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : BlocksGUI_PropagateDlg.h
// Author : VKN
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_BlocksGUI_PropagateDlg_H
#define DIALOGBOX_BlocksGUI_PropagateDlg_H
#include "GEOMBase_Skeleton.h"
//=================================================================================
// class : BlocksGUI_PropagateDlg
// purpose :
//=================================================================================
class BlocksGUI_PropagateDlg : public GEOMBase_Skeleton
{
Q_OBJECT
public:
BlocksGUI_PropagateDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~BlocksGUI_PropagateDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
virtual GEOM::GEOM_Object_ptr getFather(GEOM::GEOM_Object_ptr theObj);
private slots:
void ClickOnOk();
bool ClickOnApply();
void ClickOnCancel();
void ActivateThisDialog();
void DeactivateActiveDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
private :
void Init();
void enterEvent(QEvent* e);
void closeEvent(QCloseEvent* e);
void activateSelection();
private :
GEOM::GEOM_Object_var myObject;
QPushButton* mySelBtn;
QLineEdit* mySelName;
};
#endif // DIALOGBOX_BlocksGUI_PropagateDlg_H

View File

@ -44,12 +44,14 @@ LIB_SRC = \
BlocksGUI_QuadFaceDlg.cxx \
BlocksGUI_BlockDlg.cxx \
BlocksGUI_ExplodeDlg.cxx \
BlocksGUI_PropagateDlg.cxx \
BlocksGUI_TrsfDlg.cxx
LIB_MOC = \
BlocksGUI_QuadFaceDlg.h \
BlocksGUI_BlockDlg.h \
BlocksGUI_ExplodeDlg.h \
BlocksGUI_PropagateDlg.h \
BlocksGUI_TrsfDlg.h
LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl

50
src/GEOMAlgo/BlockFix.cdl Normal file
View File

@ -0,0 +1,50 @@
-- File: BlockFix.cdl
-- Created: Tue Dec 7 11:59:05 2004
-- Author: Pavel Durandin
-- <det@doomox>
---Copyright: Open CASCADE SA 2004
package BlockFix
uses
TColStd,
gp,
Geom,
Geom2d,
GeomAbs,
TopLoc,
TopoDS,
BRepTools,
TopTools,
ShapeBuild
is
class SphereSpaceModifier;
class UnionFaces;
class UnionEdges;
class BlockFixAPI;
---Purpose: API class to perform the fixing of the
-- block
class PeriodicSurfaceModifier;
class CheckTool;
RotateSphereSpace (S: Shape from TopoDS; Tol: Real)
returns Shape from TopoDS;
FixRanges (S: Shape from TopoDS; Tol: Real)
returns Shape from TopoDS;
---Purpose: checking and fixing cases where parametric
-- boundaries of face based on periodic surface are not
-- contained in the range of this surface.
end BlockFix;

196
src/GEOMAlgo/BlockFix.cxx Normal file
View File

@ -0,0 +1,196 @@
// File: BlockFix.cxx
// Created: Tue Dec 7 11:59:05 2004
// Author: Pavel DURANDIN
// Copyright: Open CASCADE SA 2004
#include <BlockFix.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <ShapeCustom.hxx>
#include <BRepTools.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <TopoDS_Face.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopLoc_Location.hxx>
#include <Geom_Surface.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_ConicalSurface.hxx>
#include <ShapeFix_Wire.hxx>
#include <TopoDS_Wire.hxx>
#include <BRepTools_Modifier.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_ToroidalSurface.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS_Edge.hxx>
#include <Geom2d_Curve.hxx>
#include <BRep_Builder.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeFix_Edge.hxx>
#include <ShapeFix.hxx>
#include <ShapeFix_Face.hxx>
#include <ShapeAnalysis.hxx>
#include <TColgp_SequenceOfPnt2d.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <TopoDS_Vertex.hxx>
#include <ShapeBuild_Edge.hxx>
#include <BlockFix_SphereSpaceModifier.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <BlockFix_PeriodicSurfaceModifier.hxx>
#include <TopoDS_Solid.hxx>
//=======================================================================
//function : FixResult
//purpose : auxilary
//=======================================================================
static void FixResult(const TopoDS_Shape& result,
Handle(ShapeBuild_ReShape)& Context,
const Standard_Real Tol)
{
for (TopExp_Explorer ex_f(result,TopAbs_FACE); ex_f.More(); ex_f.Next()) {
TopoDS_Shape aShape = Context->Apply(ex_f.Current().Oriented(TopAbs_FORWARD));
// face coud not be dropped or splitted on this step
TopoDS_Face aFace = TopoDS::Face(aShape);
TopLoc_Location L;
Handle(Geom_Surface) Surf = BRep_Tool::Surface(aFace,L);
if (Surf->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) ||
Surf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
Standard_Integer nbWires = 0;
for (TopExp_Explorer ex_w(aFace,TopAbs_WIRE); ex_w.More(); ex_w.Next()) {
nbWires++;
Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(TopoDS::Wire(ex_w.Current()),
aFace,
Precision::Confusion());
sfw->FixReorder();
if(sfw->StatusReorder ( ShapeExtend_FAIL ))
continue;
sfw->SetPrecision(2.*Tol);
sfw->FixShifted();
Standard_Boolean isDone = sfw->LastFixStatus ( ShapeExtend_DONE );
isDone |= sfw->FixDegenerated();
// remove degenerated edges from not degenerated points
ShapeAnalysis_Edge sae;
Handle(ShapeExtend_WireData) sewd = sfw->WireData();
Standard_Integer i;
for( i = 1; i<=sewd->NbEdges();i++) {
TopoDS_Edge E = sewd->Edge(i);
if(BRep_Tool::Degenerated(E)&&!sae.HasPCurve(E,aFace)) {
sewd->Remove(i);
isDone = Standard_True;
i--;
}
}
isDone |= sfw->FixLacking();
// remove neighbour seam edges
if(isDone) {
for( i = 1; i<sewd->NbEdges();i++) {
if(sewd->IsSeam(i) && sewd->IsSeam(i+1)) {
isDone = Standard_True;
sewd->Remove(i);
sewd->Remove(i);
i--;
}
}
if(sewd->IsSeam(1) && sewd->IsSeam(sewd->NbEdges())) {
sewd->Remove(1);
sewd->Remove(sewd->NbEdges());
}
}
if(isDone) {
TopoDS_Wire ResWire = sfw->Wire();
Context->Replace(ex_w.Current(), ResWire);
};
}
// Implement fix orientation in case of several wires
if(nbWires > 1) {
TopoDS_Face aFixedFace = TopoDS::Face(Context->Apply(aFace));
Handle(ShapeFix_Face) sff = new ShapeFix_Face(aFixedFace);
if(sff->FixOrientation())
Context->Replace(aFixedFace,sff->Face());
}
}
}
}
//=======================================================================
//function : ConvertToAnalytical
//purpose :
//=======================================================================
TopoDS_Shape BlockFix::RotateSphereSpace (const TopoDS_Shape& S,
const Standard_Real Tol)
{
// Create a modification description
Handle(BlockFix_SphereSpaceModifier) SR = new BlockFix_SphereSpaceModifier;
SR->SetTolerance(Tol);
TopTools_DataMapOfShapeShape context;
BRepTools_Modifier MD;
TopoDS_Shape result = ShapeCustom::ApplyModifier ( S, SR, context,MD );
Handle(ShapeBuild_ReShape) RS = new ShapeBuild_ReShape;
FixResult(result,RS,Tol);
result = RS->Apply(result);
ShapeFix_Edge sfe;
for(TopExp_Explorer exp(result,TopAbs_EDGE); exp.More(); exp.Next()) {
TopoDS_Edge E = TopoDS::Edge(exp.Current());
sfe.FixVertexTolerance (E);
}
ShapeFix::SameParameter(result,Standard_False);
return result;
}
//=======================================================================
//function : FixRanges
//purpose :
//=======================================================================
TopoDS_Shape BlockFix::FixRanges (const TopoDS_Shape& S,
const Standard_Real Tol)
{
// Create a modification description
Handle(BlockFix_PeriodicSurfaceModifier) SR = new BlockFix_PeriodicSurfaceModifier;
SR->SetTolerance(Tol);
TopTools_DataMapOfShapeShape context;
BRepTools_Modifier MD;
TopoDS_Shape result = ShapeCustom::ApplyModifier ( S, SR, context,MD );
Handle(ShapeBuild_ReShape) RS = new ShapeBuild_ReShape;
FixResult(result,RS,Tol);
result = RS->Apply(result);
ShapeFix_Edge sfe;
for(TopExp_Explorer exp(result,TopAbs_EDGE); exp.More(); exp.Next()) {
TopoDS_Edge E = TopoDS::Edge(exp.Current());
sfe.FixVertexTolerance (E);
}
ShapeFix::SameParameter(result,Standard_False);
return result;
}

105
src/GEOMAlgo/BlockFix.hxx Normal file
View File

@ -0,0 +1,105 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _BlockFix_HeaderFile
#define _BlockFix_HeaderFile
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
class TopoDS_Shape;
class BlockFix_SphereSpaceModifier;
class BlockFix_UnionFaces;
class BlockFix_UnionEdges;
class BlockFix_BlockFixAPI;
class BlockFix_PeriodicSurfaceModifier;
class BlockFix_CheckTool;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class BlockFix {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT static TopoDS_Shape RotateSphereSpace(const TopoDS_Shape& S,const Standard_Real Tol) ;
Standard_EXPORT static TopoDS_Shape FixRanges(const TopoDS_Shape& S,const Standard_Real Tol) ;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
friend class BlockFix_SphereSpaceModifier;
friend class BlockFix_UnionFaces;
friend class BlockFix_UnionEdges;
friend class BlockFix_BlockFixAPI;
friend class BlockFix_PeriodicSurfaceModifier;
friend class BlockFix_CheckTool;
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

26
src/GEOMAlgo/BlockFix.ixx Normal file
View File

@ -0,0 +1,26 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <BlockFix.jxx>

View File

@ -0,0 +1,6 @@
#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
#ifndef _BlockFix_HeaderFile
#include <BlockFix.hxx>
#endif

View File

@ -0,0 +1,48 @@
-- File: BlockFix_BlockFixAPI.cdl
-- Created: Tue Dec 7 17:56:09 2004
-- Author: Pavel Durandin
-- <det@doomox>
---Copyright: Open CASCADE SA 2004
class BlockFixAPI from BlockFix inherits TShared from MMgt
---Purpose:
uses
Shape from TopoDS,
ReShape from ShapeBuild
is
Create returns BlockFixAPI from BlockFix;
---Purpose: Empty constructor
SetShape(me: mutable; Shape: Shape from TopoDS);
---Purpose: Sets the shape to be operated on
---C++: inline
Perform(me: mutable);
---Purpose:
Shape(me) returns Shape from TopoDS;
---Purpose: Returns resulting shape.
---C++: inline
Context(me:mutable) returns ReShape from ShapeBuild;
---Purpose: Returns modifiable context for storing the
-- mofifications
---C++: inline
---C++: return &
Tolerance (me:mutable) returns Real;
---Purpose: Returns modifiable tolerance of recognition
---C++: inline
---C++: return &
fields
myContext : ReShape from ShapeBuild;
myShape : Shape from TopoDS;
myTolerance : Real from Standard;
end BlockFixAPI from BlockFix;

View File

@ -0,0 +1,48 @@
// File: BlockFix_BlockFixAPI.cxx
// Created: Tue Dec 7 11:59:05 2004
// Author: Pavel DURANDIN
// Copyright: Open CASCADE SA 2004
#include <BlockFix_BlockFixAPI.ixx>
#include <BlockFix.hxx>
#include <BlockFix_UnionFaces.hxx>
#include <BlockFix_UnionEdges.hxx>
#include <Precision.hxx>
//=======================================================================
//function : ShapeConvert_CanonicAPI
//purpose :
//=======================================================================
BlockFix_BlockFixAPI::BlockFix_BlockFixAPI()
{
myTolerance = Precision::Confusion();
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BlockFix_BlockFixAPI::Perform()
{
// processing spheres with degenerativities
TopoDS_Shape aShape = Shape();
myShape = BlockFix::RotateSphereSpace(aShape,myTolerance);
// faces unification
BlockFix_UnionFaces aFaceUnifier;
aFaceUnifier.GetTolerance() = myTolerance;
TopoDS_Shape aResult;
aResult = aFaceUnifier.Perform(myShape);
BlockFix_UnionEdges anEdgeUnifier;
myShape = anEdgeUnifier.Perform(aResult,myTolerance);
TopoDS_Shape aRes = BlockFix::FixRanges(myShape,myTolerance);
myShape = aRes;
}

View File

@ -0,0 +1,118 @@
// File generated by CPPExt (Transient)
//
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _BlockFix_BlockFixAPI_HeaderFile
#define _BlockFix_BlockFixAPI_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Handle_BlockFix_BlockFixAPI_HeaderFile
#include <Handle_BlockFix_BlockFixAPI.hxx>
#endif
#ifndef _Handle_ShapeBuild_ReShape_HeaderFile
#include <Handle_ShapeBuild_ReShape.hxx>
#endif
#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _MMgt_TShared_HeaderFile
#include <MMgt_TShared.hxx>
#endif
class ShapeBuild_ReShape;
class TopoDS_Shape;
class BlockFix_BlockFixAPI : public MMgt_TShared {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT BlockFix_BlockFixAPI();
void SetShape(const TopoDS_Shape& Shape) ;
Standard_EXPORT void Perform() ;
TopoDS_Shape Shape() const;
Handle_ShapeBuild_ReShape& Context() ;
Standard_Real& Tolerance() ;
Standard_EXPORT ~BlockFix_BlockFixAPI();
// Type management
//
Standard_EXPORT friend Handle_Standard_Type& BlockFix_BlockFixAPI_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
Handle_ShapeBuild_ReShape myContext;
TopoDS_Shape myShape;
Standard_Real myTolerance;
};
#include <BlockFix_BlockFixAPI.lxx>
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,76 @@
// File generated by CPPExt (Transient)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <BlockFix_BlockFixAPI.jxx>
#ifndef _Standard_TypeMismatch_HeaderFile
#include <Standard_TypeMismatch.hxx>
#endif
BlockFix_BlockFixAPI::~BlockFix_BlockFixAPI() {}
Standard_EXPORT Handle_Standard_Type& BlockFix_BlockFixAPI_Type_()
{
static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared);
if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared);
static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient);
if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient);
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL};
static Handle_Standard_Type _aType = new Standard_Type("BlockFix_BlockFixAPI",
sizeof(BlockFix_BlockFixAPI),
1,
(Standard_Address)_Ancestors,
(Standard_Address)NULL);
return _aType;
}
// DownCast method
// allow safe downcasting
//
const Handle(BlockFix_BlockFixAPI) Handle(BlockFix_BlockFixAPI)::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(BlockFix_BlockFixAPI) _anOtherObject;
if (!AnObject.IsNull()) {
if (AnObject->IsKind(STANDARD_TYPE(BlockFix_BlockFixAPI))) {
_anOtherObject = Handle(BlockFix_BlockFixAPI)((Handle(BlockFix_BlockFixAPI)&)AnObject);
}
}
return _anOtherObject ;
}
const Handle(Standard_Type)& BlockFix_BlockFixAPI::DynamicType() const
{
return STANDARD_TYPE(BlockFix_BlockFixAPI) ;
}
Standard_Boolean BlockFix_BlockFixAPI::IsKind(const Handle(Standard_Type)& AType) const
{
return (STANDARD_TYPE(BlockFix_BlockFixAPI) == AType || MMgt_TShared::IsKind(AType));
}
Handle_BlockFix_BlockFixAPI::~Handle_BlockFix_BlockFixAPI() {}

View File

@ -0,0 +1,9 @@
#ifndef _ShapeBuild_ReShape_HeaderFile
#include <ShapeBuild_ReShape.hxx>
#endif
#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
#ifndef _BlockFix_BlockFixAPI_HeaderFile
#include <BlockFix_BlockFixAPI.hxx>
#endif

View File

@ -0,0 +1,42 @@
#include <BlockFix_BlockFixAPI.hxx>
//=======================================================================
//function : Shape
//purpose :
//=======================================================================
inline void BlockFix_BlockFixAPI::SetShape(const TopoDS_Shape& Shape)
{
myShape = Shape;
}
//=======================================================================
//function : Shape
//purpose :
//=======================================================================
inline TopoDS_Shape BlockFix_BlockFixAPI::Shape() const
{
return myShape;
}
//=======================================================================
//function : Context
//purpose :
//=======================================================================
inline Handle(ShapeBuild_ReShape)& BlockFix_BlockFixAPI::Context()
{
return myContext;
}
//=======================================================================
//function : Tolerance
//purpose :
//=======================================================================
inline Standard_Real& BlockFix_BlockFixAPI::Tolerance()
{
return myTolerance;
}

View File

@ -0,0 +1,46 @@
-- File: BlockFix_CheckTool.cdl
-- Created: Fri Dec 17 10:36:58 2004
-- Author: Sergey KUUL
-- <skl@strelox.nnov.matra-dtv.fr>
---Copyright: Open CASCADE SA 2004
class CheckTool from BlockFix
---Purpose:
uses
Shape from TopoDS,
SequenceOfShape from TopTools
is
Create returns CheckTool from BlockFix;
---Purpose: Empty constructor
SetShape(me: in out; aShape: Shape from TopoDS);
Perform(me: in out);
---Purpose:
NbPossibleBlocks(me) returns Integer;
PossibleBlock(me; num: Integer) returns Shape from TopoDS;
DumpCheckResult(me; S : in out OStream);
---Purpose: Dumps results of checking
fields
myShape : Shape from TopoDS;
myHasCheck : Boolean;
myNbSolids : Integer;
myNbBlocks : Integer;
myPossibleBlocks : SequenceOfShape from TopTools;
myNbUF : Integer;
myNbUE : Integer;
myNbUFUE : Integer;
myBadRanges : Integer;
end CheckTool;

View File

@ -0,0 +1,224 @@
// File: BlockFix_CheckTool.cxx
// Created: 17.12.04 11:15:25
// Author: Sergey KUUL
// Copyright: Open CASCADE SA 2004
#include <BlockFix_CheckTool.ixx>
#include <BRep_Tool.hxx>
#include <BlockFix_UnionEdges.hxx>
#include <BlockFix_UnionFaces.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Solid.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
//=======================================================================
//function : BlockFix_CheckTool()
//purpose : Constructor
//=======================================================================
BlockFix_CheckTool::BlockFix_CheckTool( )
{
myHasCheck = Standard_False;
myPossibleBlocks.Clear();
}
//=======================================================================
//function : SetShape
//purpose :
//=======================================================================
void BlockFix_CheckTool::SetShape(const TopoDS_Shape& aShape)
{
myHasCheck = Standard_False;
myShape = aShape;
myPossibleBlocks.Clear();
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BlockFix_CheckTool::Perform()
{
myNbSolids=0;
myNbBlocks=0;
myNbUF=0;
myNbUE=0;
myNbUFUE=0;
TopExp_Explorer exps;
for(exps.Init(myShape, TopAbs_SOLID); exps.More(); exps.Next()) {
TopoDS_Solid aSolid = TopoDS::Solid(exps.Current());
myNbSolids++;
Standard_Boolean IsBlock=Standard_True;
Standard_Boolean MayBeUF=Standard_False;
Standard_Boolean MayBeUE=Standard_False;
Standard_Integer nf=0;
TopExp_Explorer expf;
for(expf.Init(aSolid, TopAbs_FACE); expf.More(); expf.Next()) nf++;
if(nf<6) {
IsBlock=Standard_False;
}
else if(nf>6) {
IsBlock=Standard_False;
// check faces unification
TopTools_SequenceOfShape faces;
for( expf.Init(aSolid, TopAbs_FACE); expf.More(); expf.Next()) {
TopoDS_Face aFace = TopoDS::Face(expf.Current());
faces.Append(aFace);
}
Standard_Boolean HasFacesForUnification = Standard_False;
for(Standard_Integer i=1; i<faces.Length() && !HasFacesForUnification; i++) {
TopoDS_Face F1 = TopoDS::Face(faces.Value(i));
TopTools_MapOfShape Edges;
for(TopExp_Explorer expe(F1,TopAbs_EDGE); expe.More(); expe.Next())
Edges.Add(expe.Current().Oriented(TopAbs_FORWARD));
TopLoc_Location L1;
Handle(Geom_Surface) S1 = BRep_Tool::Surface(F1,L1);
for(Standard_Integer j=i+1; j<=faces.Length() && !HasFacesForUnification; j++) {
TopoDS_Face F2 = TopoDS::Face(faces.Value(j));
TopLoc_Location L2;
Handle(Geom_Surface) S2 = BRep_Tool::Surface(F2,L2);
if( S1==S2 && L1==L2 ) {
// faces have equal based surface
// now check common edge
for(TopExp_Explorer expe2(F2,TopAbs_EDGE); expe2.More(); expe2.Next()) {
if(Edges.Contains(expe2.Current().Oriented(TopAbs_FORWARD))) {
HasFacesForUnification = Standard_True;
break;
}
}
}
}
}
if(HasFacesForUnification) {
MayBeUF=Standard_True;
}
}
Standard_Integer ne=0;
TopExp_Explorer expe;
for(expe.Init(aSolid, TopAbs_EDGE); expe.More(); expe.Next()) ne++;
ne = ne/2;
if(ne<12)
IsBlock=Standard_False;
if(ne>12) {
IsBlock=Standard_False;
// check edges unification
// creating map of edge faces
TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces);
for(expf.Init(aSolid, TopAbs_FACE); expf.More(); expf.Next()) {
TopoDS_Face aFace = TopoDS::Face(expf.Current());
TopTools_IndexedDataMapOfShapeListOfShape aMapFacesEdges;
for(expe.Init(aFace,TopAbs_EDGE); expe.More(); expe.Next()) {
TopoDS_Edge edge = TopoDS::Edge(expe.Current());
if(!aMapEdgeFaces.Contains(edge)) continue;
const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge);
TopTools_ListIteratorOfListOfShape anIter(aList);
for( ; anIter.More(); anIter.Next()) {
TopoDS_Face face = TopoDS::Face(anIter.Value());
if(face.IsSame(aFace)) continue;
if(aMapFacesEdges.Contains(face)) {
aMapFacesEdges.ChangeFromKey(face).Append(edge);
}
else {
TopTools_ListOfShape ListEdges;
ListEdges.Append(edge);
aMapFacesEdges.Add(face,ListEdges);
}
}
}
Standard_Integer i = 1;
for (; i <= aMapFacesEdges.Extent(); i++) {
const TopTools_ListOfShape& ListEdges = aMapFacesEdges.FindFromIndex(i);
if (ListEdges.Extent() > 1) break;
}
if (i <= aMapFacesEdges.Extent()) {
MayBeUE = Standard_True;
break;
}
}
}
if(IsBlock)
myNbBlocks++;
else {
if(MayBeUF) {
myPossibleBlocks.Append(aSolid);
if(MayBeUE)
myNbUFUE++;
else
myNbUF++;
}
else if(MayBeUE) {
myNbUE++;
myPossibleBlocks.Append(aSolid);
}
}
}
myHasCheck = Standard_True;
}
//=======================================================================
//function : NbPossibleBlocks
//purpose :
//=======================================================================
Standard_Integer BlockFix_CheckTool::NbPossibleBlocks() const
{
return myPossibleBlocks.Length();
}
//=======================================================================
//function : PossibleBlock
//purpose :
//=======================================================================
TopoDS_Shape BlockFix_CheckTool::PossibleBlock(const Standard_Integer num) const
{
TopoDS_Shape res;
if( num>0 && num<=myPossibleBlocks.Length() )
res = myPossibleBlocks.Value(num);
return res;
}
//=======================================================================
//function : DumpCheckResult
//purpose :
//=======================================================================
void BlockFix_CheckTool::DumpCheckResult(Standard_OStream& S) const
{
if(!myHasCheck)
S<<"Check not performed!"<<endl;
else {
S<<"dump results of check:"<<endl;
S<<" total number of solids = "<<myNbSolids<<endl;
S<<" including: number of good blocks = "<<myNbBlocks<<endl;
S<<" number of possible blocks = "<<NbPossibleBlocks()<<endl;
Standard_Integer nbtmp = myNbSolids - myNbBlocks - NbPossibleBlocks();
S<<" number of impossible blocks = "<<nbtmp<<endl;
S<<" including: need unionfaces = "<<myNbUF<<endl;
S<<" need unionedges = "<<myNbUE<<endl;
S<<" need both unionfaces and unionedges = "<<myNbUFUE<<endl;
}
}

View File

@ -0,0 +1,118 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _BlockFix_CheckTool_HeaderFile
#define _BlockFix_CheckTool_HeaderFile
#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _TopTools_SequenceOfShape_HeaderFile
#include <TopTools_SequenceOfShape.hxx>
#endif
#ifndef _Standard_OStream_HeaderFile
#include <Standard_OStream.hxx>
#endif
class TopoDS_Shape;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class BlockFix_CheckTool {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT BlockFix_CheckTool();
Standard_EXPORT void SetShape(const TopoDS_Shape& aShape) ;
Standard_EXPORT void Perform() ;
Standard_EXPORT Standard_Integer NbPossibleBlocks() const;
Standard_EXPORT TopoDS_Shape PossibleBlock(const Standard_Integer num) const;
Standard_EXPORT void DumpCheckResult(Standard_OStream& S) const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
TopoDS_Shape myShape;
Standard_Boolean myHasCheck;
Standard_Integer myNbSolids;
Standard_Integer myNbBlocks;
TopTools_SequenceOfShape myPossibleBlocks;
Standard_Integer myNbUF;
Standard_Integer myNbUE;
Standard_Integer myNbUFUE;
Standard_Integer myBadRanges;
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,26 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <BlockFix_CheckTool.jxx>

View File

@ -0,0 +1,6 @@
#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
#ifndef _BlockFix_CheckTool_HeaderFile
#include <BlockFix_CheckTool.hxx>
#endif

View File

@ -0,0 +1,115 @@
-- File: BlockFix_PeriodicSurfaceModifier.cdl
-- Created: Wed Dec 15 10:03:50 2004
-- Author: Sergey KUUL
-- <skl@strelox.nnov.matra-dtv.fr>
---Copyright: Open CASCADE SA 2004
class PeriodicSurfaceModifier from BlockFix inherits Modification from BRepTools
---Purpose:
uses
Vertex from TopoDS,
Edge from TopoDS,
Face from TopoDS,
Location from TopLoc,
Shape from GeomAbs,
Pnt from gp,
Curve from Geom,
Curve from Geom2d,
Surface from Geom,
IndexedMapOfTransient from TColStd,
DataMapOfShapeInteger from TopTools
is
Create returns mutable PeriodicSurfaceModifier from BlockFix;
SetTolerance(me: mutable; Toler: Real);
---Purpose: Sets the tolerance for recognition of geometry
NewSurface(me: mutable; F : Face from TopoDS;
S : out Surface from Geom;
L : out Location from TopLoc;
Tol: out Real from Standard;
RevWires : out Boolean from Standard;
RevFace : out Boolean from Standard)
returns Boolean from Standard;
---Purpose: Returns Standard_True if the face <F> has been
-- modified. In this case, <S> is the new geometric
-- support of the face, <L> the new location, <Tol>
-- the new tolerance. Otherwise, returns
-- Standard_False, and <S>, <L>, <Tol> are not
-- significant.
NewCurve(me: mutable; E : Edge from TopoDS;
C : out Curve from Geom;
L : out Location from TopLoc;
Tol: out Real from Standard)
returns Boolean from Standard;
---Purpose: Returns Standard_True if the edge <E> has been
-- modified. In this case, <C> is the new geometric
-- support of the edge, <L> the new location, <Tol>
-- the new tolerance. Otherwise, returns
-- Standard_False, and <C>, <L>, <Tol> are not
-- significant.
NewPoint(me: mutable; V : Vertex from TopoDS;
P : out Pnt from gp;
Tol: out Real from Standard)
returns Boolean from Standard;
---Purpose: Returns Standard_True if the vertex <V> has been
-- modified. In this case, <P> is the new geometric
-- support of the vertex, <Tol> the new tolerance.
-- Otherwise, returns Standard_False, and <P>, <Tol>
-- are not significant.
NewCurve2d(me: mutable; E : Edge from TopoDS;
F : Face from TopoDS;
NewE : Edge from TopoDS;
NewF : Face from TopoDS;
C : out Curve from Geom2d;
Tol : out Real from Standard)
returns Boolean from Standard;
---Purpose: Returns Standard_True if the edge <E> has a new
-- curve on surface on the face <F>.In this case, <C>
-- is the new geometric support of the edge, <L> the
-- new location, <Tol> the new tolerance.
--
-- Otherwise, returns Standard_False, and <C>, <L>,
-- <Tol> are not significant.
--
-- <NewE> is the new edge created from <E>. <NewF>
-- is the new face created from <F>. They may be usefull.
NewParameter(me: mutable; V : Vertex from TopoDS;
E : Edge from TopoDS;
P : out Real from Standard;
Tol: out Real from Standard)
returns Boolean from Standard;
---Purpose: Returns Standard_True if the Vertex <V> has a new
-- parameter on the edge <E>. In this case, <P> is
-- the parameter, <Tol> the new tolerance.
-- Otherwise, returns Standard_False, and <P>, <Tol>
-- are not significant.
Continuity(me: mutable; E : Edge from TopoDS;
F1,F2 : Face from TopoDS;
NewE : Edge from TopoDS;
NewF1,NewF2: Face from TopoDS)
returns Shape from GeomAbs;
---Purpose: Returns the continuity of <NewE> between <NewF1>
-- and <NewF2>.
--
-- <NewE> is the new edge created from <E>. <NewF1>
-- (resp. <NewF2>) is the new face created from <F1>
-- (resp. <F2>).
fields
myTolerance : Real;
myMapOfFaces : DataMapOfShapeInteger from TopTools;
myMapOfSurfaces: IndexedMapOfTransient from TColStd;
end PeriodicSurfaceModifier;

View File

@ -0,0 +1,230 @@
// File: BlockFix_PeriodicSurfaceModifier.cxx
// Created: 15.12.04 10:08:50
// Author: Sergey KUUL
// Copyright: Open CASCADE SA 2004
#include <BlockFix_PeriodicSurfaceModifier.ixx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_SphericalSurface.hxx>
#include <ShapeFix_Edge.hxx>
#include <TopExp.hxx>
//=======================================================================
//function : BlockFix_PeriodicSurfaceModifier()
//purpose : Constructor
//=======================================================================
BlockFix_PeriodicSurfaceModifier::BlockFix_PeriodicSurfaceModifier ( )
{
myMapOfFaces.Clear();
myMapOfSurfaces.Clear();
}
//=======================================================================
//function : SetTolerance
//purpose :
//=======================================================================
void BlockFix_PeriodicSurfaceModifier::SetTolerance(const Standard_Real Tol)
{
myTolerance = Tol;
}
//=======================================================================
//function : ModifySurface
//purpose : auxilary
//=======================================================================
static Standard_Boolean ModifySurface(const TopoDS_Face& aFace,
const Handle(Geom_Surface)& aSurface,
Handle(Geom_Surface)& aNewSurface)
{
Handle(Geom_Surface) S = aSurface;
if(S->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
Handle(Geom_CylindricalSurface) aCyl =
Handle(Geom_CylindricalSurface)::DownCast(S);
Standard_Real Umin, Umax, Vmin, Vmax;
BRepTools::UVBounds(aFace, Umin, Umax, Vmin, Vmax);
if( Umin<-Precision::PConfusion() || Umax>2*PI+Precision::PConfusion() ) {
gp_Ax3 ax3 = aCyl->Position();
gp_Ax1 NDir = ax3.Axis();
gp_Ax3 newax3 = ax3.Rotated(NDir,Umin-Precision::PConfusion());
Handle(Geom_CylindricalSurface) aNewCyl =
new Geom_CylindricalSurface(newax3,aCyl->Radius());
aNewSurface = aNewCyl;
return Standard_True;
}
}
if(S->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
Handle(Geom_SphericalSurface) aSphere = Handle(Geom_SphericalSurface)::DownCast(S);
Standard_Real Umin, Umax, Vmin, Vmax;
BRepTools::UVBounds(aFace, Umin, Umax, Vmin, Vmax);
if( Umin<-Precision::PConfusion() || Umax>2*PI+Precision::PConfusion() ) {
gp_Ax3 ax3 = aSphere->Position();
gp_Ax1 NDir = ax3.Axis();
gp_Ax3 newax3 = ax3.Rotated(NDir,Umin-Precision::PConfusion());
Handle(Geom_SphericalSurface) aNewSphere = new Geom_SphericalSurface(newax3,aSphere->Radius());
aNewSurface = aNewSphere;
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : NewSurface
//purpose :
//=======================================================================
Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewSurface(const TopoDS_Face& F,
Handle(Geom_Surface)& S,
TopLoc_Location& L,Standard_Real& Tol,
Standard_Boolean& RevWires,
Standard_Boolean& RevFace)
{
TopLoc_Location LS;
Handle(Geom_Surface) SIni = BRep_Tool::Surface(F, LS);
if(ModifySurface(F, SIni, S)) {
RevWires = Standard_False;
RevFace = Standard_False;
L = LS;
Tol = BRep_Tool::Tolerance(F);
Standard_Integer anIndex = myMapOfSurfaces.Add(S);
myMapOfFaces.Bind(F,anIndex);
return Standard_True;
}
return Standard_False;
}
//=======================================================================
//function : NewCurve
//purpose :
//=======================================================================
Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewCurve(const TopoDS_Edge& /*E*/,
Handle(Geom_Curve)& /*C*/,
TopLoc_Location& /*L*/,
Standard_Real& /*Tol*/)
{
return Standard_False;
}
//=======================================================================
//function : NewPoint
//purpose :
//=======================================================================
Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewPoint(const TopoDS_Vertex& /*V*/,
gp_Pnt& /*P*/,
Standard_Real& /*Tol*/)
{
return Standard_False;
}
//=======================================================================
//function : NewCurve2d
//purpose :
//=======================================================================
Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewCurve2d(const TopoDS_Edge& E,
const TopoDS_Face& F,
const TopoDS_Edge& /*NewE*/,
const TopoDS_Face& /*NewF*/,
Handle(Geom2d_Curve)& C,
Standard_Real& Tol)
{
//check if undelying surface of the face was modified
if(myMapOfFaces.IsBound(F)) {
Standard_Integer anIndex = myMapOfFaces.Find(F);
Handle(Geom_Surface) aNewSurf = Handle(Geom_Surface)::DownCast(myMapOfSurfaces.FindKey(anIndex));
Standard_Real f,l;
TopLoc_Location LC, LS;
Handle(Geom_Curve) C3d = BRep_Tool::Curve ( E, LC, f, l );
Handle(Geom_Surface) S = BRep_Tool::Surface(F, LS);
//taking into accound the orientation of the seam
C = BRep_Tool::CurveOnSurface(E,F,f,l);
Tol = BRep_Tool::Tolerance(E);
BRep_Builder B;
TopoDS_Edge TempE;
B.MakeEdge(TempE);
B.Add(TempE, TopExp::FirstVertex(E));
B.Add(TempE, TopExp::LastVertex(E));
if(!C3d.IsNull())
B.UpdateEdge(TempE, Handle(Geom_Curve)::DownCast(C3d->Transformed(LC.Transformation())), Precision::Confusion());
B.Range(TempE, f, l);
Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge;
Handle(Geom_Surface) STemp = Handle(Geom_Surface)::DownCast(aNewSurf->Transformed(LS.Transformation()));
TopLoc_Location LTemp;
LTemp.Identity();
Standard_Boolean isClosed = BRep_Tool::IsClosed (E, F);
Standard_Real aWorkTol = 2*myTolerance+Tol;
sfe->FixAddPCurve(TempE, STemp, LTemp, isClosed, Max(Precision::Confusion(), aWorkTol));
sfe->FixSameParameter(TempE);
//keep the orientation of original edge
TempE.Orientation(E.Orientation());
C = BRep_Tool::CurveOnSurface(TempE, STemp, LTemp, f, l);
//surface was modified
return Standard_True;
}
return Standard_False;
}
//=======================================================================
//function : NewParameter
//purpose :
//=======================================================================
Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewParameter(const TopoDS_Vertex& /*V*/,
const TopoDS_Edge& /*E*/,
Standard_Real& /*P*/,
Standard_Real& /*Tol*/)
{
return Standard_False;
}
//=======================================================================
//function : Continuity
//purpose :
//=======================================================================
GeomAbs_Shape BlockFix_PeriodicSurfaceModifier::Continuity(const TopoDS_Edge& E,
const TopoDS_Face& F1,
const TopoDS_Face& F2,
const TopoDS_Edge& /*NewE*/,
const TopoDS_Face& /*NewF1*/,
const TopoDS_Face& /*NewF2*/)
{
return BRep_Tool::Continuity(E,F1,F2);
}

View File

@ -0,0 +1,140 @@
// File generated by CPPExt (Transient)
//
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _BlockFix_PeriodicSurfaceModifier_HeaderFile
#define _BlockFix_PeriodicSurfaceModifier_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Handle_BlockFix_PeriodicSurfaceModifier_HeaderFile
#include <Handle_BlockFix_PeriodicSurfaceModifier.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _TopTools_DataMapOfShapeInteger_HeaderFile
#include <TopTools_DataMapOfShapeInteger.hxx>
#endif
#ifndef _TColStd_IndexedMapOfTransient_HeaderFile
#include <TColStd_IndexedMapOfTransient.hxx>
#endif
#ifndef _BRepTools_Modification_HeaderFile
#include <BRepTools_Modification.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Handle_Geom_Surface_HeaderFile
#include <Handle_Geom_Surface.hxx>
#endif
#ifndef _Handle_Geom_Curve_HeaderFile
#include <Handle_Geom_Curve.hxx>
#endif
#ifndef _Handle_Geom2d_Curve_HeaderFile
#include <Handle_Geom2d_Curve.hxx>
#endif
#ifndef _GeomAbs_Shape_HeaderFile
#include <GeomAbs_Shape.hxx>
#endif
class TopoDS_Face;
class Geom_Surface;
class TopLoc_Location;
class TopoDS_Edge;
class Geom_Curve;
class TopoDS_Vertex;
class gp_Pnt;
class Geom2d_Curve;
class BlockFix_PeriodicSurfaceModifier : public BRepTools_Modification {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT BlockFix_PeriodicSurfaceModifier();
Standard_EXPORT void SetTolerance(const Standard_Real Toler) ;
Standard_EXPORT Standard_Boolean NewSurface(const TopoDS_Face& F,Handle(Geom_Surface)& S,TopLoc_Location& L,Standard_Real& Tol,Standard_Boolean& RevWires,Standard_Boolean& RevFace) ;
Standard_EXPORT Standard_Boolean NewCurve(const TopoDS_Edge& E,Handle(Geom_Curve)& C,TopLoc_Location& L,Standard_Real& Tol) ;
Standard_EXPORT Standard_Boolean NewPoint(const TopoDS_Vertex& V,gp_Pnt& P,Standard_Real& Tol) ;
Standard_EXPORT Standard_Boolean NewCurve2d(const TopoDS_Edge& E,const TopoDS_Face& F,const TopoDS_Edge& NewE,const TopoDS_Face& NewF,Handle(Geom2d_Curve)& C,Standard_Real& Tol) ;
Standard_EXPORT Standard_Boolean NewParameter(const TopoDS_Vertex& V,const TopoDS_Edge& E,Standard_Real& P,Standard_Real& Tol) ;
Standard_EXPORT GeomAbs_Shape Continuity(const TopoDS_Edge& E,const TopoDS_Face& F1,const TopoDS_Face& F2,const TopoDS_Edge& NewE,const TopoDS_Face& NewF1,const TopoDS_Face& NewF2) ;
Standard_EXPORT ~BlockFix_PeriodicSurfaceModifier();
// Type management
//
Standard_EXPORT friend Handle_Standard_Type& BlockFix_PeriodicSurfaceModifier_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
Standard_Real myTolerance;
TopTools_DataMapOfShapeInteger myMapOfFaces;
TColStd_IndexedMapOfTransient myMapOfSurfaces;
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,78 @@
// File generated by CPPExt (Transient)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <BlockFix_PeriodicSurfaceModifier.jxx>
#ifndef _Standard_TypeMismatch_HeaderFile
#include <Standard_TypeMismatch.hxx>
#endif
BlockFix_PeriodicSurfaceModifier::~BlockFix_PeriodicSurfaceModifier() {}
Standard_EXPORT Handle_Standard_Type& BlockFix_PeriodicSurfaceModifier_Type_()
{
static Handle_Standard_Type aType1 = STANDARD_TYPE(BRepTools_Modification);
if ( aType1.IsNull()) aType1 = STANDARD_TYPE(BRepTools_Modification);
static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
static Handle_Standard_Type _aType = new Standard_Type("BlockFix_PeriodicSurfaceModifier",
sizeof(BlockFix_PeriodicSurfaceModifier),
1,
(Standard_Address)_Ancestors,
(Standard_Address)NULL);
return _aType;
}
// DownCast method
// allow safe downcasting
//
const Handle(BlockFix_PeriodicSurfaceModifier) Handle(BlockFix_PeriodicSurfaceModifier)::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(BlockFix_PeriodicSurfaceModifier) _anOtherObject;
if (!AnObject.IsNull()) {
if (AnObject->IsKind(STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier))) {
_anOtherObject = Handle(BlockFix_PeriodicSurfaceModifier)((Handle(BlockFix_PeriodicSurfaceModifier)&)AnObject);
}
}
return _anOtherObject ;
}
const Handle(Standard_Type)& BlockFix_PeriodicSurfaceModifier::DynamicType() const
{
return STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier) ;
}
Standard_Boolean BlockFix_PeriodicSurfaceModifier::IsKind(const Handle(Standard_Type)& AType) const
{
return (STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier) == AType || BRepTools_Modification::IsKind(AType));
}
Handle_BlockFix_PeriodicSurfaceModifier::~Handle_BlockFix_PeriodicSurfaceModifier() {}

View File

@ -0,0 +1,27 @@
#ifndef _TopoDS_Face_HeaderFile
#include <TopoDS_Face.hxx>
#endif
#ifndef _Geom_Surface_HeaderFile
#include <Geom_Surface.hxx>
#endif
#ifndef _TopLoc_Location_HeaderFile
#include <TopLoc_Location.hxx>
#endif
#ifndef _TopoDS_Edge_HeaderFile
#include <TopoDS_Edge.hxx>
#endif
#ifndef _Geom_Curve_HeaderFile
#include <Geom_Curve.hxx>
#endif
#ifndef _TopoDS_Vertex_HeaderFile
#include <TopoDS_Vertex.hxx>
#endif
#ifndef _gp_Pnt_HeaderFile
#include <gp_Pnt.hxx>
#endif
#ifndef _Geom2d_Curve_HeaderFile
#include <Geom2d_Curve.hxx>
#endif
#ifndef _BlockFix_PeriodicSurfaceModifier_HeaderFile
#include <BlockFix_PeriodicSurfaceModifier.hxx>
#endif

View File

@ -0,0 +1,120 @@
-- File: BlockFix_SphereSpaceModifier.cdl
-- Created: Tue Dec 7 12:01:49 2004
-- Author: Pavel Durandin
-- <det@doomox>
---Copyright: Open CASCADE SA 2004
class SphereSpaceModifier from BlockFix inherits Modification from BRepTools
---Purpose: Rotation of the parametric space of the sphere in order
-- to avoid the seam and degenerared edge within it
uses
Vertex from TopoDS,
Edge from TopoDS,
Face from TopoDS,
Location from TopLoc,
Shape from GeomAbs,
Pnt from gp,
Curve from Geom,
Curve from Geom2d,
Surface from Geom,
IndexedMapOfTransient from TColStd,
DataMapOfShapeInteger from TopTools
is
Create returns mutable SphereSpaceModifier from BlockFix;
SetTolerance(me: mutable; Toler: Real);
---Purpose: Sets the tolerance for recognition of geometry
NewSurface(me: mutable; F : Face from TopoDS;
S : out Surface from Geom;
L : out Location from TopLoc;
Tol: out Real from Standard;
RevWires : out Boolean from Standard;
RevFace : out Boolean from Standard)
returns Boolean from Standard;
---Purpose: Returns Standard_True if the face <F> has been
-- modified. In this case, <S> is the new geometric
-- support of the face, <L> the new location, <Tol>
-- the new tolerance. Otherwise, returns
-- Standard_False, and <S>, <L>, <Tol> are not
-- significant.
NewCurve(me: mutable; E : Edge from TopoDS;
C : out Curve from Geom;
L : out Location from TopLoc;
Tol: out Real from Standard)
returns Boolean from Standard;
---Purpose: Returns Standard_True if the edge <E> has been
-- modified. In this case, <C> is the new geometric
-- support of the edge, <L> the new location, <Tol>
-- the new tolerance. Otherwise, returns
-- Standard_False, and <C>, <L>, <Tol> are not
-- significant.
NewPoint(me: mutable; V : Vertex from TopoDS;
P : out Pnt from gp;
Tol: out Real from Standard)
returns Boolean from Standard;
---Purpose: Returns Standard_True if the vertex <V> has been
-- modified. In this case, <P> is the new geometric
-- support of the vertex, <Tol> the new tolerance.
-- Otherwise, returns Standard_False, and <P>, <Tol>
-- are not significant.
NewCurve2d(me: mutable; E : Edge from TopoDS;
F : Face from TopoDS;
NewE : Edge from TopoDS;
NewF : Face from TopoDS;
C : out Curve from Geom2d;
Tol : out Real from Standard)
returns Boolean from Standard;
---Purpose: Returns Standard_True if the edge <E> has a new
-- curve on surface on the face <F>.In this case, <C>
-- is the new geometric support of the edge, <L> the
-- new location, <Tol> the new tolerance.
--
-- Otherwise, returns Standard_False, and <C>, <L>,
-- <Tol> are not significant.
--
-- <NewE> is the new edge created from <E>. <NewF>
-- is the new face created from <F>. They may be usefull.
NewParameter(me: mutable; V : Vertex from TopoDS;
E : Edge from TopoDS;
P : out Real from Standard;
Tol: out Real from Standard)
returns Boolean from Standard;
---Purpose: Returns Standard_True if the Vertex <V> has a new
-- parameter on the edge <E>. In this case, <P> is
-- the parameter, <Tol> the new tolerance.
-- Otherwise, returns Standard_False, and <P>, <Tol>
-- are not significant.
Continuity(me: mutable; E : Edge from TopoDS;
F1,F2 : Face from TopoDS;
NewE : Edge from TopoDS;
NewF1,NewF2: Face from TopoDS)
returns Shape from GeomAbs;
---Purpose: Returns the continuity of <NewE> between <NewF1>
-- and <NewF2>.
--
-- <NewE> is the new edge created from <E>. <NewF1>
-- (resp. <NewF2>) is the new face created from <F1>
-- (resp. <F2>).
ForRotation(me: mutable; F: Face from TopoDS) returns Boolean;
fields
myTolerance : Real;
myMapOfFaces : DataMapOfShapeInteger from TopTools;
myMapOfSpheres: IndexedMapOfTransient from TColStd;
--myMapOfGeom: MapOfShapeTransient from TColStd;
end SphereSpaceModifier;

View File

@ -0,0 +1,224 @@
// File: BlockFix.cxx
// Created: Tue Dec 7 11:59:05 2004
// Author: Pavel DURANDIN
// Copyright: Open CASCADE SA 2004
#include <BlockFix_SphereSpaceModifier.ixx>
#include <TopLoc_Location.hxx>
#include <BRep_Tool.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <ShapeAnalysis.hxx>
#include <gp_Sphere.hxx>
#include <BRep_Builder.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <TopExp.hxx>
#include <ShapeFix_Edge.hxx>
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>
//=======================================================================
//function : BlockFix_SphereSpaceModifier
//purpose :
//=======================================================================
BlockFix_SphereSpaceModifier::BlockFix_SphereSpaceModifier()
{
myMapOfFaces.Clear();
myMapOfSpheres.Clear();
}
//=======================================================================
//function : SetTolerance
//purpose :
//=======================================================================
void BlockFix_SphereSpaceModifier::SetTolerance(const Standard_Real Tol)
{
myTolerance = Tol;
}
//=======================================================================
//function : NewSurface
//purpose :
//=======================================================================
static Standard_Boolean ModifySurface(const TopoDS_Face& aFace,
const Handle(Geom_Surface)& aSurface,
Handle(Geom_Surface)& aNewSurface)
{
Handle(Geom_Surface) S = aSurface;
if(S->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
Handle(Geom_RectangularTrimmedSurface) RTS =
Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
S = RTS->BasisSurface();
}
if(S->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
Standard_Real Umin, Umax, Vmin, Vmax;
ShapeAnalysis::GetFaceUVBounds(aFace,Umin, Umax, Vmin, Vmax);
Standard_Real PI2 = PI/2.;
if(Vmax > PI2 - Precision::PConfusion() || Vmin < -PI2+::Precision::PConfusion()) {
if(Abs(Vmax-Vmin) < PI2) {
Handle(Geom_SphericalSurface) aSphere = Handle(Geom_SphericalSurface)::DownCast(S);
gp_Sphere sp = aSphere->Sphere();
gp_Ax3 ax3 = sp.Position();
gp_Ax3 axnew3(ax3.Axis().Location(), ax3.Direction()^ax3.XDirection(),ax3.XDirection());
sp.SetPosition(axnew3);
Handle(Geom_SphericalSurface) aNewSphere = new Geom_SphericalSurface(sp);
aNewSurface = aNewSphere;
return Standard_True;
}
}
}
return Standard_False;
}
Standard_Boolean BlockFix_SphereSpaceModifier::NewSurface(const TopoDS_Face& F,
Handle(Geom_Surface)& S,
TopLoc_Location& L,Standard_Real& Tol,
Standard_Boolean& RevWires,
Standard_Boolean& RevFace)
{
TopLoc_Location LS;
Handle(Geom_Surface) SIni = BRep_Tool::Surface(F, LS);
//check if pole of the sphere in the parametric space
if(ModifySurface(F, SIni, S)) {
RevWires = Standard_False;
RevFace = Standard_False;
L = LS;
Tol = BRep_Tool::Tolerance(F);
Standard_Integer anIndex = myMapOfSpheres.Add(S);
myMapOfFaces.Bind(F,anIndex);
return Standard_True;
}
return Standard_False;
}
//=======================================================================
//function : NewCurve
//purpose :
//=======================================================================
Standard_Boolean BlockFix_SphereSpaceModifier::NewCurve(const TopoDS_Edge& /*E*/,Handle(Geom_Curve)& /*C*/,
TopLoc_Location& /*L*/,Standard_Real& /*Tol*/)
{
return Standard_False;
}
//=======================================================================
//function : NewPoint
//purpose :
//=======================================================================
Standard_Boolean BlockFix_SphereSpaceModifier::NewPoint(const TopoDS_Vertex& /*V*/,
gp_Pnt& /*P*/,
Standard_Real& /*Tol*/)
{
return Standard_False;
}
//=======================================================================
//function : NewCurve2d
//purpose :
//=======================================================================
Standard_Boolean BlockFix_SphereSpaceModifier::NewCurve2d(const TopoDS_Edge& E,const TopoDS_Face& F,
const TopoDS_Edge& /*NewE*/,const TopoDS_Face& /*NewF*/,
Handle(Geom2d_Curve)& C,Standard_Real& Tol)
{
//check if undelying surface of the face was modified
if(myMapOfFaces.IsBound(F)) {
Standard_Integer anIndex = myMapOfFaces.Find(F);
Handle(Geom_Surface) aNewSphere = Handle(Geom_Surface)::DownCast(myMapOfSpheres.FindKey(anIndex));
Standard_Real f,l;
TopLoc_Location LC, LS;
Handle(Geom_Curve) C3d = BRep_Tool::Curve ( E, LC, f, l );
Handle(Geom_Surface) S = BRep_Tool::Surface(F, LS);
//taking into accound the orientation of the seam
C = BRep_Tool::CurveOnSurface(E,F,f,l);
Tol = BRep_Tool::Tolerance(E);
BRep_Builder B;
TopoDS_Edge TempE;
B.MakeEdge(TempE);
B.Add(TempE, TopExp::FirstVertex(E));
B.Add(TempE, TopExp::LastVertex(E));
if(!C3d.IsNull())
B.UpdateEdge(TempE, Handle(Geom_Curve)::DownCast(C3d->Transformed(LC.Transformation())), Precision::Confusion());
B.Range(TempE, f, l);
Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge;
Handle(Geom_Surface) STemp = Handle(Geom_Surface)::DownCast(aNewSphere->Transformed(LS.Transformation()));
TopLoc_Location LTemp;
LTemp.Identity();
Standard_Boolean isClosed = BRep_Tool::IsClosed (E, F);
Standard_Real aWorkTol = 2*myTolerance+Tol;
sfe->FixAddPCurve(TempE, STemp, LTemp, isClosed, Max(Precision::Confusion(), aWorkTol));
sfe->FixSameParameter(TempE);
//keep the orientation of original edge
TempE.Orientation(E.Orientation());
C = BRep_Tool::CurveOnSurface(TempE, STemp, LTemp, f, l);
// shifting seam of sphere
if(isClosed && !C.IsNull()) {
Standard_Real f2,l2;
Handle(Geom2d_Curve) c22 =
BRep_Tool::CurveOnSurface(TopoDS::Edge(TempE.Reversed()),STemp, LTemp,f2,l2);
Standard_Real dPreci = Precision::PConfusion()*Precision::PConfusion();
if((C->Value(f).SquareDistance(c22->Value(f2)) < dPreci)
||(C->Value(l).SquareDistance(c22->Value(l2)) < dPreci)) {
gp_Vec2d shift(S->UPeriod(),0.);
C->Translate(shift);
}
}
//sphere was modified
return Standard_True;
}
return Standard_False;
}
//=======================================================================
//function : NewParameter
//purpose :
//=======================================================================
Standard_Boolean BlockFix_SphereSpaceModifier::NewParameter(const TopoDS_Vertex& /*V*/,const TopoDS_Edge& /*E*/,
Standard_Real& /*P*/,Standard_Real& /*Tol*/)
{
return Standard_False;
}
//=======================================================================
//function : Continuity
//purpose :
//=======================================================================
GeomAbs_Shape BlockFix_SphereSpaceModifier::Continuity(const TopoDS_Edge& E,const TopoDS_Face& F1,
const TopoDS_Face& F2,const TopoDS_Edge& /*NewE*/,
const TopoDS_Face& /*NewF1*/,const TopoDS_Face& /*NewF2*/)
{
return BRep_Tool::Continuity(E,F1,F2);
}

View File

@ -0,0 +1,141 @@
// File generated by CPPExt (Transient)
//
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _BlockFix_SphereSpaceModifier_HeaderFile
#define _BlockFix_SphereSpaceModifier_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Handle_BlockFix_SphereSpaceModifier_HeaderFile
#include <Handle_BlockFix_SphereSpaceModifier.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _TopTools_DataMapOfShapeInteger_HeaderFile
#include <TopTools_DataMapOfShapeInteger.hxx>
#endif
#ifndef _TColStd_IndexedMapOfTransient_HeaderFile
#include <TColStd_IndexedMapOfTransient.hxx>
#endif
#ifndef _BRepTools_Modification_HeaderFile
#include <BRepTools_Modification.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Handle_Geom_Surface_HeaderFile
#include <Handle_Geom_Surface.hxx>
#endif
#ifndef _Handle_Geom_Curve_HeaderFile
#include <Handle_Geom_Curve.hxx>
#endif
#ifndef _Handle_Geom2d_Curve_HeaderFile
#include <Handle_Geom2d_Curve.hxx>
#endif
#ifndef _GeomAbs_Shape_HeaderFile
#include <GeomAbs_Shape.hxx>
#endif
class TopoDS_Face;
class Geom_Surface;
class TopLoc_Location;
class TopoDS_Edge;
class Geom_Curve;
class TopoDS_Vertex;
class gp_Pnt;
class Geom2d_Curve;
class BlockFix_SphereSpaceModifier : public BRepTools_Modification {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT BlockFix_SphereSpaceModifier();
Standard_EXPORT void SetTolerance(const Standard_Real Toler) ;
Standard_EXPORT Standard_Boolean NewSurface(const TopoDS_Face& F,Handle(Geom_Surface)& S,TopLoc_Location& L,Standard_Real& Tol,Standard_Boolean& RevWires,Standard_Boolean& RevFace) ;
Standard_EXPORT Standard_Boolean NewCurve(const TopoDS_Edge& E,Handle(Geom_Curve)& C,TopLoc_Location& L,Standard_Real& Tol) ;
Standard_EXPORT Standard_Boolean NewPoint(const TopoDS_Vertex& V,gp_Pnt& P,Standard_Real& Tol) ;
Standard_EXPORT Standard_Boolean NewCurve2d(const TopoDS_Edge& E,const TopoDS_Face& F,const TopoDS_Edge& NewE,const TopoDS_Face& NewF,Handle(Geom2d_Curve)& C,Standard_Real& Tol) ;
Standard_EXPORT Standard_Boolean NewParameter(const TopoDS_Vertex& V,const TopoDS_Edge& E,Standard_Real& P,Standard_Real& Tol) ;
Standard_EXPORT GeomAbs_Shape Continuity(const TopoDS_Edge& E,const TopoDS_Face& F1,const TopoDS_Face& F2,const TopoDS_Edge& NewE,const TopoDS_Face& NewF1,const TopoDS_Face& NewF2) ;
Standard_EXPORT Standard_Boolean ForRotation(const TopoDS_Face& F) ;
Standard_EXPORT ~BlockFix_SphereSpaceModifier();
// Type management
//
Standard_EXPORT friend Handle_Standard_Type& BlockFix_SphereSpaceModifier_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
Standard_Real myTolerance;
TopTools_DataMapOfShapeInteger myMapOfFaces;
TColStd_IndexedMapOfTransient myMapOfSpheres;
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,78 @@
// File generated by CPPExt (Transient)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <BlockFix_SphereSpaceModifier.jxx>
#ifndef _Standard_TypeMismatch_HeaderFile
#include <Standard_TypeMismatch.hxx>
#endif
BlockFix_SphereSpaceModifier::~BlockFix_SphereSpaceModifier() {}
Standard_EXPORT Handle_Standard_Type& BlockFix_SphereSpaceModifier_Type_()
{
static Handle_Standard_Type aType1 = STANDARD_TYPE(BRepTools_Modification);
if ( aType1.IsNull()) aType1 = STANDARD_TYPE(BRepTools_Modification);
static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
static Handle_Standard_Type _aType = new Standard_Type("BlockFix_SphereSpaceModifier",
sizeof(BlockFix_SphereSpaceModifier),
1,
(Standard_Address)_Ancestors,
(Standard_Address)NULL);
return _aType;
}
// DownCast method
// allow safe downcasting
//
const Handle(BlockFix_SphereSpaceModifier) Handle(BlockFix_SphereSpaceModifier)::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(BlockFix_SphereSpaceModifier) _anOtherObject;
if (!AnObject.IsNull()) {
if (AnObject->IsKind(STANDARD_TYPE(BlockFix_SphereSpaceModifier))) {
_anOtherObject = Handle(BlockFix_SphereSpaceModifier)((Handle(BlockFix_SphereSpaceModifier)&)AnObject);
}
}
return _anOtherObject ;
}
const Handle(Standard_Type)& BlockFix_SphereSpaceModifier::DynamicType() const
{
return STANDARD_TYPE(BlockFix_SphereSpaceModifier) ;
}
Standard_Boolean BlockFix_SphereSpaceModifier::IsKind(const Handle(Standard_Type)& AType) const
{
return (STANDARD_TYPE(BlockFix_SphereSpaceModifier) == AType || BRepTools_Modification::IsKind(AType));
}
Handle_BlockFix_SphereSpaceModifier::~Handle_BlockFix_SphereSpaceModifier() {}

View File

@ -0,0 +1,27 @@
#ifndef _TopoDS_Face_HeaderFile
#include <TopoDS_Face.hxx>
#endif
#ifndef _Geom_Surface_HeaderFile
#include <Geom_Surface.hxx>
#endif
#ifndef _TopLoc_Location_HeaderFile
#include <TopLoc_Location.hxx>
#endif
#ifndef _TopoDS_Edge_HeaderFile
#include <TopoDS_Edge.hxx>
#endif
#ifndef _Geom_Curve_HeaderFile
#include <Geom_Curve.hxx>
#endif
#ifndef _TopoDS_Vertex_HeaderFile
#include <TopoDS_Vertex.hxx>
#endif
#ifndef _gp_Pnt_HeaderFile
#include <gp_Pnt.hxx>
#endif
#ifndef _Geom2d_Curve_HeaderFile
#include <Geom2d_Curve.hxx>
#endif
#ifndef _BlockFix_SphereSpaceModifier_HeaderFile
#include <BlockFix_SphereSpaceModifier.hxx>
#endif

View File

@ -0,0 +1,28 @@
-- File: BlockFix_UnionEdges.cdl
-- Created: Tue Dec 7 15:24:51 2004
-- Author: Sergey KUUL
-- <skl@novgorox.nnov.matra-dtv.fr>
class UnionEdges from BlockFix
---Purpose:
uses
Shape from TopoDS,
ReShape from ShapeBuild
is
Create returns UnionEdges from BlockFix;
Perform(me: in out; Shape: Shape from TopoDS;
Tol : Real)
returns Shape from TopoDS;
fields
myTolerance : Real;
myContext : ReShape from ShapeBuild;
end UnionEdges;

View File

@ -0,0 +1,325 @@
// File: BlockFix_UnionEdges.cxx
// Created: 07.12.04 15:27:30
// Author: Sergey KUUL
#include <BlockFix_UnionEdges.ixx>
#include <Approx_Curve3d.hxx>
#include <BRepAdaptor_HCompCurve.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <GC_MakeCircle.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Line.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeFix_Edge.hxx>
#include <ShapeFix_Face.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Iterator.hxx>
//=======================================================================
//function : BlockFix_UnionEdges()
//purpose : Constructor
//=======================================================================
BlockFix_UnionEdges::BlockFix_UnionEdges ( )
{
}
//=======================================================================
//function : MergeEdges
//purpose : auxilary
//=======================================================================
static Standard_Boolean MergeEdges(const TopTools_SequenceOfShape& SeqEdges,
const TopoDS_Face& aFace,
const Standard_Real Tol,
TopoDS_Edge& anEdge)
{
// make chain for union
BRep_Builder B;
ShapeAnalysis_Edge sae;
TopoDS_Edge FirstE = TopoDS::Edge(SeqEdges.Value(1));
TopoDS_Edge LastE = FirstE;
TopoDS_Vertex VF = sae.FirstVertex(FirstE);
TopoDS_Vertex VL = sae.LastVertex(LastE);
TopTools_SequenceOfShape aChain;
aChain.Append(FirstE);
TColStd_MapOfInteger IndUsedEdges;
IndUsedEdges.Add(1);
Standard_Integer j;
for (j = 2; j <= SeqEdges.Length(); j++) {
for(Standard_Integer k=2; k<=SeqEdges.Length(); k++) {
if(IndUsedEdges.Contains(k)) continue;
TopoDS_Edge edge = TopoDS::Edge(SeqEdges.Value(k));
TopoDS_Vertex VF2 = sae.FirstVertex(edge);
TopoDS_Vertex VL2 = sae.LastVertex(edge);
if(sae.FirstVertex(edge).IsSame(VL)) {
aChain.Append(edge);
LastE = edge;
VL = sae.LastVertex(LastE);
IndUsedEdges.Add(k);
}
else if(sae.LastVertex(edge).IsSame(VF)) {
aChain.Prepend(edge);
FirstE = edge;
VF = sae.FirstVertex(FirstE);
IndUsedEdges.Add(k);
}
}
}
if(aChain.Length()<SeqEdges.Length()) {
cout<<"can not create correct chain..."<<endl;
return Standard_False;
}
// union edges in chain
// first step: union lines and circles
TopLoc_Location Loc;
Standard_Real fp1,lp1,fp2,lp2;
for (j = 1; j < aChain.Length(); j++) {
TopoDS_Edge edge1 = TopoDS::Edge(aChain.Value(j));
Handle(Geom_Curve) c3d1 = BRep_Tool::Curve(edge1,Loc,fp1,lp1);
if(c3d1.IsNull()) break;
while(c3d1->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
Handle(Geom_TrimmedCurve) tc =
Handle(Geom_TrimmedCurve)::DownCast(c3d1);
c3d1 = tc->BasisCurve();
}
TopoDS_Edge edge2 = TopoDS::Edge(aChain.Value(j+1));
Handle(Geom_Curve) c3d2 = BRep_Tool::Curve(edge2,Loc,fp2,lp2);
if(c3d2.IsNull()) break;
while(c3d2->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
Handle(Geom_TrimmedCurve) tc =
Handle(Geom_TrimmedCurve)::DownCast(c3d2);
c3d2 = tc->BasisCurve();
}
if( c3d1->IsKind(STANDARD_TYPE(Geom_Line)) && c3d2->IsKind(STANDARD_TYPE(Geom_Line)) ) {
Handle(Geom_Line) L1 = Handle(Geom_Line)::DownCast(c3d1);
Handle(Geom_Line) L2 = Handle(Geom_Line)::DownCast(c3d2);
gp_Dir Dir1 = L1->Position().Direction();
gp_Dir Dir2 = L2->Position().Direction();
if(!Dir1.IsEqual(Dir2,Precision::Angular())) continue;
// can union lines => create new edge
TopoDS_Vertex V1 = sae.FirstVertex(edge1);
gp_Pnt PV1 = BRep_Tool::Pnt(V1);
TopoDS_Vertex V2 = sae.LastVertex(edge2);
gp_Pnt PV2 = BRep_Tool::Pnt(V2);
gp_Vec Vec(PV1,PV2);
Handle(Geom_Line) L = new Geom_Line(gp_Ax1(PV1,Vec));
Standard_Real dist = PV1.Distance(PV2);
Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(L,0.0,dist);
TopoDS_Edge E;
B.MakeEdge (E,tc,Precision::Confusion());
B.Add (E,V1); B.Add (E,V2);
B.UpdateVertex(V1, 0., E, 0.);
B.UpdateVertex(V2, dist, E, 0.);
ShapeFix_Edge sfe;
sfe.FixAddPCurve(E,aFace,Standard_False);
sfe.FixSameParameter(E);
aChain.Remove(j);
aChain.SetValue(j,E);
j--;
}
if( c3d1->IsKind(STANDARD_TYPE(Geom_Circle)) && c3d2->IsKind(STANDARD_TYPE(Geom_Circle)) ) {
Handle(Geom_Circle) C1 = Handle(Geom_Circle)::DownCast(c3d1);
Handle(Geom_Circle) C2 = Handle(Geom_Circle)::DownCast(c3d2);
gp_Pnt P01 = C1->Location();
gp_Pnt P02 = C2->Location();
if(P01.Distance(P02)>Precision::Confusion()) continue;
// can union circles => create new edge
TopoDS_Vertex V1 = sae.FirstVertex(edge1);
gp_Pnt PV1 = BRep_Tool::Pnt(V1);
TopoDS_Vertex V2 = sae.LastVertex(edge2);
gp_Pnt PV2 = BRep_Tool::Pnt(V2);
TopoDS_Vertex VM = sae.LastVertex(edge1);
gp_Pnt PVM = BRep_Tool::Pnt(VM);
GC_MakeCircle MC(PV1,PVM,PV2);
Handle(Geom_Circle) C = MC.Value();
gp_Pnt P0 = C->Location();
gp_Dir D1(gp_Vec(P0,PV1));
gp_Dir D2(gp_Vec(P0,PV2));
Standard_Real fpar = C->XAxis().Direction().Angle(D1);
Standard_Real lpar = C->XAxis().Direction().Angle(D2);
Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(C,fpar,lpar);
TopoDS_Edge E;
B.MakeEdge (E,tc,Precision::Confusion());
B.Add (E,V1); B.Add (E,V2);
B.UpdateVertex(V1, fpar, E, 0.);
B.UpdateVertex(V2, lpar, E, 0.);
ShapeFix_Edge sfe;
sfe.FixAddPCurve(E,aFace,Standard_False);
sfe.FixSameParameter(E);
aChain.Remove(j);
aChain.SetValue(j,E);
j--;
}
}
if(j<aChain.Length()) {
cout<<"null curve3d in edge..."<<endl;
return Standard_False;
}
if(aChain.Length()>1) {
// second step: union edges with various curves
cout<<"can not make analitical union => make approximation"<<endl;
TopoDS_Wire W;
B.MakeWire(W);
for(j=1; j<=aChain.Length(); j++) {
TopoDS_Edge edge = TopoDS::Edge(aChain.Value(j));
B.Add(W,edge);
}
Handle(BRepAdaptor_HCompCurve) Adapt = new BRepAdaptor_HCompCurve(W);
Approx_Curve3d Conv(Adapt,Tol,GeomAbs_C1,9,1000);
Handle(Geom_BSplineCurve) bc = Conv.Curve();
TopoDS_Edge E;
B.MakeEdge (E,bc,Precision::Confusion());
B.Add (E,VF);
B.Add (E,VL);
//TopLoc_Location L;
//Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace,L);
//ShapeFix_Edge sfe;
//if(!L.IsIdentity()) {
// TopoDS_Edge aPCEdge = TopoDS::Edge(E.Moved(L.Inverted()));
// sfe.FixAddPCurve(aPCEdge,aFace,Standard_False);
// Handle(Geom2d_Curve) c2d;
// Standard_Real fp,lp;
// sae.PCurve(aPCEdge,aFace,c2d,fp,lp);
// B.UpdateEdge(E,c2d,aFace,0.);
// B.Range(E,aFace,fp,lp);
// c2d.Nullify();
// B.UpdateEdge(aPCEdge,c2d,aFace,0.);
// E = aPCEdge;
//}
//else {
// sfe.FixAddPCurve(E,aFace,Standard_False);
//}
//sfe.FixSameParameter(E);
aChain.SetValue(1,E);
}
anEdge = TopoDS::Edge(aChain.Value(1));
return Standard_True;
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
TopoDS_Shape BlockFix_UnionEdges::Perform(const TopoDS_Shape& Shape,
const Standard_Real Tol)
{
myContext = new ShapeBuild_ReShape;
myTolerance = Tol;
TopoDS_Shape aResult = myContext->Apply(Shape);
TopTools_IndexedMapOfShape ChangedFaces;
// processing each solid
TopExp_Explorer exps;
for(exps.Init(Shape, TopAbs_SOLID); exps.More(); exps.Next()) {
TopoDS_Solid aSolid = TopoDS::Solid(exps.Current());
// creating map of edge faces
TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces);
// processing each face
TopExp_Explorer exp;
for(exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) {
TopoDS_Face aFace = TopoDS::Face(myContext->Apply(exp.Current().Oriented(TopAbs_FORWARD)));
TopTools_IndexedDataMapOfShapeListOfShape aMapFacesEdges;
for(TopExp_Explorer expe(aFace,TopAbs_EDGE); expe.More(); expe.Next()) {
TopoDS_Edge edge = TopoDS::Edge(expe.Current());
if(!aMapEdgeFaces.Contains(edge)) continue;
const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge);
TopTools_ListIteratorOfListOfShape anIter(aList);
for( ; anIter.More(); anIter.Next()) {
TopoDS_Face face = TopoDS::Face(anIter.Value());
TopoDS_Face face1 = TopoDS::Face(myContext->Apply(anIter.Value()));
if(face1.IsSame(aFace)) continue;
if(aMapFacesEdges.Contains(face)) {
aMapFacesEdges.ChangeFromKey(face).Append(edge);
}
else {
TopTools_ListOfShape ListEdges;
ListEdges.Append(edge);
aMapFacesEdges.Add(face,ListEdges);
}
}
}
for(Standard_Integer i=1; i<=aMapFacesEdges.Extent(); i++) {
const TopTools_ListOfShape& ListEdges = aMapFacesEdges.FindFromIndex(i);
TopTools_SequenceOfShape SeqEdges;
TopTools_ListIteratorOfListOfShape anIter(ListEdges);
for( ; anIter.More(); anIter.Next()) {
SeqEdges.Append(anIter.Value());
}
if(SeqEdges.Length()==1) continue;
TopoDS_Edge E;
if( MergeEdges(SeqEdges,aFace,Tol,E) ) {
// now we have only one edge - aChain.Value(1)
// we have to replace old ListEdges with this new edge
myContext->Replace(SeqEdges(1),E);
for(Standard_Integer j=2; j<=SeqEdges.Length(); j++) {
myContext->Remove(SeqEdges(j));
}
TopoDS_Face tmpF = TopoDS::Face(exp.Current());
if( !ChangedFaces.Contains(tmpF) )
ChangedFaces.Add(tmpF);
tmpF = TopoDS::Face(aMapFacesEdges.FindKey(i));
if( !ChangedFaces.Contains(tmpF) )
ChangedFaces.Add(tmpF);
}
}
} // end processing each face
} // end processing each solid
for(Standard_Integer i=1; i<=ChangedFaces.Extent(); i++) {
TopoDS_Face aFace = TopoDS::Face(myContext->Apply(ChangedFaces.FindKey(i)));
Handle(ShapeFix_Face) sff = new ShapeFix_Face(aFace);
sff->SetContext(myContext);
sff->SetPrecision(myTolerance);
sff->SetMinTolerance(myTolerance);
sff->SetMaxTolerance(Max(1.,myTolerance*1000.));
sff->Perform();
//Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire;
//sfw->SetContext(myContext);
//sfw->SetPrecision(myTolerance);
//sfw->SetMinTolerance(myTolerance);
//sfw->SetMaxTolerance(Max(1.,myTolerance*1000.));
//sfw->SetFace(aFace);
//for ( TopoDS_Iterator iter(aFace,Standard_False); iter.More(); iter.Next()) {
// TopoDS_Wire wire = TopoDS::Wire ( iter.Value() );
// sfw->Load(wire);
// sfw->FixReorder();
// sfw->FixShifted();
//}
}
aResult = myContext->Apply(Shape);
return aResult;
}

View File

@ -0,0 +1,99 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _BlockFix_UnionEdges_HeaderFile
#define _BlockFix_UnionEdges_HeaderFile
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _Handle_ShapeBuild_ReShape_HeaderFile
#include <Handle_ShapeBuild_ReShape.hxx>
#endif
class ShapeBuild_ReShape;
class TopoDS_Shape;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class BlockFix_UnionEdges {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT BlockFix_UnionEdges();
Standard_EXPORT TopoDS_Shape Perform(const TopoDS_Shape& Shape,const Standard_Real Tol) ;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
Standard_Real myTolerance;
Handle_ShapeBuild_ReShape myContext;
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,26 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <BlockFix_UnionEdges.jxx>

View File

@ -0,0 +1,9 @@
#ifndef _ShapeBuild_ReShape_HeaderFile
#include <ShapeBuild_ReShape.hxx>
#endif
#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
#ifndef _BlockFix_UnionEdges_HeaderFile
#include <BlockFix_UnionEdges.hxx>
#endif

View File

@ -0,0 +1,46 @@
-- File: BlockFix_UnionFaces.cdl
-- Created: Tue Dec 7 17:15:42 2004
-- Author: Pavel Durandin
-- <det@doomox>
---Copyright: Open CASCADE SA 2004
class UnionFaces from BlockFix
uses
Face from TopoDS,
Shape from TopoDS
is
Create returns UnionFaces from BlockFix;
---Purpose: Empty constructor
GetTolerance(me: in out) returns Real;
---Purpose: Returns modifiable tolerance
---C++: return&
Perform (me: in out; Shape: Shape from TopoDS) returns Shape from TopoDS;
---Purpose: Performs the unification of the fsces
-- whith the same geometry
IsSameDomain(me; aFace : Face from TopoDS;
aChekedFace: Face from TopoDS)
returns Boolean is virtual;
---Purpose: Returns true is surfaces have same geometrically domain
-- with given tolerance
MovePCurves(me; aTarget: in out Face from TopoDS;
aSource: Face from TopoDS)
is virtual;
---Purpose: Creates pcurves on aTarget face for each edge from
-- aSource one.
fields
myTolerance: Real;
end;

View File

@ -0,0 +1,512 @@
// File: BlockFix_UnionFaces.cxx
// Created: Tue Dec 7 17:15:42 2004
// Author: Pavel DURANDIN
// Open CASCADE SA 2004
#include <BlockFix_UnionFaces.ixx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopExp.hxx>
#include <TopTools_MapOfShape.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Solid.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <Geom_Surface.hxx>
#include <BRep_Tool.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <BRep_Builder.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopoDS_Vertex.hxx>
#include <ShapeFix_Face.hxx>
#include <BRep_Tool.hxx>
#include <ShapeExtend_WireData.hxx>
#include <ShapeAnalysis_WireOrder.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <Geom2d_Line.hxx>
#include <gp_XY.hxx>
#include <gp_Pnt2d.hxx>
#include <ShapeBuild_Edge.hxx>
#include <Geom_Curve.hxx>
#include <TopoDS_Vertex.hxx>
#include <ShapeFix_Wire.hxx>
#include <ShapeFix_Edge.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <BRepTools.hxx>
#include <TColGeom_HArray2OfSurface.hxx>
#include <ShapeExtend_CompositeSurface.hxx>
#include <ShapeFix_ComposeShell.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <ShapeFix_SequenceOfWireSegment.hxx>
#include <ShapeFix_WireSegment.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Iterator.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_SphericalSurface.hxx>
//=======================================================================
//function : BlockFix_UnionFaces
//purpose :
//=======================================================================
BlockFix_UnionFaces::BlockFix_UnionFaces()
: myTolerance(Precision::Confusion())
{
}
//=======================================================================
//function : GetTolearnce
//purpose :
//=======================================================================
Standard_Real& BlockFix_UnionFaces::GetTolerance()
{
return myTolerance;
}
//=======================================================================
//function : AddOrdinaryEdges
//purpose : auxilary
//=======================================================================
// adds edges from the shape to the sequence
// seams and equal edges are dropped
// Returns true if one of original edges dropped
static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges,
const TopoDS_Shape aShape,
Standard_Integer& anIndex)
{
//map of edges
TopTools_MapOfShape aNewEdges;
//add edges without seams
for(TopExp_Explorer exp(aShape,TopAbs_EDGE); exp.More(); exp.Next()) {
TopoDS_Shape edge = exp.Current();
if(aNewEdges.Contains(edge))
aNewEdges.Remove(edge);
else
aNewEdges.Add(edge);
}
Standard_Boolean isDropped = Standard_False;
//merge edges and drop seams
for(Standard_Integer i = 1; i <= edges.Length(); i++) {
TopoDS_Shape current = edges(i);
if(aNewEdges.Contains(current)) {
aNewEdges.Remove(current);
edges.Remove(i);
i--;
if(!isDropped) {
isDropped = Standard_True;
anIndex = i;
}
}
}
//add edges to the sequemce
for(TopTools_MapIteratorOfMapOfShape anIter(aNewEdges); anIter.More(); anIter.Next())
edges.Append(anIter.Key());
return isDropped;
}
//=======================================================================
//function : ClearRts
//purpose : auxilary
//=======================================================================
static Handle(Geom_Surface) ClearRts(const Handle(Geom_Surface)& aSurface)
{
if(aSurface->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
Handle(Geom_RectangularTrimmedSurface) rts =
Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface);
return rts->BasisSurface();
}
return aSurface;
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape)
{
Handle(ShapeBuild_ReShape) myContext = new ShapeBuild_ReShape;
TopoDS_Shape aResShape = myContext->Apply(Shape);
// processing each solid
TopExp_Explorer exps;
for(exps.Init(Shape, TopAbs_SOLID); exps.More(); exps.Next()) {
TopoDS_Solid aSolid = TopoDS::Solid(exps.Current());
// creating map of edge faces
TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces);
// map of processed shapes
TopTools_MapOfShape aProcessed;
Handle(ShapeBuild_ReShape) aContext = new ShapeBuild_ReShape;
Standard_Integer NbModif=0;
Standard_Boolean hasFailed = Standard_False;
Standard_Real tol = Min(Max(Precision::Confusion(), myTolerance/10.),0.1);
// processing each face
TopExp_Explorer exp;
//for( exp.Init(Shape, TopAbs_FACE); exp.More(); exp.Next()) {
for( exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) {
TopoDS_Face aFace = TopoDS::Face(exp.Current().Oriented(TopAbs_FORWARD));
if(aProcessed.Contains(aFace))
continue;
Standard_Integer dummy;
TopTools_SequenceOfShape edges;
AddOrdinaryEdges(edges,aFace,dummy);
TopTools_SequenceOfShape faces;
faces.Append(aFace);
//surface and location to construct result
TopLoc_Location aBaseLocation;
Handle(Geom_Surface) aBaseSurface = BRep_Tool::Surface(aFace,aBaseLocation);
aBaseSurface = ClearRts(aBaseSurface);
// find adjacent faces to union
Standard_Integer i;
for( i = 1; i <= edges.Length(); i++) {
TopoDS_Edge edge = TopoDS::Edge(edges(i));
if(BRep_Tool::Degenerated(edge))
continue;
const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge);
TopTools_ListIteratorOfListOfShape anIter(aList);
for( ; anIter.More(); anIter.Next()) {
TopoDS_Face anCheckedFace = TopoDS::Face(anIter.Value().Oriented(TopAbs_FORWARD));
if(anCheckedFace.IsSame(aFace))
continue;
if(aProcessed.Contains(anCheckedFace))
continue;
if(IsSameDomain(aFace,anCheckedFace)) {
if(aList.Extent() != 2) {
// non mainfold case is not processed
continue;
}
// replacing pcurves
TopoDS_Face aMockUpFace;
BRep_Builder B;
B.MakeFace(aMockUpFace,aBaseSurface,aBaseLocation,0.);
MovePCurves(aMockUpFace,anCheckedFace);
if(AddOrdinaryEdges(edges,aMockUpFace,dummy)) {
// sequence edges is modified
i = dummy;
}
faces.Append(anCheckedFace);
aProcessed.Add(anCheckedFace);
break;
}
}
}
// all faces collected in the sequence. Perform union of faces
if(faces.Length() > 1) {
NbModif++;
TopoDS_Face aResult;
BRep_Builder B;
B.MakeFace(aResult,aBaseSurface,aBaseLocation,0);
Standard_Integer nbWires = 0;
// connecting wires
while(edges.Length()>0) {
Standard_Boolean isEdge3d = Standard_False;
nbWires++;
TopTools_MapOfShape aVertices;
TopoDS_Wire aWire;
B.MakeWire(aWire);
TopoDS_Edge anEdge = TopoDS::Edge(edges(1));
edges.Remove(1);
isEdge3d |= !BRep_Tool::Degenerated(anEdge);
B.Add(aWire,anEdge);
TopoDS_Vertex V1,V2;
TopExp::Vertices(anEdge,V1,V2);
aVertices.Add(V1);
aVertices.Add(V2);
Standard_Boolean isNewFound = Standard_False;
do {
isNewFound = Standard_False;
for(Standard_Integer j = 1; j <= edges.Length(); j++) {
anEdge = TopoDS::Edge(edges(j));
TopExp::Vertices(anEdge,V1,V2);
if(aVertices.Contains(V1) || aVertices.Contains(V2)) {
isEdge3d |= !BRep_Tool::Degenerated(anEdge);
aVertices.Add(V1);
aVertices.Add(V2);
B.Add(aWire,anEdge);
edges.Remove(j);
j--;
isNewFound = Standard_True;
}
}
} while (isNewFound);
// sorting eny type of edges
aWire = TopoDS::Wire(aContext->Apply(aWire));
TopoDS_Face tmpF = TopoDS::Face(aContext->Apply(faces(1).Oriented(TopAbs_FORWARD)));
Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(aWire,tmpF,Precision::Confusion());
sfw->FixReorder();
Standard_Boolean isDegRemoved = Standard_False;
if(!sfw->StatusReorder ( ShapeExtend_FAIL )) {
// clear degenerated edges if at least one with 3d curve exist
if(isEdge3d) {
Handle(ShapeExtend_WireData) sewd = sfw->WireData();
for(Standard_Integer j = 1; j<=sewd->NbEdges();j++) {
TopoDS_Edge E = sewd->Edge(j);
if(BRep_Tool::Degenerated(E)) {
sewd->Remove(j);
isDegRemoved = Standard_True;
j--;
}
}
}
sfw->FixShifted();
if(isDegRemoved)
sfw->FixDegenerated();
}
TopoDS_Wire aWireFixed = sfw->Wire();
aContext->Replace(aWire,aWireFixed);
// add resulting wire
if(isEdge3d) {
B.Add(aResult,aWireFixed);
}
else {
// sorting edges
Handle(ShapeExtend_WireData) sbwd = sfw->WireData();
Standard_Integer nbEdges = sbwd->NbEdges();
// sort degenerated edges and create one edge instead of several ones
ShapeAnalysis_WireOrder sawo(Standard_False, 0);
ShapeAnalysis_Edge sae;
Standard_Integer aLastEdge = nbEdges;
for(Standard_Integer j = 1; j <= nbEdges; j++) {
Standard_Real f,l;
//smh protection on NULL pcurve
Handle(Geom2d_Curve) c2d;
if(!sae.PCurve(sbwd->Edge(j),tmpF,c2d,f,l)) {
aLastEdge--;
continue;
}
sawo.Add(c2d->Value(f).XY(),c2d->Value(l).XY());
}
sawo.Perform();
// constructind one degenerative edge
gp_XY aStart, anEnd, tmp;
Standard_Integer nbFirst = sawo.Ordered(1);
TopoDS_Edge anOrigE = TopoDS::Edge(sbwd->Edge(nbFirst).Oriented(TopAbs_FORWARD));
ShapeBuild_Edge sbe;
TopoDS_Vertex aDummyV;
TopoDS_Edge E = sbe.CopyReplaceVertices(anOrigE,aDummyV,aDummyV);
sawo.XY(nbFirst,aStart,tmp);
sawo.XY(sawo.Ordered(aLastEdge),tmp,anEnd);
gp_XY aVec = anEnd-aStart;
Handle(Geom2d_Line) aLine = new Geom2d_Line(aStart,gp_Dir2d(anEnd-aStart));
B.UpdateEdge(E,aLine,tmpF,0.);
B.Range(E,tmpF,0.,aVec.Modulus());
Handle(Geom_Curve) C3d;
B.UpdateEdge(E,C3d,0.);
B.Degenerated(E,Standard_True);
TopoDS_Wire aW;
B.MakeWire(aW);
B.Add(aW,E);
B.Add(aResult,aW);
}
}
// perform substitution of face
aContext->Replace(aContext->Apply(aFace),aResult);
ShapeFix_Face sff (aResult);
//Intializing by tolerances
sff.SetPrecision(myTolerance);
sff.SetMinTolerance(tol);
sff.SetMaxTolerance(Max(1.,myTolerance*1000.));
//Setting modes
sff.FixOrientationMode() = 0;
//sff.FixWireMode() = 0;
sff.SetContext(aContext);
// Applying the fixes
sff.Perform();
if(sff.Status(ShapeExtend_FAIL))
hasFailed = Standard_True;
// breaking down to several faces
TopoDS_Shape theResult = aContext->Apply(aResult);
for(TopExp_Explorer aFaceExp(theResult,TopAbs_FACE);aFaceExp.More();aFaceExp.Next()) {
TopoDS_Face aCurrent = TopoDS::Face(aFaceExp.Current().Oriented(TopAbs_FORWARD));
Handle(TColGeom_HArray2OfSurface) grid = new TColGeom_HArray2OfSurface ( 1, 1, 1, 1 );
grid->SetValue ( 1, 1, aBaseSurface );
Handle(ShapeExtend_CompositeSurface) G = new ShapeExtend_CompositeSurface ( grid );
ShapeFix_ComposeShell CompShell;
CompShell.Init ( G, aBaseLocation, aCurrent, ::Precision::Confusion() );//myPrecision
CompShell.SetContext( aContext );
TopTools_SequenceOfShape parts;
ShapeFix_SequenceOfWireSegment wires;
for(TopExp_Explorer W_Exp(aCurrent,TopAbs_WIRE);W_Exp.More();W_Exp.Next()) {
Handle(ShapeExtend_WireData) sbwd =
new ShapeExtend_WireData ( TopoDS::Wire(W_Exp.Current() ));
ShapeFix_WireSegment seg ( sbwd, TopAbs_REVERSED );
wires.Append(seg);
}
CompShell.DispatchWires ( parts,wires );
for (Standard_Integer j=1; j <= parts.Length(); j++ ) {
ShapeFix_Face aFixOrient(TopoDS::Face(parts(j)));
aFixOrient.SetContext(aContext);
aFixOrient.FixOrientation();
}
TopoDS_Shape CompRes;
if ( faces.Length() !=1 ) {
TopoDS_Shell S;
B.MakeShell ( S );
for ( i=1; i <= parts.Length(); i++ )
B.Add ( S, parts(i) );
CompRes = S;
}
else CompRes = parts(1);
aContext->Replace(aCurrent,CompRes);
}
// remove the remaining faces
for(i = 2; i <= faces.Length(); i++)
aContext->Remove(faces(i));
}
}
//TopoDS_Shape aResult = Shape;
if(NbModif>0) {
TopoDS_Shape aResult = aSolid;
if(!hasFailed) {
aResult = aContext->Apply(aSolid);
ShapeFix_Edge sfe;
for(exp.Init(aResult,TopAbs_EDGE); exp.More(); exp.Next()) {
TopoDS_Edge E = TopoDS::Edge(exp.Current());
sfe.FixVertexTolerance (E);
// ptv add fix same parameter
sfe.FixSameParameter(E, myTolerance);
}
myContext->Replace(aSolid,aResult);
}
}
else {
for( exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) {
TopoDS_Face aFace = TopoDS::Face(exp.Current().Oriented(TopAbs_FORWARD));
Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire;
sfw->SetContext(myContext);
sfw->SetPrecision(myTolerance);
sfw->SetMinTolerance(myTolerance);
sfw->SetMaxTolerance(Max(1.,myTolerance*1000.));
sfw->SetFace(aFace);
for ( TopoDS_Iterator iter(aFace,Standard_False); iter.More(); iter.Next()) {
TopoDS_Wire wire = TopoDS::Wire ( iter.Value() );
sfw->Load(wire);
sfw->FixReorder();
sfw->FixShifted();
}
}
}
} // end processing each solid
aResShape = myContext->Apply(Shape);
return aResShape;
}
//=======================================================================
//function : IsSameDomain
//purpose :
//=======================================================================
Standard_Boolean BlockFix_UnionFaces::IsSameDomain(const TopoDS_Face& aFace,
const TopoDS_Face& aCheckedFace) const
{
//checking the same handless
TopLoc_Location L1, L2;
Handle(Geom_Surface) S1, S2;
S1 = BRep_Tool::Surface(aFace,L1);
S2 = BRep_Tool::Surface(aCheckedFace,L2);
return (S1 == S2 && L1 == L2);
}
//=======================================================================
//function : MovePCurves
//purpose :
//=======================================================================
void BlockFix_UnionFaces::MovePCurves(TopoDS_Face& aTarget,
const TopoDS_Face& aSource) const
{
BRep_Builder B;
for(TopExp_Explorer wexp(aSource,TopAbs_WIRE);wexp.More();wexp.Next()) {
Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(TopoDS::Wire(wexp.Current()),
aTarget, Precision::Confusion());
sfw->FixReorder();
Standard_Boolean isReoredFailed = sfw->StatusReorder ( ShapeExtend_FAIL );
sfw->FixEdgeCurves();
if(isReoredFailed)
continue;
sfw->FixShifted();
sfw->FixDegenerated();
// remove degenerated edges from not degenerated points
ShapeAnalysis_Edge sae;
Handle(ShapeExtend_WireData) sewd = sfw->WireData();
for(Standard_Integer i = 1; i<=sewd->NbEdges();i++) {
TopoDS_Edge E = sewd->Edge(i);
if(BRep_Tool::Degenerated(E)&&!sae.HasPCurve(E,aTarget)) {
sewd->Remove(i);
i--;
}
}
TopoDS_Wire ResWire = sfw->Wire();
B.Add(aTarget,ResWire);
}
}

View File

@ -0,0 +1,101 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _BlockFix_UnionFaces_HeaderFile
#define _BlockFix_UnionFaces_HeaderFile
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
class TopoDS_Shape;
class TopoDS_Face;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class BlockFix_UnionFaces {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT BlockFix_UnionFaces();
Standard_EXPORT Standard_Real& GetTolerance() ;
Standard_EXPORT TopoDS_Shape Perform(const TopoDS_Shape& Shape) ;
Standard_EXPORT virtual Standard_Boolean IsSameDomain(const TopoDS_Face& aFace,const TopoDS_Face& aChekedFace) const;
Standard_EXPORT virtual void MovePCurves(TopoDS_Face& aTarget,const TopoDS_Face& aSource) const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
Standard_Real myTolerance;
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,26 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <BlockFix_UnionFaces.jxx>

View File

@ -0,0 +1,9 @@
#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
#ifndef _TopoDS_Face_HeaderFile
#include <TopoDS_Face.hxx>
#endif
#ifndef _BlockFix_UnionFaces_HeaderFile
#include <BlockFix_UnionFaces.hxx>
#endif

View File

@ -12,21 +12,49 @@ package GEOMAlgo
uses
TCollection,
TColStd,
Geom,
Bnd,
gp,
TopAbs,
TopoDS,
TopTools,
IntTools
IntTools,
BOPTools,
BOP
is
is
-- enumerations
--
enumeration State is
ST_UNKNOWN,
ST_IN,
ST_OUT,
ST_ON,
ST_ONIN,
ST_ONOUT,
ST_INOUT
end State;
--
-- classes
--
deferred class Algo;
deferred class ShapeAlgo;
deferred class ShapeAlgo;
--
-- gluer
class Gluer;
class GlueAnalyser;
class CoupleOfShapes;
class PassKey;
class PassKeyMapHasher;
class Tools;
--
-- finder on
deferred class ShapeSolid;
class WireSolid;
class ShellSolid;
class VertexSolid;
class FinderShapeOn;
--
class IndexedDataMapOfPassKeyListOfShape
instantiates IndexedDataMap from TCollection (PassKey from GEOMAlgo,
ListOfShape from TopTools,
@ -39,6 +67,10 @@ is
class IndexedDataMapOfIntegerShape
instantiates IndexedDataMap from TCollection (Integer from Standard,
Shape from TopoDS,
MapIntegerHasher from TColStd);
MapIntegerHasher from TColStd);
class ListOfCoupleOfShapes
instantiates List from TCollection (CoupleOfShapes from GEOMAlgo);
end GEOMAlgo;

View File

@ -21,10 +21,10 @@ is
is deferred;
CheckData(me:out)
is deferred protected;
is virtual protected;
CheckResult(me:out)
is deferred protected;
is virtual protected;
ErrorStatus (me)
returns Integer from Standard;

View File

@ -23,6 +23,22 @@
{
}
//=======================================================================
// function: CheckData
// purpose:
//=======================================================================
void GEOMAlgo_Algo::CheckData()
{
myErrorStatus=0;
}
//=======================================================================
// function: CheckResult
// purpose:
//=======================================================================
void GEOMAlgo_Algo::CheckResult()
{
myErrorStatus=0;
}
//=======================================================================
// function: ErrorStatus
// purpose:
//=======================================================================

View File

@ -66,8 +66,8 @@ protected:
//
Standard_EXPORT GEOMAlgo_Algo();
Standard_EXPORT virtual ~GEOMAlgo_Algo();
Standard_EXPORT virtual void CheckData() = 0;
Standard_EXPORT virtual void CheckResult() = 0;
Standard_EXPORT virtual void CheckData() ;
Standard_EXPORT virtual void CheckResult() ;
// Fields PROTECTED

View File

@ -0,0 +1,48 @@
-- File: GEOMAlgo_CoupleOfShapes.cdl
-- Created: Wed Dec 15 13:00:10 2004
-- Author: Peter KURNEV
-- <pkv@irinox>
---Copyright: Matra Datavision 2004
class CoupleOfShapes from GEOMAlgo
---Purpose:
uses
Shape from TopoDS
--raises
is
Create
returns CoupleOfShapes from GEOMAlgo;
SetShapes(me:out;
aS1: Shape from TopoDS;
aS2: Shape from TopoDS);
SetShape1(me:out;
aS1: Shape from TopoDS);
SetShape2(me:out;
aS2: Shape from TopoDS);
Shapes(me;
aS1:out Shape from TopoDS;
aS2:out Shape from TopoDS);
Shape1(me)
returns Shape from TopoDS;
---C++:return const &
Shape2(me)
returns Shape from TopoDS;
---C++:return const &
fields
myShape1: Shape from TopoDS is protected;
myShape2: Shape from TopoDS is protected;
end CoupleOfShapes;

View File

@ -0,0 +1,65 @@
// File: GEOMAlgo_CoupleOfShapes.cxx
// Created: Wed Dec 15 13:03:52 2004
// Author: Peter KURNEV
// <pkv@irinox>
#include <GEOMAlgo_CoupleOfShapes.ixx>
//=======================================================================
//function : GEOMAlgo_CoupleOfShapes
//purpose :
//=======================================================================
GEOMAlgo_CoupleOfShapes::GEOMAlgo_CoupleOfShapes()
{}
//=======================================================================
//function : SetShapes
//purpose :
//=======================================================================
void GEOMAlgo_CoupleOfShapes::SetShapes(const TopoDS_Shape& aS1,
const TopoDS_Shape& aS2)
{
myShape1=aS1;
myShape2=aS2;
}
//=======================================================================
//function : Shapes
//purpose :
//=======================================================================
void GEOMAlgo_CoupleOfShapes::Shapes(TopoDS_Shape& aS1,
TopoDS_Shape& aS2)const
{
aS1=myShape1;
aS2=myShape2;
}
//=======================================================================
//function : SetShape1
//purpose :
//=======================================================================
void GEOMAlgo_CoupleOfShapes::SetShape1(const TopoDS_Shape& aS1)
{
myShape1=aS1;
}
//=======================================================================
//function : SetShape2
//purpose :
//=======================================================================
void GEOMAlgo_CoupleOfShapes::SetShape2(const TopoDS_Shape& aS2)
{
myShape2=aS2;
}
//=======================================================================
//function : Shape1
//purpose :
//=======================================================================
const TopoDS_Shape& GEOMAlgo_CoupleOfShapes::Shape1()const
{
return myShape1;
}
//=======================================================================
//function : Shape2
//purpose :
//=======================================================================
const TopoDS_Shape& GEOMAlgo_CoupleOfShapes::Shape2()const
{
return myShape2;
}

View File

@ -0,0 +1,100 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _GEOMAlgo_CoupleOfShapes_HeaderFile
#define _GEOMAlgo_CoupleOfShapes_HeaderFile
#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
class TopoDS_Shape;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class GEOMAlgo_CoupleOfShapes {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT GEOMAlgo_CoupleOfShapes();
Standard_EXPORT void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2) ;
Standard_EXPORT void SetShape1(const TopoDS_Shape& aS1) ;
Standard_EXPORT void SetShape2(const TopoDS_Shape& aS2) ;
Standard_EXPORT void Shapes(TopoDS_Shape& aS1,TopoDS_Shape& aS2) const;
Standard_EXPORT const TopoDS_Shape& Shape1() const;
Standard_EXPORT const TopoDS_Shape& Shape2() const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
TopoDS_Shape myShape1;
TopoDS_Shape myShape2;
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,26 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <GEOMAlgo_CoupleOfShapes.jxx>

View File

@ -0,0 +1,6 @@
#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
#ifndef _GEOMAlgo_CoupleOfShapes_HeaderFile
#include <GEOMAlgo_CoupleOfShapes.hxx>
#endif

View File

@ -0,0 +1,83 @@
-- File: GEOMAlgo_FinderShapeOn.cdl
-- Created: Tue Jan 11 14:35:52 2005
-- Author: Peter KURNEV
-- <pkv@irinox>
---Copyright: Matra Datavision 2005
class FinderShapeOn from GEOMAlgo
inherits ShapeAlgo from GEOMAlgo
---Purpose:
uses
Surface from Geom,
ShapeEnum from TopAbs,
ListOfShape from TopTools,
DataMapOfShapeShape from TopTools,
Shape from TopoDS,
State from GEOMAlgo
--raises
is
Create
returns FinderShapeOn from GEOMAlgo;
---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_FinderShapeOn();"
Perform(me:out)
is redefined;
SetSurface(me:out;
aS:Surface from Geom);
SetShapeType(me:out;
aST:ShapeEnum from TopAbs);
SetState(me:out;
aSF:State from GEOMAlgo);
Surface(me)
returns Surface from Geom;
---C++: return const &
ShapeType(me)
returns ShapeEnum from TopAbs;
State(me)
returns State from GEOMAlgo;
Shapes(me)
returns ListOfShape from TopTools;
---C++: return const &
--
-- protected methods
--
CheckData(me:out)
is redefined protected;
MakeArguments(me:out)
is protected;
Find(me:out)
is protected;
CopySource(myclass;
aS :Shape from TopoDS;
aImages : out DataMapOfShapeShape from TopTools;
aOriginals: out DataMapOfShapeShape from TopTools;
aSC : out Shape from TopoDS);
fields
mySurface : Surface from Geom is protected;
myShapeType : ShapeEnum from TopAbs is protected;
myState : State from GEOMAlgo is protected;
myArg1 : Shape from TopoDS is protected;
myArg2 : Shape from TopoDS is protected;
myLS : ListOfShape from TopTools is protected;
myImages : DataMapOfShapeShape from TopTools is protected;
end FinderShapeOn;

View File

@ -0,0 +1,387 @@
// File: GEOMAlgo_FinderShapeOn.cxx
// Created: Tue Jan 11 14:44:31 2005
// Author: Peter KURNEV
// <pkv@irinox>
#include <GEOMAlgo_FinderShapeOn.ixx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <BRep_Builder.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <BRepLib_MakeFace.hxx>
#include <BRepLib_FaceError.hxx>
#include <BOPTools_DSFiller.hxx>
#include <GEOMAlgo_WireSolid.hxx>
#include <GEOMAlgo_ShellSolid.hxx>
#include <GEOMAlgo_VertexSolid.hxx>
#include <GEOMAlgo_ShapeSolid.hxx>
//=======================================================================
//function : GEOMAlgo_FinderShapeOn
//purpose :
//=======================================================================
GEOMAlgo_FinderShapeOn::GEOMAlgo_FinderShapeOn()
:
GEOMAlgo_ShapeAlgo()
{
myTolerance=0.0001;
myShapeType=TopAbs_VERTEX;
myState=GEOMAlgo_ST_UNKNOWN;
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
GEOMAlgo_FinderShapeOn::~GEOMAlgo_FinderShapeOn()
{
}
//=======================================================================
//function : SetSurface
//purpose :
//=======================================================================
void GEOMAlgo_FinderShapeOn::SetSurface(const Handle(Geom_Surface)& aS)
{
mySurface=aS;
}
//=======================================================================
//function : Surface
//purpose :
//=======================================================================
const Handle(Geom_Surface)& GEOMAlgo_FinderShapeOn::Surface() const
{
return mySurface;
}
//=======================================================================
//function : SetShapeType
//purpose :
//=======================================================================
void GEOMAlgo_FinderShapeOn::SetShapeType(const TopAbs_ShapeEnum aType)
{
myShapeType=aType;
}
//=======================================================================
//function : ShapeType
//purpose :
//=======================================================================
TopAbs_ShapeEnum GEOMAlgo_FinderShapeOn::ShapeType()const
{
return myShapeType;
}
//=======================================================================
//function : SetState
//purpose :
//=======================================================================
void GEOMAlgo_FinderShapeOn::SetState(const GEOMAlgo_State aState)
{
myState=aState;
}
//=======================================================================
//function : State
//purpose :
//=======================================================================
GEOMAlgo_State GEOMAlgo_FinderShapeOn::State() const
{
return myState;
}
//=======================================================================
// function: Shapes
// purpose:
//=======================================================================
const TopTools_ListOfShape& GEOMAlgo_FinderShapeOn::Shapes() const
{
return myLS;
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void GEOMAlgo_FinderShapeOn::Perform()
{
myErrorStatus=0;
myWarningStatus=0;
myLS.Clear();
//
if (!myResult.IsNull()){
myResult.Nullify();
}
//
CheckData();
if(myErrorStatus) {
return;
}
//
MakeArguments();
if(myErrorStatus || myWarningStatus) {
return;
}
//
Find();
if(myErrorStatus) {
return;
}
//
}
//=======================================================================
//function : Find
//purpose :
//=======================================================================
void GEOMAlgo_FinderShapeOn::Find()
{
myErrorStatus=0;
//
Standard_Boolean bIsDone;
Standard_Integer iErr;
TopTools_ListIteratorOfListOfShape aIt;
BRep_Builder aBB;
BOPTools_DSFiller aDF;
GEOMAlgo_ShapeSolid* pSS;
//
// 1. Prepare DSFiller
aDF.SetShapes (myArg1, myArg2);
bIsDone=aDF.IsDone();
if (!bIsDone) {
myErrorStatus=30; // wrong args are used for DSFiller
return;
}
aDF.Perform();
bIsDone=aDF.IsDone();
if (!bIsDone) {
myErrorStatus=31; // DSFiller failed
return;
}
//
// 2. Find shapes
myLS.Clear();
//
if (myShapeType==TopAbs_VERTEX) {
pSS=new GEOMAlgo_VertexSolid;
}
else if (myShapeType==TopAbs_EDGE) {
pSS=new GEOMAlgo_WireSolid;
}
else if (myShapeType==TopAbs_FACE) {
pSS=new GEOMAlgo_ShellSolid;
}
//
pSS->SetFiller(aDF);
pSS->Perform();
iErr=pSS->ErrorStatus();
if (iErr) {
myErrorStatus=32; // builder ShapeSolid failed
delete pSS;
return;
}
//
const TopTools_ListOfShape& aLS=pSS->Shapes(myState);
//
aIt.Initialize(aLS);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSImage=aIt.Value();
if (myImages.IsBound(aSImage)) {
const TopoDS_Shape& aS=myImages.Find(aSImage);
myLS.Append(aS);
}
else {
myErrorStatus=33;// can not find original shape
return;
}
}
//
delete pSS;
}
//=======================================================================
//function : MakeArguments
//purpose :
//=======================================================================
void GEOMAlgo_FinderShapeOn::MakeArguments()
{
myErrorStatus=0;
//
Standard_Integer i, aNb;
BRepLib_FaceError aFErr;
BRepLib_MakeFace aMF;
TopTools_IndexedMapOfShape aM;
BRep_Builder aBB;
TopoDS_Compound aCmp;
TopoDS_Shell aSh;
TopoDS_Solid aSd;
TopoDS_Shape aSC;
TopTools_DataMapOfShapeShape aOriginals;
TopExp_Explorer aExp;
//
// Argument 1
aMF.Init(mySurface, Standard_True);
aFErr=aMF.Error();
if (aFErr!=BRepLib_FaceDone) {
myErrorStatus=20; // can not build the face
return;
}
//
const TopoDS_Shape& aF=aMF.Shape();
//
// update tolerance
aExp.Init(aF, TopAbs_VERTEX);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Vertex& aV=TopoDS::Vertex(aExp.Current());
aBB.UpdateVertex(aV, myTolerance);
}
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
aBB.UpdateEdge(aE, myTolerance);
}
const TopoDS_Face& aFace=TopoDS::Face(aF);
aBB.UpdateFace(aFace, myTolerance);
//
// make solid
aBB.MakeShell(aSh);
aBB.Add(aSh, aFace);
aBB.MakeSolid(aSd);
aBB.Add(aSd, aSh);
myArg1=aSd;
//
// Argument 2
//
myImages.Clear();
//
GEOMAlgo_FinderShapeOn::CopySource(myShape, myImages, aOriginals, aSC);
//
TopExp::MapShapes(aSC, myShapeType, aM);
aNb=aM.Extent();
if (!aNb) {
myWarningStatus=10; // No found subshapes of type myShapeType
return;
}
//
aBB.MakeCompound(aCmp);
for (i=1; i<=aNb; ++i) {
const TopoDS_Shape& aS=aM(i);
aBB.Add(aCmp, aS);
}
myArg2=aCmp;
}
//=======================================================================
//function : CheckData
//purpose :
//=======================================================================
void GEOMAlgo_FinderShapeOn::CheckData()
{
myErrorStatus=0;
//
if(mySurface.IsNull()) {
myErrorStatus=10; // mySurface=NULL
return;
}
//
if (myShape.IsNull()) {
myErrorStatus=11; // myShape=NULL
return;
}
//
if (!(myShapeType==TopAbs_VERTEX ||
myShapeType==TopAbs_EDGE ||
myShapeType==TopAbs_FACE)) {
myErrorStatus=12; // unallowed subshape type
return;
}
//
if (myState==GEOMAlgo_ST_UNKNOWN ||
myState==GEOMAlgo_ST_INOUT) {
myErrorStatus=13; // unallowed state type
return;
}
}
//
//=======================================================================
//function : CopySource
//purpose :
//=======================================================================
void GEOMAlgo_FinderShapeOn::CopySource(const TopoDS_Shape& aE,
TopTools_DataMapOfShapeShape& aImages,
TopTools_DataMapOfShapeShape& aOriginals,
TopoDS_Shape& aEx)
{
Standard_Boolean bFree;
TopAbs_ShapeEnum aType;
Standard_Integer aR;
BRep_Builder BB;
TopoDS_Iterator aIt;
//
aType=aE.ShapeType();
//
if (aOriginals.IsBound(aE)) {
aEx=aOriginals.ChangeFind(aE);
if (aType==TopAbs_EDGE) {
return;
}
}
else {
aEx=aE.EmptyCopied();
aOriginals.Bind(aE, aEx);
aImages.Bind(aEx, aE);
}
//
aR=(Standard_Integer)aType+1;
if (aR>TopAbs_VERTEX) {
return;
}
//
bFree=aEx.Free();
aEx.Free(Standard_True);
//
aType=(TopAbs_ShapeEnum) aR;
//
aIt.Initialize(aE);//, Standard_False);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aV=aIt.Value();
TopoDS_Shape aVx;
//
CopySource (aV, aImages, aOriginals, aVx);
//
aVx.Orientation(aV.Orientation());
BB.Add(aEx, aVx);
}
//
aEx.Free(bFree);
}
//
// myErrorStatus :
//
// 10 -mySurface=NULL
// 11 -myShape=NULL
// 12 -unallowed type of subshapes
// 13 -unallowed state
// 20 -can not build the face
// 30 -wrong args are used for DSFiller
// 31 -DSFiller failed
// 32 -builder ShapeSolid failed
// 33 -can not find original shape
//
// myWarningStatus
//
// 10 -subshapes of type myShapeType can not be fond in myShape

View File

@ -0,0 +1,133 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _GEOMAlgo_FinderShapeOn_HeaderFile
#define _GEOMAlgo_FinderShapeOn_HeaderFile
#ifndef _Handle_Geom_Surface_HeaderFile
#include <Handle_Geom_Surface.hxx>
#endif
#ifndef _TopAbs_ShapeEnum_HeaderFile
#include <TopAbs_ShapeEnum.hxx>
#endif
#ifndef _GEOMAlgo_State_HeaderFile
#include <GEOMAlgo_State.hxx>
#endif
#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
#ifndef _TopTools_ListOfShape_HeaderFile
#include <TopTools_ListOfShape.hxx>
#endif
#ifndef _TopTools_DataMapOfShapeShape_HeaderFile
#include <TopTools_DataMapOfShapeShape.hxx>
#endif
#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile
#include <GEOMAlgo_ShapeAlgo.hxx>
#endif
class Geom_Surface;
class TopTools_ListOfShape;
class TopoDS_Shape;
class TopTools_DataMapOfShapeShape;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class GEOMAlgo_FinderShapeOn : public GEOMAlgo_ShapeAlgo {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT GEOMAlgo_FinderShapeOn();
Standard_EXPORT virtual ~GEOMAlgo_FinderShapeOn();
Standard_EXPORT virtual void Perform() ;
Standard_EXPORT void SetSurface(const Handle(Geom_Surface)& aS) ;
Standard_EXPORT void SetShapeType(const TopAbs_ShapeEnum aST) ;
Standard_EXPORT void SetState(const GEOMAlgo_State aSF) ;
Standard_EXPORT const Handle_Geom_Surface& Surface() const;
Standard_EXPORT TopAbs_ShapeEnum ShapeType() const;
Standard_EXPORT GEOMAlgo_State State() const;
Standard_EXPORT const TopTools_ListOfShape& Shapes() const;
Standard_EXPORT static void CopySource(const TopoDS_Shape& aS,TopTools_DataMapOfShapeShape& aImages,TopTools_DataMapOfShapeShape& aOriginals,TopoDS_Shape& aSC) ;
protected:
// Methods PROTECTED
//
Standard_EXPORT virtual void CheckData() ;
Standard_EXPORT void MakeArguments() ;
Standard_EXPORT void Find() ;
// Fields PROTECTED
//
Handle_Geom_Surface mySurface;
TopAbs_ShapeEnum myShapeType;
GEOMAlgo_State myState;
TopoDS_Shape myArg1;
TopoDS_Shape myArg2;
TopTools_ListOfShape myLS;
TopTools_DataMapOfShapeShape myImages;
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,26 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <GEOMAlgo_FinderShapeOn.jxx>

View File

@ -0,0 +1,15 @@
#ifndef _Geom_Surface_HeaderFile
#include <Geom_Surface.hxx>
#endif
#ifndef _TopTools_ListOfShape_HeaderFile
#include <TopTools_ListOfShape.hxx>
#endif
#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
#ifndef _TopTools_DataMapOfShapeShape_HeaderFile
#include <TopTools_DataMapOfShapeShape.hxx>
#endif
#ifndef _GEOMAlgo_FinderShapeOn_HeaderFile
#include <GEOMAlgo_FinderShapeOn.hxx>
#endif

View File

@ -0,0 +1,63 @@
-- File: GEOMAlgo_GlueAnalyser.cdl
-- Created: Wed Dec 15 11:03:03 2004
-- Author: Peter KURNEV
-- <pkv@irinox>
---Copyright: Matra Datavision 2004
class GlueAnalyser from GEOMAlgo
inherits Gluer from GEOMAlgo
---Purpose:
uses
ShapeEnum from TopAbs,
ListOfShape from TopTools,
ListOfCoupleOfShapes from GEOMAlgo
--raises
is
Create
returns GlueAnalyser from GEOMAlgo;
---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_GlueAnalyser();"
Perform(me:out)
is redefined;
HasSolidsToGlue(me)
returns Boolean from Standard;
SolidsToGlue(me)
returns ListOfCoupleOfShapes from GEOMAlgo;
---C++:return const &
HasSolidsAlone(me)
returns Boolean from Standard;
SolidsAlone(me)
returns ListOfShape from TopTools;
---C++:return const &
DetectVertices(me:out)
is protected;
DetectEdges(me:out)
is protected;
DetectFaces(me:out)
is protected;
DetectShapes(me:out;
aType:ShapeEnum from TopAbs)
is protected;
DetectSolids (me:out)
is protected;
fields
mySolidsToGlue : ListOfCoupleOfShapes from GEOMAlgo is protected;
mySolidsAlone : ListOfShape from TopTools is protected;
end GlueAnalyser;

View File

@ -0,0 +1,439 @@
// File: GEOMAlgo_GlueDetector.cxx
// Created: Wed Dec 15 11:08:09 2004
// Author: Peter KURNEV
// <pkv@irinox>
#include <GEOMAlgo_GlueAnalyser.ixx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx>
#include <TopExp.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <GEOMAlgo_PassKey.hxx>
#include <GEOMAlgo_IndexedDataMapOfPassKeyListOfShape.hxx>
#include <GEOMAlgo_Tools.hxx>
#include <GEOMAlgo_CoupleOfShapes.hxx>
#include <GEOMAlgo_Gluer.hxx>
#include <Bnd_HArray1OfBox.hxx>
#include <Bnd_BoundSortBox.hxx>
#include <TopoDS_Vertex.hxx>
#include <GEOMAlgo_IndexedDataMapOfIntegerShape.hxx>
#include <GEOMAlgo_IndexedDataMapOfShapeBox.hxx>
#include <Bnd_Box.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <BRepBndLib.hxx>
//=======================================================================
//function :
//purpose :
//=======================================================================
GEOMAlgo_GlueAnalyser::GEOMAlgo_GlueAnalyser()
:
GEOMAlgo_Gluer()
{}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
GEOMAlgo_GlueAnalyser::~GEOMAlgo_GlueAnalyser()
{}
//=======================================================================
//function : HasSolidsToGlue
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_GlueAnalyser::HasSolidsToGlue()const
{
return !mySolidsToGlue.IsEmpty();
}
//=======================================================================
//function : HasSolidsAlone
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_GlueAnalyser::HasSolidsAlone()const
{
return !mySolidsAlone.IsEmpty();
}
//=======================================================================
//function : SolidsToGlue
//purpose :
//=======================================================================
const GEOMAlgo_ListOfCoupleOfShapes& GEOMAlgo_GlueAnalyser::SolidsToGlue()const
{
return mySolidsToGlue;
}
//=======================================================================
//function : SolidsAlone
//purpose :
//=======================================================================
const TopTools_ListOfShape& GEOMAlgo_GlueAnalyser::SolidsAlone()const
{
return mySolidsAlone;
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void GEOMAlgo_GlueAnalyser::Perform()
{
myErrorStatus=0;
myWarningStatus=0;
//
mySolidsToGlue.Clear();
mySolidsAlone.Clear();
//
CheckData();
if (myErrorStatus) {
return;
}
//
InnerTolerance();
if (myErrorStatus) {
return;
}
//
DetectVertices();
if (myErrorStatus) {
return;
}
//
DetectEdges();
if (myErrorStatus) {
return;
}
//
DetectFaces();
if (myErrorStatus) {
return;
}
//
DetectSolids();
if (myErrorStatus) {
return;
}
}
//=======================================================================
//function : DetectVertices
//purpose :
//=======================================================================
void GEOMAlgo_GlueAnalyser::DetectVertices()
{
myErrorStatus=0;
//
Standard_Integer j, i, aNbV, aIndex, aNbVSD;
TColStd_ListIteratorOfListOfInteger aIt;
Handle(Bnd_HArray1OfBox) aHAB;
Bnd_BoundSortBox aBSB;
TopoDS_Shape aSTmp, aVF;
TopoDS_Vertex aVnew;
TopTools_IndexedMapOfShape aMV, aMVProcessed;
TopTools_ListIteratorOfListOfShape aItS;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
GEOMAlgo_IndexedDataMapOfShapeBox aMSB;
//
TopExp::MapShapes(myShape, TopAbs_VERTEX, aMV);
aNbV=aMV.Extent();
if (!aNbV) {
myErrorStatus=2; // no vertices in source shape
return;
}
//
aHAB=new Bnd_HArray1OfBox(1, aNbV);
//
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
Bnd_Box aBox;
//
aBox.SetGap(myTol);
BRepBndLib::Add(aV, aBox);
aHAB->SetValue(i, aBox);
aMIS.Add(i, aV);
aMSB.Add(aV, aBox);
}
//
aBSB.Initialize(aHAB);
//
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
//
if (aMVProcessed.Contains(aV)) {
continue;
}
//
const Bnd_Box& aBoxV=aMSB.FindFromKey(aV);
const TColStd_ListOfInteger& aLI=aBSB.Compare(aBoxV);
aNbVSD=aLI.Extent();
if (!aNbVSD) {
myErrorStatus=3; // it must not be
return;
}
//
// Images
TopTools_ListOfShape aLVSD;
//
aIt.Initialize(aLI);
for (j=0; aIt.More(); aIt.Next(), ++j) {
aIndex=aIt.Value();
const TopoDS_Shape& aVx=aMIS.FindFromKey(aIndex);
if(!j) {
aVF=aVx;
}
aLVSD.Append(aVx);
aMVProcessed.Add(aVx);
}
myImages.Bind(aVF, aLVSD);
}
// Origins
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aV=aItIm.Key();
const TopTools_ListOfShape& aLVSD=aItIm.Value();
//
aItS.Initialize(aLVSD);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aVSD=aItS.Value();
if (!myOrigins.IsBound(aVSD)) {
myOrigins.Bind(aVSD, aV);
}
}
}
}
//=======================================================================
//function : DetectFaces
//purpose :
//=======================================================================
void GEOMAlgo_GlueAnalyser::DetectFaces()
{
DetectShapes(TopAbs_FACE);
}
//=======================================================================
//function : DetectEdges
//purpose :
//=======================================================================
void GEOMAlgo_GlueAnalyser::DetectEdges()
{
DetectShapes(TopAbs_EDGE);
}
//=======================================================================
//function : DetectShapes
//purpose :
//=======================================================================
void GEOMAlgo_GlueAnalyser::DetectShapes(const TopAbs_ShapeEnum aType)
{
myErrorStatus=0;
//
Standard_Integer i, aNbF, aNbSDF, iErr;
TopoDS_Shape aNewShape;
TopTools_IndexedMapOfShape aMF;
TopTools_ListIteratorOfListOfShape aItS;
GEOMAlgo_PassKey aPKF;
GEOMAlgo_IndexedDataMapOfPassKeyListOfShape aMPKLF;
//
TopExp::MapShapes(myShape, aType, aMF);
//
aNbF=aMF.Extent();
for (i=1; i<=aNbF; ++i) {
const TopoDS_Shape& aS=aMF(i);
//
aPKF.Clear();
if (aType==TopAbs_FACE) {
const TopoDS_Face& aF=TopoDS::Face(aS);
FacePassKey(aF, aPKF);
}
else if (aType==TopAbs_EDGE) {
const TopoDS_Edge& aE=TopoDS::Edge(aS);
EdgePassKey(aE, aPKF);
}
//
if (myErrorStatus) {
return;
}
//
if (aMPKLF.Contains(aPKF)) {
TopTools_ListOfShape& aLSDF=aMPKLF.ChangeFromKey(aPKF);
aLSDF.Append(aS);
}
else {
TopTools_ListOfShape aLSDF;
//
aLSDF.Append(aS);
aMPKLF.Add(aPKF, aLSDF);
}
}
// check geometric coincidence
if (myCheckGeometry) {
iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTol, myContext); //XX
if (iErr) {
myErrorStatus=200;
return;
}
}
//
// Images/Origins
aNbF=aMPKLF.Extent();
for (i=1; i<=aNbF; ++i) {
const TopTools_ListOfShape& aLSDF=aMPKLF(i);
aNbSDF=aLSDF.Extent();
if (!aNbSDF) {
myErrorStatus=4; // it must not be
}
//
const TopoDS_Shape& aS1=aLSDF.First();
aNewShape=aS1;
//
myImages.Bind(aNewShape, aLSDF);
// origins
aItS.Initialize(aLSDF);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aFSD=aItS.Value();
if (!myOrigins.IsBound(aFSD)) {
myOrigins.Bind(aFSD, aNewShape);
}
}
}
}
//=======================================================================
//function : DetectSolids
//purpose :
//=======================================================================
void GEOMAlgo_GlueAnalyser::DetectSolids()
{
myErrorStatus=0;
//
Standard_Integer i, aNbF, aNbS, aNbC, aNbX;
TopoDS_Compound aCmp;
BRep_Builder aBB;
TopTools_IndexedDataMapOfShapeListOfShape aMFS;
TopTools_IndexedMapOfShape aMx, aMS;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
GEOMAlgo_IndexedDataMapOfPassKeyListOfShape aMPKLS;
GEOMAlgo_PassKey aPKSx;
GEOMAlgo_CoupleOfShapes aCS;
//
aBB.MakeCompound(aCmp);
//
TopExp::MapShapesAndAncestors(myShape, TopAbs_FACE, TopAbs_SOLID, aMFS);
//
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aIm=aItIm.Key();
if (aIm.ShapeType()!=TopAbs_FACE) {
continue;
}
//
const TopTools_ListOfShape& aLF=aItIm.Value();
aNbF=aLF.Extent();
if (aNbF!=2) {
continue;
}
//
TopoDS_Shape aSx[2], aFx[2];
//
aFx[0]=aLF.First();
aFx[1]=aLF.Last();
for (i=0; i<2; ++i) {
if (!aMFS.Contains(aFx[i])) {
continue;// it must not be so
}
//
const TopTools_ListOfShape& aLS=aMFS.FindFromKey(aFx[i]);
aNbS=aLS.Extent();
if (aNbS!=1) {
continue;
}
aSx[i]=aLS.First();
}
//
if (aSx[0].IsNull() || aSx[1].IsNull()) {
continue;
}
//
aPKSx.Clear();
aPKSx.SetIds(aSx[0], aSx[1]);
//
if (!aMPKLS.Contains(aPKSx)) {
TopTools_ListOfShape aLSx;
//
aLSx.Append(aSx[0]);
aLSx.Append(aSx[1]);
//
aMPKLS.Add(aPKSx, aLSx);
}
}
//
mySolidsToGlue.Clear();
mySolidsAlone.Clear();
//
aNbC=aMPKLS.Extent();
if (!aNbC) {
return;
}
//
for (i=1; i<=aNbC; ++i) {
const TopTools_ListOfShape& aLSx=aMPKLS(i);
const TopoDS_Shape& aSx1=aLSx.First();
const TopoDS_Shape& aSx2=aLSx.Last();
aCS.SetShape1(aSx1);
aCS.SetShape2(aSx2);
mySolidsToGlue.Append(aCS);
//
if (!aMx.Contains(aSx1)) {
aBB.Add(aCmp, aSx1);
aMx.Add(aSx1);
}
if (!aMx.Contains(aSx2)) {
aBB.Add(aCmp, aSx2);
aMx.Add(aSx2);
}
}
myResult=aCmp;
//
// check alone solids
TopExp::MapShapes(myShape, TopAbs_SOLID, aMS);
//
aNbX=aMx.Extent();
for (i=1; i<=aNbX; ++i) {
const TopoDS_Shape& aSx=aMx(i);
if (!aMS.Contains(aSx)) {
mySolidsAlone.Append(aSx);
}
}
}
/*
// A
// Make vertices
aMV.Clear();
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aV=aItIm.Key();
aMV.Add(aV);
const TopTools_ListOfShape& aLVSD=aItIm.Value();
MakeVertex(aLVSD, aVnew);//ZZ
myImages.Bind(aVnew, aLVSD);
}
//
aNbV=aMV.Extent();
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
myImages.UnBind(aV);
}
//
*/

View File

@ -0,0 +1,118 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _GEOMAlgo_GlueAnalyser_HeaderFile
#define _GEOMAlgo_GlueAnalyser_HeaderFile
#ifndef _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#endif
#ifndef _TopTools_ListOfShape_HeaderFile
#include <TopTools_ListOfShape.hxx>
#endif
#ifndef _GEOMAlgo_Gluer_HeaderFile
#include <GEOMAlgo_Gluer.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _TopAbs_ShapeEnum_HeaderFile
#include <TopAbs_ShapeEnum.hxx>
#endif
class GEOMAlgo_ListOfCoupleOfShapes;
class TopTools_ListOfShape;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class GEOMAlgo_GlueAnalyser : public GEOMAlgo_Gluer {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT GEOMAlgo_GlueAnalyser();
Standard_EXPORT virtual ~GEOMAlgo_GlueAnalyser();
Standard_EXPORT virtual void Perform() ;
Standard_EXPORT Standard_Boolean HasSolidsToGlue() const;
Standard_EXPORT const GEOMAlgo_ListOfCoupleOfShapes& SolidsToGlue() const;
Standard_EXPORT Standard_Boolean HasSolidsAlone() const;
Standard_EXPORT const TopTools_ListOfShape& SolidsAlone() const;
protected:
// Methods PROTECTED
//
Standard_EXPORT void DetectVertices() ;
Standard_EXPORT void DetectEdges() ;
Standard_EXPORT void DetectFaces() ;
Standard_EXPORT void DetectShapes(const TopAbs_ShapeEnum aType) ;
Standard_EXPORT void DetectSolids() ;
// Fields PROTECTED
//
GEOMAlgo_ListOfCoupleOfShapes mySolidsToGlue;
TopTools_ListOfShape mySolidsAlone;
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,26 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <GEOMAlgo_GlueAnalyser.jxx>

View File

@ -0,0 +1,9 @@
#ifndef _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#endif
#ifndef _TopTools_ListOfShape_HeaderFile
#include <TopTools_ListOfShape.hxx>
#endif
#ifndef _GEOMAlgo_GlueAnalyser_HeaderFile
#include <GEOMAlgo_GlueAnalyser.hxx>
#endif

View File

@ -14,11 +14,14 @@ uses
ShapeEnum from TopAbs,
Shape from TopoDS,
Edge from TopoDS,
Face from TopoDS,
Face from TopoDS,
Vertex from TopoDS,
ListOfShape from TopTools,
DataMapOfShapeShape from TopTools,
DataMapOfShapeListOfShape from TopTools,
Context from IntTools,
PassKey from GEOMAlgo
--raises
is
@ -33,17 +36,17 @@ is
returns Boolean from Standard;
Perform(me:out)
is redefined;
is redefined;
AloneShapes(me)
returns Integer from Standard;
CheckData(me:out)
is redefined protected;
CheckResult (me:out)
is redefined protected;
BuildResult (me:out)
is protected;
MakeVertices(me:out)
is protected;
@ -76,6 +79,10 @@ is
aPK:out PassKey from GEOMAlgo)
is protected;
MakeVertex(me:out;
aLV : ListOfShape from TopTools;
aNewV: out Vertex from TopoDS)
is protected;
MakeEdge(me:out;
aEdge : Edge from TopoDS;
aNewEdge: out Edge from TopoDS)
@ -101,13 +108,10 @@ is
---C++:return const &
fields
myCheckGeometry : Boolean from Standard is protected;
myTol : Real from Standard is protected;
myImages : DataMapOfShapeListOfShape from TopTools is protected;
myOrigins : DataMapOfShapeShape from TopTools is protected;
myNbAlone : Integer from Standard is protected;
myCheckGeometry : Boolean from Standard is protected;
myImages : DataMapOfShapeListOfShape from TopTools is protected;
myOrigins : DataMapOfShapeShape from TopTools is protected;
myContext : Context from IntTools is protected;
myTypeResult: ShapeEnum from TopAbs is protected;
myTol : Real from Standard is protected;
end Gluer;

View File

@ -11,6 +11,7 @@
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <gp_XYZ.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
@ -18,7 +19,6 @@
#include <Bnd_Box.hxx>
#include <Bnd_HArray1OfBox.hxx>
#include <Bnd_BoundSortBox.hxx>
#include <BRepBndLib.hxx>
#include <TopLoc_Location.hxx>
#include <TopAbs_ShapeEnum.hxx>
@ -45,11 +45,15 @@
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRepLib.hxx>
#include <BRepTools.hxx>
#include <BRepBndLib.hxx>
#include <IntTools_Context.hxx>
#include <BOPTools_Tools.hxx>
#include <BOPTools_Tools3D.hxx>
#include <BOPTools_Tools2D.hxx>
#include <BOP_CorrectTolerances.hxx>
#include <GEOMAlgo_IndexedDataMapOfIntegerShape.hxx>
#include <GEOMAlgo_IndexedDataMapOfShapeBox.hxx>
@ -68,7 +72,7 @@ GEOMAlgo_Gluer::GEOMAlgo_Gluer()
myTolerance=0.0001;
myTol=myTolerance;
myCheckGeometry=Standard_True;
myTypeResult=TopAbs_SOLID;
myNbAlone=0;
}
//=======================================================================
//function : ~GEOMAlgo_Gluer
@ -93,7 +97,14 @@ Standard_Boolean GEOMAlgo_Gluer::CheckGeometry() const
{
return myCheckGeometry;
}
//=======================================================================
//function : AloneShapes
//purpose :
//=======================================================================
Standard_Integer GEOMAlgo_Gluer::AloneShapes()const
{
return myNbAlone;
}
//=======================================================================
//function : Images
//purpose :
@ -120,118 +131,139 @@ void GEOMAlgo_Gluer::Perform()
myWarningStatus=0;
//
Standard_Integer i;
const Standard_Integer aNb=9;
const Standard_Integer aNb=8;
void (GEOMAlgo_Gluer::* pF[aNb])()={
&GEOMAlgo_Gluer::CheckData, &GEOMAlgo_Gluer::InnerTolerance,
&GEOMAlgo_Gluer::MakeVertices, &GEOMAlgo_Gluer::MakeEdges,
&GEOMAlgo_Gluer::MakeFaces, &GEOMAlgo_Gluer::MakeShells,
&GEOMAlgo_Gluer::MakeSolids, &GEOMAlgo_Gluer::BuildResult,
&GEOMAlgo_Gluer::CheckResult
&GEOMAlgo_Gluer::MakeSolids, &GEOMAlgo_Gluer::CheckResult
};
//
//TimeReset();
//StartChrono();
//
for (i=0; i<aNb; ++i) {
(this->*pF[i])();
if (myErrorStatus) {
return;
}
}
//
//StopChrono();
//TimeShow();
}
//=======================================================================
//function : CheckResult
//function : MakeVertices
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::CheckResult()
void GEOMAlgo_Gluer::MakeVertices()
{
myErrorStatus=0;
//
if (myResult.IsNull()) {
myErrorStatus=6;
return;
Standard_Integer j, i, aNbV, aIndex, aNbVSD;
TColStd_ListIteratorOfListOfInteger aIt;
Handle(Bnd_HArray1OfBox) aHAB;
Bnd_BoundSortBox aBSB;
TopoDS_Shape aSTmp, aVF;
TopoDS_Vertex aVnew;
TopTools_IndexedMapOfShape aMV, aMVProcessed;
TopTools_ListIteratorOfListOfShape aItS;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
TopTools_DataMapOfShapeListOfShape aMVV;
GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
GEOMAlgo_IndexedDataMapOfShapeBox aMSB;
//
TopExp::MapShapes(myShape, TopAbs_VERTEX, aMV);
aNbV=aMV.Extent();
if (!aNbV) {
myErrorStatus=2; // no vertices in source shape
return;
}
//
Standard_Boolean bFound;
Standard_Integer i, j, aNbS, aNbFS, aNbSx;
TopTools_IndexedMapOfShape aMS, aMFS;
TopTools_IndexedDataMapOfShapeListOfShape aMFR;
//
TopExp::MapShapesAndAncestors(myResult, TopAbs_FACE, myTypeResult, aMFR);
TopExp::MapShapes(myResult, myTypeResult, aMS);
aHAB=new Bnd_HArray1OfBox(1, aNbV);
//
aNbS=aMS.Extent();
for (i=1; i<=aNbS; ++i) {
const TopoDS_Shape& aSolid=aMS(i);
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
Bnd_Box aBox;
//
aMFS.Clear();
TopExp::MapShapes(aSolid, TopAbs_FACE, aMFS);
aBox.SetGap(myTol);
BRepBndLib::Add(aV, aBox);
aHAB->SetValue(i, aBox);
aMIS.Add(i, aV);
aMSB.Add(aV, aBox);
}
//
aBSB.Initialize(aHAB);
//
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
//
bFound=Standard_False;
aNbFS=aMFS.Extent();
for (j=1; j<=aNbFS; ++j) {
const TopoDS_Shape& aFS=aMFS(j);
if (aMFR.Contains(aFS)) {
const TopTools_ListOfShape& aLSx=aMFR.FindFromKey(aFS);
aNbSx=aLSx.Extent();
if (aNbSx==2) {
bFound=!bFound;
break;
}
if (aMVProcessed.Contains(aV)) {
continue;
}
//
const Bnd_Box& aBoxV=aMSB.FindFromKey(aV);
const TColStd_ListOfInteger& aLI=aBSB.Compare(aBoxV);
aNbVSD=aLI.Extent();
if (!aNbVSD) {
myErrorStatus=3; // it must not be
return;
}
//
// Images
//
TopTools_ListOfShape aLVSD;
//
aIt.Initialize(aLI);
for (j=0; aIt.More(); aIt.Next(), ++j) {
aIndex=aIt.Value();
const TopoDS_Shape& aVx=aMIS.FindFromKey(aIndex);
if(!j) {
aVF=aVx;
}
aLVSD.Append(aVx);
aMVProcessed.Add(aVx);
}
//
myImages.Bind(aVF, aLVSD);
}
//
// Make new vertices
aMV.Clear();
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aV=aItIm.Key();
const TopTools_ListOfShape& aLVSD=aItIm.Value();
aNbVSD=aLVSD.Extent();
if (aNbVSD>1) {
aMV.Add(aV);
MakeVertex(aLVSD, aVnew);
aMVV.Bind(aVnew, aLVSD);
}
}
//
// UnBind old vertices
aNbV=aMV.Extent();
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
myImages.UnBind(aV);
}
//
// Bind new vertices
aItIm.Initialize(aMVV);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aV=aItIm.Key();
const TopTools_ListOfShape& aLVSD=aItIm.Value();
myImages.Bind(aV, aLVSD);
}
//
// Origins
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aV=aItIm.Key();
const TopTools_ListOfShape& aLVSD=aItIm.Value();
//
aItS.Initialize(aLVSD);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aVSD=aItS.Value();
if (!myOrigins.IsBound(aVSD)) {
myOrigins.Bind(aVSD, aV);
}
}
//
if (!bFound) {
myWarningStatus=1;
break;
}
}
}
//=======================================================================
//function : CheckData
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::CheckData()
{
myErrorStatus=0;
//
if (myShape.IsNull()) {
myErrorStatus=5;
return;
}
}
//=======================================================================
//function : InnerTolerance
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::InnerTolerance()
{
myErrorStatus=0;
//
Standard_Integer i;
Standard_Real aX[3][2], dH, dHmin, aCoef, aTolTresh;
Bnd_Box aBox;
//
BRepBndLib::Add(myShape, aBox);
aBox.Get(aX[0][0], aX[1][0], aX[2][0], aX[0][1], aX[1][1], aX[2][1]);
//
dHmin=aX[0][1]-aX[0][0];
for (i=1; i<3; ++i) {
dH=aX[i][1]-aX[i][0];
if (dH<dHmin) {
dHmin=dH;
}
}
//
myTol=myTolerance;
aCoef=0.01;
aTolTresh=aCoef*dHmin;
if (myTol>aTolTresh) {
myTol=aTolTresh;
}
}
//=======================================================================
@ -242,17 +274,25 @@ void GEOMAlgo_Gluer::MakeSolids()
{
myErrorStatus=0;
//
Standard_Integer i, aNbS;
Standard_Integer aNbS;
TopAbs_Orientation anOr;
TopoDS_Compound aCmp;
TopoDS_Solid aNewSolid;
TopTools_IndexedMapOfShape aMS;
TopExp_Explorer aExp;
TopExp_Explorer aExpS, aExp;
BRep_Builder aBB;
//
TopExp::MapShapes(myShape, TopAbs_SOLID, aMS);
aBB.MakeCompound(aCmp);
//
aNbS=aMS.Extent();
for (i=1; i<=aNbS; ++i) {
const TopoDS_Solid& aSolid=TopoDS::Solid(aMS(i));
aExpS.Init(myShape, TopAbs_SOLID);
for (; aExpS.More(); aExpS.Next()) {
const TopoDS_Solid& aSolid=TopoDS::Solid(aExpS.Current());
if (aMS.Contains(aSolid)) {
continue;
}
aMS.Add(aSolid);
//
anOr=aSolid.Orientation();
//
aBB.MakeSolid(aNewSolid);
@ -264,11 +304,22 @@ void GEOMAlgo_Gluer::MakeSolids()
const TopoDS_Shape& aShellR=myOrigins.Find(aShell);
aBB.Add(aNewSolid, aShellR);
}
//
TopTools_ListOfShape aLS;
//
aLS.Append(aSolid);
myImages.Bind(aNewSolid, aLS);
myOrigins.Bind(aSolid, aNewSolid);
//
aBB.Add(aCmp, aNewSolid);
}
//
myResult=aCmp;
//
aNbS=aMS.Extent();
if (aNbS) {
Standard_Real aTol=1.e-7;
BOP_CorrectTolerances::CorrectCurveOnSurface(myResult);
}
}
//=======================================================================
@ -383,7 +434,7 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType)
}
// check geometric coincidence
if (myCheckGeometry) {
iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTol, myContext); //XX
iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTol, myContext);
if (iErr) {
myErrorStatus=200;
return;
@ -427,116 +478,101 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType)
}
}
//=======================================================================
//function : MakeVertices
//function : CheckResult
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::MakeVertices()
void GEOMAlgo_Gluer::CheckResult()
{
myErrorStatus=0;
//
Standard_Boolean bFound;
Standard_Integer i, aNbV, aIndex, aNbVSD;
TColStd_ListIteratorOfListOfInteger aIt;
Handle(Bnd_HArray1OfBox) aHAB;
Bnd_BoundSortBox aBSB;
TopoDS_Shape aSTmp;
TopTools_IndexedMapOfShape aMV;
TopTools_ListIteratorOfListOfShape aItS;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
GEOMAlgo_IndexedDataMapOfShapeBox aMSB;
//
TopExp::MapShapes(myShape, TopAbs_VERTEX, aMV);
aNbV=aMV.Extent();
if (!aNbV) {
myErrorStatus=2; // no vertices in source shape
return;
if (myResult.IsNull()) {
myErrorStatus=6;
return;
}
//
Standard_Boolean bFound;
Standard_Integer i, j, aNbS, aNbFS, aNbSx;
TopTools_IndexedMapOfShape aMS, aMFS;
TopTools_IndexedDataMapOfShapeListOfShape aMFR;
//
aHAB=new Bnd_HArray1OfBox(1, aNbV);
TopExp::MapShapesAndAncestors(myResult, TopAbs_FACE, TopAbs_SOLID, aMFR);
TopExp::MapShapes(myResult, TopAbs_SOLID, aMS);
//
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
Bnd_Box aBox;
myNbAlone=0;
aNbS=aMS.Extent();
for (i=1; i<=aNbS; ++i) {
const TopoDS_Shape& aSolid=aMS(i);
//
aBox.SetGap(myTol);//XX
BRepBndLib::Add(aV, aBox);
aHAB->SetValue(i, aBox);
aMIS.Add(i, aV);
aMSB.Add(aV, aBox);
}
//
aBSB.Initialize(aHAB);
//
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
const Bnd_Box& aBoxV=aMSB.FindFromKey(aV);
const TColStd_ListOfInteger& aLI=aBSB.Compare(aBoxV);
aNbVSD=aLI.Extent();
if (!aNbVSD) {
myErrorStatus=3; // it must not be
return;
}
//
// Images
TopTools_ListOfShape aLVSD;
TopoDS_Shape aVF;
aMFS.Clear();
TopExp::MapShapes(aSolid, TopAbs_FACE, aMFS);
//
bFound=Standard_False;
aIt.Initialize(aLI);
for (; aIt.More(); aIt.Next()) {
aIndex=aIt.Value();
const TopoDS_Shape& aVx=aMIS.FindFromKey(aIndex);
if (myImages.IsBound(aVx)) {
bFound=Standard_True;
aVF=aVx;
aNbFS=aMFS.Extent();
for (j=1; j<=aNbFS; ++j) {
const TopoDS_Shape& aFS=aMFS(j);
if (aMFR.Contains(aFS)) {
const TopTools_ListOfShape& aLSx=aMFR.FindFromKey(aFS);
aNbSx=aLSx.Extent();
if (aNbSx==2) {
bFound=!bFound;
break;
}
}
aLVSD.Append(aVx);
}
if (bFound) {
TopTools_ListOfShape& aLVI=myImages.ChangeFind(aVF);
aLVI.Append(aLVSD);
}
else {
myImages.Bind(aV, aLVSD);
}
}
//
// Refine Images
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
TopTools_ListOfShape aLVSDNew;
TopTools_MapOfShape aM;
//
const TopoDS_Shape& aV=aItIm.Key();
const TopTools_ListOfShape& aLVSD=aItIm.Value();
aItS.Initialize(aLVSD);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aVSD=aItS.Value();
if (aM.Add(aVSD)) {
aLVSDNew.Append(aVSD);
}
if (!bFound) {
myWarningStatus=1;
++myNbAlone;
//break;
}
TopTools_ListOfShape& aLVI=myImages.ChangeFind(aV);
aLVI.Clear();
aLVI.Append(aLVSDNew);
}
}
//=======================================================================
//function : CheckData
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::CheckData()
{
myErrorStatus=0;
//
// Origins
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aV=aItIm.Key();
//
const TopTools_ListOfShape& aLVSD=myImages.Find(aV);
aItS.Initialize(aLVSD);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aVSD=aItS.Value();
if (!myOrigins.IsBound(aVSD)) {
myOrigins.Bind(aVSD, aV);
}
if (myShape.IsNull()) {
myErrorStatus=5;
return;
}
}
//=======================================================================
//function : InnerTolerance
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::InnerTolerance()
{
myErrorStatus=0;
//
/*
Standard_Integer i;
Standard_Real aX[3][2], dH, dHmin, aCoef, aTolTresh;
Bnd_Box aBox;
//
BRepBndLib::Add(myShape, aBox);
aBox.Get(aX[0][0], aX[1][0], aX[2][0], aX[0][1], aX[1][1], aX[2][1]);
//
dHmin=aX[0][1]-aX[0][0];
for (i=1; i<3; ++i) {
dH=aX[i][1]-aX[i][0];
if (dH<dHmin) {
dHmin=dH;
}
}
//
myTol=myTolerance;
aCoef=0.01;
aTolTresh=aCoef*dHmin;
if (myTol>aTolTresh) {
myTol=aTolTresh;
}
*/
myTol=myTolerance;
}
//=======================================================================
//function : FacePassKey
@ -588,18 +624,68 @@ void GEOMAlgo_Gluer::EdgePassKey(const TopoDS_Edge& aE,
aPK.SetIds(aVR1, aVR2);
}
//=======================================================================
//function : MakeVertex
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::MakeVertex(const TopTools_ListOfShape& aLV,
TopoDS_Vertex& aNewVertex)
{
Standard_Integer aNbV;
Standard_Real aTolV, aD, aDmax;
gp_XYZ aGC;
gp_Pnt aP3D, aPGC;
TopoDS_Vertex aVx;
BRep_Builder aBB;
TopTools_ListIteratorOfListOfShape aIt;
//
aNbV=aLV.Extent();
if (!aNbV) {
return;
}
//
// center of gravity
aGC.SetCoord(0.,0.,0.);
aIt.Initialize(aLV);
for (; aIt.More(); aIt.Next()) {
aVx=TopoDS::Vertex(aIt.Value());
aP3D=BRep_Tool::Pnt(aVx);
aGC+=aP3D.XYZ();
}
aGC/=(Standard_Real)aNbV;
aPGC.SetXYZ(aGC);
//
// tolerance value
aDmax=-1.;
aIt.Initialize(aLV);
for (; aIt.More(); aIt.Next()) {
aVx=TopoDS::Vertex(aIt.Value());
aP3D=BRep_Tool::Pnt(aVx);
aTolV=BRep_Tool::Tolerance(aVx);
aD=aPGC.Distance(aP3D)+aTolV;
if (aD>aDmax) {
aDmax=aD;
}
}
//
aBB.MakeVertex (aNewVertex, aPGC, aDmax);
}
//=======================================================================
//function : MakeEdge
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE,
TopoDS_Edge& aNewEdge)
{
//modified by NIZNHY-PKV Thu Dec 30 11:15:23 2004 f
myErrorStatus=0;
//
Standard_Boolean bIsDE;
Standard_Real aT1, aT2;
TopoDS_Vertex aV1, aV2, aVR1, aVR2;
TopoDS_Edge aEx;
//
bIsDE=BRep_Tool::Degenerated(aE);
//
aEx=aE;
aEx.Orientation(TopAbs_FORWARD);
//
@ -613,7 +699,31 @@ void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE,
aVR2=TopoDS::Vertex(myOrigins.Find(aV2));
aVR2.Orientation(TopAbs_REVERSED);
//
BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
if (bIsDE) {
Standard_Real aTol;
BRep_Builder aBB;
TopoDS_Edge E;
TopAbs_Orientation anOrE;
//
anOrE=aE.Orientation();
aTol=BRep_Tool::Tolerance(aE);
//
E=aEx;
E.EmptyCopy();
//
aBB.Add (E, aVR1);
aBB.Add (E, aVR2);
aBB.Range(E, aT1, aT2);
aBB.Degenerated(E, Standard_True);
aBB.UpdateEdge(E, aTol);
//
aNewEdge=E;
}
//
else {
BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
}
//modified by NIZNHY-PKV Thu Dec 30 11:15:28 2004 t
}
//
//=======================================================================
@ -625,13 +735,14 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
{
myErrorStatus=0;
//
Standard_Boolean bIsToReverse;
Standard_Real aTol;
Standard_Boolean bIsToReverse, bIsUPeriodic;
Standard_Real aTol, aUMin, aUMax, aVMin, aVMax;
TopoDS_Edge aER;
TopoDS_Wire newWire;
TopoDS_Face aFFWD, newFace;
TopLoc_Location aLoc;
Handle(Geom_Surface) aS;
Handle(Geom2d_Curve) aC2D;
TopExp_Explorer aExpW, aExpE;
BRep_Builder aBB;
//
@ -639,7 +750,9 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
aFFWD.Orientation(TopAbs_FORWARD);
//
aS=BRep_Tool::Surface(aFFWD, aLoc);
bIsUPeriodic=GEOMAlgo_Tools::IsUPeriodic(aS);
aTol=BRep_Tool::Tolerance(aFFWD);
BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
//
aBB.MakeFace (newFace, aS, aLoc, aTol);
//
@ -651,13 +764,23 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
for (; aExpE.More(); aExpE.Next()) {
const TopoDS_Edge& aE=TopoDS::Edge(aExpE.Current());
aER=TopoDS::Edge(myOrigins.Find(aE));
//
aER.Orientation(TopAbs_FORWARD);
// build p-curve
BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aER, aFFWD);
// orient image
bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aER, aE, myContext);
if (bIsToReverse) {
aER.Reverse();
if (!BRep_Tool::Degenerated(aER)) {//modified by NIZNHY-PKV Thu Dec 30 11:31:37 2004 ft
// build p-curve
if (bIsUPeriodic) {
GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax);
}
BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aER, aFFWD);
// orient image
bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aER, aE, myContext);
if (bIsToReverse) {
aER.Reverse();
}
}
else {
aER.Orientation(aE.Orientation());
}
//
aBB.Add(newWire, aER);
@ -683,54 +806,37 @@ Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR,
bRet=Standard_False;
//
aExp.Init(aF, TopAbs_EDGE);
if (!aExp.More()) {
return bRet;
for (; aExp.More(); aExp.Next()) {
const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
//modified by NIZNHY-PKV Thu Dec 30 11:38:05 2004 f
if (BRep_Tool::Degenerated(aE)) {
continue;
}
//modified by NIZNHY-PKV Thu Dec 30 11:38:08 2004 t
const TopoDS_Edge& aER=TopoDS::Edge(myOrigins.Find(aE));
//
aC3D=BRep_Tool::Curve(aE, aT1, aT2);
aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
aC3D->D0(aT, aP);
myContext.ProjectPointOnEdge(aP, aER, aTR);
//
BOPTools_Tools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNF);
if (aF.Orientation()==TopAbs_REVERSED) {
aDNF.Reverse();
}
//
BOPTools_Tools3D::GetNormalToFaceOnEdge (aER, aFR, aTR, aDNFR);
if (aFR.Orientation()==TopAbs_REVERSED) {
aDNFR.Reverse();
}
//
aScPr=aDNF*aDNFR;
return (aScPr<0.);
}
const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
const TopoDS_Edge& aER=TopoDS::Edge(myOrigins.Find(aE));
//
aC3D=BRep_Tool::Curve(aE, aT1, aT2);
aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
aC3D->D0(aT, aP);
myContext.ProjectPointOnEdge(aP, aER, aTR);
//
BOPTools_Tools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNF);
if (aF.Orientation()==TopAbs_REVERSED) {
aDNF.Reverse();
}
//
BOPTools_Tools3D::GetNormalToFaceOnEdge (aER, aFR, aTR, aDNFR);
if (aFR.Orientation()==TopAbs_REVERSED) {
aDNFR.Reverse();
}
//
aScPr=aDNF*aDNFR;
return (aScPr<0.);
return bRet;
}
//
//=======================================================================
//function : BuildResult
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::BuildResult()
{
TopoDS_Compound aCmp;
BRep_Builder aBB;
TopAbs_ShapeEnum aType;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
//
aBB.MakeCompound(aCmp);
//
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aIm=aItIm.Key();
aType=aIm.ShapeType();
if(aType==myTypeResult) {
aBB.Add(aCmp, aIm);
}
}
myResult=aCmp;
}
//
// ErrorStatus
//
@ -748,81 +854,37 @@ void GEOMAlgo_Gluer::BuildResult()
//
// 1 - some shapes can not be glued by faces
//
/*
//
// CHRONOMETER
//
#include <Standard_Static.hxx>
#include <OSD_Chronometer.hxx>
static Standard_Real S_ChronoTime;
Standard_STATIC(OSD_Chronometer, S_Chrono);
static void StartChrono();
static void StopChrono();
static void TimeShow();
static void TimeReset();
static int HasChrono();
//=======================================================================
//function : StartChrono
//function : BuildResult
//purpose :
//=======================================================================
void StartChrono()
void GEOMAlgo_Gluer::BuildResult()
{
if (HasChrono()){
S_Chrono().Reset();
S_Chrono().Start();
}
}
//=======================================================================
//function : StopChrono
//purpose :
//=======================================================================
void StopChrono()
{
if (HasChrono()) {
Standard_Real Chrono;
S_Chrono().Stop();
S_Chrono().Show(Chrono);
//
S_ChronoTime+=Chrono;
}
}
//=======================================================================
//function : TimeReset
//purpose :
//=======================================================================
void TimeReset()
{
if (HasChrono()){
S_ChronoTime=0;
}
}
//=======================================================================
//function : TimeShow
//purpose :
//=======================================================================
void TimeShow()
{
if (HasChrono()){
cout << "Tps: " << S_ChronoTime << endl;
}
}
//=======================================================================
//function : HasChrono
//purpose :
//=======================================================================
int HasChrono()
{
char *xr=getenv ("XCHRONO");
if (xr!=NULL){
if (!strcmp (xr, "yes")) {
return 1;
Standard_Boolean bAdded;
TopoDS_Compound aCmp;
BRep_Builder aBB;
TopAbs_ShapeEnum aType;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
//
aBB.MakeCompound(aCmp);
//
bAdded=Standard_False;
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aIm=aItIm.Key();
aType=aIm.ShapeType();
if(aType==TopAbs_SOLID) {
bAdded=Standard_True;
aBB.Add(aCmp, aIm);
}
}
return 0;
myResult=aCmp;
//
if (bAdded) {
Standard_Real aTol=1.e-7;
BOP_CorrectTolerances::CorrectCurveOnSurface(myResult);
//BRepLib::SameParameter(myResult, aTol, bAdded);
}
}
*/

View File

@ -25,27 +25,29 @@
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _TopTools_DataMapOfShapeListOfShape_HeaderFile
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#endif
#ifndef _TopTools_DataMapOfShapeShape_HeaderFile
#include <TopTools_DataMapOfShapeShape.hxx>
#endif
#ifndef _IntTools_Context_HeaderFile
#include <IntTools_Context.hxx>
#endif
#ifndef _TopAbs_ShapeEnum_HeaderFile
#include <TopAbs_ShapeEnum.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile
#include <GEOMAlgo_ShapeAlgo.hxx>
#endif
#ifndef _TopAbs_ShapeEnum_HeaderFile
#include <TopAbs_ShapeEnum.hxx>
#endif
class TopoDS_Edge;
class GEOMAlgo_PassKey;
class TopoDS_Face;
class TopTools_ListOfShape;
class TopoDS_Vertex;
class TopTools_DataMapOfShapeListOfShape;
class TopTools_DataMapOfShapeShape;
@ -80,6 +82,7 @@ Standard_EXPORT virtual ~GEOMAlgo_Gluer();
Standard_EXPORT void SetCheckGeometry(const Standard_Boolean aFlag) ;
Standard_EXPORT Standard_Boolean CheckGeometry() const;
Standard_EXPORT virtual void Perform() ;
Standard_EXPORT Standard_Integer AloneShapes() const;
Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& Images() const;
Standard_EXPORT const TopTools_DataMapOfShapeShape& Origins() const;
@ -93,7 +96,6 @@ protected:
//
Standard_EXPORT virtual void CheckData() ;
Standard_EXPORT virtual void CheckResult() ;
Standard_EXPORT void BuildResult() ;
Standard_EXPORT void MakeVertices() ;
Standard_EXPORT void MakeEdges() ;
Standard_EXPORT void MakeFaces() ;
@ -103,6 +105,7 @@ Standard_EXPORT void MakeSolids() ;
Standard_EXPORT void InnerTolerance() ;
Standard_EXPORT void EdgePassKey(const TopoDS_Edge& aE,GEOMAlgo_PassKey& aPK) ;
Standard_EXPORT void FacePassKey(const TopoDS_Face& aF,GEOMAlgo_PassKey& aPK) ;
Standard_EXPORT void MakeVertex(const TopTools_ListOfShape& aLV,TopoDS_Vertex& aNewV) ;
Standard_EXPORT void MakeEdge(const TopoDS_Edge& aEdge,TopoDS_Edge& aNewEdge) ;
Standard_EXPORT void MakeFace(const TopoDS_Face& aFace,TopoDS_Face& aNewEdge) ;
Standard_EXPORT Standard_Boolean IsToReverse(const TopoDS_Face& aFR,const TopoDS_Face& aF) ;
@ -111,11 +114,10 @@ Standard_EXPORT Standard_Boolean IsToReverse(const TopoDS_Face& aFR,const Topo
// Fields PROTECTED
//
Standard_Boolean myCheckGeometry;
Standard_Real myTol;
TopTools_DataMapOfShapeListOfShape myImages;
TopTools_DataMapOfShapeShape myOrigins;
IntTools_Context myContext;
TopAbs_ShapeEnum myTypeResult;
Standard_Real myTol;
Standard_Integer myNbAlone;
private:

View File

@ -7,6 +7,12 @@
#ifndef _TopoDS_Face_HeaderFile
#include <TopoDS_Face.hxx>
#endif
#ifndef _TopTools_ListOfShape_HeaderFile
#include <TopTools_ListOfShape.hxx>
#endif
#ifndef _TopoDS_Vertex_HeaderFile
#include <TopoDS_Vertex.hxx>
#endif
#ifndef _TopTools_DataMapOfShapeListOfShape_HeaderFile
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#endif

View File

@ -0,0 +1,131 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_HeaderFile
#define _GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_HeaderFile
#ifndef _Standard_Address_HeaderFile
#include <Standard_Address.hxx>
#endif
#ifndef _Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile
#include <Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
class Standard_NoMoreObject;
class Standard_NoSuchObject;
class GEOMAlgo_ListOfCoupleOfShapes;
class GEOMAlgo_CoupleOfShapes;
class GEOMAlgo_ListNodeOfListOfCoupleOfShapes;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class GEOMAlgo_ListIteratorOfListOfCoupleOfShapes {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT GEOMAlgo_ListIteratorOfListOfCoupleOfShapes();
Standard_EXPORT GEOMAlgo_ListIteratorOfListOfCoupleOfShapes(const GEOMAlgo_ListOfCoupleOfShapes& L);
Standard_EXPORT void Initialize(const GEOMAlgo_ListOfCoupleOfShapes& L) ;
Standard_Boolean More() const;
Standard_EXPORT void Next() ;
Standard_EXPORT GEOMAlgo_CoupleOfShapes& Value() const;
friend class GEOMAlgo_ListOfCoupleOfShapes;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
Standard_Address current;
Standard_Address previous;
};
#define Item GEOMAlgo_CoupleOfShapes
#define Item_hxx <GEOMAlgo_CoupleOfShapes.hxx>
#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_hxx <GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes
#define TCollection_ListIterator_hxx <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_()
#define TCollection_List GEOMAlgo_ListOfCoupleOfShapes
#define TCollection_List_hxx <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#include <TCollection_ListIterator.lxx>
#undef Item
#undef Item_hxx
#undef TCollection_ListNode
#undef TCollection_ListNode_hxx
#undef TCollection_ListIterator
#undef TCollection_ListIterator_hxx
#undef Handle_TCollection_ListNode
#undef TCollection_ListNode_Type_
#undef TCollection_List
#undef TCollection_List_hxx
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,52 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
#ifndef _Standard_NoMoreObject_HeaderFile
#include <Standard_NoMoreObject.hxx>
#endif
#ifndef _Standard_NoSuchObject_HeaderFile
#include <Standard_NoSuchObject.hxx>
#endif
#ifndef _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#endif
#ifndef _GEOMAlgo_CoupleOfShapes_HeaderFile
#include <GEOMAlgo_CoupleOfShapes.hxx>
#endif
#ifndef _GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile
#include <GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#endif
#define Item GEOMAlgo_CoupleOfShapes
#define Item_hxx <GEOMAlgo_CoupleOfShapes.hxx>
#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_hxx <GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes
#define TCollection_ListIterator_hxx <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_()
#define TCollection_List GEOMAlgo_ListOfCoupleOfShapes
#define TCollection_List_hxx <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#include <TCollection_ListIterator.gxx>

View File

@ -0,0 +1,130 @@
// File generated by CPPExt (Transient)
//
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile
#define _GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile
#include <Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#endif
#ifndef _GEOMAlgo_CoupleOfShapes_HeaderFile
#include <GEOMAlgo_CoupleOfShapes.hxx>
#endif
#ifndef _TCollection_MapNode_HeaderFile
#include <TCollection_MapNode.hxx>
#endif
#ifndef _TCollection_MapNodePtr_HeaderFile
#include <TCollection_MapNodePtr.hxx>
#endif
class GEOMAlgo_CoupleOfShapes;
class GEOMAlgo_ListOfCoupleOfShapes;
class GEOMAlgo_ListIteratorOfListOfCoupleOfShapes;
class GEOMAlgo_ListNodeOfListOfCoupleOfShapes : public TCollection_MapNode {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
GEOMAlgo_ListNodeOfListOfCoupleOfShapes(const GEOMAlgo_CoupleOfShapes& I,const TCollection_MapNodePtr& n);
GEOMAlgo_CoupleOfShapes& Value() const;
Standard_EXPORT ~GEOMAlgo_ListNodeOfListOfCoupleOfShapes();
// Type management
//
Standard_EXPORT friend Handle_Standard_Type& GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
GEOMAlgo_CoupleOfShapes myValue;
};
#define Item GEOMAlgo_CoupleOfShapes
#define Item_hxx <GEOMAlgo_CoupleOfShapes.hxx>
#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_hxx <GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes
#define TCollection_ListIterator_hxx <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_()
#define TCollection_List GEOMAlgo_ListOfCoupleOfShapes
#define TCollection_List_hxx <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#include <TCollection_ListNode.lxx>
#undef Item
#undef Item_hxx
#undef TCollection_ListNode
#undef TCollection_ListNode_hxx
#undef TCollection_ListIterator
#undef TCollection_ListIterator_hxx
#undef Handle_TCollection_ListNode
#undef TCollection_ListNode_Type_
#undef TCollection_List
#undef TCollection_List_hxx
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,98 @@
// File generated by CPPExt (Transient)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#ifndef _Standard_TypeMismatch_HeaderFile
#include <Standard_TypeMismatch.hxx>
#endif
#ifndef _GEOMAlgo_CoupleOfShapes_HeaderFile
#include <GEOMAlgo_CoupleOfShapes.hxx>
#endif
#ifndef _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#endif
#ifndef _GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_HeaderFile
#include <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
#endif
GEOMAlgo_ListNodeOfListOfCoupleOfShapes::~GEOMAlgo_ListNodeOfListOfCoupleOfShapes() {}
Standard_EXPORT Handle_Standard_Type& GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_()
{
static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode);
if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode);
static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_ListNodeOfListOfCoupleOfShapes",
sizeof(GEOMAlgo_ListNodeOfListOfCoupleOfShapes),
1,
(Standard_Address)_Ancestors,
(Standard_Address)NULL);
return _aType;
}
// DownCast method
// allow safe downcasting
//
const Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes) Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes) _anOtherObject;
if (!AnObject.IsNull()) {
if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_ListNodeOfListOfCoupleOfShapes))) {
_anOtherObject = Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)((Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)&)AnObject);
}
}
return _anOtherObject ;
}
const Handle(Standard_Type)& GEOMAlgo_ListNodeOfListOfCoupleOfShapes::DynamicType() const
{
return STANDARD_TYPE(GEOMAlgo_ListNodeOfListOfCoupleOfShapes) ;
}
Standard_Boolean GEOMAlgo_ListNodeOfListOfCoupleOfShapes::IsKind(const Handle(Standard_Type)& AType) const
{
return (STANDARD_TYPE(GEOMAlgo_ListNodeOfListOfCoupleOfShapes) == AType || TCollection_MapNode::IsKind(AType));
}
Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes::~Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes() {}
#define Item GEOMAlgo_CoupleOfShapes
#define Item_hxx <GEOMAlgo_CoupleOfShapes.hxx>
#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_hxx <GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes
#define TCollection_ListIterator_hxx <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_()
#define TCollection_List GEOMAlgo_ListOfCoupleOfShapes
#define TCollection_List_hxx <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#include <TCollection_ListNode.gxx>

View File

@ -0,0 +1,157 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile
#define _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile
#ifndef _Standard_Address_HeaderFile
#include <Standard_Address.hxx>
#endif
#ifndef _Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile
#include <Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
class Standard_NoSuchObject;
class GEOMAlgo_ListIteratorOfListOfCoupleOfShapes;
class GEOMAlgo_CoupleOfShapes;
class GEOMAlgo_ListNodeOfListOfCoupleOfShapes;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class GEOMAlgo_ListOfCoupleOfShapes {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT GEOMAlgo_ListOfCoupleOfShapes();
Standard_EXPORT void Assign(const GEOMAlgo_ListOfCoupleOfShapes& Other) ;
void operator=(const GEOMAlgo_ListOfCoupleOfShapes& Other)
{
Assign(Other);
}
Standard_EXPORT Standard_Integer Extent() const;
Standard_EXPORT void Clear() ;
~GEOMAlgo_ListOfCoupleOfShapes()
{
Clear();
}
Standard_Boolean IsEmpty() const;
Standard_EXPORT void Prepend(const GEOMAlgo_CoupleOfShapes& I) ;
Standard_EXPORT void Prepend(const GEOMAlgo_CoupleOfShapes& I,GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& theIt) ;
Standard_EXPORT void Prepend(GEOMAlgo_ListOfCoupleOfShapes& Other) ;
Standard_EXPORT void Append(const GEOMAlgo_CoupleOfShapes& I) ;
Standard_EXPORT void Append(const GEOMAlgo_CoupleOfShapes& I,GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& theIt) ;
Standard_EXPORT void Append(GEOMAlgo_ListOfCoupleOfShapes& Other) ;
Standard_EXPORT GEOMAlgo_CoupleOfShapes& First() const;
Standard_EXPORT GEOMAlgo_CoupleOfShapes& Last() const;
Standard_EXPORT void RemoveFirst() ;
Standard_EXPORT void Remove(GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& It) ;
Standard_EXPORT void InsertBefore(const GEOMAlgo_CoupleOfShapes& I,GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& It) ;
Standard_EXPORT void InsertBefore(GEOMAlgo_ListOfCoupleOfShapes& Other,GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& It) ;
Standard_EXPORT void InsertAfter(const GEOMAlgo_CoupleOfShapes& I,GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& It) ;
Standard_EXPORT void InsertAfter(GEOMAlgo_ListOfCoupleOfShapes& Other,GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& It) ;
friend class GEOMAlgo_ListIteratorOfListOfCoupleOfShapes;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
Standard_EXPORT GEOMAlgo_ListOfCoupleOfShapes(const GEOMAlgo_ListOfCoupleOfShapes& Other);
// Fields PRIVATE
//
Standard_Address myFirst;
Standard_Address myLast;
};
#define Item GEOMAlgo_CoupleOfShapes
#define Item_hxx <GEOMAlgo_CoupleOfShapes.hxx>
#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_hxx <GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes
#define TCollection_ListIterator_hxx <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_()
#define TCollection_List GEOMAlgo_ListOfCoupleOfShapes
#define TCollection_List_hxx <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#include <TCollection_List.lxx>
#undef Item
#undef Item_hxx
#undef TCollection_ListNode
#undef TCollection_ListNode_hxx
#undef TCollection_ListIterator
#undef TCollection_ListIterator_hxx
#undef Handle_TCollection_ListNode
#undef TCollection_ListNode_Type_
#undef TCollection_List
#undef TCollection_List_hxx
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,49 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#ifndef _Standard_NoSuchObject_HeaderFile
#include <Standard_NoSuchObject.hxx>
#endif
#ifndef _GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_HeaderFile
#include <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
#endif
#ifndef _GEOMAlgo_CoupleOfShapes_HeaderFile
#include <GEOMAlgo_CoupleOfShapes.hxx>
#endif
#ifndef _GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile
#include <GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#endif
#define Item GEOMAlgo_CoupleOfShapes
#define Item_hxx <GEOMAlgo_CoupleOfShapes.hxx>
#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_hxx <GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes
#define TCollection_ListIterator_hxx <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_()
#define TCollection_List GEOMAlgo_ListOfCoupleOfShapes
#define TCollection_List_hxx <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#include <TCollection_List.gxx>

View File

@ -0,0 +1,49 @@
-- File: GEOMAlgo_ShapeSolid.cdl
-- Created: Thu Jan 13 12:44:07 2005
-- Author: Peter KURNEV
-- <pkv@irinox>
---Copyright: Matra Datavision 2005
deferred class ShapeSolid from GEOMAlgo
inherits Algo from GEOMAlgo
---Purpose:
uses
ListOfShape from TopTools,
State from GEOMAlgo,
PDSFiller from BOPTools,
DSFiller from BOPTools
--raises
is
Initialize
returns ShapeSolid from GEOMAlgo;
SetFiller(me:out;
aDSF:DSFiller from BOPTools);
---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ShapeSolid();"
Shapes(me;
aState:State from GEOMAlgo)
returns ListOfShape from TopTools;
---C++: return const &
BuildResult (me:out)
is deferred protected;
Prepare(me:out)
is deferred protected;
fields
myLSIN : ListOfShape from TopTools is protected;
myLSOUT : ListOfShape from TopTools is protected;
myLSON : ListOfShape from TopTools is protected;
myLS : ListOfShape from TopTools is protected;
myRank : Integer from Standard is protected;
myDSFiller : PDSFiller from BOPTools is protected;
end ShapeSolid;

View File

@ -0,0 +1,114 @@
// File: GEOMAlgo_ShapeSolid.cxx
// Created: Thu Jan 13 12:54:48 2005
// Author: Peter KURNEV
// <pkv@irinox>
#include <GEOMAlgo_ShapeSolid.ixx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
//=======================================================================
//function : GEOMAlgo_ShapeSolid
//purpose :
//=======================================================================
GEOMAlgo_ShapeSolid::GEOMAlgo_ShapeSolid()
:
GEOMAlgo_Algo(),
myRank(0),
myDSFiller(NULL)
{
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
GEOMAlgo_ShapeSolid::~GEOMAlgo_ShapeSolid()
{
}
//=======================================================================
//function : SetFiller
//purpose :
//=======================================================================
void GEOMAlgo_ShapeSolid::SetFiller(const BOPTools_DSFiller& aDSFiller)
{
myDSFiller=(BOPTools_DSFiller*) &aDSFiller;
}
//=======================================================================
// function: Shapes
// purpose:
//=======================================================================
const TopTools_ListOfShape& GEOMAlgo_ShapeSolid::Shapes(const GEOMAlgo_State aState) const
{
TopTools_ListIteratorOfListOfShape aIt;
//
TopTools_ListOfShape* pLS=(TopTools_ListOfShape*)&myLS;
//
pLS->Clear();
//
switch (aState) {
case GEOMAlgo_ST_IN: {
aIt.Initialize(myLSIN);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
pLS->Append(aS);
}
}
break;
//
case GEOMAlgo_ST_OUT: {
aIt.Initialize(myLSOUT);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
pLS->Append(aS);
}
}
break;
//
case GEOMAlgo_ST_ON: {
aIt.Initialize(myLSON);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
pLS->Append(aS);
}
}
break;
//
case GEOMAlgo_ST_ONIN: {
aIt.Initialize(myLSON);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
pLS->Append(aS);
}
aIt.Initialize(myLSIN);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
pLS->Append(aS);
}
}
break;
//
case GEOMAlgo_ST_ONOUT: {
aIt.Initialize(myLSON);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
pLS->Append(aS);
}
aIt.Initialize(myLSOUT);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
pLS->Append(aS);
}
}
break;
//
case GEOMAlgo_ST_UNKNOWN:
case GEOMAlgo_ST_INOUT:
default:
break;
}
return myLS;
}

View File

@ -0,0 +1,116 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _GEOMAlgo_ShapeSolid_HeaderFile
#define _GEOMAlgo_ShapeSolid_HeaderFile
#ifndef _TopTools_ListOfShape_HeaderFile
#include <TopTools_ListOfShape.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _BOPTools_PDSFiller_HeaderFile
#include <BOPTools_PDSFiller.hxx>
#endif
#ifndef _GEOMAlgo_Algo_HeaderFile
#include <GEOMAlgo_Algo.hxx>
#endif
#ifndef _GEOMAlgo_State_HeaderFile
#include <GEOMAlgo_State.hxx>
#endif
class BOPTools_DSFiller;
class TopTools_ListOfShape;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class GEOMAlgo_ShapeSolid : public GEOMAlgo_Algo {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT void SetFiller(const BOPTools_DSFiller& aDSF) ;
Standard_EXPORT virtual ~GEOMAlgo_ShapeSolid();
Standard_EXPORT const TopTools_ListOfShape& Shapes(const GEOMAlgo_State aState) const;
protected:
// Methods PROTECTED
//
Standard_EXPORT GEOMAlgo_ShapeSolid();
Standard_EXPORT virtual void BuildResult() = 0;
Standard_EXPORT virtual void Prepare() = 0;
// Fields PROTECTED
//
TopTools_ListOfShape myLSIN;
TopTools_ListOfShape myLSOUT;
TopTools_ListOfShape myLSON;
TopTools_ListOfShape myLS;
Standard_Integer myRank;
BOPTools_PDSFiller myDSFiller;
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,26 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <GEOMAlgo_ShapeSolid.jxx>

View File

@ -0,0 +1,9 @@
#ifndef _BOPTools_DSFiller_HeaderFile
#include <BOPTools_DSFiller.hxx>
#endif
#ifndef _TopTools_ListOfShape_HeaderFile
#include <TopTools_ListOfShape.hxx>
#endif
#ifndef _GEOMAlgo_ShapeSolid_HeaderFile
#include <GEOMAlgo_ShapeSolid.hxx>
#endif

View File

@ -0,0 +1,34 @@
-- File: GEOMAlgo_ShellSolid.cdl
-- Created: Wed Jan 12 12:45:20 2005
-- Author: Peter KURNEV
-- <pkv@irinox>
---Copyright: Matra Datavision 2005
class ShellSolid from GEOMAlgo
inherits ShapeSolid from GEOMAlgo
---Purpose:
--uses
--raises
is
Create
returns ShellSolid from GEOMAlgo;
---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ShellSolid();"
Perform (me:out)
is redefined;
Prepare(me:out)
is redefined protected;
BuildResult (me:out)
is redefined protected;
DetectSDFaces(me:out)
is protected;
--fields
end ShellSolid;

View File

@ -0,0 +1,416 @@
// File: GEOMAlgo_ShellSolid.cxx
// Created: Wed Jan 12 12:49:45 2005
// Author: Peter KURNEV
// <pkv@irinox>
#include <GEOMAlgo_ShellSolid.ixx>
#include <Standard_Failure.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Pnt.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Solid.hxx>
#include <BRep_Tool.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopExp_Explorer.hxx>
#include <BOPTColStd_Dump.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <IntTools_Context.hxx>
#include <BooleanOperations_ShapesDataStructure.hxx>
#include <BOPTools_PaveFiller.hxx>
#include <BOPTools_SolidStateFiller.hxx>
#include <BOPTools_PCurveMaker.hxx>
#include <BOPTools_DEProcessor.hxx>
#include <BOPTools_InterferencePool.hxx>
#include <BOPTools_CArray1OfSSInterference.hxx>
#include <BOPTools_ListOfPaveBlock.hxx>
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
#include <BOPTools_PaveBlock.hxx>
#include <BOPTools_SSInterference.hxx>
#include <BOPTools_SequenceOfCurves.hxx>
#include <BOPTools_Curve.hxx>
#include <BOPTools_PaveFiller.hxx>
#include <BOPTools_SplitShapesPool.hxx>
#include <BOPTools_Tools3D.hxx>
#include <BOPTools_DSFiller.hxx>
//
#include <gp_Dir.hxx>
#include <BOPTools_SSInterference.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS.hxx>
#include <BOPTools_ListOfPaveBlock.hxx>
#include <TopoDS_Edge.hxx>
#include <BOPTools_Tools3D.hxx>
#include <BOP_WireEdgeSet.hxx>
#include <BOP_SDFWESFiller.hxx>
#include <BOP_FaceBuilder.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <BRepTools.hxx>
#include <IntTools_Context.hxx>
#include <Geom_Surface.hxx>
#include <TopExp_Explorer.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
static
Standard_Boolean CheckSameDomainFaceInside(const TopoDS_Face& theFace1,
const TopoDS_Face& theFace2);
//=======================================================================
//function : GEOMAlgo_ShellSolid
//purpose :
//=======================================================================
GEOMAlgo_ShellSolid::GEOMAlgo_ShellSolid()
:
GEOMAlgo_ShapeSolid()
{
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
GEOMAlgo_ShellSolid::~GEOMAlgo_ShellSolid()
{
}
//=======================================================================
// function:
// purpose:
//=======================================================================
void GEOMAlgo_ShellSolid::Perform()
{
myErrorStatus=0;
//
try {
if (myDSFiller==NULL) {
myErrorStatus=10;
return;
}
if(!myDSFiller->IsDone()) {
myErrorStatus=11;
return;
}
//
Standard_Boolean bIsNewFiller;
//
bIsNewFiller=myDSFiller->IsNewFiller();
if (bIsNewFiller) {
Prepare();
myDSFiller->SetNewFiller(!bIsNewFiller);
}
//
myRank=(myDSFiller->DS().Object().ShapeType()==TopAbs_SHELL) ? 1 : 2;
BuildResult();
}
catch (Standard_Failure) {
myErrorStatus=12;
}
}
//=======================================================================
// function: Prepare
// purpose:
//=======================================================================
void GEOMAlgo_ShellSolid::Prepare()
{
const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
//
// 1 States
BOPTools_SolidStateFiller aStateFiller(aPaveFiller);
aStateFiller.Do();
//
// 2 Project section edges on corresp. faces -> P-Curves on edges.
BOPTools_PCurveMaker aPCurveMaker(aPaveFiller);
aPCurveMaker.Do();
//
// 3. Degenerated Edges Processing
BOPTools_DEProcessor aDEProcessor(aPaveFiller);
aDEProcessor.Do();
//
// 4. Detect Same Domain Faces
DetectSDFaces();
}
//=================================================================================
// function: BuildResult
// purpose:
//=================================================================================
void GEOMAlgo_ShellSolid::BuildResult()
{
Standard_Boolean bIsTouchCase;
Standard_Integer i, j, nF1, nF2, aNbFFs, aNbS, aNbCurves, nSp, iRank1;
Standard_Integer nE, nF, aNbPB, iBeg, iEnd;
BooleanOperations_StateOfShape aState;
TopExp_Explorer anExp;
TopAbs_ShapeEnum aType;
gp_Pnt2d aP2D;
gp_Pnt aP3D;
//
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
const BOPTools_InterferencePool& anInterfPool=myDSFiller->InterfPool();
BOPTools_InterferencePool* pInterfPool=(BOPTools_InterferencePool*) &anInterfPool;
BOPTools_CArray1OfSSInterference& aFFs=pInterfPool->SSInterferences();
const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
const BOPTools_SplitShapesPool& aSplitShapesPool=aPaveFiller.SplitShapesPool();
//
// 1. process pf non-interferring faces
iBeg=1;
iEnd=aDS.NumberOfShapesOfTheObject();
if (myRank==2) {
iBeg=iEnd+1;
iEnd=aDS.NumberOfSourceShapes();
}
//
for (i=iBeg; i<=iEnd; ++i) {
aType=aDS.GetShapeType(i);
if (aType!=TopAbs_FACE) {
continue;
}
//
const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(i));
aState=aDS.GetState(i);
if (aState==BooleanOperations_IN) {
myLSIN.Append(aF1);
}
else if (aState==BooleanOperations_OUT) {
myLSOUT.Append(aF1);
}
}
//
// 2. process pf interferred faces
aNbFFs=aFFs.Extent();
for (i=1; i<=aNbFFs; ++i) {
BOPTools_SSInterference& aFFi=aFFs(i);
//
nF1=aFFi.Index1();
nF2=aFFi.Index2();
iRank1=aDS.Rank(nF1);
nF=(iRank1==myRank) ? nF1 : nF2;
const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(nF));
//
bIsTouchCase=aFFi.IsTangentFaces();
//
if (bIsTouchCase) {
myLSON.Append(aF1);
continue;
}
//
// Has section edges ?
aNbS=0;
BOPTools_SequenceOfCurves& aBCurves=aFFi.Curves();
aNbCurves=aBCurves.Length();
for (j=1; j<=aNbCurves; j++) {
BOPTools_Curve& aBC=aBCurves(j);
const BOPTools_ListOfPaveBlock& aSectEdges=aBC.NewPaveBlocks();
aNbS=aSectEdges.Extent();
if (aNbS) {
break;
}
}
//
if (aNbS) { // it has
continue;
}
//
anExp.Init(aF1, TopAbs_EDGE);
for (; anExp.More(); anExp.Next()) {
const TopoDS_Edge& aE=TopoDS::Edge(anExp.Current());
if (BRep_Tool::Degenerated(aE)) {
continue;
}
//
nE=aDS.ShapeIndex(aE, myRank);
const BOPTools_ListOfPaveBlock& aLPB=aSplitShapesPool(aDS.RefEdge(nE));
aNbPB=aLPB.Extent();
//
if (aNbPB<2) {
nSp=nE;
if (aNbPB) {
const BOPTools_PaveBlock& aPB=aLPB.First();
nSp=aPB.Edge();
}
const TopoDS_Shape& aSp=aDS.Shape(nSp);
//
aState=aDS.GetState(nSp);
if (aState==BooleanOperations_IN) {
myLSIN.Append(aF1);
}
else if (aState==BooleanOperations_OUT) {
myLSOUT.Append(aF1);
}
else if (aState==BooleanOperations_ON) {
Standard_Real aTol;
TopAbs_State aSt;
//
//const TopoDS_Face& aF2=TopoDS::Face(aDS.Shape((iRank1==myRank)? nF2 : nF1));
//aTol=BRep_Tool::Tolerance(aF2);
aTol=1.e-7;
//
BOPTools_Tools3D::PointNearEdge(aE, aF1, aP2D, aP3D);
const TopoDS_Solid& aRefSolid=(myRank==1) ?
TopoDS::Solid(aDS.Tool()) : TopoDS::Solid(aDS.Object());
//
BOPTools_PaveFiller* pPF=(BOPTools_PaveFiller*)& aPaveFiller;
IntTools_Context& aCtx=pPF->ChangeContext();
//
BRepClass3d_SolidClassifier& aSC=aCtx.SolidClassifier(aRefSolid);
aSC.Perform(aP3D, aTol);
aSt=aSC.State();
if (aSt==TopAbs_IN) {
myLSIN.Append(aF1);
}
else if (aSt==TopAbs_OUT) {
myLSOUT.Append(aF1);
}
}
break;
} // if (aNbPB<2) {
} //for (; anExp.More(); anExp.Next())
}
}
//=======================================================================
// function: DetectSDFaces
// purpose:
//=======================================================================
void GEOMAlgo_ShellSolid::DetectSDFaces()
{
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
BOPTools_InterferencePool* pIntrPool=(BOPTools_InterferencePool*)&myDSFiller->InterfPool();
BOPTools_CArray1OfSSInterference& aFFs=pIntrPool->SSInterferences();
//
Standard_Boolean bFlag;
Standard_Integer i, aNb, nF1, nF2, iZone, aNbSps, iSenseFlag;
gp_Dir aDNF1, aDNF2;
aNb=aFFs.Extent();
for (i=1; i<=aNb; i++) {
bFlag=Standard_False;
BOPTools_SSInterference& aFF=aFFs(i);
nF1=aFF.Index1();
nF2=aFF.Index2();
const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(nF1));
const TopoDS_Face& aF2=TopoDS::Face(aDS.Shape(nF2));
//
// iSenseFlag;
const BOPTools_ListOfPaveBlock& aLPB=aFF.PaveBlocks();
aNbSps=aLPB.Extent();
if (!aNbSps) {
continue;
}
const BOPTools_PaveBlock& aPB=aLPB.First();
const TopoDS_Edge& aSpE=TopoDS::Edge(aDS.Shape(aPB.Edge()));
BOPTools_Tools3D::GetNormalToFaceOnEdge (aSpE, aF1, aDNF1);
BOPTools_Tools3D::GetNormalToFaceOnEdge (aSpE, aF2, aDNF2);
iSenseFlag=BOPTools_Tools3D::SenseFlag (aDNF1, aDNF2);
//
if (iSenseFlag==1 || iSenseFlag==-1) {
//
//
TopoDS_Face aF1FWD=aF1;
aF1FWD.Orientation (TopAbs_FORWARD);
BOP_WireEdgeSet aWES (aF1FWD);
BOP_SDFWESFiller aWESFiller(nF1, nF2, *myDSFiller);
aWESFiller.SetSenseFlag(iSenseFlag);
aWESFiller.SetOperation(BOP_COMMON);
aWESFiller.Do(aWES);
BOP_FaceBuilder aFB;
aFB.Do(aWES);
const TopTools_ListOfShape& aLF=aFB.NewFaces();
iZone=0;
TopTools_ListIteratorOfListOfShape anIt(aLF);
for (; anIt.More(); anIt.Next()) {
const TopoDS_Shape& aFR=anIt.Value();
if (aFR.ShapeType()==TopAbs_FACE) {
const TopoDS_Face& aFaceResult=TopoDS::Face(aFR);
//
Standard_Boolean bIsValidIn2D, bNegativeFlag;
bIsValidIn2D=BOPTools_Tools3D::IsValidArea (aFaceResult, bNegativeFlag);
if (bIsValidIn2D) {
if(CheckSameDomainFaceInside(aFaceResult, aF2)) {
iZone=1;
break;
}
}
//
}
}
if (iZone) {
bFlag=Standard_True;
aFF.SetStatesMap(aWESFiller.StatesMap());
}
}// if (iSenseFlag)
aFF.SetTangentFacesFlag(bFlag);
aFF.SetSenseFlag (iSenseFlag);
}// end of for (i=1; i<=aNb; i++)
}
//=======================================================================
//function : CheckSameDomainFaceInside
//purpose :
//=======================================================================
Standard_Boolean CheckSameDomainFaceInside(const TopoDS_Face& theFace1,
const TopoDS_Face& theFace2)
{
Standard_Real umin = 0., umax = 0., vmin = 0., vmax = 0.;
BRepTools::UVBounds(theFace1, umin, umax, vmin, vmax);
IntTools_Context aContext;
Handle(Geom_Surface) aSurface = BRep_Tool::Surface(theFace1);
Standard_Real aTolerance = BRep_Tool::Tolerance(theFace1);
TopExp_Explorer anExpE(theFace1, TopAbs_EDGE);
for(; anExpE.More(); anExpE.Next()) {
const TopoDS_Edge& anEdge = TopoDS::Edge(anExpE.Current());
Standard_Real anEdgeTol = BRep_Tool::Tolerance(anEdge);
aTolerance = (aTolerance < anEdgeTol) ? anEdgeTol : aTolerance;
}
aTolerance += BRep_Tool::Tolerance(theFace2);
Standard_Integer nbpoints = 5;
Standard_Real adeltau = (umax - umin) / (nbpoints + 1);
Standard_Real adeltav = (vmax - vmin) / (nbpoints + 1);
Standard_Real U = umin + adeltau;
GeomAPI_ProjectPointOnSurf& aProjector = aContext.ProjPS(theFace2);
for(Standard_Integer i = 1; i <= nbpoints; i++, U+=adeltau) {
Standard_Real V = vmin + adeltav;
for(Standard_Integer j = 1; j <= nbpoints; j++, V+=adeltav) {
gp_Pnt2d aPoint(U,V);
if(aContext.IsPointInFace(theFace1, aPoint)) {
gp_Pnt aP3d = aSurface->Value(U, V);
aProjector.Perform(aP3d);
if(aProjector.IsDone()) {
if(aProjector.LowerDistance() > aTolerance)
return Standard_False;
}
}
}
}
return Standard_True;
}

View File

@ -0,0 +1,96 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _GEOMAlgo_ShellSolid_HeaderFile
#define _GEOMAlgo_ShellSolid_HeaderFile
#ifndef _GEOMAlgo_ShapeSolid_HeaderFile
#include <GEOMAlgo_ShapeSolid.hxx>
#endif
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class GEOMAlgo_ShellSolid : public GEOMAlgo_ShapeSolid {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT GEOMAlgo_ShellSolid();
Standard_EXPORT virtual ~GEOMAlgo_ShellSolid();
Standard_EXPORT virtual void Perform() ;
protected:
// Methods PROTECTED
//
Standard_EXPORT virtual void Prepare() ;
Standard_EXPORT virtual void BuildResult() ;
Standard_EXPORT void DetectSDFaces() ;
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,26 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <GEOMAlgo_ShellSolid.jxx>

View File

@ -0,0 +1,3 @@
#ifndef _GEOMAlgo_ShellSolid_HeaderFile
#include <GEOMAlgo_ShellSolid.hxx>
#endif

View File

@ -0,0 +1,40 @@
// File generated by CPPExt (Enum)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _GEOMAlgo_State_HeaderFile
#define _GEOMAlgo_State_HeaderFile
enum GEOMAlgo_State {
GEOMAlgo_ST_UNKNOWN,
GEOMAlgo_ST_IN,
GEOMAlgo_ST_OUT,
GEOMAlgo_ST_ON,
GEOMAlgo_ST_ONIN,
GEOMAlgo_ST_ONOUT,
GEOMAlgo_ST_INOUT
};
#ifndef _Standard_PrimitiveTypes_HeaderFile
#include <Standard_PrimitiveTypes.hxx>
#endif
#endif

View File

@ -10,7 +10,8 @@ class Tools from GEOMAlgo
---Purpose:
uses
Pnt from gp,
Pnt from gp,
Surface from Geom,
Edge from TopoDS,
Face from TopoDS,
Shape from TopoDS,
@ -72,6 +73,16 @@ is
aU :Real from Standard;
aV :Real from Standard;
aP3D:out Pnt from gp);
RefinePCurveForEdgeOnFace (myclass;
aE : Edge from TopoDS;
aF : Face from TopoDS;
aU1 : Real from Standard;
aU2 : Real from Standard);
IsUPeriodic(myclass;
aS:Surface from Geom)
returns Boolean from Standard;
--fields
end Tools;

View File

@ -6,9 +6,12 @@
#include <GEOMAlgo_Tools.ixx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
@ -23,7 +26,7 @@
#include <TopTools_IndexedMapOfShape.hxx>
#include <BRep_Tool.hxx>
#include <BOPTools_Tools2D.hxx>
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
#include <BOPTools_Tools2D.hxx>
@ -31,7 +34,7 @@
#include <GEOMAlgo_PassKey.hxx>
#include <GEOMAlgo_IndexedDataMapOfPassKeyListOfShape.hxx>
//
//=======================================================================
//function : RefineSDShapes
//purpose :
@ -48,8 +51,8 @@ Standard_Integer GEOMAlgo_Tools::RefineSDShapes(GEOMAlgo_IndexedDataMapOfPassKey
aNbE=aMPKLE.Extent();
for (i=1; i<=aNbE; ++i) {
TopTools_ListOfShape& aLSDE=aMPKLE.ChangeFromIndex(i);
aMEE.Clear();
//
aMEE.Clear();
iErr=GEOMAlgo_Tools::FindSDShapes(aLSDE, aTol, aMEE, aCtx);
if (iErr) {
return iErr;
@ -104,11 +107,17 @@ Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopTools_ListOfShape& aLE,
TopTools_ListOfShape aLESD;
TopTools_ListIteratorOfListOfShape aIt, aIt1;
TopTools_IndexedMapOfShape aMProcessed;
TopAbs_ShapeEnum aType;
//
aNbE=aLE.Extent();
if (!aNbE) {
return 3; // Err
}
}
//modified by NIZNHY-PKV Thu Dec 30 10:56:52 2004 f
if (aNbE==1) {
return 0; // Nothing to do
}
//modified by NIZNHY-PKV Thu Dec 30 10:56:56 2004 t
//
while(1) {
aNbEProcessed=aMProcessed.Extent();
@ -119,10 +128,22 @@ Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopTools_ListOfShape& aLE,
aIt.Initialize(aLE);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
//
if (aMProcessed.Contains(aS)) {
continue;
}
//
//modified by NIZNHY-PKV Thu Dec 30 10:57:01 2004 f
aType=aS.ShapeType();
if (aType==TopAbs_EDGE) {
const TopoDS_Edge& aE=TopoDS::Edge(aS);
if (BRep_Tool::Degenerated(aE)) {
aMProcessed.Add(aE);
continue;
}
}
//modified by NIZNHY-PKV Thu Dec 30 10:57:03 2004 t
//
aLESD.Clear();
iErr=GEOMAlgo_Tools::FindSDShapes(aS, aLE, aTol, aLESD, aCtx);
if (iErr) {
@ -314,84 +335,55 @@ void GEOMAlgo_Tools::PointOnEdge(const TopoDS_Edge& aE,
aC3D=BRep_Tool::Curve(aE, aT1, aT2);
aC3D->D0(aT, aP3D);
}
/*
//=======================================================================
//function : FindSDEdges
//function : RefinePCurveForEdgeOnFace
//purpose :
//=======================================================================
Standard_Integer GEOMAlgo_Tools::FindSDEdges(const TopoDS_Edge& aE1,
const TopTools_ListOfShape& aLE,
const Standard_Real aTol,
TopTools_ListOfShape& aLESD,
IntTools_Context& aCtx)
void GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,
const TopoDS_Face& aF,
const Standard_Real aUMin,
const Standard_Real aUMax)
{
Standard_Boolean bIsDone;
Standard_Real aT2, aTol2, aD2;
gp_Pnt aP1, aP2;
TopTools_ListIteratorOfListOfShape aIt;
Standard_Real aT1, aT2, aTx, aUx, aTol, aTwoPI;
gp_Pnt2d aP2D;
Handle(Geom_Surface) aS;
Handle(Geom2d_Curve) aC2D;
BRep_Builder aBB;
//
aTol2=aTol*aTol;
aTwoPI=PI+PI;
//
GEOMAlgo_Tools::PointOnEdge(aE1, aP1);
aIt.Initialize(aLE);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Edge& aE2=TopoDS::Edge(aIt.Value());
if (aE2.IsSame(aE1)) {
aLESD.Append(aE2);
aC2D=BRep_Tool::CurveOnSurface(aE, aF, aT1, aT2);
if (!aC2D.IsNull()) {
if (BRep_Tool::IsClosed(aE, aF)) {
return;
}
else {
bIsDone=aCtx.ProjectPointOnEdge(aP1, aE2, aT2);
if (!bIsDone) {
return 1;
}
GEOMAlgo_Tools::PointOnEdge(aE2, aT2, aP2);
aD2=aP1.SquareDistance(aP2);
if(aD2<aTol2) {
aLESD.Append(aE2);
}
}
}
return 0;
}
//=======================================================================
//function : FindSDFaces
//purpose :
//=======================================================================
Standard_Integer GEOMAlgo_Tools::FindSDFaces(const TopoDS_Face& aF1,
const TopTools_ListOfShape& aLF,
const Standard_Real aTol,
TopTools_ListOfShape& aLFSD,
IntTools_Context& aCtx)
{
Standard_Boolean bIsDone;
Standard_Real aTol2, aD2;
gp_Pnt aP1, aP2;
TopTools_ListIteratorOfListOfShape aIt;
//
aTol2=aTol*aTol;
//
GEOMAlgo_Tools::PointOnFace(aF1, aP1);
aIt.Initialize(aLF);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Face& aF2=TopoDS::Face(aIt.Value());
if (aF2.IsSame(aF1)) {
aLFSD.Append(aF2);
}
else {
GeomAPI_ProjectPointOnSurf& aProj=aCtx.ProjPS(aF2);
aProj.Perform(aP1);
bIsDone=aProj.IsDone();
if (!bIsDone) {
return 1; //??
}
aTx=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
aC2D->D0(aTx, aP2D);
aUx=aP2D.X();
if (aUx < aUMin || aUx > aUMax) {
// need to rebuild
Handle(Geom2d_Curve) aC2Dx;
//
aP2=aProj.NearestPoint();
aD2=aP1.SquareDistance(aP2);
if(aD2<aTol2) {
aLFSD.Append(aF2);
}
aTol=BRep_Tool::Tolerance(aE);
aBB.UpdateEdge(aE, aC2Dx, aF, aTol);
}
}
return 0;
}
*/
//=======================================================================
//function : IsUPeriodic
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_Tools::IsUPeriodic(const Handle(Geom_Surface) &aS)
{
Standard_Boolean bRet;
GeomAbs_SurfaceType aType;
GeomAdaptor_Surface aGAS;
//
aGAS.Load(aS);
aType=aGAS.GetType();
bRet=(aType==GeomAbs_Cylinder||
aType==GeomAbs_Cone ||
aType==GeomAbs_Sphere);
//
return bRet;
}

View File

@ -31,6 +31,9 @@
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Handle_Geom_Surface_HeaderFile
#include <Handle_Geom_Surface.hxx>
#endif
class GEOMAlgo_IndexedDataMapOfPassKeyListOfShape;
class IntTools_Context;
class TopTools_ListOfShape;
@ -39,6 +42,7 @@ class TopoDS_Shape;
class gp_Pnt;
class TopoDS_Edge;
class TopoDS_Face;
class Geom_Surface;
#ifndef _Standard_HeaderFile
@ -75,6 +79,8 @@ Standard_EXPORT static void PointOnEdge(const TopoDS_Edge& aE,gp_Pnt& aP3D) ;
Standard_EXPORT static void PointOnEdge(const TopoDS_Edge& aE,const Standard_Real aT,gp_Pnt& aP3D) ;
Standard_EXPORT static void PointOnFace(const TopoDS_Face& aF,gp_Pnt& aP3D) ;
Standard_EXPORT static void PointOnFace(const TopoDS_Face& aF,const Standard_Real aU,const Standard_Real aV,gp_Pnt& aP3D) ;
Standard_EXPORT static void RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,const TopoDS_Face& aF,const Standard_Real aU1,const Standard_Real aU2) ;
Standard_EXPORT static Standard_Boolean IsUPeriodic(const Handle(Geom_Surface)& aS) ;

View File

@ -22,6 +22,9 @@
#ifndef _TopoDS_Face_HeaderFile
#include <TopoDS_Face.hxx>
#endif
#ifndef _Geom_Surface_HeaderFile
#include <Geom_Surface.hxx>
#endif
#ifndef _GEOMAlgo_Tools_HeaderFile
#include <GEOMAlgo_Tools.hxx>
#endif

View File

@ -0,0 +1,32 @@
-- File: GEOMAlgo_VertexSolid.cdl
-- Created: Wed Jan 12 16:34:53 2005
-- Author: Peter KURNEV
-- <pkv@irinox>
---Copyright: Matra Datavision 2005
class VertexSolid from GEOMAlgo
inherits ShapeSolid from GEOMAlgo
---Purpose:
--uses
--raises
is
Create
returns VertexSolid from GEOMAlgo;
---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_VertexSolid();"
Perform (me:out)
is redefined;
Prepare(me:out)
is redefined protected;
BuildResult (me:out)
is redefined protected;
--fields
end VertexSolid;

View File

@ -0,0 +1,219 @@
// File: GEOMAlgo_VertexSolid.cxx
// Created: Wed Jan 12 16:36:40 2005
// Author: Peter KURNEV
// <pkv@irinox>
#include <GEOMAlgo_VertexSolid.ixx>
#include <gp_Pnt.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopAbs_State.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopExp.hxx>
#include <BRep_Tool.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <BOPTColStd_Dump.hxx>
#include <IntTools_Context.hxx>
#include <BooleanOperations_StateOfShape.hxx>
#include <BooleanOperations_ShapesDataStructure.hxx>
#include <BOPTools_InterferencePool.hxx>
#include <BOPTools_CArray1OfVVInterference.hxx>
#include <BOPTools_VVInterference.hxx>
#include <BOPTools_PaveFiller.hxx>
#include <BOPTools_DSFiller.hxx>
//=======================================================================
//function : GEOMAlgo_VertexSolid
//purpose :
//=======================================================================
GEOMAlgo_VertexSolid::GEOMAlgo_VertexSolid()
:
GEOMAlgo_ShapeSolid()
{
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
GEOMAlgo_VertexSolid::~GEOMAlgo_VertexSolid()
{
}
//=======================================================================
// function: Perform
// purpose:
//=======================================================================
void GEOMAlgo_VertexSolid::Perform()
{
myErrorStatus=0;
//
try {
if (myDSFiller==NULL) {
myErrorStatus=10;
return;
}
if(!myDSFiller->IsDone()) {
myErrorStatus=11;
return;
}
//
Standard_Boolean bIsNewFiller;
Standard_Integer aNbF;
TopTools_IndexedMapOfShape aM;
//
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
const TopoDS_Shape& aObj=aDS.Object();
//
TopExp::MapShapes(aObj, TopAbs_FACE, aM);
aNbF=aM.Extent();
myRank=(aNbF) ? 2 : 1;
//
bIsNewFiller=myDSFiller->IsNewFiller();
if (bIsNewFiller) {
Prepare();
myDSFiller->SetNewFiller(!bIsNewFiller);
}
BuildResult();
}
//
catch (Standard_Failure) {
myErrorStatus = 12;
}
}
//=======================================================================
// function: Prepare
// purpose:
//=======================================================================
void GEOMAlgo_VertexSolid::Prepare()
{
Standard_Integer i, iBeg, iEnd, aNbVV, j, n1, n2, iFound;
Standard_Real aTol;
TopAbs_State aSt;
TopAbs_ShapeEnum aType;
BooleanOperations_StateOfShape aState;
gp_Pnt aP3D;
//
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
BooleanOperations_ShapesDataStructure* pDS=(BooleanOperations_ShapesDataStructure*)&aDS;
const BOPTools_InterferencePool& aIP=myDSFiller->InterfPool();
BOPTools_InterferencePool* pIP=(BOPTools_InterferencePool*) &aIP;
BOPTools_CArray1OfVVInterference& aVVs=pIP->VVInterferences();
const BOPTools_PaveFiller& aPF=myDSFiller->PaveFiller();
BOPTools_PaveFiller* pPF=(BOPTools_PaveFiller*)&aPF;
IntTools_Context& aCtx=pPF->ChangeContext();
//
const TopoDS_Shape& aObj=aDS.Object();
const TopoDS_Shape& aTool=aDS.Tool();
//
const TopoDS_Solid& aSolid=(myRank==1) ? TopoDS::Solid(aTool) : TopoDS::Solid(aObj);
const TopoDS_Shape& aSV =(myRank==1)? aObj : aTool;
//
BRepClass3d_SolidClassifier& aSC=aCtx.SolidClassifier(aSolid);
//
iBeg=1;
iEnd=aDS.NumberOfShapesOfTheObject();
if (myRank==2) {
iBeg=iEnd+1;
iEnd=aDS.NumberOfSourceShapes();
}
//
for (i=iBeg; i<=iEnd; ++i) {
aType=aDS.GetShapeType(i);
if (aType!=TopAbs_VERTEX) {
continue;
}
//
const TopoDS_Vertex& aV=TopoDS::Vertex(aDS.Shape(i));
//
aState=aDS.GetState(i);
if (aState==BooleanOperations_ON ||
aState==BooleanOperations_IN ||
aState==BooleanOperations_OUT) {
continue;
}
//
iFound=0;
aNbVV=aVVs.Extent();
for (j=1; j<=aNbVV; ++j) {
BOPTools_VVInterference& aVV=aVVs(j);
aVV.Indices(n1, n2);
if (n1==i || n2==i) {
pDS->SetState (n1, BooleanOperations_ON);
pDS->SetState (n2, BooleanOperations_ON);
iFound=1;
break;
}
}
if (iFound) {
continue;
}
//
aP3D=BRep_Tool::Pnt(aV);
aTol=1.E-7;
aSC.Perform(aP3D, aTol);
aSt=aSC.State();
if (aSt==TopAbs_IN) {
pDS->SetState (i, BooleanOperations_IN);
}
else if (aSt==TopAbs_OUT) {
pDS->SetState (i, BooleanOperations_OUT);
}
}
}
//=======================================================================
// function: BuildResult
// purpose:
//=======================================================================
void GEOMAlgo_VertexSolid::BuildResult()
{
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
//
Standard_Integer i, iBeg, iEnd;
TopAbs_ShapeEnum aType;
BooleanOperations_StateOfShape aState;
//
myLSIN.Clear();
myLSOUT.Clear();
myLSON.Clear();
//
iBeg=1;
iEnd=aDS.NumberOfShapesOfTheObject();
if (myRank==2) {
iBeg=iEnd+1;
iEnd=aDS.NumberOfSourceShapes();
}
//
for (i=iBeg; i<=iEnd; ++i) {
aType=aDS.GetShapeType(i);
if (aType!=TopAbs_VERTEX) {
continue;
}
const TopoDS_Shape& aV=aDS.Shape(i);
aState=aDS.GetState(i);
//
if (aState==BooleanOperations_IN) {
myLSIN.Append(aV);
}
else if (aState==BooleanOperations_OUT) {
myLSOUT.Append(aV);
}
else if (aState==BooleanOperations_ON) {
myLSON.Append(aV);
}
}
}

View File

@ -0,0 +1,95 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _GEOMAlgo_VertexSolid_HeaderFile
#define _GEOMAlgo_VertexSolid_HeaderFile
#ifndef _GEOMAlgo_ShapeSolid_HeaderFile
#include <GEOMAlgo_ShapeSolid.hxx>
#endif
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class GEOMAlgo_VertexSolid : public GEOMAlgo_ShapeSolid {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT GEOMAlgo_VertexSolid();
Standard_EXPORT virtual ~GEOMAlgo_VertexSolid();
Standard_EXPORT virtual void Perform() ;
protected:
// Methods PROTECTED
//
Standard_EXPORT virtual void Prepare() ;
Standard_EXPORT virtual void BuildResult() ;
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,26 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <GEOMAlgo_VertexSolid.jxx>

View File

@ -0,0 +1,3 @@
#ifndef _GEOMAlgo_VertexSolid_HeaderFile
#include <GEOMAlgo_VertexSolid.hxx>
#endif

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