From da9569a4257702366c8a827ee0f7c31594110282 Mon Sep 17 00:00:00 2001 From: jfa Date: Wed, 14 Jul 2010 07:16:07 +0000 Subject: [PATCH] IMPs 0020745 (GetVertexNearPoint and GetShapesNearPoint) and 0020851 (LimitTolerance). --- .../gui/GEOM/images/limit_tolerance_dlg.png | Bin 0 -> 23699 bytes .../GEOM/input/limit_tolerance_operation.doc | 23 + .../gui/GEOM/input/repairing_operations.doc | 2 + .../GEOM/input/tui_repairing_operations.doc | 25 + doc/salome/gui/GEOM/input/tui_test_others.doc | 9 + idl/GEOM_Gen.idl | 33 ++ resources/Makefile.am | 1 + resources/limit_tolerance.png | Bin 0 -> 565 bytes src/GEOMGUI/GEOM_images.ts | 8 + src/GEOMGUI/GEOM_msg_en.ts | 20 + src/GEOMGUI/GeometryGUI.cxx | 42 +- src/GEOMGUI/GeometryGUI_Operations.h | 6 +- src/GEOMImpl/GEOMImpl_HealingDriver.cxx | 40 +- src/GEOMImpl/GEOMImpl_HealingDriver.hxx | 7 +- src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx | 205 ++++++++ src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx | 105 +++-- src/GEOMImpl/GEOMImpl_IHealing.hxx | 7 +- src/GEOMImpl/GEOMImpl_IHealingOperations.cxx | 61 ++- src/GEOMImpl/GEOMImpl_IHealingOperations.hxx | 27 +- src/GEOMImpl/GEOMImpl_Types.hxx | 1 + src/GEOM_I/GEOM_IBlocksOperations_i.cc | 59 +++ src/GEOM_I/GEOM_IBlocksOperations_i.hh | 12 +- src/GEOM_I/GEOM_IHealingOperations_i.cc | 28 +- src/GEOM_I/GEOM_IHealingOperations_i.hh | 59 ++- src/GEOM_SWIG/GEOM_TestOthers.py | 16 + src/GEOM_SWIG/geompyDC.py | 56 ++- src/RepairGUI/Makefile.am | 4 + src/RepairGUI/RepairGUI.cxx | 37 +- src/RepairGUI/RepairGUI_LimitToleranceDlg.cxx | 441 ++++++++++++++++++ src/RepairGUI/RepairGUI_LimitToleranceDlg.h | 83 ++++ 30 files changed, 1275 insertions(+), 142 deletions(-) create mode 100644 doc/salome/gui/GEOM/images/limit_tolerance_dlg.png create mode 100644 doc/salome/gui/GEOM/input/limit_tolerance_operation.doc create mode 100644 resources/limit_tolerance.png create mode 100644 src/RepairGUI/RepairGUI_LimitToleranceDlg.cxx create mode 100644 src/RepairGUI/RepairGUI_LimitToleranceDlg.h diff --git a/doc/salome/gui/GEOM/images/limit_tolerance_dlg.png b/doc/salome/gui/GEOM/images/limit_tolerance_dlg.png new file mode 100644 index 0000000000000000000000000000000000000000..98adfc454b804f2cff872fb96bf2db10813d5dbf GIT binary patch literal 23699 zcmb@u1yq#nzBfFWh^Ul;q(})!N~eN!Nh39MhlKQi3W&6HgLH$$&>=`8ARR+@cMk*K zH9mWv@7?=6=bZJP^{(~!i1*Ch*Y*GZ>canxyu>{$Vk`&*a!*R~wGsq^kqQ1JVBP{- zjM73KAdn{zsn@SmToN~@+_hESpa0nFo4oz{r7}UCR&GY-%lS;a9YO*)9%KHLw3d$b zuo{z`<i5(KC#^)L z3-Vs{Huz8^vj3V<90?yb_<4RbLq&Vww?29&W2xNo)Soyan3Ri>QeXpN7!?iJtScH4 z33hV1$E$>QRAh`F`|fVtdm?Fzz3JMK^CC=(YbPfk)FT8({czIq7$l^LGjRxR-h4yw z@LA?6YigFyhw^)i+`$=}Q+Mk*7D{TpO7m`Hlyy^+m%ZI}F1r(m;-Y&Jh%U3CVN!Zu zqXID<3-REG(4GA0x${bWo;kGx3f2bI(WjgY&%#KY{Wnx}ekJy7J&-wp>Ub^7k4~H@syk#v z=9`BGJmnZ+B+$Nyl+UBK*_?>}@d(vlK`fG5{b5oD8sX_Ee8unl*c*zof+!c+Ik_t& zRJe2z3F(66fc8@nLGUdQ|>ewqoXNcm_Y#9EcUWtw%TBI$F= z-J%gMwoa!TH&|;!w^ry@D0#OmpyJj&#__9qvV^OXzqrJl=S{~PdZXVkwA=pv(UI^? z>+TzjY?hy14V6)hfu;y^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^Ss@2Kka6Vf{oaM^ zSFi5W(UAbq5>^%7zTFBUOCG+Q#Zosj!vH9O_>}T#E6NOEDZx0V(FV+X>^)tu4M1aX z-A3&SY*7yn#UgJu(o#Zfbzy0V13{u#TL*mKFUeF;MV;HS3iGrdz+@=L29svEnDviwGK`RQU0d-b-O7 zvp<={=rNx2Uv4WaqkTk72N4&_`SilqGcC4aJxH}NnoHL(<#+mb0xY7YpVs4-C;k#* zZN3zRNjk?w{eWVhcdjxF?Ns^4fe~39`fwHF@F*{m+JwV>@B8Dv?%rsQfsTem;#;%u zlcQF*Y()@9k2*G$X3{lZl2R{Z_kL+g2pE31jrc1&ZUO@vRF79?nqrNE>O6s)XR}8) za)`6ugTnu+oMY~m^Pu5>U#CNnf6;w)-@jM+#^0$(=$z&z8Yg_6Nc6xO HXXF11LPsPa literal 0 HcmV?d00001 diff --git a/doc/salome/gui/GEOM/input/limit_tolerance_operation.doc b/doc/salome/gui/GEOM/input/limit_tolerance_operation.doc new file mode 100644 index 000000000..7f692656d --- /dev/null +++ b/doc/salome/gui/GEOM/input/limit_tolerance_operation.doc @@ -0,0 +1,23 @@ +/*! + +\page limit_tolerance_operation_page Limit Tolerance + +\n To produce a Limit Tolerance operation in the Main + Menu select Repair - > Limit Tolerance. + +\n It is possible on all kind of shapes. + +\n The \b Result will be a \b GEOM_Object. + +\n TUI Command: geompy.LimitTolerance(Shape, Tolerance), + where \em Shape is a shape with presumably incorrect tolerance, \em + Tolerance is a desired value of tolerance. + +\image html limit_tolerance_dlg.png + +\n Arguments: Name + 1 shape + 1 value (new tolerance). + +Our TUI Scripts provide you with useful examples of the use of +\ref tui_limit_tolerance "Repairing Operations". + +*/ diff --git a/doc/salome/gui/GEOM/input/repairing_operations.doc b/doc/salome/gui/GEOM/input/repairing_operations.doc index 542f5c25e..592c1b653 100644 --- a/doc/salome/gui/GEOM/input/repairing_operations.doc +++ b/doc/salome/gui/GEOM/input/repairing_operations.doc @@ -17,6 +17,8 @@ holes with free boundaries on a selected face.

  • \subpage sewing_operation_page "Sewing" - sews faces or shells.
  • \subpage glue_faces_operation_page "Glue faces" - unites coincident faces within the given tolerance.
  • +
  • \subpage limit_tolerance_operation_page "Limit Tolerance" - tries +to set new tolerance value for the given shape.
  • \subpage add_point_on_edge_operation_page "Add point on edge" - splits an edge in two.
  • \subpage change_orientation_operation_page "Change orientation" - diff --git a/doc/salome/gui/GEOM/input/tui_repairing_operations.doc b/doc/salome/gui/GEOM/input/tui_repairing_operations.doc index 98dccc6f0..ff562631f 100644 --- a/doc/salome/gui/GEOM/input/tui_repairing_operations.doc +++ b/doc/salome/gui/GEOM/input/tui_repairing_operations.doc @@ -289,6 +289,31 @@ gg.createAndDisplayGO(id_glue) gg.setDisplayMode(id_glue,1) \endcode +\anchor tui_limit_tolerance +

    Limit Tolerance

    + +\code +import geompy +gg = salome.ImportComponentGUI("GEOM") + +# import initial topology +bad_shape = geompy.ImportBREP("my_bad_shape.brep") + +# limit tolerance +tolerance = 1e-07 +good_shape = geompy.LimitTolerance(bad_shape, tolerance) + +# add objects in the study +id_bad_shape = geompy.addToStudy(bad_shape, "My Bad Shape") +id_good_shape = geompy.addToStudy(good_shape, "My Good Shape") + +# display the results +gg.createAndDisplayGO(id_bad_shape) +gg.setDisplayMode(id_bad_shape, 1) +gg.createAndDisplayGO(id_good_shape) +gg.setDisplayMode(id_good_shape, 1) +\endcode + \anchor tui_add_point_on_edge

    Add Point on Edge

    diff --git a/doc/salome/gui/GEOM/input/tui_test_others.doc b/doc/salome/gui/GEOM/input/tui_test_others.doc index 443326fea..e2c6d43b4 100644 --- a/doc/salome/gui/GEOM/input/tui_test_others.doc +++ b/doc/salome/gui/GEOM/input/tui_test_others.doc @@ -99,12 +99,21 @@ \anchor swig_GetPoint \until blocksComp (-50, -50, -50) +\anchor swig_GetVertexNearPoint +\until near (40, 40, 40) + +\anchor swig_GetEdge +\until by two points + \anchor swig_GetEdgeNearPoint \until edge near point \anchor swig_GetBlockByParts \until "b0 image" +\anchor swig_GetShapesNearPoint +\until "faces near point" + \anchor swig_GetShapesOnPlane \until Face on Plane diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 164969e51..309d9bbe8 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -1905,6 +1905,15 @@ module GEOM in double theZ, in double theEpsilon); + /*! + * Find a vertex of the given shape, which has minimal distance to the given point. + * \param theShape Any shape. + * \param thePoint Point, close to the desired vertex. + * \return New GEOM_Object, containing the found vertex. + */ + GEOM_Object GetVertexNearPoint (in GEOM_Object theShape, + in GEOM_Object thePoint); + /*! * Get an edge, found in the given shape by two given vertices. * \param theShape Block or a compound of blocks. @@ -1973,6 +1982,22 @@ module GEOM GEOM_Object GetFaceByNormale (in GEOM_Object theBlock, in GEOM_Object theVector); + /*! + * Find all subshapes of type \a theShapeType of the given shape, + * which have minimal distance to the given point. + * \param theShape Any shape. + * \param thePoint Point, close to the desired shape. + * \param theShapeType Defines what kind of subshapes is searched. + * \param theTolerance The tolerance for distances comparison. All shapes + * with distances to the given point in interval + * [minimal_distance, minimal_distance + theTolerance] will be gathered. + * \return New GEOM_Object, containing a group of all found shapes. + */ + GEOM_Object GetShapesNearPoint (in GEOM_Object theShape, + in GEOM_Object thePoint, + in long theShapeType, + in double theTolerance); + /*! * Extract blocks from blocks compounds */ @@ -2726,6 +2751,14 @@ module GEOM GEOM_Object ChangeOrientation (in GEOM_Object theObject); GEOM_Object ChangeOrientationCopy (in GEOM_Object theObject); + /*! + * Try to limit tolerance of the given object by value \a theTolerance. + * \param theObject Shape to be processed. + * \param theTolerance Required tolerance value. + * \return New GEOM_Object, containing processed shape. + */ + GEOM_Object LimitTolerance (in GEOM_Object theObject, in double theTolerance); + }; /*! diff --git a/resources/Makefile.am b/resources/Makefile.am index 3ba2946e0..f8bc0a9dc 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -93,6 +93,7 @@ filletface.png \ filling.png \ fuse.png \ geometry.png \ +limit_tolerance.png \ line.png \ line2points.png \ line2faces.png \ diff --git a/resources/limit_tolerance.png b/resources/limit_tolerance.png new file mode 100644 index 0000000000000000000000000000000000000000..35f20804e63c150e81b78be80e32474caa2c1c46 GIT binary patch literal 565 zcmV-50?Pe~P)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ-t4TybRCwBA{Qv(y12q9a0I|RrjEsyJk|y!}SZzDA zu#gd#fdB!-f=v)+5Ktozkdgpm9vt!*1_J~T1IWwB-i9jX24ZC(wg%#0AdW}FATets zwQv9sKqv+xDbR;%3Wgf0kA`6u1*01Z5J1?xtOE7s3ncs%O$|3xjRcaOJ0Nuc0R(p; z)Fx#lS0Q@^S5n|c@;XQ_13&;Vp(%jbh~g?HCa^MbjPQb}d4Z&t8z6vKuo(CPNzs3( zVIV_a{QLJ0oWjubAR8zF5J2cI1SO9zNUq}n8UhL*1|VGlq(Y!x<3@8OOfL^W0I?8A z_#j0pP?y1i;|rRlC;%XUmwN)gI)bD4;z7!KJV+7t6(E4n4Ma9n1ugv0!wi;;?!fag z5C8-aHUrT!KSp^7wE%130T4jA3`92=mw_0G8z8^{vYo7x#-!Ws00000NkvXXu0mjf De$2&r literal 0 HcmV?d00001 diff --git a/src/GEOMGUI/GEOM_images.ts b/src/GEOMGUI/GEOM_images.ts index 3dab5a404..e41de1d95 100644 --- a/src/GEOMGUI/GEOM_images.ts +++ b/src/GEOMGUI/GEOM_images.ts @@ -269,6 +269,10 @@ ICON_DLG_GLUE_FACES2 glue2.png + + ICON_DLG_LIMIT_TOLERANCE + limit_tolerance.png + ICON_DLG_INERTIA axisinertia.png @@ -849,6 +853,10 @@ ICO_GLUE_FACES glue.png + + ICO_LIMIT_TOLERANCE + limit_tolerance.png + ICO_GROUP_CREATE group_new.png diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index aac0da797..9a47a49af 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -771,6 +771,10 @@ Please, select face, shell or solid and try again GEOM_GLUE_TITLE Glue faces + + GEOM_LIMIT_TOLERANCE_TITLE + Limit tolerance + GEOM_HEIGHT Height : @@ -2055,6 +2059,10 @@ Please, select face, shell or solid and try again GLUE_NEW_OBJ_NAME Glue + + LIMIT_TOLERANCE_NEW_OBJ_NAME + Limit_tolerance + MEN_ALL_SEL_ONLY Select All @@ -2307,6 +2315,10 @@ Please, select face, shell or solid and try again MEN_ISOS Isos + + MEN_LIMIT_TOLERANCE + Limit tolerance + MEN_LINE Line @@ -2955,6 +2967,10 @@ Please, select face, shell or solid and try again STB_LINE Create a line + + STB_LIMIT_TOLERANCE + Limit tolerance + STB_LOCAL_CS Create a local coordinate system @@ -3479,6 +3495,10 @@ Please, select face, shell or solid and try again TOP_LINE Create a line + + TOP_LIMIT_TOLERANCE + Limit tolerance + TOP_LOCAL_CS Create a local coordinate system diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 1edeb1ada..44d9898fd 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -19,11 +19,10 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// GEOM GEOMGUI : GUI for Geometry component +// File : GeometryGUI.cxx +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// GEOM GEOMGUI : GUI for Geometry component -// File : GeometryGUI.cxx -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// #include // E.A. must be included before Python.h to fix compilation on windows #include "Python.h" #include "GeometryGUI.h" @@ -476,6 +475,7 @@ void GeometryGUI::OnGUIEvent( int id ) case GEOMOp::OpFreeFaces: // MENU MEASURE - FREE FACES case GEOMOp::OpOrientation: // MENU REPAIR - CHANGE ORIENTATION case GEOMOp::OpGlueFaces: // MENU REPAIR - GLUE FACES + case GEOMOp::OpLimitTolerance: // MENU REPAIR - LIMIT TOLERANCE case GEOMOp::OpRemoveExtraEdges: // MENU REPAIR - REMOVE EXTRA EDGES libName = "RepairGUI"; break; @@ -580,7 +580,7 @@ void GeometryGUI::createGeomAction( const int id, const QString& label, const QS createAction( id, tr( QString( "TOP_%1" ).arg( label ).toLatin1().constData() ), icon, - tr( QString( "MEN_%1" ).arg( label ).toLatin1().constData() ), + tr( QString( "MEN_%1" ).arg( label ).toLatin1().constData() ), tr( QString( "STB_%1" ).arg( label ).toLatin1().constData() ), accel, application()->desktop(), @@ -706,6 +706,7 @@ void GeometryGUI::initialize( CAM_Application* app ) createGeomAction( GEOMOp::OpSewing, "SEWING" ); createGeomAction( GEOMOp::OpGlueFaces, "GLUE_FACES" ); + createGeomAction( GEOMOp::OpLimitTolerance, "LIMIT_TOLERANCE" ); createGeomAction( GEOMOp::OpSuppressFaces, "SUPPRESS_FACES" ); createGeomAction( GEOMOp::OpSuppressHoles, "SUPPERSS_HOLES" ); createGeomAction( GEOMOp::OpShapeProcess, "SHAPE_PROCESS" ); @@ -765,7 +766,7 @@ void GeometryGUI::initialize( CAM_Application* app ) createGeomAction( GEOMOp::OpShowChildren, "POP_SHOW_CHILDREN" ); createGeomAction( GEOMOp::OpHideChildren, "POP_HIDE_CHILDREN" ); createGeomAction( GEOMOp::OpPointMarker, "POP_POINT_MARKER" ); - + createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" ); // createGeomAction( GEOMOp::OpPipeTShapeGroups, "PIPETSHAPEGROUPS" ); //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@// @@ -891,6 +892,7 @@ void GeometryGUI::initialize( CAM_Application* app ) createMenu( GEOMOp::OpSuppressHoles, repairId, -1 ); createMenu( GEOMOp::OpSewing, repairId, -1 ); createMenu( GEOMOp::OpGlueFaces, repairId, -1 ); + createMenu( GEOMOp::OpLimitTolerance, repairId, -1 ); createMenu( GEOMOp::OpAddPointOnEdge, repairId, -1 ); //createMenu( GEOMOp::OpFreeBoundaries, repairId, -1 ); //createMenu( GEOMOp::OpFreeFaces, repairId, -1 ); @@ -1210,7 +1212,7 @@ bool GeometryGUI::activateModule( SUIT_Study* study ) SALOME_ListIO selected; sm->selectedObjects( selected ); sm->clearSelected(); - + // disable OCC selectors getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() ); QListIterator itOCCSel( myOCCSelectors ); @@ -1473,7 +1475,7 @@ void GeometryGUI::createPreferences() setPreferenceProperty( genGroup, "columns", 2 ); int dispmode = addPreference( tr( "PREF_DISPLAY_MODE" ), genGroup, - LightApp_Preferences::Selector, + LightApp_Preferences::Selector, "Geometry", "display_mode" ); addPreference( tr( "PREF_SHADING_COLOR" ), genGroup, @@ -1499,36 +1501,36 @@ void GeometryGUI::createPreferences() int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup, LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" ); - + // Quantities with individual precision settings int precGroup = addPreference( tr( "GEOM_PREF_GROUP_PRECISION" ), tabId ); setPreferenceProperty( precGroup, "columns", 2 ); - + const int nbQuantities = 8; int prec[nbQuantities], ii = 0; prec[ii++] = addPreference( tr( "GEOM_PREF_length_precision" ), precGroup, - LightApp_Preferences::IntSpin, "Geometry", "length_precision" ); + LightApp_Preferences::IntSpin, "Geometry", "length_precision" ); prec[ii++] = addPreference( tr( "GEOM_PREF_angle_precision" ), precGroup, - LightApp_Preferences::IntSpin, "Geometry", "angle_precision" ); + LightApp_Preferences::IntSpin, "Geometry", "angle_precision" ); prec[ii++] = addPreference( tr( "GEOM_PREF_len_tol_precision" ), precGroup, - LightApp_Preferences::IntSpin, "Geometry", "len_tol_precision" ); + LightApp_Preferences::IntSpin, "Geometry", "len_tol_precision" ); prec[ii++] = addPreference( tr( "GEOM_PREF_ang_tol_precision" ), precGroup, - LightApp_Preferences::IntSpin, "Geometry", "ang_tol_precision" ); + LightApp_Preferences::IntSpin, "Geometry", "ang_tol_precision" ); prec[ii++] = addPreference( tr( "GEOM_PREF_weight_precision" ), precGroup, - LightApp_Preferences::IntSpin, "Geometry", "weight_precision" ); + LightApp_Preferences::IntSpin, "Geometry", "weight_precision" ); prec[ii++] = addPreference( tr( "GEOM_PREF_density_precision" ), precGroup, - LightApp_Preferences::IntSpin, "Geometry", "density_precision" ); + LightApp_Preferences::IntSpin, "Geometry", "density_precision" ); prec[ii++] = addPreference( tr( "GEOM_PREF_parametric_precision" ), precGroup, - LightApp_Preferences::IntSpin, "Geometry", "parametric_precision" ); + LightApp_Preferences::IntSpin, "Geometry", "parametric_precision" ); prec[ii ] = addPreference( tr( "GEOM_PREF_param_tol_precision" ), precGroup, - LightApp_Preferences::IntSpin, "Geometry", "param_tol_precision" ); - + LightApp_Preferences::IntSpin, "Geometry", "param_tol_precision" ); + // Set property for precision value for spinboxes for ( ii = 0; ii < nbQuantities; ii++ ){ setPreferenceProperty( prec[ii], "min", -14 ); setPreferenceProperty( prec[ii], "max", 14 ); setPreferenceProperty( prec[ii], "precision", 2 ); - } + } int VertexGroup = addPreference( tr( "PREF_GROUP_VERTEX" ), tabId ); setPreferenceProperty( VertexGroup, "columns", 2 ); diff --git a/src/GEOMGUI/GeometryGUI_Operations.h b/src/GEOMGUI/GeometryGUI_Operations.h index 311dbbe76..c027220c9 100644 --- a/src/GEOMGUI/GeometryGUI_Operations.h +++ b/src/GEOMGUI/GeometryGUI_Operations.h @@ -16,10 +16,9 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // - // File : GeometryGUI_Operations.h // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// + #ifndef GEOMETRYGUI_OPERATIONS_H #define GEOMETRYGUI_OPERATIONS_H @@ -131,6 +130,7 @@ namespace GEOMOp { OpOrientation = 4009, // MENU REPAIR - CHANGE ORIENTATION OpGlueFaces = 4010, // MENU REPAIR - GLUE FACES OpRemoveExtraEdges = 4011, // MENU REPAIR - REMOVE EXTRA EDGES + OpLimitTolerance = 4012, // MENU REPAIR - LIMIT TOLERANCE // MeasureGUI ----------------//-------------------------------- OpProperties = 5000, // MENU MEASURES - PROPERTIES OpCenterMass = 5001, // MENU MEASURES - CENTRE OF MASS @@ -160,6 +160,6 @@ namespace GEOMOp { // OpPipeTShapeGroups = 10002, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS //@@ insert new functions before this line @@ do not remove this line @@// }; -} +} #endif // GEOMETRYGUI_OPERATIONS_H diff --git a/src/GEOMImpl/GEOMImpl_HealingDriver.cxx b/src/GEOMImpl/GEOMImpl_HealingDriver.cxx index 5670d099b..d59b07203 100644 --- a/src/GEOMImpl/GEOMImpl_HealingDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_HealingDriver.cxx @@ -18,7 +18,6 @@ // 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 @@ -45,6 +44,12 @@ #include #include +#include +#include +#include +#include +#include + #include #include @@ -126,6 +131,9 @@ Standard_Integer GEOMImpl_HealingDriver::Execute(TFunction_Logbook& log) const case CHANGE_ORIENTATION: ChangeOrientation(&HI, anOriginalShape, aShape); break; + case LIMIT_TOLERANCE: + LimitTolerance(&HI, anOriginalShape, aShape); + break; default: return 0; } @@ -465,6 +473,36 @@ Standard_Boolean GEOMImpl_HealingDriver::ChangeOrientation (GEOMImpl_IHealing* t return aResult; } +//======================================================================= +//function : LimitTolerance +//purpose : +//======================================================================= +void GEOMImpl_HealingDriver::LimitTolerance (GEOMImpl_IHealing* theHI, + const TopoDS_Shape& theOriginalShape, + TopoDS_Shape& theOutShape) const +{ + Standard_Real aTol = theHI->GetTolerance(); + if (aTol < Precision::Confusion()) + aTol = Precision::Confusion(); + + // 1. Make a copy to prevent the original shape changes. + TopoDS_Shape aShapeCopy; + TColStd_IndexedDataMapOfTransientTransient aMapTShapes; + TNaming_CopyShape::CopyTool(theOriginalShape, aMapTShapes, aShapeCopy); + + // 2. Limit tolerance. + ShapeFix_ShapeTolerance aSFT; + aSFT.LimitTolerance(aShapeCopy, aTol, aTol, TopAbs_SHAPE); + + // 3. Fix obtained shape. + Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape (aShapeCopy); + aSfs->Perform(); + theOutShape = aSfs->Shape(); + + BRepCheck_Analyzer ana (theOutShape, Standard_True); + if (!ana.IsValid()) + StdFail_NotDone::Raise("Non valid shape result"); +} //======================================================================= //function : GEOMImpl_HealingDriver_Type_ diff --git a/src/GEOMImpl/GEOMImpl_HealingDriver.hxx b/src/GEOMImpl/GEOMImpl_HealingDriver.hxx index 344cf770c..4e4b44b49 100644 --- a/src/GEOMImpl/GEOMImpl_HealingDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_HealingDriver.hxx @@ -19,10 +19,9 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // - // File : GEOMImpl_HealingDriver.hxx // Module : GEOMImpl -// + #ifndef _GEOMImpl_HealingDriver_HeaderFile #define _GEOMImpl_HealingDriver_HeaderFile @@ -156,7 +155,7 @@ Standard_EXPORT ~GEOMImpl_HealingDriver() {}; // Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_HealingDriver_Type_(); Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_HealingDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_HealingDriver) == AType || TFunction_Driver::IsKind(AType)); } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_HealingDriver) == AType || TFunction_Driver::IsKind(AType)); } private: Standard_Boolean ShapeProcess ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; @@ -167,7 +166,7 @@ Standard_Boolean RemoveHoles ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS Standard_Boolean Sew ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; Standard_Boolean AddPointOnEdge( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; Standard_Boolean ChangeOrientation( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; - +void LimitTolerance( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; }; diff --git a/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx b/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx index 3aeca3008..b4c4ebd77 100644 --- a/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx @@ -569,6 +569,81 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetPoint return aResult; } +//============================================================================= +/*! + * GetVertexNearPoint + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetVertexNearPoint + (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) thePoint) +{ + SetErrorCode(KO); + + // New Point object + Handle(GEOM_Object) aResult; + + // Arguments + if (theShape.IsNull() || thePoint.IsNull()) return NULL; + + TopoDS_Shape aBlockOrComp = theShape->GetValue(); + TopoDS_Shape aPoint = thePoint->GetValue(); + if (aBlockOrComp.IsNull() || aPoint.IsNull()) { + SetErrorCode("Given shape is null"); + return NULL; + } + + if (aPoint.ShapeType() != TopAbs_VERTEX) { + SetErrorCode("Element for vertex identification is not a vertex"); + return NULL; + } + + TopoDS_Vertex aVert = TopoDS::Vertex(aPoint); + gp_Pnt aP = BRep_Tool::Pnt(aVert); + + // Compute the Vertex value + TopoDS_Shape V; + bool isFound = false; + Standard_Real aDist = RealLast(); + TopTools_MapOfShape mapShape; + + TopExp_Explorer exp (aBlockOrComp, TopAbs_VERTEX); + for (; exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + TopoDS_Vertex aVi = TopoDS::Vertex(exp.Current()); + gp_Pnt aPi = BRep_Tool::Pnt(aVi); + Standard_Real aDisti = aPi.Distance(aP); + if (aDisti < aDist) { + V = aVi; + aDist = aDisti; + isFound = true; + } + } + } + + if (!isFound) { + SetErrorCode("Vertex has not been found"); + return NULL; + } + + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aBlockOrComp, anIndices); + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(V)); + aResult = GetEngine()->AddSubShape(theShape, anArray); + + // The GetPoint() doesn't change object so no new function is required. + Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + + // Make a Python command + GEOM::TPythonDump(aFunction, /*append=*/true) + << aResult << " = geompy.GetVertexNearPoint(" + << theShape << ", " << thePoint << ")"; + + SetErrorCode(OK); + return aResult; +} + //============================================================================= /*! * GetEdge @@ -1458,6 +1533,136 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceByNormale return aResult; } +//============================================================================= +/*! + * GetShapesNearPoint + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetShapesNearPoint + (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) thePoint, + const Standard_Integer theShapeType, + const Standard_Real theTolerance) +{ + SetErrorCode(KO); + + // New object + Handle(GEOM_Object) aResult; + + // Arguments + if (theShape.IsNull() || thePoint.IsNull()) return NULL; + + TopoDS_Shape aBlockOrComp = theShape->GetValue(); + if (aBlockOrComp.IsNull()) { + SetErrorCode("Block or compound is null"); + return NULL; + } + + TopoDS_Shape anArg = thePoint->GetValue(); + if (anArg.IsNull()) { + SetErrorCode("Null shape is given as argument"); + return NULL; + } + if (anArg.ShapeType() != TopAbs_VERTEX) { + SetErrorCode("Element for face identification is not a vertex"); + return NULL; + } + + if (theShapeType < TopAbs_SOLID || TopAbs_VERTEX < theShapeType) { + SetErrorCode("Invalid type of result is requested"); + return NULL; + } + + if (theTolerance < Precision::Confusion()) { + theTolerance == Precision::Confusion(); + } + + // Compute the result + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + TopoDS_Vertex aVert = TopoDS::Vertex(anArg); + + TopTools_MapOfShape mapShape; + Standard_Integer nbEdges = 0; + TopExp_Explorer exp (aBlockOrComp, TopAbs_ShapeEnum(theShapeType)); + for (; exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + nbEdges++; + } + } + + if (nbEdges == 0) { + SetErrorCode("Given shape contains no subshapes of requested type"); + return NULL; + } + + // Calculate distances and find min + mapShape.Clear(); + Standard_Integer ind = 1; + Standard_Real aMinDist = RealLast(); + TopTools_Array1OfShape anEdges (1, nbEdges); + TColStd_Array1OfReal aDistances (1, nbEdges); + for (exp.Init(aBlockOrComp, TopAbs_ShapeEnum(theShapeType)); exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + TopoDS_Shape anEdge = exp.Current(); + anEdges(ind) = anEdge; + + BRepExtrema_DistShapeShape aDistTool (aVert, anEdges(ind)); + if (!aDistTool.IsDone()) { + SetErrorCode("Can not find a distance from the given point to one of subshapes"); + return NULL; + } + aDistances(ind) = aDistTool.Value(); + if (aDistances(ind) < aMinDist) { + aMinDist = aDistances(ind); + } + ind++; + } + } + + if (aMinDist < RealLast()) { + // Collect subshapes with distance < (aMinDist + theTolerance) + int nbSubShapes = 0; + TopTools_Array1OfShape aNearShapes (1, nbEdges); + for (ind = 1; ind <= nbEdges; ind++) { + if (aDistances(ind) < aMinDist + theTolerance) { + nbSubShapes++; + aNearShapes(nbSubShapes) = anEdges(ind); + } + } + + // Add subshape + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aBlockOrComp, anIndices); + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger (1, nbSubShapes); + for (ind = 1; ind <= nbSubShapes; ind++) { + anArray->SetValue(ind, anIndices.FindIndex(aNearShapes(ind))); + } + aResult = GetEngine()->AddSubShape(theShape, anArray); + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + if (aResult.IsNull()) + return NULL; + + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); + + //Make a Python command + GEOM::TPythonDump(aFunction) + << aResult << " = geompy.GetShapesNearPoint(" << theShape << ", " << thePoint + << ", " << TopAbs_ShapeEnum(theShapeType) << ", " << theTolerance << ")"; + + SetErrorCode(OK); + return aResult; +} + //============================================================================= /*! * IsCompoundOfBlocks diff --git a/src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx b/src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx index c5ce21151..43caa5883 100644 --- a/src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx @@ -18,7 +18,6 @@ // 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_IBlocksOperations_HXX_ #define _GEOMImpl_IBlocksOperations_HXX_ @@ -41,68 +40,76 @@ class GEOMImpl_IBlocksOperations : public GEOM_IOperations { // Creation of blocks and block faces Standard_EXPORT Handle(GEOM_Object) MakeQuad (Handle(GEOM_Object) theEdge1, - Handle(GEOM_Object) theEdge2, - Handle(GEOM_Object) theEdge3, - Handle(GEOM_Object) theEdge4); + Handle(GEOM_Object) theEdge2, + Handle(GEOM_Object) theEdge3, + Handle(GEOM_Object) theEdge4); Standard_EXPORT Handle(GEOM_Object) MakeQuad2Edges (Handle(GEOM_Object) theEdge1, - Handle(GEOM_Object) theEdge2); + Handle(GEOM_Object) theEdge2); Standard_EXPORT Handle(GEOM_Object) MakeQuad4Vertices (Handle(GEOM_Object) thePoint1, - Handle(GEOM_Object) thePoint2, - Handle(GEOM_Object) thePoint3, - Handle(GEOM_Object) thePoint4); + Handle(GEOM_Object) thePoint2, + Handle(GEOM_Object) thePoint3, + Handle(GEOM_Object) thePoint4); Standard_EXPORT Handle(GEOM_Object) MakeHexa (Handle(GEOM_Object) theFace1, - Handle(GEOM_Object) theFace2, - Handle(GEOM_Object) theFace3, - Handle(GEOM_Object) theFace4, - Handle(GEOM_Object) theFace5, - Handle(GEOM_Object) theFace6); + Handle(GEOM_Object) theFace2, + Handle(GEOM_Object) theFace3, + Handle(GEOM_Object) theFace4, + Handle(GEOM_Object) theFace5, + Handle(GEOM_Object) theFace6); Standard_EXPORT Handle(GEOM_Object) MakeHexa2Faces (Handle(GEOM_Object) theFace1, - Handle(GEOM_Object) theFace2); + Handle(GEOM_Object) theFace2); Standard_EXPORT Handle(GEOM_Object) MakeBlockCompound (Handle(GEOM_Object) theCompound); // Extract elements of blocks and blocks compounds Standard_EXPORT Handle(GEOM_Object) GetPoint (Handle(GEOM_Object) theShape, - const Standard_Real theX, - const Standard_Real theY, - const Standard_Real theZ, - const Standard_Real theEpsilon); + const Standard_Real theX, + const Standard_Real theY, + const Standard_Real theZ, + const Standard_Real theEpsilon); + + Standard_EXPORT Handle(GEOM_Object) GetVertexNearPoint (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) thePoint); Standard_EXPORT Handle(GEOM_Object) GetEdge (Handle(GEOM_Object) theShape, - Handle(GEOM_Object) thePoint1, - Handle(GEOM_Object) thePoint2); + Handle(GEOM_Object) thePoint1, + Handle(GEOM_Object) thePoint2); Standard_EXPORT Handle(GEOM_Object) GetEdgeNearPoint (Handle(GEOM_Object) theBlock, - Handle(GEOM_Object) thePoint); + Handle(GEOM_Object) thePoint); Standard_EXPORT Handle(GEOM_Object) GetFaceByPoints (Handle(GEOM_Object) theShape, - Handle(GEOM_Object) thePoint1, - Handle(GEOM_Object) thePoint2, - Handle(GEOM_Object) thePoint3, - Handle(GEOM_Object) thePoint4); + Handle(GEOM_Object) thePoint1, + Handle(GEOM_Object) thePoint2, + Handle(GEOM_Object) thePoint3, + Handle(GEOM_Object) thePoint4); Standard_EXPORT Handle(GEOM_Object) GetFaceByEdges (Handle(GEOM_Object) theShape, - Handle(GEOM_Object) theEdge1, - Handle(GEOM_Object) theEdge2); + Handle(GEOM_Object) theEdge1, + Handle(GEOM_Object) theEdge2); Standard_EXPORT Handle(GEOM_Object) GetOppositeFace (Handle(GEOM_Object) theBlock, - Handle(GEOM_Object) theFace); + Handle(GEOM_Object) theFace); Standard_EXPORT Handle(GEOM_Object) GetFaceNearPoint (Handle(GEOM_Object) theBlock, - Handle(GEOM_Object) thePoint); + Handle(GEOM_Object) thePoint); Standard_EXPORT Handle(GEOM_Object) GetFaceByNormale (Handle(GEOM_Object) theBlock, - Handle(GEOM_Object) theVector); + Handle(GEOM_Object) theVector); + + Standard_EXPORT Handle(GEOM_Object) GetShapesNearPoint (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) thePoint, + const Standard_Integer theShapeType, + const Standard_Real theTolerance); // Check blocks compounds Standard_EXPORT Standard_Boolean IsCompoundOfBlocks (Handle(GEOM_Object) theCompound, - const Standard_Integer theMinNbFaces, - const Standard_Integer theMaxNbFaces, - Standard_Integer& theNbBlocks); + const Standard_Integer theMinNbFaces, + const Standard_Integer theMaxNbFaces, + Standard_Integer& theNbBlocks); enum BCErrorType { NOT_BLOCK, @@ -118,13 +125,13 @@ class GEOMImpl_IBlocksOperations : public GEOM_IOperations { }; Standard_EXPORT Standard_Boolean CheckCompoundOfBlocksOld (Handle(GEOM_Object) theCompound, - std::list& theErrors); + std::list& theErrors); Standard_EXPORT Standard_Boolean CheckCompoundOfBlocks (Handle(GEOM_Object) theCompound, - std::list& theErrors); + std::list& theErrors); Standard_EXPORT TCollection_AsciiString PrintBCErrors (Handle(GEOM_Object) theCompound, - const std::list& theErrors); + const std::list& theErrors); Standard_EXPORT Handle(GEOM_Object) RemoveExtraEdges (Handle(GEOM_Object) theShape, const Standard_Integer theOptimumNbFaces = 6); @@ -132,9 +139,9 @@ class GEOMImpl_IBlocksOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) CheckAndImprove (Handle(GEOM_Object) theCompound); Standard_EXPORT static void AddBlocksFrom (const TopoDS_Shape& theShape, - TopTools_ListOfShape& BLO, - TopTools_ListOfShape& NOT, - TopTools_ListOfShape& EXT); + TopTools_ListOfShape& BLO, + TopTools_ListOfShape& NOT, + TopTools_ListOfShape& EXT); // Extract blocks from blocks compounds Standard_EXPORT Handle(TColStd_HSequenceOfTransient) ExplodeCompoundOfBlocks @@ -143,7 +150,7 @@ class GEOMImpl_IBlocksOperations : public GEOM_IOperations { const Standard_Integer theMaxNbFaces); Standard_EXPORT Handle(GEOM_Object) GetBlockNearPoint (Handle(GEOM_Object) theCompound, - Handle(GEOM_Object) thePoint); + Handle(GEOM_Object) thePoint); Standard_EXPORT Handle(GEOM_Object) GetBlockByParts (Handle(GEOM_Object) theCompound, @@ -155,17 +162,17 @@ class GEOMImpl_IBlocksOperations : public GEOM_IOperations { // Operations on blocks with gluing of result Standard_EXPORT Handle(GEOM_Object) MakeMultiTransformation1D (Handle(GEOM_Object) theBlock, - const Standard_Integer theDirFace1, - const Standard_Integer theDirFace2, - const Standard_Integer theNbTimes); + const Standard_Integer theDirFace1, + const Standard_Integer theDirFace2, + const Standard_Integer theNbTimes); Standard_EXPORT Handle(GEOM_Object) MakeMultiTransformation2D (Handle(GEOM_Object) theBlock, - const Standard_Integer theDirFace1U, - const Standard_Integer theDirFace2U, - const Standard_Integer theNbTimesU, - const Standard_Integer theDirFace1V, - const Standard_Integer theDirFace2V, - const Standard_Integer theNbTimesV); + const Standard_Integer theDirFace1U, + const Standard_Integer theDirFace2U, + const Standard_Integer theNbTimesU, + const Standard_Integer theDirFace1V, + const Standard_Integer theDirFace2V, + const Standard_Integer theNbTimesV); // Build groups for Propagation of 1D hypotheses Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Propagate (Handle(GEOM_Object) theShape); diff --git a/src/GEOMImpl/GEOMImpl_IHealing.hxx b/src/GEOMImpl/GEOMImpl_IHealing.hxx index 07252ac76..5a9d26455 100755 --- a/src/GEOMImpl/GEOMImpl_IHealing.hxx +++ b/src/GEOMImpl/GEOMImpl_IHealing.hxx @@ -19,9 +19,8 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// NOTE: This is an intreface to a function for the Healing creation. -//NOTE: This is an intreface to a function for the Healing creation. -// #include "GEOM_Function.hxx" #include @@ -76,7 +75,7 @@ public: void SetIndex( Standard_Integer val ) { _func->SetInteger(ARG_SUBSHAPE_INDEX, val); } Standard_Integer GetIndex() { return _func->GetInteger(ARG_SUBSHAPE_INDEX); } - + private: - Handle(GEOM_Function) _func; + Handle(GEOM_Function) _func; }; diff --git a/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx b/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx index d78c82d4e..e19acd19a 100644 --- a/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx @@ -18,7 +18,6 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// #ifdef WNT #pragma warning( disable:4786 ) @@ -864,7 +863,6 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::ChangeOrientation (Handle(GEOM_ return theObject; } - //============================================================================= /*! * ChangeOrientationCopy @@ -921,3 +919,62 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::ChangeOrientationCopy (Handle(G SetErrorCode(OK); return aNewObject; } + +//============================================================================= +/*! + * LimitTolerance + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IHealingOperations::LimitTolerance (Handle(GEOM_Object) theObject, + double theTolerance) +{ + // Set error code, check parameters + SetErrorCode(KO); + + if (theObject.IsNull()) + return NULL; + + Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) + return NULL; // There is no function which creates an object to be processed + + // Add a new object + Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + + // Add the function + aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), LIMIT_TOLERANCE); + + if (aFunction.IsNull()) + return NULL; + + // Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL; + + // Prepare "data container" class IHealing + GEOMImpl_IHealing HI (aFunction); + HI.SetOriginal(aLastFunction); + HI.SetTolerance(theTolerance); + + // Compute + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Healing driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + // Make a Python command + GEOM::TPythonDump(aFunction) << aNewObject << " = geompy.LimitTolerance(" + << theObject << ", " << theTolerance << ")"; + + SetErrorCode(OK); + return aNewObject; +} diff --git a/src/GEOMImpl/GEOMImpl_IHealingOperations.hxx b/src/GEOMImpl/GEOMImpl_IHealingOperations.hxx index aafa9687d..064194fdd 100644 --- a/src/GEOMImpl/GEOMImpl_IHealingOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IHealingOperations.hxx @@ -18,7 +18,6 @@ // 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_IHealingOperations_HXX_ #define _GEOMImpl_IHealingOperations_HXX_ @@ -39,9 +38,9 @@ class GEOMImpl_IHealingOperations : public GEOM_IOperations { // Apply Shape Processing to the selected Object Standard_EXPORT Handle(GEOM_Object) ShapeProcess( Handle(GEOM_Object) theObject, - const Handle(TColStd_HArray1OfExtendedString)& theOperations, - const Handle(TColStd_HArray1OfExtendedString)& theParams, - const Handle(TColStd_HArray1OfExtendedString)& theValues ); + const Handle(TColStd_HArray1OfExtendedString)& theOperations, + const Handle(TColStd_HArray1OfExtendedString)& theParams, + const Handle(TColStd_HArray1OfExtendedString)& theValues ); // Retrieve default Shape Process parameters (from resource file) Standard_EXPORT void GetShapeProcessParameters( std::list& theOperations, @@ -49,12 +48,13 @@ class GEOMImpl_IHealingOperations : public GEOM_IOperations { std::list& theValues ); // Retrieve default Shape Process parameters for given operator - Standard_EXPORT bool GetOperatorParameters( const std::string theOperation, + Standard_EXPORT bool GetOperatorParameters( const std::string theOperation, std::list& theParams, std::list& theValues ); // returns all parameters that are valid for the given operation (Shape Process operator) - Standard_EXPORT static bool GetParameters( const std::string theOperation, std::list& theParams ); + Standard_EXPORT static bool GetParameters( const std::string theOperation, + std::list& theParams ); Standard_EXPORT Handle(GEOM_Object) SuppressFaces( Handle(GEOM_Object) theObject, const Handle(TColStd_HArray1OfInteger)& theFaces); @@ -68,25 +68,28 @@ class GEOMImpl_IHealingOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) FillHoles( Handle(GEOM_Object) theObject, const Handle(TColStd_HArray1OfInteger)& theWires); - + Standard_EXPORT Handle(GEOM_Object) Sew( Handle(GEOM_Object) theObject, double theTolerance ); Standard_EXPORT Handle(GEOM_Object) DivideEdge( Handle(GEOM_Object) theObject, - int theIndex, - double theValue, - bool isByParameter ); + int theIndex, + double theValue, + bool isByParameter ); // this function does not use Function-Driver mechanism, it just computes the free // boundary edges and returns them in the sequence. It is called just for information reasons // and it's not intended for history/undo/redo/etc.. - Standard_EXPORT bool GetFreeBoundary ( Handle(GEOM_Object) theObject, - Handle(TColStd_HSequenceOfTransient)& theOutClosedWires, + Standard_EXPORT bool GetFreeBoundary ( Handle(GEOM_Object) theObject, + Handle(TColStd_HSequenceOfTransient)& theOutClosedWires, Handle(TColStd_HSequenceOfTransient)& theOutOpenWires ); Standard_EXPORT Handle(GEOM_Object) ChangeOrientation( Handle(GEOM_Object) theObject); Standard_EXPORT Handle(GEOM_Object) ChangeOrientationCopy( Handle(GEOM_Object) theObject); + Standard_EXPORT Handle(GEOM_Object) LimitTolerance( Handle(GEOM_Object) theObject, + double theTolerance ); + }; #endif diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index b1d626427..d1dcbe274 100755 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -269,6 +269,7 @@ #define SEWING 6 #define DIVIDE_EDGE 7 #define CHANGE_ORIENTATION 8 +#define LIMIT_TOLERANCE 9 #define BASIC_FILLING 1 diff --git a/src/GEOM_I/GEOM_IBlocksOperations_i.cc b/src/GEOM_I/GEOM_IBlocksOperations_i.cc index d5435c5d1..f765856d0 100644 --- a/src/GEOM_I/GEOM_IBlocksOperations_i.cc +++ b/src/GEOM_I/GEOM_IBlocksOperations_i.cc @@ -269,6 +269,34 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetPoint (GEOM::GEOM_Object_ptr return GetObject(anObject); } +//============================================================================= +/*! + * GetVertexNearPoint + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetVertexNearPoint + (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint) +{ + GEOM::GEOM_Object_var aGEOMObject; + + // Set a not done flag + GetOperations()->SetNotDone(); + + // Get the reference Objects + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint); + if (aShape.IsNull() || aPoint.IsNull()) return aGEOMObject._retn(); + + // Create the Point + Handle(GEOM_Object) anObject = + GetOperations()->GetVertexNearPoint(aShape, aPoint); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * GetEdge @@ -481,6 +509,37 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByNormale (GEOM::GEOM_Obj return GetObject(anObject); } +//============================================================================= +/*! + * GetShapesNearPoint + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetShapesNearPoint + (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint, + CORBA::Long theShapeType, + CORBA::Double theTolerance) +{ + GEOM::GEOM_Object_var aGEOMObject; + + // Set a not done flag + GetOperations()->SetNotDone(); + + // Get the reference Objects + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint); + + if (aShape.IsNull() || aPoint.IsNull()) return aGEOMObject._retn(); + + // Create the Shape + Handle(GEOM_Object) anObject = + GetOperations()->GetShapesNearPoint(aShape, aPoint, theShapeType, theTolerance); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * ExplodeCompoundOfBlocks diff --git a/src/GEOM_I/GEOM_IBlocksOperations_i.hh b/src/GEOM_I/GEOM_IBlocksOperations_i.hh index 68904892c..8fa1e1de7 100644 --- a/src/GEOM_I/GEOM_IBlocksOperations_i.hh +++ b/src/GEOM_I/GEOM_IBlocksOperations_i.hh @@ -75,6 +75,9 @@ class GEOM_I_EXPORT GEOM_IBlocksOperations_i : CORBA::Double theZ, CORBA::Double theEpsilon); + GEOM::GEOM_Object_ptr GetVertexNearPoint (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint); + GEOM::GEOM_Object_ptr GetEdge (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr thePoint1, GEOM::GEOM_Object_ptr thePoint2); @@ -101,10 +104,15 @@ class GEOM_I_EXPORT GEOM_IBlocksOperations_i : GEOM::GEOM_Object_ptr GetFaceByNormale (GEOM::GEOM_Object_ptr theBlock, GEOM::GEOM_Object_ptr theVector); + GEOM::GEOM_Object_ptr GetShapesNearPoint (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint, + CORBA::Long theShapeType, + CORBA::Double theTolerance); + // Check blocks compound CORBA::Boolean IsCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, - CORBA::Long theMinNbFaces, - CORBA::Long theMaxNbFaces, + CORBA::Long theMinNbFaces, + CORBA::Long theMaxNbFaces, CORBA::Long& theNbBlocks); CORBA::Boolean CheckCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, diff --git a/src/GEOM_I/GEOM_IHealingOperations_i.cc b/src/GEOM_I/GEOM_IHealingOperations_i.cc index 81dac09c3..39df78fe1 100644 --- a/src/GEOM_I/GEOM_IHealingOperations_i.cc +++ b/src/GEOM_I/GEOM_IHealingOperations_i.cc @@ -18,7 +18,6 @@ // 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 @@ -493,3 +492,30 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::ChangeOrientationCopy (GEOM::GE return GetObject(aNewObject); } + +//============================================================================= +/*! + * LimitTolerance + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::LimitTolerance (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theTolerance) +{ + GEOM::GEOM_Object_var aGEOMObject; + + // Set a not done flag + GetOperations()->SetNotDone(); + + // Get the object itself + Handle(GEOM_Object) anObject = GetObjectImpl(theObject); + if (anObject.IsNull()) + return aGEOMObject._retn(); + + // Perform + Handle(GEOM_Object) aNewObject = + GetOperations()->LimitTolerance(anObject, theTolerance); + if (!GetOperations()->IsDone() || aNewObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(aNewObject); +} diff --git a/src/GEOM_I/GEOM_IHealingOperations_i.hh b/src/GEOM_I/GEOM_IHealingOperations_i.hh index be42fbd55..01b3f48fc 100644 --- a/src/GEOM_I/GEOM_IHealingOperations_i.hh +++ b/src/GEOM_I/GEOM_IHealingOperations_i.hh @@ -18,7 +18,7 @@ // 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_IHealingOperations_i_HeaderFile #define _GEOM_IHealingOperations_i_HeaderFile @@ -36,42 +36,65 @@ #include #include -class GEOM_I_EXPORT GEOM_IHealingOperations_i : +class GEOM_I_EXPORT GEOM_IHealingOperations_i : public virtual POA_GEOM::GEOM_IHealingOperations, public virtual GEOM_IOperations_i { public: - GEOM_IHealingOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_IHealingOperations* theImpl); + GEOM_IHealingOperations_i(PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IHealingOperations* theImpl); ~GEOM_IHealingOperations_i(); - - GEOM::GEOM_Object_ptr ProcessShape(GEOM::GEOM_Object_ptr theObject, const GEOM::string_array& theOperations, const GEOM::string_array& theParams, const GEOM::string_array& theValues); - void GetShapeProcessParameters(GEOM::string_array_out theOperations, GEOM::string_array_out theParams, GEOM::string_array_out theValues); + GEOM::GEOM_Object_ptr ProcessShape(GEOM::GEOM_Object_ptr theObject, + const GEOM::string_array& theOperations, + const GEOM::string_array& theParams, + const GEOM::string_array& theValues); + + void GetShapeProcessParameters(GEOM::string_array_out theOperations, + GEOM::string_array_out theParams, + GEOM::string_array_out theValues); - void GetOperatorParameters (const char* theOperator, GEOM::string_array_out theParams, GEOM::string_array_out theValues); + void GetOperatorParameters (const char* theOperator, + GEOM::string_array_out theParams, + GEOM::string_array_out theValues); - GEOM::GEOM_Object_ptr SuppressFaces(GEOM::GEOM_Object_ptr theObject, const GEOM::short_array& theFaces); + GEOM::GEOM_Object_ptr SuppressFaces(GEOM::GEOM_Object_ptr theObject, + const GEOM::short_array& theFaces); - GEOM::GEOM_Object_ptr CloseContour (GEOM::GEOM_Object_ptr theObject, const GEOM::short_array& theWires, CORBA::Boolean isCommonVertex); + GEOM::GEOM_Object_ptr CloseContour (GEOM::GEOM_Object_ptr theObject, + const GEOM::short_array& theWires, + CORBA::Boolean isCommonVertex); - GEOM::GEOM_Object_ptr RemoveIntWires (GEOM::GEOM_Object_ptr theObject, const GEOM::short_array& theWires); - - GEOM::GEOM_Object_ptr FillHoles (GEOM::GEOM_Object_ptr theObject, const GEOM::short_array& theWires); + GEOM::GEOM_Object_ptr RemoveIntWires (GEOM::GEOM_Object_ptr theObject, + const GEOM::short_array& theWires); - GEOM::GEOM_Object_ptr Sew (GEOM::GEOM_Object_ptr theObject, CORBA::Double theTolerance); + GEOM::GEOM_Object_ptr FillHoles (GEOM::GEOM_Object_ptr theObject, + const GEOM::short_array& theWires); - GEOM::GEOM_Object_ptr DivideEdge (GEOM::GEOM_Object_ptr theObject, CORBA::Short theIndex, CORBA::Double theValue, CORBA::Boolean isByParameter); + GEOM::GEOM_Object_ptr Sew (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theTolerance); + + GEOM::GEOM_Object_ptr DivideEdge (GEOM::GEOM_Object_ptr theObject, + CORBA::Short theIndex, + CORBA::Double theValue, + CORBA::Boolean isByParameter); + + CORBA::Boolean GetFreeBoundary(GEOM::GEOM_Object_ptr theObject, + GEOM::ListOfGO_out theClosedWires, + GEOM::ListOfGO_out theOpenWires ); - CORBA::Boolean GetFreeBoundary(GEOM::GEOM_Object_ptr theObject, GEOM::ListOfGO_out theClosedWires, GEOM::ListOfGO_out theOpenWires ); - GEOM::GEOM_Object_ptr ChangeOrientation (GEOM::GEOM_Object_ptr theObject); GEOM::GEOM_Object_ptr ChangeOrientationCopy (GEOM::GEOM_Object_ptr theObject); + GEOM::GEOM_Object_ptr LimitTolerance (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theTolerance); + ::GEOMImpl_IHealingOperations* GetOperations() { return (::GEOMImpl_IHealingOperations*)GetImpl(); } private: - Handle(TColStd_HArray1OfExtendedString) Convert( const GEOM::string_array& ); - Handle(TColStd_HArray1OfInteger) Convert( const GEOM::short_array& ); + Handle(TColStd_HArray1OfExtendedString) Convert( const GEOM::string_array& ); + Handle(TColStd_HArray1OfInteger) Convert( const GEOM::short_array& ); }; diff --git a/src/GEOM_SWIG/GEOM_TestOthers.py b/src/GEOM_SWIG/GEOM_TestOthers.py index ca37dd30b..a1607cd43 100644 --- a/src/GEOM_SWIG/GEOM_TestOthers.py +++ b/src/GEOM_SWIG/GEOM_TestOthers.py @@ -500,6 +500,17 @@ def TestOtherOperations (geompy, math): geompy.addToStudyInFather(blocksComp, pb0_top_1, "point from blocksComp (-50, 50, 50)") geompy.addToStudyInFather(blocksComp, pb0_bot_1, "point from blocksComp (-50, -50, -50)") + # GetVertexNearPoint(theShape, thePoint) + pb0_top_2_near = geompy.MakeVertex(40, 40, 40) + pb0_top_2 = geompy.GetVertexNearPoint(blocksComp, pb0_top_2_near) + + geompy.addToStudyInFather(blocksComp, pb0_top_2, "point from blocksComp near (40, 40, 40)") + + # GetEdge(theShape, thePoint1, thePoint2) + edge_top_y50 = geompy.GetEdge(blocksComp, pb0_top_1, pb0_top_2) + + geompy.addToStudyInFather(blocksComp, edge_top_y50, "edge from blocksComp by two points") + # GetEdgeNearPoint(theShape, thePoint) pmidle = geompy.MakeVertex(50, 0, 50) edge1 = geompy.GetEdgeNearPoint(blocksComp, pmidle) @@ -511,6 +522,11 @@ def TestOtherOperations (geompy, math): geompy.addToStudyInFather(blocksComp, b0_image, "b0 image") + # GetShapesNearPoint(theShape, thePoint, theShapeType, theTolerance) + b0_faces_plus = geompy.GetShapesNearPoint(blocksComp, pb0_top_2_near, geompy.ShapeType["FACE"], 0.01) + + geompy.addToStudyInFather(blocksComp, b0_faces_plus, "faces near point (40, 40, 40)") + # GetShapesOnPlane faces_on_pln = geompy.GetShapesOnPlane(blocksComp, geompy.ShapeType["FACE"], v_0pp, geompy.GEOM.ST_ONIN) diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 67657dce1..0f570563f 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -448,7 +448,7 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @return New GEOM_Object, containing the created point. # # @ref tui_creation_point "Example" - def MakeVertex(self,theX, theY, theZ): + def MakeVertex(self, theX, theY, theZ): # Example: see GEOM_TestAll.py theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ) anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ) @@ -2266,11 +2266,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @return New GEOM_Object, containing processed shape. # # @ref swig_todo "Example" - def ChangeOrientationShellCopy(self,theObject): + def ChangeOrientationShellCopy(self, theObject): anObj = self.HealOp.ChangeOrientationCopy(theObject) RaiseIfFailed("ChangeOrientationCopy", self.HealOp) return anObj + ## Try to limit tolerance of the given object by value \a theTolerance. + # @param theObject Shape to be processed. + # @param theTolerance Required tolerance value. + # @return New GEOM_Object, containing processed shape. + # + # @ref tui_limit_tolerance "Example" + def LimitTolerance(self, theObject, theTolerance = 1e-07): + anObj = self.HealOp.LimitTolerance(theObject, theTolerance) + RaiseIfFailed("LimitTolerance", self.HealOp) + return anObj + ## Get a list of wires (wrapped in GEOM_Object-s), # that constitute a free boundary of the given shape. # @param theObject Shape to get free boundary of. @@ -2280,7 +2291,7 @@ class geompyDC(GEOM._objref_GEOM_Gen): # theOpenWires: Open wires on the free boundary of the given shape. # # @ref tui_measurement_tools_page "Example" - def GetFreeBoundary(self,theObject): + def GetFreeBoundary(self, theObject): # Example: see GEOM_TestHealing.py anObj = self.HealOp.GetFreeBoundary(theObject) RaiseIfFailed("GetFreeBoundary", self.HealOp) @@ -3620,19 +3631,31 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @return New GEOM_Object, containing the found vertex. # # @ref swig_GetPoint "Example" - def GetPoint(self,theShape, theX, theY, theZ, theEpsilon): + def GetPoint(self, theShape, theX, theY, theZ, theEpsilon): # Example: see GEOM_TestOthers.py anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon) RaiseIfFailed("GetPoint", self.BlocksOp) return anObj + ## Find a vertex of the given shape, which has minimal distance to the given point. + # @param theShape Any shape. + # @param thePoint Point, close to the desired vertex. + # @return New GEOM_Object, containing the found vertex. + # + # @ref swig_GetVertexNearPoint "Example" + def GetVertexNearPoint(self, theShape, thePoint): + # Example: see GEOM_TestOthers.py + anObj = self.BlocksOp.GetVertexNearPoint(theShape, thePoint) + RaiseIfFailed("GetVertexNearPoint", self.BlocksOp) + return anObj + ## Get an edge, found in the given shape by two given vertices. # @param theShape Block or a compound of blocks. # @param thePoint1,thePoint2 Points, close to the ends of the desired edge. # @return New GEOM_Object, containing the found edge. # - # @ref swig_todo "Example" - def GetEdge(self,theShape, thePoint1, thePoint2): + # @ref swig_GetEdge "Example" + def GetEdge(self, theShape, thePoint1, thePoint2): # Example: see GEOM_Spanner.py anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2) RaiseIfFailed("GetEdge", self.BlocksOp) @@ -3644,7 +3667,7 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @return New GEOM_Object, containing the found edge. # # @ref swig_GetEdgeNearPoint "Example" - def GetEdgeNearPoint(self,theShape, thePoint): + def GetEdgeNearPoint(self, theShape, thePoint): # Example: see GEOM_TestOthers.py anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint) RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp) @@ -3692,7 +3715,7 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @return New GEOM_Object, containing the found face. # # @ref swig_GetFaceNearPoint "Example" - def GetFaceNearPoint(self,theShape, thePoint): + def GetFaceNearPoint(self, theShape, thePoint): # Example: see GEOM_Spanner.py anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint) RaiseIfFailed("GetFaceNearPoint", self.BlocksOp) @@ -3710,6 +3733,23 @@ class geompyDC(GEOM._objref_GEOM_Gen): RaiseIfFailed("GetFaceByNormale", self.BlocksOp) return anObj + ## Find all subshapes of type \a theShapeType of the given shape, + # which have minimal distance to the given point. + # @param theShape Any shape. + # @param thePoint Point, close to the desired shape. + # @param theShapeType Defines what kind of subshapes is searched. + # @param theTolerance The tolerance for distances comparison. All shapes + # with distances to the given point in interval + # [minimal_distance, minimal_distance + theTolerance] will be gathered. + # @return New GEOM_Object, containing a group of all found shapes. + # + # @ref swig_GetShapesNearPoint "Example" + def GetShapesNearPoint(self, theShape, thePoint, theShapeType, theTolerance = 1e-07): + # Example: see GEOM_TestOthers.py + anObj = self.BlocksOp.GetShapesNearPoint(theShape, thePoint, theShapeType, theTolerance) + RaiseIfFailed("GetShapesNearPoint", self.BlocksOp) + return anObj + # end of l3_blocks_op ## @} diff --git a/src/RepairGUI/Makefile.am b/src/RepairGUI/Makefile.am index c59c15056..7f8a4fcbe 100644 --- a/src/RepairGUI/Makefile.am +++ b/src/RepairGUI/Makefile.am @@ -38,6 +38,7 @@ salomeinclude_HEADERS = \ RepairGUI_FreeFacesDlg.h \ RepairGUI_ChangeOrientationDlg.h \ RepairGUI_GlueDlg.h \ + RepairGUI_LimitToleranceDlg.h \ RepairGUI_RemoveExtraEdgesDlg.h # Libraries targets @@ -56,6 +57,7 @@ dist_libRepairGUI_la_SOURCES = \ RepairGUI_FreeFacesDlg.h \ RepairGUI_ChangeOrientationDlg.h \ RepairGUI_GlueDlg.h \ + RepairGUI_LimitToleranceDlg.h \ RepairGUI_RemoveExtraEdgesDlg.h \ \ RepairGUI.cxx \ @@ -70,6 +72,7 @@ dist_libRepairGUI_la_SOURCES = \ RepairGUI_FreeFacesDlg.cxx \ RepairGUI_ChangeOrientationDlg.cxx \ RepairGUI_GlueDlg.cxx \ + RepairGUI_LimitToleranceDlg.cxx \ RepairGUI_RemoveExtraEdgesDlg.cxx MOC_FILES = \ @@ -84,6 +87,7 @@ MOC_FILES = \ RepairGUI_FreeFacesDlg_moc.cxx \ RepairGUI_ChangeOrientationDlg_moc.cxx \ RepairGUI_GlueDlg_moc.cxx \ + RepairGUI_LimitToleranceDlg_moc.cxx \ RepairGUI_RemoveExtraEdgesDlg_moc.cxx nodist_libRepairGUI_la_SOURCES = \ diff --git a/src/RepairGUI/RepairGUI.cxx b/src/RepairGUI/RepairGUI.cxx index 652cdb63a..ebfc75fb4 100644 --- a/src/RepairGUI/RepairGUI.cxx +++ b/src/RepairGUI/RepairGUI.cxx @@ -19,11 +19,10 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// GEOM GEOMGUI : GUI for Geometry component +// File : RepairGUI.cxx +// Author : Damien COQUERET, Open CASCADE S.A.S. -// GEOM GEOMGUI : GUI for Geometry component -// File : RepairGUI.cxx -// Author : Damien COQUERET, Open CASCADE S.A.S. -// #include "RepairGUI.h" #include @@ -43,8 +42,9 @@ #include "RepairGUI_FreeBoundDlg.h" // Method FREE BOUNDARIES #include "RepairGUI_FreeFacesDlg.h" // Method FREE FACES #include "RepairGUI_GlueDlg.h" // Method GLUE FACES +#include "RepairGUI_LimitToleranceDlg.h" // Method LIMIT TOLERANCE #include "RepairGUI_ChangeOrientationDlg.h" // Method CHANGE ORIENTATION -#include "RepairGUI_RemoveExtraEdgesDlg.h" // Method REMOVE EXTRA EDGES +#include "RepairGUI_RemoveExtraEdgesDlg.h" // Method REMOVE EXTRA EDGES //======================================================================= // function : RepairGUI() @@ -66,7 +66,7 @@ RepairGUI::~RepairGUI() //======================================================================= // function : OnGUIEvent() -// purpose : +// purpose : //======================================================================= bool RepairGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) { @@ -77,18 +77,19 @@ bool RepairGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) QDialog* aDlg = NULL; switch ( theCommandID ) { - case GEOMOp::OpSewing: aDlg = new RepairGUI_SewingDlg ( getGeometryGUI(), parent ); break; - case GEOMOp::OpGlueFaces: aDlg = new RepairGUI_GlueDlg ( getGeometryGUI(), parent ); break; - case GEOMOp::OpSuppressFaces: aDlg = new RepairGUI_SuppressFacesDlg ( getGeometryGUI(), parent ); break; - case GEOMOp::OpSuppressHoles: aDlg = new RepairGUI_RemoveHolesDlg ( getGeometryGUI(), parent ); break; - case GEOMOp::OpShapeProcess: aDlg = new RepairGUI_ShapeProcessDlg ( getGeometryGUI(), parent ); break; - case GEOMOp::OpCloseContour: aDlg = new RepairGUI_CloseContourDlg ( getGeometryGUI(), parent ); break; - case GEOMOp::OpRemoveIntWires: aDlg = new RepairGUI_RemoveIntWiresDlg ( getGeometryGUI(), parent ); break; - case GEOMOp::OpAddPointOnEdge: aDlg = new RepairGUI_DivideEdgeDlg ( getGeometryGUI(), parent ); break; - case GEOMOp::OpFreeBoundaries: aDlg = new RepairGUI_FreeBoundDlg ( getGeometryGUI(), parent ); break; - case GEOMOp::OpFreeFaces: aDlg = new RepairGUI_FreeFacesDlg ( getGeometryGUI(), parent ); break; - case GEOMOp::OpOrientation: aDlg = new RepairGUI_ChangeOrientationDlg ( getGeometryGUI(), parent ); break; - case GEOMOp::OpRemoveExtraEdges: aDlg = new RepairGUI_RemoveExtraEdgesDlg ( getGeometryGUI(), parent ); break; + case GEOMOp::OpSewing: aDlg = new RepairGUI_SewingDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpGlueFaces: aDlg = new RepairGUI_GlueDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpLimitTolerance: aDlg = new RepairGUI_LimitToleranceDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpSuppressFaces: aDlg = new RepairGUI_SuppressFacesDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpSuppressHoles: aDlg = new RepairGUI_RemoveHolesDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpShapeProcess: aDlg = new RepairGUI_ShapeProcessDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpCloseContour: aDlg = new RepairGUI_CloseContourDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpRemoveIntWires: aDlg = new RepairGUI_RemoveIntWiresDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpAddPointOnEdge: aDlg = new RepairGUI_DivideEdgeDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpFreeBoundaries: aDlg = new RepairGUI_FreeBoundDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpFreeFaces: aDlg = new RepairGUI_FreeFacesDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpOrientation: aDlg = new RepairGUI_ChangeOrientationDlg (getGeometryGUI(), parent); break; + case GEOMOp::OpRemoveExtraEdges: aDlg = new RepairGUI_RemoveExtraEdgesDlg (getGeometryGUI(), parent); break; default: app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); break; diff --git a/src/RepairGUI/RepairGUI_LimitToleranceDlg.cxx b/src/RepairGUI/RepairGUI_LimitToleranceDlg.cxx new file mode 100644 index 000000000..19cfe7a02 --- /dev/null +++ b/src/RepairGUI/RepairGUI_LimitToleranceDlg.cxx @@ -0,0 +1,441 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This 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 RepairGUI : GUI for Geometry component +// File : RepairGUI_LimitToleranceDlg.cxx + +#include "RepairGUI_LimitToleranceDlg.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#define DEFAULT_TOLERANCE_VALUE 1e-07 + +//================================================================================= +// class : RepairGUI_LimitToleranceDlg() +// purpose : Constructs a RepairGUI_LimitToleranceDlg 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. +//================================================================================= +RepairGUI_LimitToleranceDlg::RepairGUI_LimitToleranceDlg(GeometryGUI* theGeometryGUI, + QWidget* parent, bool modal) + : GEOMBase_Skeleton(theGeometryGUI, parent, modal) +{ + QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_LIMIT_TOLERANCE"))); + QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setWindowTitle(tr("GEOM_LIMIT_TOLERANCE_TITLE")); + + /***************************************************************/ + mainFrame()->GroupConstructors->setTitle(tr("GEOM_LIMIT_TOLERANCE_TITLE")); + mainFrame()->RadioButton1->setIcon(image0); + mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->close(); + + GroupPoints = new DlgRef_1SelExt(centralWidget()); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE")); + GroupPoints->PushButton1->setIcon(image1); + GroupPoints->LineEdit1->setReadOnly(true); + + QLabel* aTolLab = new QLabel(tr("GEOM_TOLERANCE"), GroupPoints->Box); + myTolEdt = new SalomeApp_DoubleSpinBox(GroupPoints->Box); + initSpinBox(myTolEdt, 0., 100., DEFAULT_TOLERANCE_VALUE, "len_tol_precision"); + myTolEdt->setValue(DEFAULT_TOLERANCE_VALUE); + + QGridLayout* boxLayout = new QGridLayout(GroupPoints->Box); + boxLayout->setMargin(0); boxLayout->setSpacing(6); + boxLayout->addWidget(aTolLab, 0, 0); + boxLayout->addWidget(myTolEdt, 0, 2); + + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); + layout->setMargin(0); layout->setSpacing(6); + layout->addWidget(GroupPoints); + + setHelpFileName("limit_tolerance_operation_page.html"); + + Init(); +} + + +//================================================================================= +// function : ~RepairGUI_LimitToleranceDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +RepairGUI_LimitToleranceDlg::~RepairGUI_LimitToleranceDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void RepairGUI_LimitToleranceDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myObject = GEOM::GEOM_Object::_nil(); + + //myGeomGUI->SetState(0); + //globalSelection(GEOM_COMPOUND); + + mainFrame()->GroupBoxPublish->show(); + + /* signals and slots connections */ + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + + initName(tr("LIMIT_TOLERANCE_NEW_OBJ_NAME")); + + ConstructorsClicked(0); + + activateSelection(); + updateButtonState(); +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void RepairGUI_LimitToleranceDlg::ConstructorsClicked(int constructorId) +{ + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + + GroupPoints->show(); + GroupPoints->LineEdit1->setText(""); + myEditCurrentArgument = GroupPoints->LineEdit1; + myEditCurrentArgument->setFocus(); + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + + qApp->processEvents(); + updateGeometry(); + resize(minimumSizeHint()); + + updateButtonState(); + activateSelection(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : Same than click on apply but close this dialog. +//================================================================================= +void RepairGUI_LimitToleranceDlg::ClickOnOk() +{ + if (ClickOnApply()) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool RepairGUI_LimitToleranceDlg::ClickOnApply() +{ + if (!onAcceptLocal()) + return false; + + initName(); + + ConstructorsClicked(0); + + return true; +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection +//================================================================================= +void RepairGUI_LimitToleranceDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + myObject = GEOM::GEOM_Object::_nil(); + + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + SALOME_ListIO aSelList; + aSelMgr->selectedObjects(aSelList); + + if (aSelList.Extent() == 1) { + Handle(SALOME_InteractiveObject) anIO = aSelList.First(); + Standard_Boolean aRes; + myObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); + if (aRes) + myEditCurrentArgument->setText(GEOMBase::GetName(myObject)); + } + updateButtonState(); +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void RepairGUI_LimitToleranceDlg::SetEditCurrentArgument() +{ + const QObject* send = sender(); + if (send == GroupPoints->PushButton1) { + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); + } +} + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void RepairGUI_LimitToleranceDlg::LineEditReturnPressed() +{ + const QObject* send = sender(); + if (send == GroupPoints->LineEdit1) { + myEditCurrentArgument = GroupPoints->LineEdit1; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void RepairGUI_LimitToleranceDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + activateSelection(); +} + +//================================================================================= +// function : enterEvent() +// purpose : Mouse enter onto the dialog to activate it +//================================================================================= +void RepairGUI_LimitToleranceDlg::enterEvent(QEvent*) +{ + if (!mainFrame()->GroupConstructors->isEnabled()) + ActivateThisDialog(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr RepairGUI_LimitToleranceDlg::createOperation() +{ + return getGeomEngine()->GetIHealingOperations(getStudyId()); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool RepairGUI_LimitToleranceDlg::isValid(QString& msg) +{ + double v = myTolEdt->value(); + bool ok = myTolEdt->isValid(msg, true); + return !myObject->_is_nil() && (v > 0.) && ok; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool RepairGUI_LimitToleranceDlg::execute(ObjectList& objects) +{ + bool aResult = false; + objects.clear(); + + GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation()); + GEOM::GEOM_Object_var anObj = anOper->LimitTolerance(myObject, myTolEdt->value()); + aResult = !anObj->_is_nil(); + if (aResult) { + QStringList aParameters; + aParameters << myTolEdt->text(); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + objects.push_back(anObj._retn()); + } + + return aResult; +} + +//================================================================ +// Function : onAccept +// Purpose : This method should be called from dialog's slots onOk() and onApply() +// It perfroms user input validation, then it +// performs a proper operation and manages transactions, etc. +//================================================================ +bool RepairGUI_LimitToleranceDlg::onAcceptLocal() +{ + if (!getStudy() || !(getStudy()->studyDS())) + return false; + + _PTR(Study) aStudy = getStudy()->studyDS(); + + bool aLocked = aStudy->GetProperties()->IsLocked(); + if (aLocked) { + MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked"); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), tr("WRN_STUDY_LOCKED"), tr("BUT_OK")); + return false; + } + + QString msg; + if (!isValid(msg)) { + showError(msg); + return false; + } + + try { + if (openCommand()) { + SUIT_OverrideCursor wc; + + myGeomGUI->getApp()->putInfo(""); + ObjectList objects; + + if (!execute(objects)) { + wc.suspend(); + abortCommand(); + showError(); + } + else { + const int nbObjs = objects.size(); + for (ObjectList::iterator it = objects.begin(); it != objects.end(); ++it) { + QString aName = getNewObjectName(); + if (nbObjs > 1) { + if (aName.isEmpty()) + aName = getPrefix(*it); + aName = GEOMBase::GetDefaultName(aName); + } + else { + // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName() + if (aName.isEmpty()) + aName = GEOMBase::GetDefaultName(getPrefix(*it)); + } + addInStudy(*it, aName.toLatin1().data()); + display(*it, false); + } + + if (nbObjs) { + commitCommand(); + updateObjBrowser(); + myGeomGUI->getApp()->putInfo(QObject::tr("GEOM_PRP_DONE")); + } + else { + abortCommand(); + } + + // JFA 28.12.2004 BEGIN // To enable warnings + GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation()); + if (!CORBA::is_nil(anOper) && !anOper->IsDone()) { + wc.suspend(); + QString msgw = QObject::tr(anOper->GetErrorCode()); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), msgw, tr("BUT_OK")); + } + // JFA 28.12.2004 END + } + } + } + catch(const SALOME::SALOME_Exception& e) { + SalomeApp_Tools::QtCatchCorbaException(e); + abortCommand(); + } + + updateViewer(); + activateSelection(); + updateButtonState(); + + return true; +} + +//================================================================================= +// function : activateSelection +// purpose : Activate selection +//================================================================================= +void RepairGUI_LimitToleranceDlg::activateSelection() +{ + disconnect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + + globalSelection(GEOM_ALLSHAPES); + if (myObject->_is_nil()) + SelectionIntoArgument(); + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + updateViewer(); +} + +//================================================================================= +// function : updateButtonState +// purpose : Update button state +//================================================================================= +void RepairGUI_LimitToleranceDlg::updateButtonState() +{ + bool hasMainObj = !myObject->_is_nil(); + buttonOk()->setEnabled(hasMainObj); + buttonApply()->setEnabled(hasMainObj); +} + +//================================================================================= +// function : restoreSubShapes +// purpose : +//================================================================================= +void RepairGUI_LimitToleranceDlg::restoreSubShapes(SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theSObject) +{ + if (mainFrame()->CheckBoxRestoreSS->isChecked()) { + // empty list of arguments means that all arguments should be restored + getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), + GEOM::FSM_GetInPlace, /*theInheritFirstArg=*/true, + mainFrame()->CheckBoxAddPrefix->isChecked()); + } +} diff --git a/src/RepairGUI/RepairGUI_LimitToleranceDlg.h b/src/RepairGUI/RepairGUI_LimitToleranceDlg.h new file mode 100644 index 000000000..bba1dbfff --- /dev/null +++ b/src/RepairGUI/RepairGUI_LimitToleranceDlg.h @@ -0,0 +1,83 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This 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 : RepairGUI_LimitToleranceDlg.h + +#ifndef REPAIRGUI_LIMITTOLERANCEDLG_H +#define REPAIRGUI_LIMITTOLERANCEDLG_H + +#include + +class DlgRef_1SelExt; +class SalomeApp_DoubleSpinBox; +class QPushButton; +class QCheckBox; + +//================================================================================= +// class : RepairGUI_LimitToleranceDlg +// purpose : +//================================================================================= +class RepairGUI_LimitToleranceDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + RepairGUI_LimitToleranceDlg (GeometryGUI*, QWidget* = 0, bool = false); + ~RepairGUI_LimitToleranceDlg(); + +protected: + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid (QString&); + virtual bool execute (ObjectList&); + virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr); + +private: + void Init(); + void enterEvent (QEvent*); + void initSelection(); + + bool onAcceptLocal(); + + void activateSelection(); + void updateButtonState(); + +private: + GEOM::GEOM_Object_var myObject; + + DlgRef_1SelExt* GroupPoints; + SalomeApp_DoubleSpinBox* myTolEdt; + +private slots: + void ClickOnOk(); + bool ClickOnApply(); + + void ActivateThisDialog(); + + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + + void ConstructorsClicked( int ); +}; + +#endif // REPAIRGUI_LIMITTOLERANCEDLG_H -- 2.39.2