mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-15 10:08:35 +05:00
0021209: Bug GetInPlace with faces. Integrate self-intersections checker.
This commit is contained in:
parent
59c66d2ea4
commit
1c97ae08b2
BIN
doc/salome/gui/GEOM/images/measures11.png
Normal file
BIN
doc/salome/gui/GEOM/images/measures11.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
@ -385,6 +385,20 @@ else:
|
|||||||
print "\nBox is valid"
|
print "\nBox is valid"
|
||||||
\endcode
|
\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>
|
<br><h2>Check Compound of Blocks</h2>
|
||||||
|
|
||||||
\code
|
\code
|
||||||
|
@ -21,6 +21,7 @@ concerning created or imported geometrical objects. They are:
|
|||||||
<li>\ref whatis_anchor "WhatIs"</li>
|
<li>\ref whatis_anchor "WhatIs"</li>
|
||||||
<li>\ref check_anchor "Check"</li>
|
<li>\ref check_anchor "Check"</li>
|
||||||
<li>\ref check_compound_anchor "Check compound of blocks"</li>
|
<li>\ref check_compound_anchor "Check compound of blocks"</li>
|
||||||
|
<li>\ref check_self_intersections_anchor "Detect Self-intersections"</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
\n Our <b>TUI Scripts</b> show how to use
|
\n Our <b>TUI Scripts</b> show how to use
|
||||||
@ -254,5 +255,18 @@ is returned, and encountered errors are printed in the python console.
|
|||||||
|
|
||||||
\image html measures10.png
|
\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
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -3287,6 +3287,15 @@ module GEOM
|
|||||||
boolean CheckShapeWithGeometry (in GEOM_Object theShape,
|
boolean CheckShapeWithGeometry (in GEOM_Object theShape,
|
||||||
out string theDescription);
|
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
|
* Check if the given shape can be an argument for MakeSolid operation
|
||||||
* \param theShape Shape to be described.
|
* \param theShape Shape to be described.
|
||||||
|
@ -15,13 +15,12 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
|
||||||
|
|
||||||
# -* Makefile *-
|
# -* Makefile *-
|
||||||
# Author : Patrick GOLDBRONN (CEA)
|
# Author : Patrick GOLDBRONN (CEA)
|
||||||
# Date : 28/06/2001
|
# Date : 28/06/2001
|
||||||
# Modified by : Alexander BORODIN (OCN) - autotools usage
|
# Modified by : Alexander BORODIN (OCN) - autotools usage
|
||||||
#
|
|
||||||
include $(top_srcdir)/adm_local/unix/make_common_starter.am
|
include $(top_srcdir)/adm_local/unix/make_common_starter.am
|
||||||
|
|
||||||
dist_salomeres_DATA = \
|
dist_salomeres_DATA = \
|
||||||
@ -221,6 +220,7 @@ group_new.png \
|
|||||||
group_edit.png \
|
group_edit.png \
|
||||||
glue.png \
|
glue.png \
|
||||||
check_blocks_compound.png \
|
check_blocks_compound.png \
|
||||||
|
check_self_intersections.png \
|
||||||
free_faces.png \
|
free_faces.png \
|
||||||
propagate.png \
|
propagate.png \
|
||||||
redo.png \
|
redo.png \
|
||||||
|
BIN
resources/check_self_intersections.png
Normal file
BIN
resources/check_self_intersections.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 575 B |
@ -159,6 +159,10 @@
|
|||||||
<source>ICON_DLG_CHECK_COMPOUND_OF_BLOCKS</source>
|
<source>ICON_DLG_CHECK_COMPOUND_OF_BLOCKS</source>
|
||||||
<translation>check_blocks_compound.png</translation>
|
<translation>check_blocks_compound.png</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>ICON_DLG_CHECK_SELF_INTERSECTIONS</source>
|
||||||
|
<translation>check_self_intersections.png</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>ICON_DLG_CIRCLE_PNTS</source>
|
<source>ICON_DLG_CIRCLE_PNTS</source>
|
||||||
<translation>circle3points.png</translation>
|
<translation>circle3points.png</translation>
|
||||||
@ -719,6 +723,10 @@
|
|||||||
<source>ICO_CHECK_COMPOUND</source>
|
<source>ICO_CHECK_COMPOUND</source>
|
||||||
<translation>check_blocks_compound.png</translation>
|
<translation>check_blocks_compound.png</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>ICO_CHECK_SELF_INTERSECTIONS</source>
|
||||||
|
<translation>check_self_intersections.png</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>ICO_CHECK_FREE_BNDS</source>
|
<source>ICO_CHECK_FREE_BNDS</source>
|
||||||
<translation>free_bound.png</translation>
|
<translation>free_bound.png</translation>
|
||||||
|
@ -357,6 +357,22 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<source>GEOM_CHECK_TITLE</source>
|
<source>GEOM_CHECK_TITLE</source>
|
||||||
<translation>Check Shape Information</translation>
|
<translation>Check Shape Information</translation>
|
||||||
</message>
|
</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>
|
<message>
|
||||||
<source>GEOM_CIRCLE</source>
|
<source>GEOM_CIRCLE</source>
|
||||||
<translation>Circle</translation>
|
<translation>Circle</translation>
|
||||||
@ -2213,6 +2229,10 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<source>MEN_CHECK_COMPOUND</source>
|
<source>MEN_CHECK_COMPOUND</source>
|
||||||
<translation>Check Compound of Blocks</translation>
|
<translation>Check Compound of Blocks</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>MEN_CHECK_SELF_INTERSECTIONS</source>
|
||||||
|
<translation>Detect Self-intersections</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>MEN_CHECK_FREE_BNDS</source>
|
<source>MEN_CHECK_FREE_BNDS</source>
|
||||||
<translation>Check Free Boundaries</translation>
|
<translation>Check Free Boundaries</translation>
|
||||||
@ -2905,6 +2925,10 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<source>STB_CHECK_COMPOUND</source>
|
<source>STB_CHECK_COMPOUND</source>
|
||||||
<translation>Check compound of blocks</translation>
|
<translation>Check compound of blocks</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>STB_CHECK_SELF_INTERSECTIONS</source>
|
||||||
|
<translation>Detect Self-intersections</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>STB_CHECK_FREE_BNDS</source>
|
<source>STB_CHECK_FREE_BNDS</source>
|
||||||
<translation>Check free boundaries</translation>
|
<translation>Check free boundaries</translation>
|
||||||
@ -3465,6 +3489,10 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<source>TOP_CHECK_COMPOUND</source>
|
<source>TOP_CHECK_COMPOUND</source>
|
||||||
<translation>Check compound of blocks</translation>
|
<translation>Check compound of blocks</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>TOP_CHECK_SELF_INTERSECTIONS</source>
|
||||||
|
<translation>Detect Self-intersections</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>TOP_CHECK_FREE_BNDS</source>
|
<source>TOP_CHECK_FREE_BNDS</source>
|
||||||
<translation>Check free boundaries</translation>
|
<translation>Check free boundaries</translation>
|
||||||
|
@ -535,6 +535,7 @@ void GeometryGUI::OnGUIEvent( int id )
|
|||||||
case GEOMOp::OpCheckShape: // MENU MEASURE - CHECK
|
case GEOMOp::OpCheckShape: // MENU MEASURE - CHECK
|
||||||
case GEOMOp::OpCheckCompound: // MENU MEASURE - CHECK COMPOUND OF BLOCKS
|
case GEOMOp::OpCheckCompound: // MENU MEASURE - CHECK COMPOUND OF BLOCKS
|
||||||
case GEOMOp::OpPointCoordinates: // MENU MEASURE - POINT COORDINATES
|
case GEOMOp::OpPointCoordinates: // MENU MEASURE - POINT COORDINATES
|
||||||
|
case GEOMOp::OpCheckSelfInters: // MENU MEASURE - CHECK SELF INTERSECTIONS
|
||||||
libName = "MeasureGUI";
|
libName = "MeasureGUI";
|
||||||
break;
|
break;
|
||||||
case GEOMOp::OpGroupCreate: // MENU GROUP - CREATE
|
case GEOMOp::OpGroupCreate: // MENU GROUP - CREATE
|
||||||
@ -796,6 +797,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
|||||||
createGeomAction( GEOMOp::OpWhatIs, "WHAT_IS" );
|
createGeomAction( GEOMOp::OpWhatIs, "WHAT_IS" );
|
||||||
createGeomAction( GEOMOp::OpCheckShape, "CHECK" );
|
createGeomAction( GEOMOp::OpCheckShape, "CHECK" );
|
||||||
createGeomAction( GEOMOp::OpCheckCompound, "CHECK_COMPOUND" );
|
createGeomAction( GEOMOp::OpCheckCompound, "CHECK_COMPOUND" );
|
||||||
|
createGeomAction( GEOMOp::OpCheckSelfInters, "CHECK_SELF_INTERSECTIONS" );
|
||||||
|
|
||||||
#ifdef _DEBUG_ // PAL16821
|
#ifdef _DEBUG_ // PAL16821
|
||||||
createGeomAction( GEOMOp::OpCheckGeom, "CHECK_GEOMETRY" );
|
createGeomAction( GEOMOp::OpCheckGeom, "CHECK_GEOMETRY" );
|
||||||
@ -1013,6 +1015,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
|||||||
createMenu( GEOMOp::OpWhatIs, measurId, -1 );
|
createMenu( GEOMOp::OpWhatIs, measurId, -1 );
|
||||||
createMenu( GEOMOp::OpCheckShape, measurId, -1 );
|
createMenu( GEOMOp::OpCheckShape, measurId, -1 );
|
||||||
createMenu( GEOMOp::OpCheckCompound, measurId, -1 );
|
createMenu( GEOMOp::OpCheckCompound, measurId, -1 );
|
||||||
|
createMenu( GEOMOp::OpCheckSelfInters, measurId, -1 );
|
||||||
|
|
||||||
#ifdef _DEBUG_ // PAL16821
|
#ifdef _DEBUG_ // PAL16821
|
||||||
int toolsId = createMenu( tr( "MEN_TOOLS" ), -1, -1, 50 );
|
int toolsId = createMenu( tr( "MEN_TOOLS" ), -1, -1, 50 );
|
||||||
@ -1140,6 +1143,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
|||||||
createTool( GEOMOp::OpWhatIs, measureTbId );
|
createTool( GEOMOp::OpWhatIs, measureTbId );
|
||||||
createTool( GEOMOp::OpCheckShape, measureTbId );
|
createTool( GEOMOp::OpCheckShape, measureTbId );
|
||||||
createTool( GEOMOp::OpCheckCompound, measureTbId );
|
createTool( GEOMOp::OpCheckCompound, measureTbId );
|
||||||
|
createTool( GEOMOp::OpCheckSelfInters, measureTbId );
|
||||||
|
|
||||||
int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) );
|
int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) );
|
||||||
createTool( GEOMOp::OpPipeTShape, advancedTbId );
|
createTool( GEOMOp::OpPipeTShape, advancedTbId );
|
||||||
|
@ -160,6 +160,7 @@ namespace GEOMOp {
|
|||||||
OpCheckShape = 5009, // MENU MEASURES - CHECK
|
OpCheckShape = 5009, // MENU MEASURES - CHECK
|
||||||
OpCheckCompound = 5010, // MENU MEASURES - CHECK COMPOUND OF BLOCKS
|
OpCheckCompound = 5010, // MENU MEASURES - CHECK COMPOUND OF BLOCKS
|
||||||
OpPointCoordinates = 5011, // MENU MEASURES - POINT COORDINATES
|
OpPointCoordinates = 5011, // MENU MEASURES - POINT COORDINATES
|
||||||
|
OpCheckSelfInters = 5012, // MENU MEASURES - CHECK SELF INTERSECTIONS
|
||||||
// GroupGUI ------------------//--------------------------------
|
// GroupGUI ------------------//--------------------------------
|
||||||
OpGroupCreate = 6000, // MENU GROUP - CREATE
|
OpGroupCreate = 6000, // MENU GROUP - CREATE
|
||||||
OpGroupEdit = 6001, // MENU GROUP - EDIT
|
OpGroupEdit = 6001, // MENU GROUP - EDIT
|
||||||
|
@ -34,6 +34,15 @@
|
|||||||
#include <GEOM_Function.hxx>
|
#include <GEOM_Function.hxx>
|
||||||
#include <GEOM_PythonDump.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 <Basics_OCCTVersion.hxx>
|
||||||
|
|
||||||
#include <utilities.h>
|
#include <utilities.h>
|
||||||
@ -1310,6 +1319,88 @@ bool GEOMImpl_IMeasureOperations::CheckShape (Handle(GEOM_Object) theShape,
|
|||||||
return isValid;
|
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
|
* IsGoodForSolid
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef _GEOMImpl_IMeasureOperations_HXX_
|
#ifndef _GEOMImpl_IMeasureOperations_HXX_
|
||||||
#define _GEOMImpl_IMeasureOperations_HXX_
|
#define _GEOMImpl_IMeasureOperations_HXX_
|
||||||
@ -127,6 +126,9 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations {
|
|||||||
const Standard_Boolean theIsCheckGeom,
|
const Standard_Boolean theIsCheckGeom,
|
||||||
TCollection_AsciiString& theDump);
|
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 IsGoodForSolid (Handle(GEOM_Object) theShape);
|
||||||
|
|
||||||
Standard_EXPORT TCollection_AsciiString WhatIs (Handle(GEOM_Object) theShape);
|
Standard_EXPORT TCollection_AsciiString WhatIs (Handle(GEOM_Object) theShape);
|
||||||
|
@ -241,6 +241,7 @@ libGEOMimpl_la_CPPFLAGS = \
|
|||||||
$(BOOST_CPPFLAGS) \
|
$(BOOST_CPPFLAGS) \
|
||||||
$(PYTHON_INCLUDES) \
|
$(PYTHON_INCLUDES) \
|
||||||
-I$(srcdir)/../ShHealOper \
|
-I$(srcdir)/../ShHealOper \
|
||||||
|
-I$(srcdir)/../NMTDS \
|
||||||
-I$(srcdir)/../NMTTools \
|
-I$(srcdir)/../NMTTools \
|
||||||
-I$(srcdir)/../GEOM \
|
-I$(srcdir)/../GEOM \
|
||||||
-I$(srcdir)/../GEOMAlgo \
|
-I$(srcdir)/../GEOMAlgo \
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
|
||||||
|
|
||||||
#include <Standard_Stream.hxx>
|
#include <Standard_Stream.hxx>
|
||||||
|
|
||||||
@ -367,6 +366,45 @@ CORBA::Boolean GEOM_IMeasureOperations_i::CheckShapeWithGeometry (GEOM::GEOM_Obj
|
|||||||
return 0;
|
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
|
* IsGoodForSolid
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef _GEOM_IMeasureOperations_i_HeaderFile
|
#ifndef _GEOM_IMeasureOperations_i_HeaderFile
|
||||||
#define _GEOM_IMeasureOperations_i_HeaderFile
|
#define _GEOM_IMeasureOperations_i_HeaderFile
|
||||||
@ -86,6 +85,9 @@ class GEOM_I_EXPORT GEOM_IMeasureOperations_i :
|
|||||||
CORBA::Boolean CheckShapeWithGeometry (GEOM::GEOM_Object_ptr theShape,
|
CORBA::Boolean CheckShapeWithGeometry (GEOM::GEOM_Object_ptr theShape,
|
||||||
CORBA::String_out theDescription);
|
CORBA::String_out theDescription);
|
||||||
|
|
||||||
|
CORBA::Boolean CheckSelfIntersections (GEOM::GEOM_Object_ptr theShape,
|
||||||
|
GEOM::ListOfLong_out theIntersections);
|
||||||
|
|
||||||
char* IsGoodForSolid (GEOM::GEOM_Object_ptr theShape);
|
char* IsGoodForSolid (GEOM::GEOM_Object_ptr theShape);
|
||||||
|
|
||||||
char* WhatIs (GEOM::GEOM_Object_ptr theShape);
|
char* WhatIs (GEOM::GEOM_Object_ptr theShape);
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
|
||||||
|
|
||||||
def TestMeasureOperations (geompy, math):
|
def TestMeasureOperations (geompy, math):
|
||||||
|
|
||||||
@ -47,6 +46,14 @@ def TestMeasureOperations (geompy, math):
|
|||||||
else:
|
else:
|
||||||
print "\nBox is valid"
|
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 #######
|
####### WhatIs #######
|
||||||
|
|
||||||
Descr = geompy.WhatIs(box)
|
Descr = geompy.WhatIs(box)
|
||||||
|
@ -3755,6 +3755,17 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
print Status
|
print Status
|
||||||
return IsValid
|
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.
|
## Get position (LCS) of theShape.
|
||||||
#
|
#
|
||||||
# Origin of the LCS is situated at the shape's center of mass.
|
# Origin of the LCS is situated at the shape's center of mass.
|
||||||
|
@ -15,13 +15,12 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
|
||||||
|
|
||||||
# GEOM MEASUREGUI :
|
# GEOM MEASUREGUI :
|
||||||
# File : Makefile.am
|
# File : Makefile.am
|
||||||
# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com)
|
# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com)
|
||||||
# Package : MeasureGUI
|
# Package : MeasureGUI
|
||||||
#
|
|
||||||
include $(top_srcdir)/adm_local/unix/make_common_starter.am
|
include $(top_srcdir)/adm_local/unix/make_common_starter.am
|
||||||
|
|
||||||
# header files
|
# header files
|
||||||
@ -40,6 +39,7 @@ salomeinclude_HEADERS = \
|
|||||||
MeasureGUI_WhatisDlg.h \
|
MeasureGUI_WhatisDlg.h \
|
||||||
MeasureGUI_CheckShapeDlg.h \
|
MeasureGUI_CheckShapeDlg.h \
|
||||||
MeasureGUI_CheckCompoundOfBlocksDlg.h \
|
MeasureGUI_CheckCompoundOfBlocksDlg.h \
|
||||||
|
MeasureGUI_CheckSelfIntersectionsDlg.h \
|
||||||
MeasureGUI_PointDlg.h
|
MeasureGUI_PointDlg.h
|
||||||
|
|
||||||
# Libraries targets
|
# Libraries targets
|
||||||
@ -60,6 +60,7 @@ dist_libMeasureGUI_la_SOURCES = \
|
|||||||
MeasureGUI_WhatisDlg.cxx \
|
MeasureGUI_WhatisDlg.cxx \
|
||||||
MeasureGUI_CheckShapeDlg.cxx \
|
MeasureGUI_CheckShapeDlg.cxx \
|
||||||
MeasureGUI_CheckCompoundOfBlocksDlg.cxx \
|
MeasureGUI_CheckCompoundOfBlocksDlg.cxx \
|
||||||
|
MeasureGUI_CheckSelfIntersectionsDlg.cxx \
|
||||||
MeasureGUI_PointDlg.cxx
|
MeasureGUI_PointDlg.cxx
|
||||||
|
|
||||||
MOC_FILES = \
|
MOC_FILES = \
|
||||||
@ -76,6 +77,7 @@ MOC_FILES = \
|
|||||||
MeasureGUI_WhatisDlg_moc.cxx \
|
MeasureGUI_WhatisDlg_moc.cxx \
|
||||||
MeasureGUI_CheckShapeDlg_moc.cxx \
|
MeasureGUI_CheckShapeDlg_moc.cxx \
|
||||||
MeasureGUI_CheckCompoundOfBlocksDlg_moc.cxx \
|
MeasureGUI_CheckCompoundOfBlocksDlg_moc.cxx \
|
||||||
|
MeasureGUI_CheckSelfIntersectionsDlg_moc.cxx \
|
||||||
MeasureGUI_PointDlg_moc.cxx
|
MeasureGUI_PointDlg_moc.cxx
|
||||||
|
|
||||||
nodist_libMeasureGUI_la_SOURCES = \
|
nodist_libMeasureGUI_la_SOURCES = \
|
||||||
|
@ -18,12 +18,11 @@
|
|||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
|
||||||
|
|
||||||
// GEOM GEOMGUI : GUI for Geometry component
|
// GEOM GEOMGUI : GUI for Geometry component
|
||||||
// File : MeasureGUI.cxx
|
// File : MeasureGUI.cxx
|
||||||
// Author : Damien COQUERET, Open CASCADE S.A.S.
|
// Author : Damien COQUERET, Open CASCADE S.A.S.
|
||||||
//
|
|
||||||
#include "MeasureGUI.h"
|
#include "MeasureGUI.h"
|
||||||
|
|
||||||
#include <GeometryGUI.h>
|
#include <GeometryGUI.h>
|
||||||
@ -42,6 +41,7 @@
|
|||||||
#include "MeasureGUI_WhatisDlg.h" // Method WHATIS
|
#include "MeasureGUI_WhatisDlg.h" // Method WHATIS
|
||||||
#include "MeasureGUI_CheckShapeDlg.h" // Method CHECKSHAPE
|
#include "MeasureGUI_CheckShapeDlg.h" // Method CHECKSHAPE
|
||||||
#include "MeasureGUI_CheckCompoundOfBlocksDlg.h" // Method CHECKCOMPOUND
|
#include "MeasureGUI_CheckCompoundOfBlocksDlg.h" // Method CHECKCOMPOUND
|
||||||
|
#include "MeasureGUI_CheckSelfIntersectionsDlg.h" // Method CHECK SELF INTERSCTIONS
|
||||||
#include "MeasureGUI_PointDlg.h" // Method POINTCOORDINATES
|
#include "MeasureGUI_PointDlg.h" // Method POINTCOORDINATES
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -109,6 +109,9 @@ bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
|
|||||||
case GEOMOp::OpCheckCompound:
|
case GEOMOp::OpCheckCompound:
|
||||||
dlg = new MeasureGUI_CheckCompoundOfBlocksDlg( getGeometryGUI(), parent );
|
dlg = new MeasureGUI_CheckCompoundOfBlocksDlg( getGeometryGUI(), parent );
|
||||||
break; // CHECKCOMPOUND
|
break; // CHECKCOMPOUND
|
||||||
|
case GEOMOp::OpCheckSelfInters:
|
||||||
|
dlg = new MeasureGUI_CheckSelfIntersectionsDlg( getGeometryGUI(), parent );
|
||||||
|
break; // CHECK SELF INTERSCTIONS
|
||||||
case GEOMOp::OpPointCoordinates:
|
case GEOMOp::OpPointCoordinates:
|
||||||
dlg = new MeasureGUI_PointDlg( getGeometryGUI(), parent );
|
dlg = new MeasureGUI_PointDlg( getGeometryGUI(), parent );
|
||||||
break; // POINT COORDINATES
|
break; // POINT COORDINATES
|
||||||
|
@ -72,7 +72,14 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="3" >
|
<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>
|
||||||
<item row="2" column="0" >
|
<item row="2" column="0" >
|
||||||
<widget class="QLabel" name="TextLabel2" >
|
<widget class="QLabel" name="TextLabel2" >
|
||||||
|
249
src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.cxx
Normal file
249
src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.cxx
Normal file
@ -0,0 +1,249 @@
|
|||||||
|
// 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
62
src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.h
Normal file
62
src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.h
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
// 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
|
@ -15,13 +15,11 @@
|
|||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
|
||||||
|
|
||||||
// File: NMTDS_Tools.cxx
|
// File: NMTDS_Tools.cxx
|
||||||
// Created: Tue Feb 20 14:57:28 2007
|
// Created: Tue Feb 20 14:57:28 2007
|
||||||
// Author: Peter KURNEV
|
// Author: Peter KURNEV
|
||||||
// <pkv@irinox>
|
|
||||||
//
|
|
||||||
#include <NMTDS_Tools.ixx>
|
#include <NMTDS_Tools.ixx>
|
||||||
#include <TopoDS_Vertex.hxx>
|
#include <TopoDS_Vertex.hxx>
|
||||||
#include <gp_Pnt.hxx>
|
#include <gp_Pnt.hxx>
|
||||||
@ -68,6 +66,7 @@ void CopySource(const TopoDS_Shape& aS,
|
|||||||
Standard_Boolean bFree;
|
Standard_Boolean bFree;
|
||||||
TopAbs_ShapeEnum aT;
|
TopAbs_ShapeEnum aT;
|
||||||
TopoDS_Iterator aIt;
|
TopoDS_Iterator aIt;
|
||||||
|
TopoDS_Shape aSF;
|
||||||
BRep_Builder BB;
|
BRep_Builder BB;
|
||||||
//
|
//
|
||||||
aT=aS.ShapeType();
|
aT=aS.ShapeType();
|
||||||
@ -84,7 +83,19 @@ void CopySource(const TopoDS_Shape& aS,
|
|||||||
//
|
//
|
||||||
bFree=aSC.Free();
|
bFree=aSC.Free();
|
||||||
aSC.Free(Standard_True);
|
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()) {
|
for (; aIt.More(); aIt.Next()) {
|
||||||
TopoDS_Shape aSCx;
|
TopoDS_Shape aSCx;
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user