print "\nBox is valid"
\endcode
+<br><h2>Detect Self-intersections</h2>
+
+\code
+import geompy
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,30,100)
+IsValid = geompy.CheckSelfIntersections(box)
+if IsValid == 0:
+ raise RuntimeError, "Box with self-intersections created"
+else:
+ print "\nBox is valid"
+\endcode
+
<br><h2>Check Compound of Blocks</h2>
\code
-/*!\r
-\r
-\page using_measurement_tools_page Using measurement tools\r
-\r
-\n Measurement tools in GEOM are necessary for getting different data\r
-concerning created or imported geometrical objects. They are:\r
-\r
-<ul>\r
-<li>\ref point_coord_anchor "Point coordinates"</li>\r
-<li>\ref basic_prop_anchor "Basic properties"</li>\r
+/*!
+
+\page using_measurement_tools_page Using measurement tools
+
+\n Measurement tools in GEOM are necessary for getting different data
+concerning created or imported geometrical objects. They are:
+
+<ul>
+<li>\ref point_coord_anchor "Point coordinates"</li>
+<li>\ref basic_prop_anchor "Basic properties"</li>
<li>\ref center_mass_anchor "Center of mass"</li>
<li>\ref vertex_by_index "Get Vertex By Index"</li>
-<li>\ref inertia_anchor "Inertia"</li>\r
-<li>\ref normale_anchor "Normal to a Face"</li>\r
-<li>\ref boundaries_anchor "Check Free Boundaries"</li>\r
-<li>\ref faces_anchor "Check Faces"</li>\r
-<li>\ref bounding_box_anchor "Bounding box"</li>\r
-<li>\ref min_distance_anchor "Min. distance"</li>\r
-<li>\ref angle_anchor "Angle"</li>\r
-<li>\ref tolerance_anchor "Tolerance"</li>\r
-<li>\ref whatis_anchor "WhatIs"</li>\r
-<li>\ref check_anchor "Check"</li>\r
-<li>\ref check_compound_anchor "Check compound of blocks"</li>\r
-</ul>\r
-\r
-\n Our <b>TUI Scripts</b> show how to use\r
-\ref tui_measurement_tools_page "Measurement Tools" with <b>TUI\r
-commands</b>.\r
-\r
-\n <em>To use measurement tools:</em>\r
-\par\r
-In the <b>Main menu</b> select \b Measures submenu.\r
-\r
-\anchor point_coord_anchor\r
-<br><h2>Point coordinates</h2>\r
-\r
-\n Returns the coordinates of a point.\r
-\r
-\n <b>Result:</b> Point coordinates (X, Y, Z) in 3D space in the form of Python Tuple.\r
-\n <b>TUI Command:</b> <em>geompy.PointCoordinates(Point),</em>\r
-where \em Point is a point whose coordinates are inquired.\r
-\r
-\image html measures1.png\r
-\r
-\anchor basic_prop_anchor\r
-<br><h2>Basic properties</h2>\r
-\r
-\n Returns the properties (Length, Surface & Volume) for the selected\r
-geometrical object.\r
-\r
-\n <b>Result:</b> Display Length, Surface & Volume in the form of\r
-Python Tuple.\r
-\n <b>TUI Command:</b> <em>geompy.BasicProperties(Shape),</em> where\r
-\em Shape is a shape whose properties are inquired.\r
-\r
-\image html neo-basicprop.png\r
+<li>\ref inertia_anchor "Inertia"</li>
+<li>\ref normale_anchor "Normal to a Face"</li>
+<li>\ref boundaries_anchor "Check Free Boundaries"</li>
+<li>\ref faces_anchor "Check Faces"</li>
+<li>\ref bounding_box_anchor "Bounding box"</li>
+<li>\ref min_distance_anchor "Min. distance"</li>
+<li>\ref angle_anchor "Angle"</li>
+<li>\ref tolerance_anchor "Tolerance"</li>
+<li>\ref whatis_anchor "WhatIs"</li>
+<li>\ref check_anchor "Check"</li>
+<li>\ref check_compound_anchor "Check compound of blocks"</li>
+<li>\ref check_self_intersections_anchor "Detect Self-intersections"</li>
+</ul>
+
+\n Our <b>TUI Scripts</b> show how to use
+\ref tui_measurement_tools_page "Measurement Tools" with <b>TUI
+commands</b>.
+
+\n <em>To use measurement tools:</em>
+\par
+In the <b>Main menu</b> select \b Measures submenu.
+
+\anchor point_coord_anchor
+<br><h2>Point coordinates</h2>
+
+\n Returns the coordinates of a point.
+
+\n <b>Result:</b> Point coordinates (X, Y, Z) in 3D space in the form of Python Tuple.
+\n <b>TUI Command:</b> <em>geompy.PointCoordinates(Point),</em>
+where \em Point is a point whose coordinates are inquired.
+
+\image html measures1.png
+
+\anchor basic_prop_anchor
+<br><h2>Basic properties</h2>
+
+\n Returns the properties (Length, Surface & Volume) for the selected
+geometrical object.
+
+\n <b>Result:</b> Display Length, Surface & Volume in the form of
+Python Tuple.
+\n <b>TUI Command:</b> <em>geompy.BasicProperties(Shape),</em> where
+\em Shape is a shape whose properties are inquired.
+
+\image html neo-basicprop.png
\anchor center_mass_anchor
<br><h2>Center of mass</h2>
\anchor normale_anchor
<br><h2>Normal to a Face</h2>
-\n Calculates the normal vector to the selected \b Face. The \b Point\r
-is a point of the \b Face, where the Normal should be calculated.\r
-\r
-\image html normaletoface.png\r
-\r
-\anchor boundaries_anchor\r
-<br><h2>Check Free Boundaries</h2>\r
-\r
-\n Detects and highlights wires and edges that are not shared between\r
-two faces and are considered a shape's boundary.\r
-\r
-\n <b>TUI Command:</b> <em>(NoError, ClosedWires, OpenWires) =\r
-geompy.GetFreeBoundary(Shape),</em> where \em Shape is a shape to be\r
-checked, \em NoError is false if an error occurred while checking free\r
-boundaries, \em ClosedWires is a list of closed free boundary wires,\r
-\em OpenWires is a list of open free boundary wires.\r
-\r
-\image html repair9.png\r
-\r
-\anchor faces_anchor\r
-<br><h2>Check Free Faces</h2>\r
-\r
-\n Highlights all free faces of a given shape. A free\r
-face is a face which is not shared between two objects of the shape.\r
-\r
-\n \b NOTE: This functionality works only in VTK viewer.\r
-\r
-\n \b Result: a list of IDs of all free faces, containing in the shape.\r
-\n <b>TUI Command:</b> <em>GetFreeFacesIDs(Shape),</em> where \em Shape is\r
-a shape to be checked.\r
-\r
-\image html repair10.png\r
-\r
-\anchor bounding_box_anchor\r
-<br><h2>Bounding box</h2>\r
-\r
-Returns the dimensions of the bounding box for the selected\r
-geometrical object.\r
+\n Calculates the normal vector to the selected \b Face. The \b Point
+is a point of the \b Face, where the Normal should be calculated.
+
+\image html normaletoface.png
+
+\anchor boundaries_anchor
+<br><h2>Check Free Boundaries</h2>
+
+\n Detects and highlights wires and edges that are not shared between
+two faces and are considered a shape's boundary.
+
+\n <b>TUI Command:</b> <em>(NoError, ClosedWires, OpenWires) =
+geompy.GetFreeBoundary(Shape),</em> where \em Shape is a shape to be
+checked, \em NoError is false if an error occurred while checking free
+boundaries, \em ClosedWires is a list of closed free boundary wires,
+\em OpenWires is a list of open free boundary wires.
+
+\image html repair9.png
+
+\anchor faces_anchor
+<br><h2>Check Free Faces</h2>
+
+\n Highlights all free faces of a given shape. A free
+face is a face which is not shared between two objects of the shape.
+
+\n \b NOTE: This functionality works only in VTK viewer.
+
+\n \b Result: a list of IDs of all free faces, containing in the shape.
+\n <b>TUI Command:</b> <em>GetFreeFacesIDs(Shape),</em> where \em Shape is
+a shape to be checked.
+
+\image html repair10.png
+
+\anchor bounding_box_anchor
+<br><h2>Bounding box</h2>
+
+Returns the dimensions of the bounding box for the selected
+geometrical object.
\b NOTE: In order to take into account any possible distortion of a shape
that affects the resulting bounding box, the algorithm enlarges
This functionallity is implemented in such a way in order to have
satisfactory performance.
-<b>Result:</b> Displays the dimensions of the bounding box of a\r
-geometrical object in the form of Python Tuple (Xmin, Xmax, Ymin,\r
-Ymax, Zmin, Zmax).\r
-\n <b>TUI Command:</b> <em>geompy.BoundingBox(Shape),</em> where \em Shape\r
-is a shape for which a bounding box is computed.\r
-\r
-\image html measures5.png\r
-\r
-\anchor min_distance_anchor\r
-<br><h2>Min. distance</h2>\r
-\r
-\n Returns the minimum distance between two geometrical objects and\r
-the coordinates of the vector of distance and shows the vector in the viewer.\r
-\r
-\n <b>TUI Command:</b> <em>geompy.MinDistance(Shape1, Shape2),</em>\r
-where \em Shape1 and \em Shape2 are shapes between which the minimal\r
-distance is computed.\r
-\r
-\image html distance.png\r
-\r
-\anchor angle_anchor\r
-<br><h2>Angle</h2>\r
-\r
-\n Returns the angle between two lines or linear edges in degrees\r
-\n <b>TUI Command:</b> <em>geompy.GetAngle(shape1, shape2),</em> where\r
-Shape1 and Shape2 are shapes between which the angle is computed. \r
-Another TUI command is <em>geompy.GetAngleRadians(shape1,shape2),</em> \r
-which returns the value of angle in radians.\r
-\r
-\image html angle.png\r
-\r
-\anchor tolerance_anchor\r
-<br><h2>Tolerance</h2>\r
-\r
-\n Returns the maximum and the minimum tolerance for the selected\r
-geometrical object.\r
-\r
-\n <b>Result:</b> Displays the tolerance values (FaceMinTol,\r
-FaceMaxTol, EgdeMinTol, EgdeMaxTol, VertexMinTol, VertexMaxTol).\r
-\n <b>TUI Command:</b> <em>geompy.Tolerance(Shape),</em> where \em Shape\r
-is a shape for which minimal and maximal tolerances are returned.\r
-\r
-\image html new-tolerance.png\r
-\r
-\anchor whatis_anchor\r
-<br><h2>WhatIs</h2>\r
-\r
-\n General information about the selected geometrical object is the\r
-list of types and quantities of all topological entities, composing\r
-the shape.\r
-\r
-\n <b>TUI Command:</b> <em>geompy.WhatIs(Shape),</em> where \em Shape is a\r
-shape from which a description is returned.\r
-\r
-\image html measures8.png\r
-\r
-\n <b>Kind of Shape</b> field characterises the\r
-whole shape. If there is no additional information available for the\r
-shape, <b>Basic Properties</b> button will be disabled, otherwise it\r
-will show a dialog with information about\r
-dimensions, position, orientation and other parameters of the shape.\r
-\r
-\n <b>TUI Command:</b> <em>geompy.KindOfShape(Shape),</em> where \em Shape is a\r
-shape from which a description is returned.\r
-\r
-\image html measures8a.png\r
-\r
-\anchor check_anchor\r
-<br><h2>Check</h2>\r
-\r
-\n Checks the topology of the selected geometrical object and returns\r
-True if it is valid. Check also geometry checkbox allows to test the\r
-geometry as well.\r
-\r
-\n <b>Result:</b> Boolean.\r
-\n <b>TUI Command:</b> <em>geompy.CheckShape(theShape, theIsCheckGeom = 0),</em>\r
-where \em theShape is the shape checked for validity.\r
-\r
-\image html measures9.png\r
-\r
-\anchor check_compound_anchor\r
-<br><h2>Check compound of blocks</h2>\r
-\r
-\n Checks whether a shape is a compound of glued blocks. To be\r
-considered as a compound of blocks, the given shape must satisfy the\r
-following conditions:\r
-<ul>\r
-<li>Each element of the compound should be a Block (6 faces and 12 edges);</li>\r
-<li>A connection between two Blocks should be an entire quadrangle face or an entire edge;</li>\r
-<li>The compound should be connected;</li>\r
-<li>Two quadrangle faces should be glued.</li>\r
-</ul>\r
-\r
-\n Informs of the following possible errors:\r
-<ul>\r
-<li>not a block;</li>\r
-<li>not glued;</li>\r
-<li>not connected;</li>\r
-<li>extra or degenerated edge.</li>\r
-</ul>\r
-\r
-\n <b>Result:</b> Boolean; highlight in the viewer.\r
-\n <b>TUI Command:</b>\r
-<em>geompy.CheckCompoundOfBlocks(Compound).</em> Checks if the shape\r
-is a valid compound of blocks. If it is true, then the validity flag\r
-is returned, and encountered errors are printed in the python console.\r
-\r
-\image html measures10.png\r
-\r
-*/\r
-\r
+<b>Result:</b> Displays the dimensions of the bounding box of a
+geometrical object in the form of Python Tuple (Xmin, Xmax, Ymin,
+Ymax, Zmin, Zmax).
+\n <b>TUI Command:</b> <em>geompy.BoundingBox(Shape),</em> where \em Shape
+is a shape for which a bounding box is computed.
+
+\image html measures5.png
+
+\anchor min_distance_anchor
+<br><h2>Min. distance</h2>
+
+\n Returns the minimum distance between two geometrical objects and
+the coordinates of the vector of distance and shows the vector in the viewer.
+
+\n <b>TUI Command:</b> <em>geompy.MinDistance(Shape1, Shape2),</em>
+where \em Shape1 and \em Shape2 are shapes between which the minimal
+distance is computed.
+
+\image html distance.png
+
+\anchor angle_anchor
+<br><h2>Angle</h2>
+
+\n Returns the angle between two lines or linear edges in degrees
+\n <b>TUI Command:</b> <em>geompy.GetAngle(shape1, shape2),</em> where
+Shape1 and Shape2 are shapes between which the angle is computed.
+Another TUI command is <em>geompy.GetAngleRadians(shape1,shape2),</em>
+which returns the value of angle in radians.
+
+\image html angle.png
+
+\anchor tolerance_anchor
+<br><h2>Tolerance</h2>
+
+\n Returns the maximum and the minimum tolerance for the selected
+geometrical object.
+
+\n <b>Result:</b> Displays the tolerance values (FaceMinTol,
+FaceMaxTol, EgdeMinTol, EgdeMaxTol, VertexMinTol, VertexMaxTol).
+\n <b>TUI Command:</b> <em>geompy.Tolerance(Shape),</em> where \em Shape
+is a shape for which minimal and maximal tolerances are returned.
+
+\image html new-tolerance.png
+
+\anchor whatis_anchor
+<br><h2>WhatIs</h2>
+
+\n General information about the selected geometrical object is the
+list of types and quantities of all topological entities, composing
+the shape.
+
+\n <b>TUI Command:</b> <em>geompy.WhatIs(Shape),</em> where \em Shape is a
+shape from which a description is returned.
+
+\image html measures8.png
+
+\n <b>Kind of Shape</b> field characterises the
+whole shape. If there is no additional information available for the
+shape, <b>Basic Properties</b> button will be disabled, otherwise it
+will show a dialog with information about
+dimensions, position, orientation and other parameters of the shape.
+
+\n <b>TUI Command:</b> <em>geompy.KindOfShape(Shape),</em> where \em Shape is a
+shape from which a description is returned.
+
+\image html measures8a.png
+
+\anchor check_anchor
+<br><h2>Check</h2>
+
+\n Checks the topology of the selected geometrical object and returns
+True if it is valid. Check also geometry checkbox allows to test the
+geometry as well.
+
+\n <b>Result:</b> Boolean.
+\n <b>TUI Command:</b> <em>geompy.CheckShape(theShape, theIsCheckGeom = 0),</em>
+where \em theShape is the shape checked for validity.
+
+\image html measures9.png
+
+\anchor check_compound_anchor
+<br><h2>Check compound of blocks</h2>
+
+\n Checks whether a shape is a compound of glued blocks. To be
+considered as a compound of blocks, the given shape must satisfy the
+following conditions:
+<ul>
+<li>Each element of the compound should be a Block (6 faces and 12 edges);</li>
+<li>A connection between two Blocks should be an entire quadrangle face or an entire edge;</li>
+<li>The compound should be connected;</li>
+<li>Two quadrangle faces should be glued.</li>
+</ul>
+
+\n Informs of the following possible errors:
+<ul>
+<li>not a block;</li>
+<li>not glued;</li>
+<li>not connected;</li>
+<li>extra or degenerated edge.</li>
+</ul>
+
+\n <b>Result:</b> Boolean; highlight in the viewer.
+\n <b>TUI Command:</b>
+<em>geompy.CheckCompoundOfBlocks(Compound).</em> Checks if the shape
+is a valid compound of blocks. If it is true, then the validity flag
+is returned, and encountered errors are printed in the python console.
+
+\image html measures10.png
+
+\anchor check_self_intersections_anchor
+<br><h2>Detect Self-intersections</h2>
+
+\n Checks the topology of the selected shape to detect self-intersections.
+ Returns True if there are no self-intersections. Reports pairs of
+ intersected sub shapes, if there are any.
+
+\n <b>Result:</b> Boolean.
+\n <b>TUI Command:</b> <em>geompy.CheckSelfIntersections(theShape),</em>
+where \em theShape is the shape checked for validity.
+
+\image html measures11.png
+
+*/
+
boolean CheckShapeWithGeometry (in GEOM_Object theShape,
out string theDescription);
+ /*!
+ * Check a topology of the given shape on self-intersections presence.
+ * \param theShape Shape to check validity of.
+ * \param theIntersections Output. List of intersected sub shapes IDs, it contains pairs of IDs.
+ * \return TRUE, if the shape does not have any self-intersections.
+ */
+ boolean CheckSelfIntersections (in GEOM_Object theShape,
+ out ListOfLong theIntersections);
+
/*!
* Check if the given shape can be an argument for MakeSolid operation
* \param theShape Shape to be described.
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
# -* Makefile *-
# Author : Patrick GOLDBRONN (CEA)
# Date : 28/06/2001
# Modified by : Alexander BORODIN (OCN) - autotools usage
-#
+
include $(top_srcdir)/adm_local/unix/make_common_starter.am
dist_salomeres_DATA = \
group_edit.png \
glue.png \
check_blocks_compound.png \
+check_self_intersections.png \
free_faces.png \
propagate.png \
redo.png \
<source>ICON_DLG_CHECK_COMPOUND_OF_BLOCKS</source>
<translation>check_blocks_compound.png</translation>
</message>
+ <message>
+ <source>ICON_DLG_CHECK_SELF_INTERSECTIONS</source>
+ <translation>check_self_intersections.png</translation>
+ </message>
<message>
<source>ICON_DLG_CIRCLE_PNTS</source>
<translation>circle3points.png</translation>
<source>ICO_CHECK_COMPOUND</source>
<translation>check_blocks_compound.png</translation>
</message>
+ <message>
+ <source>ICO_CHECK_SELF_INTERSECTIONS</source>
+ <translation>check_self_intersections.png</translation>
+ </message>
<message>
<source>ICO_CHECK_FREE_BNDS</source>
<translation>free_bound.png</translation>
<source>GEOM_CHECK_TITLE</source>
<translation>Check Shape Information</translation>
</message>
+ <message>
+ <source>GEOM_CHECK_SELF_INTERSECTIONS</source>
+ <translation>Detect Self-intersections</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_SELF_INTERSECTIONS_FAILED</source>
+ <translation>Detection of self-intersections failed</translation>
+ </message>
+ <message>
+ <source>GEOM_NO_SELF_INTERSECTIONS</source>
+ <translation>There are no self-intersections in the shape</translation>
+ </message>
+ <message>
+ <source>GEOM_SELF_INTERSECTIONS_FOUND</source>
+ <translation>Some self-intersections detected</translation>
+ </message>
<message>
<source>GEOM_CIRCLE</source>
<translation>Circle</translation>
<source>MEN_CHECK_COMPOUND</source>
<translation>Check Compound of Blocks</translation>
</message>
+ <message>
+ <source>MEN_CHECK_SELF_INTERSECTIONS</source>
+ <translation>Detect Self-intersections</translation>
+ </message>
<message>
<source>MEN_CHECK_FREE_BNDS</source>
<translation>Check Free Boundaries</translation>
<source>STB_CHECK_COMPOUND</source>
<translation>Check compound of blocks</translation>
</message>
+ <message>
+ <source>STB_CHECK_SELF_INTERSECTIONS</source>
+ <translation>Detect Self-intersections</translation>
+ </message>
<message>
<source>STB_CHECK_FREE_BNDS</source>
<translation>Check free boundaries</translation>
<source>TOP_CHECK_COMPOUND</source>
<translation>Check compound of blocks</translation>
</message>
+ <message>
+ <source>TOP_CHECK_SELF_INTERSECTIONS</source>
+ <translation>Detect Self-intersections</translation>
+ </message>
<message>
<source>TOP_CHECK_FREE_BNDS</source>
<translation>Check free boundaries</translation>
case GEOMOp::OpCheckShape: // MENU MEASURE - CHECK
case GEOMOp::OpCheckCompound: // MENU MEASURE - CHECK COMPOUND OF BLOCKS
case GEOMOp::OpPointCoordinates: // MENU MEASURE - POINT COORDINATES
+ case GEOMOp::OpCheckSelfInters: // MENU MEASURE - CHECK SELF INTERSECTIONS
libName = "MeasureGUI";
break;
case GEOMOp::OpGroupCreate: // MENU GROUP - CREATE
createGeomAction( GEOMOp::OpWhatIs, "WHAT_IS" );
createGeomAction( GEOMOp::OpCheckShape, "CHECK" );
createGeomAction( GEOMOp::OpCheckCompound, "CHECK_COMPOUND" );
+ createGeomAction( GEOMOp::OpCheckSelfInters, "CHECK_SELF_INTERSECTIONS" );
#ifdef _DEBUG_ // PAL16821
createGeomAction( GEOMOp::OpCheckGeom, "CHECK_GEOMETRY" );
createMenu( GEOMOp::OpMinDistance, dimId, -1 );
createMenu( GEOMOp::OpAngle, dimId, -1 );
- createMenu( separator(), measurId, -1 );
- createMenu( GEOMOp::OpTolerance, measurId, -1 );
- createMenu( separator(), measurId, -1 );
- createMenu( GEOMOp::OpWhatIs, measurId, -1 );
- createMenu( GEOMOp::OpCheckShape, measurId, -1 );
- createMenu( GEOMOp::OpCheckCompound, measurId, -1 );
+ createMenu( separator(), measurId, -1 );
+ createMenu( GEOMOp::OpTolerance, measurId, -1 );
+ createMenu( separator(), measurId, -1 );
+ createMenu( GEOMOp::OpWhatIs, measurId, -1 );
+ createMenu( GEOMOp::OpCheckShape, measurId, -1 );
+ createMenu( GEOMOp::OpCheckCompound, measurId, -1 );
+ createMenu( GEOMOp::OpCheckSelfInters, measurId, -1 );
#ifdef _DEBUG_ // PAL16821
int toolsId = createMenu( tr( "MEN_TOOLS" ), -1, -1, 50 );
createTool( GEOMOp::OpWhatIs, measureTbId );
createTool( GEOMOp::OpCheckShape, measureTbId );
createTool( GEOMOp::OpCheckCompound, measureTbId );
+ createTool( GEOMOp::OpCheckSelfInters, measureTbId );
int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) );
createTool( GEOMOp::OpPipeTShape, advancedTbId );
OpCheckShape = 5009, // MENU MEASURES - CHECK
OpCheckCompound = 5010, // MENU MEASURES - CHECK COMPOUND OF BLOCKS
OpPointCoordinates = 5011, // MENU MEASURES - POINT COORDINATES
+ OpCheckSelfInters = 5012, // MENU MEASURES - CHECK SELF INTERSECTIONS
// GroupGUI ------------------//--------------------------------
OpGroupCreate = 6000, // MENU GROUP - CREATE
OpGroupEdit = 6001, // MENU GROUP - EDIT
#include <GEOM_Function.hxx>
#include <GEOM_PythonDump.hxx>
+#include <NMTTools_CheckerSI.hxx>
+
+#include <NMTDS_Tools.hxx>
+#include <NMTDS_InterfPool.hxx>
+#include <NMTDS_PInterfPool.hxx>
+#include <NMTDS_PassKeyBoolean.hxx>
+#include <NMTDS_ShapesDataStructure.hxx>
+#include <NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx>
+
#include <Basics_OCCTVersion.hxx>
#include <utilities.h>
return isValid;
}
+//=============================================================================
+/*!
+ * CheckSelfIntersections
+ */
+//=============================================================================
+bool GEOMImpl_IMeasureOperations::CheckSelfIntersections
+ (Handle(GEOM_Object) theShape,
+ Handle(TColStd_HSequenceOfInteger)& theIntersections)
+{
+ SetErrorCode(KO);
+ bool isGood = false;
+
+ if (theIntersections.IsNull())
+ theIntersections = new TColStd_HSequenceOfInteger;
+ else
+ theIntersections->Clear();
+
+ if (theShape.IsNull())
+ return isGood;
+
+ Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
+ if (aRefShape.IsNull()) return isGood;
+
+ TopoDS_Shape aShape = aRefShape->GetValue();
+ if (aShape.IsNull()) return isGood;
+
+ // 0. Prepare data
+ BRep_Builder aBB;
+ TopoDS_Compound aCS;
+ TopoDS_Shape aScopy;
+ NMTDS_Tools::CopyShape(aShape, aScopy);
+
+ // Map sub-shapes and their indices
+ TopTools_IndexedMapOfShape anIndices;
+ TopExp::MapShapes(aScopy, anIndices);
+
+ aBB.MakeCompound(aCS);
+ aBB.Add(aCS, aScopy);
+
+ NMTTools_CheckerSI aCSI; // checker of self-interferences
+ aCSI.SetCompositeShape(aCS);
+
+ // 1. Launch the checker
+ aCSI.Perform();
+ Standard_Integer iErr = aCSI.StopStatus();
+ if (iErr) {
+ return false; // Error
+ }
+
+ isGood = true;
+
+ // 2. Take the shapes from DS
+ const NMTDS_ShapesDataStructure& aDS = *(aCSI.DS());
+ Standard_Integer aNbS = aDS.NumberOfShapesOfTheObject();
+
+ // 3. Get the pairs of interfered shapes
+ NMTDS_PInterfPool pIP = aCSI.IP();
+ const NMTDS_ListOfPassKeyBoolean& aLPKB = pIP->Get();
+
+ Standard_Integer n1, n2;
+ NMTDS_ListIteratorOfListOfPassKeyBoolean aIt;
+
+ aIt.Initialize(aLPKB);
+ for (; aIt.More(); aIt.Next()) {
+ const NMTDS_PassKeyBoolean& aPKB = aIt.Value();
+ aPKB.Ids(n1, n2);
+
+ if (n1 > aNbS || n2 > aNbS)
+ return false; // Error
+
+ const TopoDS_Shape& aS1 = aDS.Shape(n1);
+ const TopoDS_Shape& aS2 = aDS.Shape(n2);
+
+ theIntersections->Append(anIndices.FindIndex(aS1));
+ theIntersections->Append(anIndices.FindIndex(aS2));
+ isGood = false;
+ }
+
+ SetErrorCode(OK);
+ return isGood;
+}
+
//=============================================================================
/*!
* IsGoodForSolid
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#ifndef _GEOMImpl_IMeasureOperations_HXX_
#define _GEOMImpl_IMeasureOperations_HXX_
const Standard_Boolean theIsCheckGeom,
TCollection_AsciiString& theDump);
+ Standard_EXPORT bool CheckSelfIntersections (Handle(GEOM_Object) theShape,
+ Handle(TColStd_HSequenceOfInteger)& theIntersections);
+
Standard_EXPORT TCollection_AsciiString IsGoodForSolid (Handle(GEOM_Object) theShape);
Standard_EXPORT TCollection_AsciiString WhatIs (Handle(GEOM_Object) theShape);
$(BOOST_CPPFLAGS) \
$(PYTHON_INCLUDES) \
-I$(srcdir)/../ShHealOper \
+ -I$(srcdir)/../NMTDS \
-I$(srcdir)/../NMTTools \
-I$(srcdir)/../GEOM \
-I$(srcdir)/../GEOMAlgo \
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#include <Standard_Stream.hxx>
return 0;
}
+//=============================================================================
+/*!
+ * CheckSelfIntersections
+ */
+//=============================================================================
+CORBA::Boolean GEOM_IMeasureOperations_i::CheckSelfIntersections (GEOM::GEOM_Object_ptr theShape,
+ GEOM::ListOfLong_out theIntersections)
+{
+ // Set a not done flag
+ GetOperations()->SetNotDone();
+
+ bool isGood = false;
+
+ // Allocate the CORBA arrays
+ GEOM::ListOfLong_var anIntegersArray = new GEOM::ListOfLong();
+
+ // Get the reference shape
+ Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
+
+ if (!aShape.IsNull()) {
+ Handle(TColStd_HSequenceOfInteger) anIntegers = new TColStd_HSequenceOfInteger;
+
+ // Detect self-intersections
+ isGood = GetOperations()->CheckSelfIntersections(aShape, anIntegers);
+
+ int nbInts = anIntegers->Length();
+
+ anIntegersArray->length(nbInts);
+
+ for (int ii = 0; ii < nbInts; ii++) {
+ anIntegersArray[ii] = anIntegers->Value(ii + 1);
+ }
+ }
+
+ // Initialize out-parameters with local arrays
+ theIntersections = anIntegersArray._retn();
+ return isGood;
+}
+
//=============================================================================
/*!
* IsGoodForSolid
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#ifndef _GEOM_IMeasureOperations_i_HeaderFile
#define _GEOM_IMeasureOperations_i_HeaderFile
CORBA::Boolean CheckShapeWithGeometry (GEOM::GEOM_Object_ptr theShape,
CORBA::String_out theDescription);
+ CORBA::Boolean CheckSelfIntersections (GEOM::GEOM_Object_ptr theShape,
+ GEOM::ListOfLong_out theIntersections);
+
char* IsGoodForSolid (GEOM::GEOM_Object_ptr theShape);
char* WhatIs (GEOM::GEOM_Object_ptr theShape);
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
def TestMeasureOperations (geompy, math):
else:
print "\nBox is valid"
+ ####### Detect Self-intersections #######
+
+ [Face_1,Face_2] = geompy.SubShapes(box, [33, 23])
+ Translation_1 = geompy.MakeTranslation(Face_1, 5, -15, -40)
+ Compound_1 = geompy.MakeCompound([Face_2, Translation_1])
+ if geompy.CheckSelfIntersections(Compound_1) == True:
+ raise RuntimeError, "Existing self-intersection is not detected"
+
####### WhatIs #######
Descr = geompy.WhatIs(box)
print Status
return IsValid
+ ## Detect self-intersections in the given shape.
+ # @param theShape Shape to check.
+ # @return TRUE, if the shape contains no self-intersections.
+ #
+ # @ref tui_measurement_tools_page "Example"
+ def CheckSelfIntersections (self, theShape):
+ # Example: see GEOM_TestMeasures.py
+ (IsValid, Pairs) = self.MeasuOp.CheckSelfIntersections(theShape)
+ RaiseIfFailed("CheckSelfIntersections", self.MeasuOp)
+ return IsValid
+
## Get position (LCS) of theShape.
#
# Origin of the LCS is situated at the shape's center of mass.
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
# GEOM MEASUREGUI :
# File : Makefile.am
# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com)
# Package : MeasureGUI
-#
+
include $(top_srcdir)/adm_local/unix/make_common_starter.am
# header files
MeasureGUI_WhatisDlg.h \
MeasureGUI_CheckShapeDlg.h \
MeasureGUI_CheckCompoundOfBlocksDlg.h \
+ MeasureGUI_CheckSelfIntersectionsDlg.h \
MeasureGUI_PointDlg.h
# Libraries targets
MeasureGUI_MaxToleranceDlg.cxx \
MeasureGUI_WhatisDlg.cxx \
MeasureGUI_CheckShapeDlg.cxx \
- MeasureGUI_CheckCompoundOfBlocksDlg.cxx \
+ MeasureGUI_CheckCompoundOfBlocksDlg.cxx \
+ MeasureGUI_CheckSelfIntersectionsDlg.cxx \
MeasureGUI_PointDlg.cxx
MOC_FILES = \
MeasureGUI_WhatisDlg_moc.cxx \
MeasureGUI_CheckShapeDlg_moc.cxx \
MeasureGUI_CheckCompoundOfBlocksDlg_moc.cxx \
+ MeasureGUI_CheckSelfIntersectionsDlg_moc.cxx \
MeasureGUI_PointDlg_moc.cxx
nodist_libMeasureGUI_la_SOURCES = \
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// GEOM GEOMGUI : GUI for Geometry component
// File : MeasureGUI.cxx
// Author : Damien COQUERET, Open CASCADE S.A.S.
-//
+
#include "MeasureGUI.h"
#include <GeometryGUI.h>
#include "MeasureGUI_WhatisDlg.h" // Method WHATIS
#include "MeasureGUI_CheckShapeDlg.h" // Method CHECKSHAPE
#include "MeasureGUI_CheckCompoundOfBlocksDlg.h" // Method CHECKCOMPOUND
+#include "MeasureGUI_CheckSelfIntersectionsDlg.h" // Method CHECK SELF INTERSCTIONS
#include "MeasureGUI_PointDlg.h" // Method POINTCOORDINATES
#include <QApplication>
case GEOMOp::OpCheckCompound:
dlg = new MeasureGUI_CheckCompoundOfBlocksDlg( getGeometryGUI(), parent );
break; // CHECKCOMPOUND
+ case GEOMOp::OpCheckSelfInters:
+ dlg = new MeasureGUI_CheckSelfIntersectionsDlg( getGeometryGUI(), parent );
+ break; // CHECK SELF INTERSCTIONS
case GEOMOp::OpPointCoordinates:
dlg = new MeasureGUI_PointDlg( getGeometryGUI(), parent );
break; // POINT COORDINATES
</widget>
</item>
<item row="1" column="0" colspan="3" >
- <widget class="QTextBrowser" name="TextView1" />
+ <widget class="QTextBrowser" name="TextView1" >
+ <property name="minimumSize" >
+ <size>
+ <width>300</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="TextLabel2" >
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File : MeasureGUI_CheckSelfIntersectionsDlg.cxx
+// Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com)
+
+#include "MeasureGUI_CheckSelfIntersectionsDlg.h"
+#include "MeasureGUI_Widgets.h"
+
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+#include <LightApp_SelectionMgr.h>
+#include <SalomeApp_Tools.h>
+#include <SalomeApp_Application.h>
+
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopExp.hxx>
+#include <TColStd_MapOfInteger.hxx>
+
+#include <DlgRef.h>
+#include <GeometryGUI.h>
+#include <GEOMBase.h>
+#include <GEOMImpl_Types.hxx>
+
+#define TEXTEDIT_FONT_FAMILY "Courier"
+#define TEXTEDIT_FONT_SIZE 11
+
+//=================================================================================
+// class : MeasureGUI_CheckSelfIntersectionsDlg()
+// purpose : Constructs a MeasureGUI_CheckSelfIntersectionsDlg 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.
+//=================================================================================
+MeasureGUI_CheckSelfIntersectionsDlg::MeasureGUI_CheckSelfIntersectionsDlg (GeometryGUI* GUI, QWidget* parent)
+ : MeasureGUI_Skeleton(GUI, parent, false)
+{
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_CHECK_SELF_INTERSECTIONS")));
+ QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
+
+ setWindowTitle(tr("GEOM_CHECK_SELF_INTERSECTIONS"));
+
+ /***************************************************************/
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_CHECK_SELF_INTERSECTIONS"));
+ mainFrame()->RadioButton1->setIcon(image0);
+
+ myGrp = new MeasureGUI_1Sel1TextView2ListBox (centralWidget());
+ myGrp->GroupBox1->setTitle(tr("GEOM_CHECK_INFOS"));
+ myGrp->TextLabel1->setText(tr("GEOM_OBJECT"));
+
+ myGrp->TextView1->setReadOnly(true);
+ QFont aFont (TEXTEDIT_FONT_FAMILY, TEXTEDIT_FONT_SIZE);
+ aFont.setStyleHint(QFont::TypeWriter, QFont::PreferAntialias);
+ myGrp->TextView1->setFont(aFont);
+
+ myGrp->PushButton1->setIcon(image1);
+ myGrp->LineEdit1->setReadOnly(true);
+
+ myGrp->TextLabel2->setText(tr("GEOM_CHECK_BLOCKS_COMPOUND_ERRORS"));
+ myGrp->TextLabel3->setText(tr("GEOM_CHECK_BLOCKS_COMPOUND_SUBSHAPES"));
+
+ myGrp->ListBox2->setSelectionMode(QAbstractItemView::ExtendedSelection);
+
+ QVBoxLayout* layout = new QVBoxLayout (centralWidget());
+ layout->setMargin(0); layout->setSpacing(6);
+ layout->addWidget(myGrp);
+
+ /***************************************************************/
+
+ myHelpFileName = "using_measurement_tools_page.html#check_self_intersections_anchor";
+
+ /* Initialisation */
+ Init();
+}
+
+//=================================================================================
+// function : ~MeasureGUI_CheckSelfIntersectionsDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+MeasureGUI_CheckSelfIntersectionsDlg::~MeasureGUI_CheckSelfIntersectionsDlg()
+{
+}
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void MeasureGUI_CheckSelfIntersectionsDlg::Init()
+{
+ mySelBtn = myGrp->PushButton1;
+ mySelEdit = myGrp->LineEdit1;
+ MeasureGUI_Skeleton::Init();
+
+ connect(myGrp->ListBox1, SIGNAL(itemSelectionChanged()), SLOT(onErrorsListSelectionChanged()));
+ connect(myGrp->ListBox2, SIGNAL(itemSelectionChanged()), SLOT(onSubShapesListSelectionChanged()));
+}
+
+//=================================================================================
+// function : processObject
+// purpose :
+//=================================================================================
+void MeasureGUI_CheckSelfIntersectionsDlg::processObject()
+{
+ myGrp->ListBox1->clear();
+ myGrp->ListBox2->clear();
+ erasePreview();
+
+ if (myObj->_is_nil())
+ return;
+
+ QString aMsg ("");
+ GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow(getOperation());
+ bool isGood = false, isFailed = false;
+ int nbPairs = 0;
+ try {
+ isGood = anOper->CheckSelfIntersections(myObj, myInters);
+ nbPairs = myInters->length()/2;
+ if (nbPairs*2 != myInters->length()) {
+ isFailed = true;
+ }
+ }
+ catch (const SALOME::SALOME_Exception& e) {
+ SalomeApp_Tools::QtCatchCorbaException(e);
+ isFailed = true;
+ }
+ if (isFailed) {
+ aMsg += tr("GEOM_CHECK_SELF_INTERSECTIONS_FAILED");
+ myGrp->TextView1->setText(aMsg);
+ return;
+ }
+
+ // Status
+ if (isGood) {
+ aMsg += tr("GEOM_NO_SELF_INTERSECTIONS");
+ }
+ else {
+ aMsg += tr("GEOM_SELF_INTERSECTIONS_FOUND");
+ }
+ myGrp->TextView1->setText(aMsg);
+
+ // Pairs
+ QStringList aErrList;
+ QString aErrStr ("");
+ for (int i = 1; i <= nbPairs; i++) {
+ aErrStr = "Intersection # ";
+ aErrStr += QString::number(i);
+ aErrList.append(aErrStr);
+ }
+
+ myGrp->ListBox1->addItems(aErrList);
+}
+
+//=================================================================================
+// function : onErrorsListSelectionChanged
+// purpose :
+//=================================================================================
+void MeasureGUI_CheckSelfIntersectionsDlg::onErrorsListSelectionChanged()
+{
+ erasePreview();
+ int aCurItem = myGrp->ListBox1->currentRow();
+ if (aCurItem < 0)
+ return;
+
+ //int nbPairs = myInters->length()/2;
+
+ QStringList aSubShapeList;
+ TopoDS_Shape aSelShape;
+ if (!myObj->_is_nil() && GEOMBase::GetShape(myObj, aSelShape)) {
+ TopTools_IndexedMapOfShape anIndices;
+ TopExp::MapShapes(aSelShape, anIndices);
+
+ TopoDS_Shape aSubShape = anIndices.FindKey(myInters[aCurItem*2]);
+ QString aType = GEOMBase::GetShapeTypeString(aSubShape);
+ if (!aType.isEmpty())
+ aSubShapeList.append(QString("%1_%2").arg(aType).arg(myInters[aCurItem*2]));
+ aSubShape = anIndices.FindKey(myInters[aCurItem*2 + 1]);
+ aType = GEOMBase::GetShapeTypeString(aSubShape);
+ if (!aType.isEmpty())
+ aSubShapeList.append(QString("%1_%2").arg(aType).arg(myInters[aCurItem*2 + 1]));
+ }
+ myGrp->ListBox2->clear();
+ myGrp->ListBox2->addItems(aSubShapeList);
+}
+
+//=================================================================================
+// function : onSubShapesListSelectionChanged
+// purpose :
+//=================================================================================
+void MeasureGUI_CheckSelfIntersectionsDlg::onSubShapesListSelectionChanged()
+{
+ erasePreview();
+
+ // Current pair
+ int aErrCurItem = myGrp->ListBox1->currentRow();
+ if (aErrCurItem < 0)
+ return;
+
+ // Selected IDs
+ QList<int> aIds;
+ for (int i = 0, n = myGrp->ListBox2->count(); i < n; i++) {
+ if (myGrp->ListBox2->item(i)->isSelected())
+ aIds.append(i);
+ }
+ if (aIds.count() < 1)
+ return;
+
+ TopoDS_Shape aSelShape;
+ TopoDS_Shape aSubShape;
+ TopTools_IndexedMapOfShape anIndices;
+ if (!myObj->_is_nil() && GEOMBase::GetShape(myObj, aSelShape)) {
+ SALOME_Prs* aPrs = 0;
+ TopExp::MapShapes(aSelShape, anIndices);
+ QList<int>::iterator it;
+ for (it = aIds.begin(); it != aIds.end(); ++it) {
+ aSubShape = anIndices.FindKey(myInters[aErrCurItem*2 + (*it)]);
+ try {
+ getDisplayer()->SetColor(Quantity_NOC_RED);
+ getDisplayer()->SetWidth(3);
+ getDisplayer()->SetToActivate(false);
+ aPrs = !aSubShape.IsNull() ? getDisplayer()->BuildPrs(aSubShape) : 0;
+ if (aPrs)
+ displayPreview(aPrs, true);
+ }
+ catch (const SALOME::SALOME_Exception& e) {
+ SalomeApp_Tools::QtCatchCorbaException(e);
+ }
+ }
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File : MeasureGUI_CheckSelfIntersectionsDlg.h
+
+#ifndef MEASUREGUI_CHECKSELFINTERDLG_H
+#define MEASUREGUI_CHECKSELFINTERDLG_H
+
+#include <MeasureGUI_Skeleton.h>
+
+class MeasureGUI_1Sel1TextView2ListBox;
+
+//=================================================================================
+// class : MeasureGUI_CheckSelfIntersectionsDlg
+// purpose :
+//=================================================================================
+
+class MeasureGUI_CheckSelfIntersectionsDlg : public MeasureGUI_Skeleton
+{
+ Q_OBJECT
+
+public:
+ MeasureGUI_CheckSelfIntersectionsDlg(GeometryGUI*, QWidget*);
+ ~MeasureGUI_CheckSelfIntersectionsDlg();
+
+protected:
+ // redefined from GEOMBase_Helper and MeasureGUI_Skeleton
+ virtual void processObject();
+
+private slots:
+ void onErrorsListSelectionChanged();
+ void onSubShapesListSelectionChanged();
+
+private:
+ void Init();
+
+private:
+ MeasureGUI_1Sel1TextView2ListBox* myGrp;
+
+ GEOM::ListOfLong_var myInters;
+};
+
+#endif // MEASUREGUI_CHECKSELFINTERDLG_H
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// File: NMTDS_Tools.cxx
// Created: Tue Feb 20 14:57:28 2007
// Author: Peter KURNEV
-// <pkv@irinox>
-//
+
#include <NMTDS_Tools.ixx>
#include <TopoDS_Vertex.hxx>
#include <gp_Pnt.hxx>
#include <TopoDS_Iterator.hxx>
#include <BRep_Builder.hxx>
-void CopySource(const TopoDS_Shape& aS,
- TopTools_IndexedDataMapOfShapeShape& aMapSS,
+void CopySource(const TopoDS_Shape& aS,
+ TopTools_IndexedDataMapOfShapeShape& aMapSS,
TopoDS_Shape& aSC);
//=======================================================================
//function : CopyShape
-//purpose :
+//purpose :
//=======================================================================
- void NMTDS_Tools::CopyShape(const TopoDS_Shape& aS,
+ void NMTDS_Tools::CopyShape(const TopoDS_Shape& aS,
TopoDS_Shape& aSC)
{
TopTools_IndexedDataMapOfShapeShape aMapSS;
}
//=======================================================================
//function : CopyShape
-//purpose :
+//purpose :
//=======================================================================
- void NMTDS_Tools::CopyShape(const TopoDS_Shape& aS,
+ void NMTDS_Tools::CopyShape(const TopoDS_Shape& aS,
TopoDS_Shape& aSC,
TopTools_IndexedDataMapOfShapeShape& aMapSS)
{
}
//=======================================================================
//function : CopySource
-//purpose :
+//purpose :
//=======================================================================
-void CopySource(const TopoDS_Shape& aS,
- TopTools_IndexedDataMapOfShapeShape& aMapSS,
+void CopySource(const TopoDS_Shape& aS,
+ TopTools_IndexedDataMapOfShapeShape& aMapSS,
TopoDS_Shape& aSC)
{
Standard_Boolean bFree;
TopAbs_ShapeEnum aT;
TopoDS_Iterator aIt;
+ TopoDS_Shape aSF;
BRep_Builder BB;
//
aT=aS.ShapeType();
//
bFree=aSC.Free();
aSC.Free(Standard_True);
- aIt.Initialize(aS);
+ //modified by NIZNHY-PKV Fri Nov 25 10:10:03 2011f
+ aSF=aS;
+ if (aT==TopAbs_EDGE){
+ TopAbs_Orientation aOr;
+ //
+ aOr=aS.Orientation();
+ if(aOr==TopAbs_INTERNAL) {
+ aSF.Orientation(TopAbs_FORWARD);
+ }
+ }
+ aIt.Initialize(aSF);
+ //aIt.Initialize(aS);
+ //modified by NIZNHY-PKV Fri Nov 25 10:10:05 2011t
for (; aIt.More(); aIt.Next()) {
TopoDS_Shape aSCx;
//
const TopoDS_Shape& aSx=aIt.Value();
//
- CopySource (aSx, aMapSS, aSCx);
+ CopySource (aSx, aMapSS, aSCx);
//
aSCx.Orientation(aSx.Orientation());
BB.Add(aSC, aSCx);
}
//=======================================================================
// function: ComputeVV
-// purpose:
+// purpose:
//=======================================================================
- Standard_Integer NMTDS_Tools::ComputeVV(const TopoDS_Vertex& aV1,
+ Standard_Integer NMTDS_Tools::ComputeVV(const TopoDS_Vertex& aV1,
const TopoDS_Vertex& aV2)
{
Standard_Real aTolV1, aTolV2, aTolSum, aTolSum2, aD2;
}
//=======================================================================
// function: HasBRep
-// purpose:
+// purpose:
//=======================================================================
Standard_Boolean NMTDS_Tools::HasBRep(const TopAbs_ShapeEnum aTi)
{
}
//=======================================================================
//function : TypeToInteger
-//purpose :
+//purpose :
//=======================================================================
Standard_Integer NMTDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1,
const TopAbs_ShapeEnum aType2)
default:
break;
}
- return iRet;
+ return iRet;
}