0016819: EDF PAL 564: Make fillet on 2D surface

This commit is contained in:
dmv 2008-12-23 11:21:26 +00:00
parent ad18f00191
commit 32059ef998
33 changed files with 1100 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -0,0 +1,25 @@
/*!
\page fillet2d_operation_page Fillet 2D
This operation creates fillets on the corners of a <b>2D Planar Face</b>.
\image html fillet2d_2.png
To produce a \b Fillet 2D in the <b>Main Menu</b> select
<b>Operations - > Transformation - > Fillet 2D</b>
Define the <b>Main Object</b> to create a fillet on, select the necessary
vertexes on this face in the OCC Viewer and define the \b Radius of the Fillet.
<b>TUI Command:</b> <em>geompy.MakeFillet(Shape, R, ListVertexes)</em>
\n <b>Arguments:</b> Name + 1 shape + one or several vertexes + 1 value (Fillet radius).
<b>Examples:</b>
\image html fillet2d_1.png
Our <b>TUI Scripts</b> provide you with useful examples of the use of
\ref tui_fillet2d "Transformation Operations".
*/

View File

@ -86,6 +86,7 @@
<li>\ref offset_operation_page</li> <li>\ref offset_operation_page</li>
<li>\ref multi_translation_operation_page</li> <li>\ref multi_translation_operation_page</li>
<li>\ref multi_rotation_operation_page</li> <li>\ref multi_rotation_operation_page</li>
<li>\ref fillet2d_operation_page</li>
<li>\ref fillet_operation_page</li> <li>\ref fillet_operation_page</li>
<li>\ref chamfer_operation_page</li> <li>\ref chamfer_operation_page</li>
</ul> </ul>

View File

@ -11,6 +11,7 @@
<li>\subpage offset_operation_page</li> <li>\subpage offset_operation_page</li>
<li>\subpage multi_translation_operation_page</li> <li>\subpage multi_translation_operation_page</li>
<li>\subpage multi_rotation_operation_page</li> <li>\subpage multi_rotation_operation_page</li>
<li>\subpage fillet2d_operation_page</li>
<li>\subpage fillet_operation_page</li> <li>\subpage fillet_operation_page</li>
<li>\subpage chamfer_operation_page</li> <li>\subpage chamfer_operation_page</li>
</ul> </ul>

View File

@ -26,6 +26,7 @@
<li>\ref offset_operation_page</li> <li>\ref offset_operation_page</li>
<li>\ref multi_translation_operation_page</li> <li>\ref multi_translation_operation_page</li>
<li>\ref multi_rotation_operation_page</li> <li>\ref multi_rotation_operation_page</li>
<li>\ref fillet2d_operation_page</li>
<li>\ref fillet_operation_page</li> <li>\ref fillet_operation_page</li>
<li>\ref chamfer_operation_page</li> <li>\ref chamfer_operation_page</li>
</ul> </ul>

View File

@ -349,6 +349,27 @@ gg.createAndDisplayGO(id_rot2d)
gg.setDisplayMode(id_rot2d,1) gg.setDisplayMode(id_rot2d,1)
\endcode \endcode
\anchor tui_fillet2d
<br><h2>Fillet 2D</h2>
\code
import geompy
import salome
gg = salome.ImportComponentGUI("GEOM")
# create a face in OXY plane
face = geompy.MakeFaceHW(100, 100, 1)
fillet2d = geompy.MakeFillet2D(face, 30, [7, 9])
# add objects in the study
id_face = geompy.addToStudy(face,"Face_1")
id_fillet2d = geompy.addToStudy(fillet2d,"Fillet 2D_1")
# display disks
gg.createAndDisplayGO(id_face)
gg.createAndDisplayGO(id_fillet2d)
\endcode
\anchor tui_fillet \anchor tui_fillet
<br><h2>Fillet</h2> <br><h2>Fillet</h2>

View File

@ -2244,11 +2244,25 @@ module GEOM
GEOM_Object MakeFilletFaces (in GEOM_Object theShape, GEOM_Object MakeFilletFaces (in GEOM_Object theShape,
in double theR, in double theR,
in ListOfLong theFaces); in ListOfLong theFaces);
GEOM_Object MakeFilletFacesR1R2 (in GEOM_Object theShape, GEOM_Object MakeFilletFacesR1R2 (in GEOM_Object theShape,
in double theR1, in double theR1,
in double theR2, in double theR2,
in ListOfLong theFaces); in ListOfLong theFaces);
/*!
* Perform a fillet on face of the specified vertexes of the given shape.
* \param theShape Shape, to perform fillet on.
* \param theR Fillet radius.
* \param theVertexes Global indices of vertexes to perform fillet on.
* \note Global index of sub-shape can be obtained, using method
* <VAR>GEOM_IShapesOperations.GetSubShapeIndex()</VAR>.
* \return New GEOM_Object, containing the result shape.
*/
GEOM_Object MakeFillet2D (in GEOM_Object theShape,
in double theR,
in ListOfLong theVertexes);
/*! /*!
* Perform a symmetric chamfer on all edges of the given shape. * Perform a symmetric chamfer on all edges of the given shape.
* \param theShape Shape, to perform chamfer on. * \param theShape Shape, to perform chamfer on.

View File

@ -512,6 +512,9 @@ module GEOM
in double theR1, in double theR1,
in double theR2, in double theR2,
in GEOM_List theFaces) ; in GEOM_List theFaces) ;
GEOM_Object MakeFillet2D (in GEOM_Object theShape,
in double theR,
in GEOM_List theVertexes) ;
GEOM_Object MakeChamferAll (in GEOM_Object theShape, GEOM_Object MakeChamferAll (in GEOM_Object theShape,
in double theD) ; in double theD) ;
GEOM_Object MakeChamferEdge (in GEOM_Object theShape, GEOM_Object MakeChamferEdge (in GEOM_Object theShape,

View File

@ -87,6 +87,7 @@ eraseall.png \
face_hw.png \ face_hw.png \
face_vechw.png \ face_vechw.png \
fillet.png \ fillet.png \
fillet2d.png \
filletall.png \ filletall.png \
filletedge.png \ filletedge.png \
filletface.png \ filletface.png \

BIN
resources/fillet2d.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 980 B

View File

@ -202,6 +202,10 @@
<source>ICON_DLG_FILLET</source> <source>ICON_DLG_FILLET</source>
<translation>fillet.png</translation> <translation>fillet.png</translation>
</message> </message>
<message>
<source>ICON_DLG_FILLET_2D</source>
<translation>fillet2d.png</translation>
</message>
<message> <message>
<source>ICON_DLG_FILLET_ALL</source> <source>ICON_DLG_FILLET_ALL</source>
<translation>filletall.png</translation> <translation>filletall.png</translation>
@ -738,6 +742,10 @@
<source>ICO_FILLET</source> <source>ICO_FILLET</source>
<translation>fillet.png</translation> <translation>fillet.png</translation>
</message> </message>
<message>
<source>ICO_FILLET_2D</source>
<translation>fillet2d.png</translation>
</message>
<message> <message>
<source>ICO_FILLING</source> <source>ICO_FILLING</source>
<translation>filling.png</translation> <translation>filling.png</translation>

View File

@ -580,6 +580,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_FILLET</source> <source>GEOM_FILLET</source>
<translation>Fillet</translation> <translation>Fillet</translation>
</message> </message>
<message>
<source>GEOM_FILLET_2D</source>
<translation>Fillet 2D</translation>
</message>
<message> <message>
<source>GEOM_FILLET_ABORT</source> <source>GEOM_FILLET_ABORT</source>
<translation>Fillet can't be computed with radius %1</translation> <translation>Fillet can't be computed with radius %1</translation>
@ -596,10 +600,18 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_FILLET_FACES</source> <source>GEOM_FILLET_FACES</source>
<translation>Fillet On Faces From Shape</translation> <translation>Fillet On Faces From Shape</translation>
</message> </message>
<message>
<source>GEOM_FILLET_VERTEXES</source>
<translation>Fillet On Vertexes From Face</translation>
</message>
<message> <message>
<source>GEOM_FILLET_TITLE</source> <source>GEOM_FILLET_TITLE</source>
<translation>Fillet Construction</translation> <translation>Fillet Construction</translation>
</message> </message>
<message>
<source>GEOM_FILLET_2D_TITLE</source>
<translation>2D Fillet Construction</translation>
</message>
<message> <message>
<source>GEOM_FILLING</source> <source>GEOM_FILLING</source>
<translation>Filling</translation> <translation>Filling</translation>
@ -1812,6 +1824,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_VERTEX</source> <source>GEOM_VERTEX</source>
<translation>Vertex</translation> <translation>Vertex</translation>
</message> </message>
<message>
<source>GEOM_VERTEXES</source>
<translation>Vertexes</translation>
</message>
<message> <message>
<source>GEOM_WATER_DENSITY</source> <source>GEOM_WATER_DENSITY</source>
<translation>Water Density :</translation> <translation>Water Density :</translation>
@ -2120,6 +2136,10 @@ Please, select face, shell or solid and try again</translation>
<source>MEN_FILLET</source> <source>MEN_FILLET</source>
<translation>Fillet</translation> <translation>Fillet</translation>
</message> </message>
<message>
<source>MEN_FILLET_2D</source>
<translation>Fillet 2D</translation>
</message>
<message> <message>
<source>MEN_FILLING</source> <source>MEN_FILLING</source>
<translation>Filling</translation> <translation>Filling</translation>

View File

@ -491,7 +491,8 @@ void GeometryGUI::OnGUIEvent( int id )
id == 505 || // MENU OPERATION - FILLET id == 505 || // MENU OPERATION - FILLET
id == 506 || // MENU OPERATION - CHAMFER id == 506 || // MENU OPERATION - CHAMFER
id == 507 || // MENU OPERATION - CLIPPING RANGE id == 507 || // MENU OPERATION - CLIPPING RANGE
id == 508 ) { // MENU OPERATION - GET SHAPES ON SHAPE id == 508 || // MENU OPERATION - GET SHAPES ON SHAPE
id == 509 ) { // MENU OPERATION - FILLET 2D
#ifndef WNT #ifndef WNT
library = getLibrary( "libOperationGUI.so" ); library = getLibrary( "libOperationGUI.so" );
#else #else
@ -828,6 +829,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( 506, "CHAMFER" ); createGeomAction( 506, "CHAMFER" );
//createGeomAction( 507, "CLIPPING" ); //createGeomAction( 507, "CLIPPING" );
createGeomAction( 508, "GET_SHAPES_ON_SHAPES" ); createGeomAction( 508, "GET_SHAPES_ON_SHAPES" );
createGeomAction( 509, "FILLET_2D" );
createGeomAction( 9998, "MUL_TRANSFORM" ); createGeomAction( 9998, "MUL_TRANSFORM" );
createGeomAction( 9995, "EXPLODE_BLOCKS" ); createGeomAction( 9995, "EXPLODE_BLOCKS" );
@ -982,6 +984,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createMenu( 504, operId, -1 ); createMenu( 504, operId, -1 );
createMenu( 508, operId, -1 ); createMenu( 508, operId, -1 );
createMenu( separator(), operId, -1 ); createMenu( separator(), operId, -1 );
createMenu( 509, transId, -1 );
createMenu( 505, transId, -1 ); createMenu( 505, transId, -1 );
createMenu( 506, transId, -1 ); createMenu( 506, transId, -1 );
//createMenu( 507, transId, -1 ); //createMenu( 507, transId, -1 );

View File

@ -87,6 +87,7 @@ SOURCES += GEOMImpl_ArcDriver.cxx
SOURCES += GEOMImpl_SplineDriver.cxx SOURCES += GEOMImpl_SplineDriver.cxx
SOURCES += GEOMImpl_SketcherDriver.cxx SOURCES += GEOMImpl_SketcherDriver.cxx
SOURCES += GEOMImpl_FilletDriver.cxx SOURCES += GEOMImpl_FilletDriver.cxx
SOURCES += GEOMImpl_Fillet2dDriver.cxx
SOURCES += GEOMImpl_ChamferDriver.cxx SOURCES += GEOMImpl_ChamferDriver.cxx
SOURCES += GEOMImpl_BooleanDriver.cxx SOURCES += GEOMImpl_BooleanDriver.cxx
SOURCES += GEOMImpl_PartitionDriver.cxx SOURCES += GEOMImpl_PartitionDriver.cxx

View File

@ -0,0 +1,152 @@
// Copyright (C) 2005 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
//
#include <Standard_Stream.hxx>
#include <GEOMImpl_Fillet2dDriver.hxx>
#include <GEOMImpl_IFillet2d.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOMImpl_ILocalOperations.hxx>
#include <GEOM_Function.hxx>
#include <BRepFilletAPI_MakeFillet2d.hxx>
#include <BRepCheck_Analyzer.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Edge.hxx>
#include <TopAbs.hxx>
#include <TopExp_Explorer.hxx>
#include <ShapeFix_ShapeTolerance.hxx>
#include <ShapeFix_Shape.hxx>
#include <Precision.hxx>
#include <gp_Pnt.hxx>
#include <StdFail_NotDone.hxx>
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
const Standard_GUID& GEOMImpl_Fillet2dDriver::GetID()
{
static Standard_GUID aFillet2dDriver("FF1AAB41-2A14-4df2-581B-3A568163BA46");
return aFillet2dDriver;
}
//=======================================================================
//function : GEOMImpl_Fillet2dDriver
//purpose :
//=======================================================================
GEOMImpl_Fillet2dDriver::GEOMImpl_Fillet2dDriver()
{
}
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_Fillet2dDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_IFillet2d aCI (aFunction);
TopoDS_Shape aShape;
Handle(GEOM_Function) aRefShape = aCI.GetShape();
TopoDS_Face aFaceShape = TopoDS::Face(aRefShape->GetValue());
if (aFaceShape.ShapeType() != TopAbs_FACE)
Standard_ConstructionError::Raise("Wrong arguments: two faces must be given");
BRepFilletAPI_MakeFillet2d fillet2d (aFaceShape);
int aLen = aCI.GetLength();
int ind = 1;
double rad = aCI.GetR();
for (; ind <= aLen; ind++) {
TopoDS_Shape aShapeVertex;
if (GEOMImpl_ILocalOperations::GetSubShape
(aFaceShape, aCI.GetVertex(ind), aShapeVertex)) {
fillet2d.AddFillet(TopoDS::Vertex(aShapeVertex), rad);
}
}
fillet2d.Build();
if (!fillet2d.IsDone()) {
StdFail_NotDone::Raise("2D Fillet can't be computed on the given shape with the given radius");
}
aShape = fillet2d.Shape();
if (aShape.IsNull()) return 0;
aFunction->SetValue(aShape);
log.SetTouched(Label());
return 1;
}
//=======================================================================
//function : GEOMImpl_Fillet2dDriver_Type_
//purpose :
//=======================================================================
Standard_EXPORT Handle_Standard_Type& GEOMImpl_Fillet2dDriver_Type_()
{
static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_Fillet2dDriver",
sizeof(GEOMImpl_Fillet2dDriver),
1,
(Standard_Address)_Ancestors,
(Standard_Address)NULL);
return _aType;
}
//=======================================================================
//function : DownCast
//purpose :
//=======================================================================
const Handle(GEOMImpl_Fillet2dDriver) Handle(GEOMImpl_Fillet2dDriver)::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(GEOMImpl_Fillet2dDriver) _anOtherObject;
if (!AnObject.IsNull()) {
if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_Fillet2dDriver))) {
_anOtherObject = Handle(GEOMImpl_Fillet2dDriver)((Handle(GEOMImpl_Fillet2dDriver)&)AnObject);
}
}
return _anOtherObject ;
}

View File

@ -0,0 +1,158 @@
// Copyright (C) 2005 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
//
// File : GEOMImpl_Fillet2dDriver.ixx
// Module : GEOMImpl
#ifndef _GEOMImpl_Fillet2dDriver_HeaderFile
#define _GEOMImpl_Fillet2dDriver_HeaderFile
#ifndef _TColStd_SequenceOfExtendedString_HeaderFile
#include <TColStd_SequenceOfExtendedString.hxx>
#endif
#ifndef _Standard_TypeMismatch_HeaderFile
#include <Standard_TypeMismatch.hxx>
#endif
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_GUID_HeaderFile
#include <Standard_GUID.hxx>
#endif
#ifndef _Handle_TFunction_Driver_HeaderFile
#include <Handle_TFunction_Driver.hxx>
#endif
class Standard_Transient;
class Handle_Standard_Type;
class Handle(TFunction_Driver);
class GEOMImpl_Fillet2dDriver;
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_Fillet2dDriver);
class Handle(GEOMImpl_Fillet2dDriver) : public Handle(TFunction_Driver) {
public:
inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
Handle(GEOMImpl_Fillet2dDriver)():Handle(TFunction_Driver)() {}
Handle(GEOMImpl_Fillet2dDriver)(const Handle(GEOMImpl_Fillet2dDriver)& aHandle) : Handle(TFunction_Driver)(aHandle)
{
}
Handle(GEOMImpl_Fillet2dDriver)(const GEOMImpl_Fillet2dDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem)
{
}
Handle(GEOMImpl_Fillet2dDriver)& operator=(const Handle(GEOMImpl_Fillet2dDriver)& aHandle)
{
Assign(aHandle.Access());
return *this;
}
Handle(GEOMImpl_Fillet2dDriver)& operator=(const GEOMImpl_Fillet2dDriver* anItem)
{
Assign((Standard_Transient *)anItem);
return *this;
}
GEOMImpl_Fillet2dDriver* operator->()
{
return (GEOMImpl_Fillet2dDriver *)ControlAccess();
}
GEOMImpl_Fillet2dDriver* operator->() const
{
return (GEOMImpl_Fillet2dDriver *)ControlAccess();
}
Standard_EXPORT ~Handle(GEOMImpl_Fillet2dDriver)() {};
Standard_EXPORT static const Handle(GEOMImpl_Fillet2dDriver) DownCast(const Handle(Standard_Transient)& AnObject);
};
#ifndef _TFunction_Driver_HeaderFile
#include <TFunction_Driver.hxx>
#endif
#ifndef _TFunction_Logbook_HeaderFile
#include <TFunction_Logbook.hxx>
#endif
#ifndef _Standard_CString_HeaderFile
#include <Standard_CString.hxx>
#endif
class TColStd_SequenceOfExtendedString;
class GEOMImpl_Fillet2dDriver : public TFunction_Driver {
public:
inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT GEOMImpl_Fillet2dDriver();
Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const;
Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {}
Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; }
Standard_EXPORT static const Standard_GUID& GetID();
Standard_EXPORT ~GEOMImpl_Fillet2dDriver() {};
// Type management
//
Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_Fillet2dDriver_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_Fillet2dDriver) ; }
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_Fillet2dDriver) == AType || TFunction_Driver::IsKind(AType)); }
};
#endif

View File

@ -60,6 +60,7 @@
#include <GEOMImpl_BooleanDriver.hxx> #include <GEOMImpl_BooleanDriver.hxx>
#include <GEOMImpl_ChamferDriver.hxx> #include <GEOMImpl_ChamferDriver.hxx>
#include <GEOMImpl_FilletDriver.hxx> #include <GEOMImpl_FilletDriver.hxx>
#include <GEOMImpl_Fillet2dDriver.hxx>
#include <GEOMImpl_TranslateDriver.hxx> #include <GEOMImpl_TranslateDriver.hxx>
#include <GEOMImpl_RotateDriver.hxx> #include <GEOMImpl_RotateDriver.hxx>
#include <GEOMImpl_MirrorDriver.hxx> #include <GEOMImpl_MirrorDriver.hxx>
@ -131,6 +132,7 @@ GEOMImpl_Gen::GEOMImpl_Gen()
// Local Operations // Local Operations
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ChamferDriver::GetID(), new GEOMImpl_ChamferDriver()); TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ChamferDriver::GetID(), new GEOMImpl_ChamferDriver());
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_FilletDriver::GetID(), new GEOMImpl_FilletDriver()); TFunction_DriverTable::Get()->AddDriver(GEOMImpl_FilletDriver::GetID(), new GEOMImpl_FilletDriver());
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_Fillet2dDriver::GetID(), new GEOMImpl_Fillet2dDriver());
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ArchimedeDriver::GetID(), new GEOMImpl_ArchimedeDriver()); TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ArchimedeDriver::GetID(), new GEOMImpl_ArchimedeDriver());
// Geometrical Transformations, Offset, Scale // Geometrical Transformations, Offset, Scale

View File

@ -0,0 +1,51 @@
// Copyright (C) 2005 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
//
//NOTE: This is an interface to a function for the Fillet2d and creation.
#include "GEOM_Function.hxx"
#define FILLET2D_ARG_SH 1
#define FILLET2D_ARG_R 2
#define FILLET2D_ARG_LENG 3
#define FILLET2D_ARG_LAST 4
class GEOMImpl_IFillet2d
{
public:
GEOMImpl_IFillet2d(Handle(GEOM_Function) theFunction): _func(theFunction) {}
void SetShape(Handle(GEOM_Function) theRef) { _func->SetReference(FILLET2D_ARG_SH, theRef); }
Handle(GEOM_Function) GetShape() { return _func->GetReference(FILLET2D_ARG_SH); }
void SetR(double theR) { _func->SetReal(FILLET2D_ARG_R, theR); }
void SetLength(int theLen) { _func->SetInteger(FILLET2D_ARG_LENG, theLen); }
void SetVertex(int theInd, int theVertex)
{ _func->SetInteger(FILLET2D_ARG_LAST + theInd, theVertex); }
double GetR() { return _func->GetReal(FILLET2D_ARG_R); }
int GetLength() { return _func->GetInteger(FILLET2D_ARG_LENG); }
int GetVertex(int theInd) { return _func->GetInteger(FILLET2D_ARG_LAST + theInd); }
private:
Handle(GEOM_Function) _func;
};

View File

@ -27,9 +27,11 @@
#include <GEOMImpl_Types.hxx> #include <GEOMImpl_Types.hxx>
#include <GEOMImpl_FilletDriver.hxx> #include <GEOMImpl_FilletDriver.hxx>
#include <GEOMImpl_Fillet2dDriver.hxx>
#include <GEOMImpl_ChamferDriver.hxx> #include <GEOMImpl_ChamferDriver.hxx>
#include <GEOMImpl_IFillet.hxx> #include <GEOMImpl_IFillet.hxx>
#include <GEOMImpl_IFillet2d.hxx>
#include <GEOMImpl_IChamfer.hxx> #include <GEOMImpl_IChamfer.hxx>
#include <GEOMImpl_IArchimede.hxx> #include <GEOMImpl_IArchimede.hxx>
@ -408,6 +410,75 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletFacesR1R2
return aFillet; return aFillet;
} }
//=============================================================================
/*!
* MakeFillet2D
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFillet2D
(Handle(GEOM_Object) theShape, double theR, std::list<int> theVertexes)
{
SetErrorCode(KO);
//Add a new Fillet object
Handle(GEOM_Object) aFillet2D = GetEngine()->AddObject(GetDocID(), GEOM_FILLET_2D);
//Add a new Fillet function
Handle(GEOM_Function) aFunction =
aFillet2D->AddFunction(GEOMImpl_Fillet2dDriver::GetID(), FILLET_2D_SHAPE_VERTEXES);
if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly
if (aFunction->GetDriverGUID() != GEOMImpl_Fillet2dDriver::GetID()) return NULL;
GEOMImpl_IFillet2d aCI (aFunction);
Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
if (aRefShape.IsNull()) return NULL;
aCI.SetShape(aRefShape);
aCI.SetR(theR);
int aLen = theVertexes.size();
aCI.SetLength(aLen);
int ind = 1;
std::list<int>::iterator it = theVertexes.begin();
for (; it != theVertexes.end(); it++, ind++) {
aCI.SetVertex(ind, (*it));
}
//Compute the Fillet value
try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
if (!GetSolver()->ComputeFunction(aFunction)) {
SetErrorCode("2D Fillet 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 pd (aFunction);
pd << aFillet2D << " = geompy.MakeFillet2D(" << theShape
<< ", " << theR << ", [";
it = theVertexes.begin();
pd << (*it++);
while (it != theVertexes.end()) {
pd << ", " << (*it++);
}
pd << "])";
SetErrorCode(OK);
return aFillet2D;
}
//============================================================================= //=============================================================================
/*! /*!
* MakeChamferAll * MakeChamferAll

View File

@ -45,6 +45,8 @@ class GEOMImpl_ILocalOperations : public GEOM_IOperations {
Standard_EXPORT Handle(GEOM_Object) MakeFilletFacesR1R2 (Handle(GEOM_Object) theShape, Standard_EXPORT Handle(GEOM_Object) MakeFilletFacesR1R2 (Handle(GEOM_Object) theShape,
double theR1, double theR2, double theR1, double theR2,
std::list<int> theFaces); std::list<int> theFaces);
Standard_EXPORT Handle(GEOM_Object) MakeFillet2D (Handle(GEOM_Object) theShape, double theR,
std::list<int> theVertexes);
Standard_EXPORT Handle(GEOM_Object) MakeChamferAll (Handle(GEOM_Object) theShape, double theD); Standard_EXPORT Handle(GEOM_Object) MakeChamferAll (Handle(GEOM_Object) theShape, double theD);
Standard_EXPORT Handle(GEOM_Object) MakeChamferEdge (Handle(GEOM_Object) theShape, Standard_EXPORT Handle(GEOM_Object) MakeChamferEdge (Handle(GEOM_Object) theShape,

View File

@ -46,6 +46,7 @@
#define GEOM_CIRC_ARC 19 #define GEOM_CIRC_ARC 19
#define GEOM_FILLET 20 #define GEOM_FILLET 20
#define GEOM_FILLET_2D 45
#define GEOM_CHAMFER 21 #define GEOM_CHAMFER 21
#define GEOM_EDGE 22 #define GEOM_EDGE 22
@ -227,6 +228,8 @@
#define FILLET_SHAPE_EDGES_2R 4 #define FILLET_SHAPE_EDGES_2R 4
#define FILLET_SHAPE_FACES_2R 5 #define FILLET_SHAPE_FACES_2R 5
#define FILLET_2D_SHAPE_VERTEXES 1
#define CHAMFER_SHAPE_ALL 1 #define CHAMFER_SHAPE_ALL 1
#define CHAMFER_SHAPE_EDGE 2 #define CHAMFER_SHAPE_EDGE 2
#define CHAMFER_SHAPE_FACES 3 #define CHAMFER_SHAPE_FACES 3

View File

@ -55,6 +55,7 @@ salomeinclude_HEADERS = \
GEOMImpl_ISpline.hxx \ GEOMImpl_ISpline.hxx \
GEOMImpl_IEllipse.hxx \ GEOMImpl_IEllipse.hxx \
GEOMImpl_IFillet.hxx \ GEOMImpl_IFillet.hxx \
GEOMImpl_IFillet2d.hxx \
GEOMImpl_IChamfer.hxx \ GEOMImpl_IChamfer.hxx \
GEOMImpl_ICopy.hxx \ GEOMImpl_ICopy.hxx \
GEOMImpl_IArchimede.hxx \ GEOMImpl_IArchimede.hxx \
@ -126,6 +127,7 @@ salomeinclude_HEADERS = \
GEOMImpl_SketcherDriver.hxx \ GEOMImpl_SketcherDriver.hxx \
GEOMImpl_3DSketcherDriver.hxx \ GEOMImpl_3DSketcherDriver.hxx \
GEOMImpl_FilletDriver.hxx \ GEOMImpl_FilletDriver.hxx \
GEOMImpl_Fillet2dDriver.hxx \
GEOMImpl_ChamferDriver.hxx \ GEOMImpl_ChamferDriver.hxx \
GEOMImpl_BooleanDriver.hxx \ GEOMImpl_BooleanDriver.hxx \
GEOMImpl_PartitionDriver.hxx \ GEOMImpl_PartitionDriver.hxx \
@ -188,6 +190,7 @@ dist_libGEOMimpl_la_SOURCES = \
GEOMImpl_SketcherDriver.cxx \ GEOMImpl_SketcherDriver.cxx \
GEOMImpl_3DSketcherDriver.cxx \ GEOMImpl_3DSketcherDriver.cxx \
GEOMImpl_FilletDriver.cxx \ GEOMImpl_FilletDriver.cxx \
GEOMImpl_Fillet2dDriver.cxx \
GEOMImpl_ChamferDriver.cxx \ GEOMImpl_ChamferDriver.cxx \
GEOMImpl_BooleanDriver.cxx \ GEOMImpl_BooleanDriver.cxx \
GEOMImpl_PartitionDriver.cxx \ GEOMImpl_PartitionDriver.cxx \

View File

@ -219,6 +219,41 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletFacesR1R2
return GetObject(anObject); return GetObject(anObject);
} }
//=============================================================================
/*!
* MakeFillet2D
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFillet2D
(GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
const GEOM::ListOfLong& theVertexes)
{
GEOM::GEOM_Object_var aGEOMObject;
if (theShape == NULL) return aGEOMObject._retn();
//Get the reference shape
Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
(theShape->GetStudyID(), theShape->GetEntry());
if (aShapeRef.IsNull()) return aGEOMObject._retn();
//Get the reference vertex
int ind = 0;
int aLen = theVertexes.length();
list<int> aVertexes;
for (; ind < aLen; ind++) {
aVertexes.push_back(theVertexes[ind]);
}
//Create the Fillet
Handle(GEOM_Object) anObject =
GetOperations()->MakeFillet2D(aShapeRef, theR, aVertexes);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
return GetObject(anObject);
}
//============================================================================= //=============================================================================
/*! /*!
* MakeChamferAll * MakeChamferAll

View File

@ -59,6 +59,9 @@ class GEOM_I_EXPORT GEOM_ILocalOperations_i :
CORBA::Double theR2, CORBA::Double theR2,
const GEOM::ListOfLong& theFaces); const GEOM::ListOfLong& theFaces);
GEOM::GEOM_Object_ptr MakeFillet2D (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
const GEOM::ListOfLong& theVertexes);
GEOM::GEOM_Object_ptr MakeChamferAll (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD); GEOM::GEOM_Object_ptr MakeChamferAll (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD);
GEOM::GEOM_Object_ptr MakeChamferEdge (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr MakeChamferEdge (GEOM::GEOM_Object_ptr theShape,

View File

@ -2766,6 +2766,26 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletFacesR1R2 (GEOM::GEOM_Object_ptr
return NULL; return NULL;
} }
//=============================================================================
// MakeFillet2D:
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFillet2D (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theR,
GEOM::GEOM_List_ptr theVertexes)
{
beginService( " GEOM_Superv_i::MakeFillet2D" );
MESSAGE("GEOM_Superv_i::MakeFillet2D");
if (GEOM_List_i<GEOM::ListOfLong>* aListImplV =
dynamic_cast<GEOM_List_i<GEOM::ListOfLong>*>(GetServant(theVertexes, myPOA).in())) {
getLocalOp();
GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeFillet2D(theShape, theR, aListImplV->GetList());
endService( " GEOM_Superv_i::MakeFillet2D" );
return anObj;
}
endService( " GEOM_Superv_i::MakeFillet2D" );
return NULL;
}
//============================================================================= //=============================================================================
// MakeChamferAll: // MakeChamferAll:
//============================================================================= //=============================================================================

View File

@ -584,6 +584,8 @@ public:
GEOM::GEOM_List_ptr theFaces); GEOM::GEOM_List_ptr theFaces);
GEOM::GEOM_Object_ptr MakeFilletFacesR1R2 (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR1, GEOM::GEOM_Object_ptr MakeFilletFacesR1R2 (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR1,
CORBA::Double theR2, GEOM::GEOM_List_ptr theFaces); CORBA::Double theR2, GEOM::GEOM_List_ptr theFaces);
GEOM::GEOM_Object_ptr MakeFillet2D (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
GEOM::GEOM_List_ptr theVertexes);
GEOM::GEOM_Object_ptr MakeChamferAll (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD); GEOM::GEOM_Object_ptr MakeChamferAll (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD);
GEOM::GEOM_Object_ptr MakeChamferEdge (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr MakeChamferEdge (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theD1, CORBA::Double theD2, CORBA::Double theD1, CORBA::Double theD2,

View File

@ -235,6 +235,7 @@ def TestAll (geompy, math):
IDlist_f = [f_ind_1, f_ind_2] IDlist_f = [f_ind_1, f_ind_2]
#Local operations #Local operations
Fillet2d = geompy.MakeFillet2D(Face3, radius, [4, 7, 9]) #(GEOM_Object_ptr, Double, ListOfLong)->GEOM_Object_ptr
Fillet = geompy.MakeFillet (Prism, radius, ShapeTypeEdge, Fillet = geompy.MakeFillet (Prism, radius, ShapeTypeEdge,
IDlist_e) #(GEOM_Object_ptr, Double, Short, ListOfLong)->GEOM_Object_ptr IDlist_e) #(GEOM_Object_ptr, Double, Short, ListOfLong)->GEOM_Object_ptr
Fillet2 = geompy.MakeFilletR1R2 (Prism, 7., 13., ShapeTypeEdge, Fillet2 = geompy.MakeFilletR1R2 (Prism, 7., 13., ShapeTypeEdge,
@ -381,6 +382,7 @@ def TestAll (geompy, math):
id_Fillet = geompy.addToStudy(Fillet, "Fillet") id_Fillet = geompy.addToStudy(Fillet, "Fillet")
id_Fillet2 = geompy.addToStudy(Fillet2, "Fillet2") id_Fillet2 = geompy.addToStudy(Fillet2, "Fillet2")
id_Fillet2d = geompy.addToStudy(Fillet2d, "Fillet2D")
id_Chamfer = geompy.addToStudy(Chamfer, "Chamfer on Edge") id_Chamfer = geompy.addToStudy(Chamfer, "Chamfer on Edge")
id_Chamfer2 = geompy.addToStudy(Chamfer2, "Chamfer on Faces") id_Chamfer2 = geompy.addToStudy(Chamfer2, "Chamfer on Faces")

View File

@ -2409,6 +2409,20 @@ class geompyDC(GEOM._objref_GEOM_Gen):
RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp) RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
return anObj return anObj
## Perform a fillet on the specified edges/faces of the given shape
# @param theShape - Face Shape to perform fillet on.
# @param theR - Fillet radius.
# @param theListOfVertexes Global indices of vertexes to perform fillet on.
# \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
# @return New GEOM_Object, containing the result shape.
#
# @ref tui_fillet2d "Example"
def MakeFillet2D(self,theShape, theR, theListOfVertexes):
# Example: see GEOM_TestAll.py
anObj = self.LocalOp.MakeFillet2D(theShape, theR, theListOfVertexes)
RaiseIfFailed("MakeFillet2D", self.LocalOp)
return anObj
## Perform a symmetric chamfer on all edges of the given shape. ## Perform a symmetric chamfer on all edges of the given shape.
# @param theShape Shape, to perform chamfer on. # @param theShape Shape, to perform chamfer on.
# @param theD Chamfer size along each face. # @param theD Chamfer size along each face.

View File

@ -32,6 +32,7 @@ salomeinclude_HEADERS = \
OperationGUI_ArchimedeDlg.h \ OperationGUI_ArchimedeDlg.h \
OperationGUI_PartitionDlg.h \ OperationGUI_PartitionDlg.h \
OperationGUI_FilletDlg.h \ OperationGUI_FilletDlg.h \
OperationGUI_Fillet2dDlg.h \
OperationGUI_ChamferDlg.h \ OperationGUI_ChamferDlg.h \
OperationGUI_GetShapesOnShapeDlg.h \ OperationGUI_GetShapesOnShapeDlg.h \
OperationGUI_ClippingDlg.h OperationGUI_ClippingDlg.h
@ -45,6 +46,7 @@ dist_libOperationGUI_la_SOURCES = \
OperationGUI_PartitionDlg.cxx \ OperationGUI_PartitionDlg.cxx \
OperationGUI_GetShapesOnShapeDlg.cxx \ OperationGUI_GetShapesOnShapeDlg.cxx \
OperationGUI_FilletDlg.cxx \ OperationGUI_FilletDlg.cxx \
OperationGUI_Fillet2dDlg.cxx \
OperationGUI_ChamferDlg.cxx \ OperationGUI_ChamferDlg.cxx \
OperationGUI_ClippingDlg.cxx OperationGUI_ClippingDlg.cxx
@ -53,6 +55,7 @@ MOC_FILES = \
OperationGUI_PartitionDlg_moc.cxx \ OperationGUI_PartitionDlg_moc.cxx \
OperationGUI_GetShapesOnShapeDlg_moc.cxx\ OperationGUI_GetShapesOnShapeDlg_moc.cxx\
OperationGUI_FilletDlg_moc.cxx \ OperationGUI_FilletDlg_moc.cxx \
OperationGUI_Fillet2dDlg_moc.cxx \
OperationGUI_ChamferDlg_moc.cxx \ OperationGUI_ChamferDlg_moc.cxx \
OperationGUI_ClippingDlg_moc.cxx OperationGUI_ClippingDlg_moc.cxx

View File

@ -38,6 +38,7 @@
#include "OperationGUI_PartitionDlg.h" // Method PARTITION #include "OperationGUI_PartitionDlg.h" // Method PARTITION
#include "OperationGUI_ArchimedeDlg.h" // Method ARCHIMEDE #include "OperationGUI_ArchimedeDlg.h" // Method ARCHIMEDE
#include "OperationGUI_FilletDlg.h" // Method FILLET #include "OperationGUI_FilletDlg.h" // Method FILLET
#include "OperationGUI_Fillet2dDlg.h" // Method FILLET 2D
#include "OperationGUI_ChamferDlg.h" // Method CHAMFER #include "OperationGUI_ChamferDlg.h" // Method CHAMFER
#include "OperationGUI_ClippingDlg.h" // Clipping dialog box #include "OperationGUI_ClippingDlg.h" // Clipping dialog box
#include "OperationGUI_GetShapesOnShapeDlg.h" #include "OperationGUI_GetShapesOnShapeDlg.h"
@ -78,6 +79,7 @@ bool OperationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
case 506: ( new OperationGUI_ChamferDlg ( getGeometryGUI(), parent ) )->show(); break; case 506: ( new OperationGUI_ChamferDlg ( getGeometryGUI(), parent ) )->show(); break;
case 507: ( new OperationGUI_ClippingDlg ( getGeometryGUI(), parent ) )->show(); break; case 507: ( new OperationGUI_ClippingDlg ( getGeometryGUI(), parent ) )->show(); break;
case 508: ( new OperationGUI_GetShapesOnShapeDlg( getGeometryGUI(), parent ) )->show(); break; case 508: ( new OperationGUI_GetShapesOnShapeDlg( getGeometryGUI(), parent ) )->show(); break;
case 509: ( new OperationGUI_Fillet2dDlg ( getGeometryGUI(), parent ) )->show(); break;
default: default:
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
} }

View File

@ -0,0 +1,400 @@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : OperationGUI_Fillet2dDlg.cxx
// Author : DMV, OCN.
//
#include "OperationGUI_Fillet2dDlg.h"
#include <DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_ViewWindow.h>
#include <SUIT_ViewManager.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <OCCViewer_ViewModel.h>
// OCCT Includes
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <GEOMImpl_Types.hxx>
//=================================================================================
// class : OperationGUI_Fillet2dDlg()
// purpose : Constructs a OperationGUI_Fillet2dDlg 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.
//=================================================================================
OperationGUI_Fillet2dDlg::OperationGUI_Fillet2dDlg (GeometryGUI* theGeometryGUI, QWidget* parent)
: GEOMBase_Skeleton(theGeometryGUI, parent, false)
{
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_FILLET_2D")));
QPixmap iconSelect (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
setWindowTitle(tr("GEOM_FILLET_2D_TITLE"));
/***************************************************************/
mainFrame()->GroupConstructors->setTitle(tr("GEOM_FILLET_2D"));
mainFrame()->RadioButton1->setIcon(image0);
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->close();
GroupVertexes = new DlgRef_2Sel1Spin(centralWidget());
GroupVertexes->GroupBox1->setTitle(tr("GEOM_FILLET_2D"));
GroupVertexes->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
GroupVertexes->TextLabel2->setText(tr("GEOM_VERTEXES"));
GroupVertexes->TextLabel3->setText(tr("GEOM_RADIUS"));
GroupVertexes->PushButton1->setIcon(iconSelect);
GroupVertexes->PushButton2->setIcon(iconSelect);
GroupVertexes->LineEdit1->setReadOnly(true);
GroupVertexes->LineEdit2->setReadOnly(true);
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(GroupVertexes);
/***************************************************************/
// Set range of spinboxes
double SpecificStep = 10.0;
initSpinBox(GroupVertexes->SpinBox_DX, 0.00001, COORD_MAX, SpecificStep, 5); // VSR: TODO: DBL_DIGITS_DISPLAY
setHelpFileName("fillet2d_operation_page.html");
// Initialisation
Init();
resize(0,0);
}
//=================================================================================
// function : ~OperationGUI_Fillet2dDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
OperationGUI_Fillet2dDlg::~OperationGUI_Fillet2dDlg()
{
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void OperationGUI_Fillet2dDlg::Init()
{
// Set Initial values of spinboxes
GroupVertexes->SpinBox_DX->setValue(5);
// Clear line edits
GroupVertexes->LineEdit1->setText("");
GroupVertexes->LineEdit2->setText("");
myShape = GEOM::GEOM_Object::_nil();
myVertexes.Clear();
// signals and slots connections
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk() ));
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
// connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
connect(GroupVertexes->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupVertexes->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupVertexes->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupVertexes->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupVertexes->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
initName(tr("GEOM_FILLET_2D"));
GroupVertexes->PushButton1->click();
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void OperationGUI_Fillet2dDlg::ClickOnOk()
{
if (ClickOnApply())
ClickOnCancel();
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
bool OperationGUI_Fillet2dDlg::ClickOnApply()
{
if (!onAccept())
return false;
initName();
// Reset dialog state
GroupVertexes->LineEdit1->setText("");
GroupVertexes->LineEdit2->setText("");
myShape = GEOM::GEOM_Object::_nil();
myVertexes.Clear();
GroupVertexes->PushButton1->click();
return true;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection is changed or on dialog initialization or activation
//=================================================================================
void OperationGUI_Fillet2dDlg::SelectionIntoArgument()
{
erasePreview();
myEditCurrentArgument->setText("");
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
// If selection of main object is activated
if (myEditCurrentArgument == GroupVertexes->LineEdit1) {
myShape = GEOM::GEOM_Object::_nil();
if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult);
if (aResult && !anObj->_is_nil()) {
QString aName = GEOMBase::GetName( anObj );
TopoDS_Shape aShape;
if ( GEOMBase::GetShape( anObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes(aSelList.First(), aMap);
if ( aMap.Extent() == 1 ) { // Local Selection
int anIndex = aMap( 1 );
aName += QString( ":face_%1" ).arg( anIndex );
//Find SubShape Object in Father
GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( anObj, aName );
if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
anObj = aShapesOp->GetSubShape( anObj, anIndex );
}
else
anObj = aFindedObject; // get Object from study
}
else { // Global Selection
if ( aShape.ShapeType() != TopAbs_FACE ) {
anObj = GEOM::GEOM_Object::_nil();
aName = "";
}
}
}
myShape = anObj;
myEditCurrentArgument->setText(aName
);
displayPreview();
}
}
} else if (myEditCurrentArgument == GroupVertexes->LineEdit2) {
myVertexes.Clear();
if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult);
if (aResult && !anObj->_is_nil()) {
TColStd_IndexedMapOfInteger anIndexes;
aSelMgr->GetIndexes(aSelList.First(), anIndexes);
if (anIndexes.Extent() > 0) {
QString aName;
if (anIndexes.Extent() == 1) {
int anIndex = anIndexes(1);
aName = QString(GEOMBase::GetName(anObj)) + QString(":vertex_%1").arg(anIndex);
}
else
aName = tr("GEOM_MEN_POPUP_NAME").arg(anIndexes.Extent());
myEditCurrentArgument->setText(aName);
myVertexes = anIndexes;
displayPreview();
}
}
}
}
if (myEditCurrentArgument == GroupVertexes->LineEdit1) {
if (!myShape->_is_nil() && myVertexes.Extent() == 0)
GroupVertexes->PushButton2->click();
}
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void OperationGUI_Fillet2dDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
if (send == GroupVertexes->PushButton1) {
myEditCurrentArgument = GroupVertexes->LineEdit1;
GroupVertexes->PushButton2->setDown(false);
GroupVertexes->LineEdit2->setEnabled(false);
}
else if (send == GroupVertexes->PushButton2) {
myEditCurrentArgument = GroupVertexes->LineEdit2;
GroupVertexes->PushButton1->setDown(false);
GroupVertexes->LineEdit1->setEnabled(false);
}
// enable line edit
myEditCurrentArgument->setEnabled(true);
myEditCurrentArgument->setFocus();
// after setFocus(), because it will be setDown(false) when loses focus
send->setDown(true);
activateSelection();
// seems we need it only to avoid preview disappearing, caused by selection mode change
displayPreview();
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void OperationGUI_Fillet2dDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if (send == GroupVertexes->LineEdit1)
myEditCurrentArgument = GroupVertexes->LineEdit1;
else if (send == GroupVertexes->LineEdit2)
myEditCurrentArgument = GroupVertexes->LineEdit2;
else
return;
GEOMBase_Skeleton::LineEditReturnPressed();
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void OperationGUI_Fillet2dDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void OperationGUI_Fillet2dDlg::enterEvent (QEvent*)
{
if (!mainFrame()->GroupConstructors->isEnabled())
this->ActivateThisDialog();
}
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
void OperationGUI_Fillet2dDlg::ValueChangedInSpinBox (double)
{
displayPreview();
}
//=================================================================================
// function : activateSelection
// purpose : Activate selection in accordance with myEditCurrentArgument
//=================================================================================
void OperationGUI_Fillet2dDlg::activateSelection()
{
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
globalSelection();
if (myEditCurrentArgument == GroupVertexes->LineEdit1)
globalSelection( GEOM_FACE ); // localSelection(myShape, TopAbs_FACE);
else if (!myShape->_is_nil() && myEditCurrentArgument == GroupVertexes->LineEdit2)
localSelection(myShape, TopAbs_VERTEX);
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
}
//=================================================================================
// function : createOperation
// purpose :
//=================================================================================
GEOM::GEOM_IOperations_ptr OperationGUI_Fillet2dDlg::createOperation()
{
return getGeomEngine()->GetILocalOperations(getStudyId());
}
//=================================================================================
// function : isValid()
// purpose : Verify validity of input data
//=================================================================================
bool OperationGUI_Fillet2dDlg::isValid (QString&)
{
return !myShape->_is_nil() && myVertexes.Extent() > 0;
}
//=================================================================================
// function : execute
// purpose :
//=================================================================================
bool OperationGUI_Fillet2dDlg::execute (ObjectList& objects)
{
GEOM::GEOM_Object_var anObj;
GEOM::ListOfLong_var aListOfIndexes = new GEOM::ListOfLong;
aListOfIndexes->length(myVertexes.Extent());
for (int i = 1, n = myVertexes.Extent(); i <= n; i++)
aListOfIndexes[ i - 1 ] = myVertexes(i);
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
MakeFillet2D(myShape, getRadius(), aListOfIndexes);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
return true;
}
//=================================================================================
// function : getRadius
// purpose : Get radius
//=================================================================================
double OperationGUI_Fillet2dDlg::getRadius() const
{
return GroupVertexes ->SpinBox_DX->value();
}

View File

@ -0,0 +1,75 @@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : OperationGUI_Fillet2dDlg.h
// Author : DMV, OCN
//
#ifndef OPERATIONGUI_FILLET2DDLG_H
#define OPERATIONGUI_FILLET2DDLG_H
#include <GEOMBase_Skeleton.h>
#include <TColStd_IndexedMapOfInteger.hxx>
class DlgRef_2Sel1Spin;
//=================================================================================
// class : OperationGUI_Fillet2dDlg
// purpose :
//=================================================================================
class OperationGUI_Fillet2dDlg : public GEOMBase_Skeleton
{
Q_OBJECT
public:
OperationGUI_Fillet2dDlg( GeometryGUI*, QWidget* );
~OperationGUI_Fillet2dDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
private slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void ValueChangedInSpinBox( double );
private:
void Init();
void enterEvent( QEvent* );
void activateSelection();
double getRadius() const;
private:
GEOM::GEOM_Object_var myShape;
TColStd_IndexedMapOfInteger myVertexes;
DlgRef_2Sel1Spin* GroupVertexes;
};
#endif // OPERATIONGUI_FILLET2DDLG_H