diff --git a/doc/salome/examples/CMakeLists.txt b/doc/salome/examples/CMakeLists.txt
index 67721de68..76c3883e1 100644
--- a/doc/salome/examples/CMakeLists.txt
+++ b/doc/salome/examples/CMakeLists.txt
@@ -37,6 +37,7 @@ SET(GOOD_TESTS
basic_geom_objs_ex07.py
basic_geom_objs_ex08.py
basic_geom_objs_ex09.py
+ basic_geom_objs_ex10.py
basic_operations_ex01.py
basic_operations_ex02.py
basic_operations_ex03.py
diff --git a/doc/salome/examples/basic_geom_objs_ex10.py b/doc/salome/examples/basic_geom_objs_ex10.py
new file mode 100644
index 000000000..f9f7f0165
--- /dev/null
+++ b/doc/salome/examples/basic_geom_objs_ex10.py
@@ -0,0 +1,37 @@
+# Creation of a Surface From Face
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+import math
+import SALOMEDS
+
+# Create Vertices, Edges, Wire, Face and Disk
+Vertex_1 = geompy.MakeVertex(0, 0, 0)
+Vertex_2 = geompy.MakeVertex(100, 0, 0)
+Vertex_3 = geompy.MakeVertex(50, 100, 0)
+Edge_1 = geompy.MakeEdge(Vertex_1, Vertex_2)
+Edge_2 = geompy.MakeEdge(Vertex_2, Vertex_3)
+Edge_3 = geompy.MakeEdge(Vertex_3, Vertex_1)
+Wire_1 = geompy.MakeWire([Edge_1, Edge_2, Edge_3])
+Face_1 = geompy.MakeFace(Wire_1, True)
+Disk_1 = geompy.MakeDiskR(100, 1)
+
+# Create Surfaces From Faces.
+SurfaceFromFace_1 = geompy.MakeSurfaceFromFace(Face_1)
+SurfaceFromFace_2 = geompy.MakeSurfaceFromFace(Disk_1)
+
+#Add created object to study
+geompy.addToStudy( Vertex_1, "Vertex_1" )
+geompy.addToStudy( Vertex_2, "Vertex_2" )
+geompy.addToStudy( Vertex_3, "Vertex_3" )
+geompy.addToStudy( Edge_1, "Edge_1" )
+geompy.addToStudy( Edge_2, "Edge_2" )
+geompy.addToStudy( Edge_3, "Edge_3" )
+geompy.addToStudy( Wire_1, "Wire_1" )
+geompy.addToStudy( Face_1, "Face_1" )
+geompy.addToStudy( Disk_1, "Disk_1" )
+geompy.addToStudy( SurfaceFromFace_1, "SurfaceFromFace_1" )
+geompy.addToStudy( SurfaceFromFace_2, "SurfaceFromFace_2" )
diff --git a/doc/salome/gui/GEOM/images/surface_from_face1.png b/doc/salome/gui/GEOM/images/surface_from_face1.png
new file mode 100644
index 000000000..ba039fd91
Binary files /dev/null and b/doc/salome/gui/GEOM/images/surface_from_face1.png differ
diff --git a/doc/salome/gui/GEOM/images/surface_from_face_example.png b/doc/salome/gui/GEOM/images/surface_from_face_example.png
new file mode 100644
index 000000000..db22d6fe2
Binary files /dev/null and b/doc/salome/gui/GEOM/images/surface_from_face_example.png differ
diff --git a/doc/salome/gui/GEOM/input/creating_basic_go.doc b/doc/salome/gui/GEOM/input/creating_basic_go.doc
index 6693b469d..19758a3d6 100644
--- a/doc/salome/gui/GEOM/input/creating_basic_go.doc
+++ b/doc/salome/gui/GEOM/input/creating_basic_go.doc
@@ -15,6 +15,7 @@ geometrical objects as:
\subpage create_isoline_page
\subpage create_sketcher_page
\subpage create_3dsketcher_page
+\subpage create_surface_from_face_page
\subpage create_vector_page
\subpage create_plane_page
\subpage create_lcs_page
diff --git a/doc/salome/gui/GEOM/input/creating_surface_from_face.doc b/doc/salome/gui/GEOM/input/creating_surface_from_face.doc
new file mode 100644
index 000000000..6034ed5e3
--- /dev/null
+++ b/doc/salome/gui/GEOM/input/creating_surface_from_face.doc
@@ -0,0 +1,27 @@
+/*!
+
+\page create_surface_from_face_page Surface From Face
+
+To create a Surface From Face in the Main Menu select New Entity - > Basic - > Surface From Face
+
+\n This function takes some face as input parameter and creates new
+GEOM_Object, i.e. topological shape by extracting underlying surface
+of the source face and limiting it by the Umin, Umax, Vmin, Vmax
+parameters of the source face (in the parametrical space).
+\n
+\ref restore_presentation_parameters_page "Advanced options".
+
+\n TUI Command: geompy.MakeSurfaceFromFace(theFace) ,
+where \em theFace the input face.
+\n Arguments: Name + Object (Face).
+
+\image html surface_from_face1.png "Surface From Face"
+
+\n Example:
+
+\image html surface_from_face_example.png "Original Face (white) and Created Surface"
+
+Our TUI Scripts provide you with useful examples of the use of
+\ref tui_creation_surface "Surface From Face" creation.
+
+*/
diff --git a/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc b/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc
index 89be6f64b..2083bcc46 100644
--- a/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc
+++ b/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc
@@ -38,4 +38,8 @@
Creation of a Local Coordinate System
\tui_script{basic_geom_objs_ex09.py}
+\anchor tui_creation_surface
+Creation of a Surface From Face
+\tui_script{basic_geom_objs_ex10.py}
+
*/
diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl
index 2cfbe5a22..924550b10 100644
--- a/idl/GEOM_Gen.idl
+++ b/idl/GEOM_Gen.idl
@@ -2573,6 +2573,17 @@ module GEOM
in double theVMin,
in double theVMax);
+ /*!
+ * \brief Make a surface from a face. This function takes some face as
+ * input parameter and creates new GEOM_Object, i.e. topological shape
+ * by extracting underlying surface of the source face and limiting it
+ * by the Umin, Umax, Vmin, Vmax parameters of the source face (in the
+ * parametrical space).
+ * \param theFace the input face.
+ * \return a newly created face.
+ */
+ GEOM_Object MakeSurfaceFromFace(in GEOM_Object theFace);
+
};
// # GEOM_IBlocksOperations:
diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt
index f2e64385a..7a6644562 100755
--- a/resources/CMakeLists.txt
+++ b/resources/CMakeLists.txt
@@ -94,6 +94,7 @@ SET( _res_files
eraseall.png
extruded_boss.png
extruded_cut.png
+ facetosurface.png
faceextension.png
face_hw.png
face_vechw.png
diff --git a/resources/facetosurface.png b/resources/facetosurface.png
new file mode 100644
index 000000000..ecd57cfba
Binary files /dev/null and b/resources/facetosurface.png differ
diff --git a/src/EntityGUI/CMakeLists.txt b/src/EntityGUI/CMakeLists.txt
index 865678ad3..a30e1e738 100755
--- a/src/EntityGUI/CMakeLists.txt
+++ b/src/EntityGUI/CMakeLists.txt
@@ -105,6 +105,7 @@ SET(EntityGUI_HEADERS
EntityGUI_SketcherDlg.h
EntityGUI_3DSketcherDlg.h
EntityGUI_IsolineDlg.h
+ EntityGUI_SurfFromFaceDlg.h
EntityGUI_SubShapeDlg.h
EntityGUI_FeatureDetectorDlg.h
EntityGUI_PictureImportDlg.h
@@ -117,6 +118,7 @@ SET(_moc_HEADERS
EntityGUI_SketcherDlg.h
EntityGUI_3DSketcherDlg.h
EntityGUI_IsolineDlg.h
+ EntityGUI_SurfFromFaceDlg.h
EntityGUI_SubShapeDlg.h
EntityGUI_PictureImportDlg.h
${FeatureDetectorDlg_moc_h}
@@ -137,6 +139,7 @@ SET(EntityGUI_SOURCES
EntityGUI_SketcherDlg.cxx
EntityGUI_3DSketcherDlg.cxx
EntityGUI_IsolineDlg.cxx
+ EntityGUI_SurfFromFaceDlg.cxx
EntityGUI_SubShapeDlg.cxx
EntityGUI_PictureImportDlg.cxx
${FeatureDetectorDlg_Sources}
diff --git a/src/EntityGUI/EntityGUI.cxx b/src/EntityGUI/EntityGUI.cxx
index b6f36c8ad..5c0d3e91e 100644
--- a/src/EntityGUI/EntityGUI.cxx
+++ b/src/EntityGUI/EntityGUI.cxx
@@ -55,6 +55,7 @@
#include "EntityGUI_SketcherDlg.h" // Sketcher
#include "EntityGUI_3DSketcherDlg.h" // Sketcher
#include "EntityGUI_IsolineDlg.h" // Isoline
+#include "EntityGUI_SurfFromFaceDlg.h" // Surface From Face
#include "EntityGUI_SubShapeDlg.h" // Method SUBSHAPE
#include "EntityGUI_FeatureDetectorDlg.h" // Feature Detection
#include "EntityGUI_PictureImportDlg.h" // Import Picture in viewer
@@ -105,6 +106,9 @@ bool EntityGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
case GEOMOp::OpIsoline: // ISOLINE
aDlg = new EntityGUI_IsolineDlg( getGeometryGUI(), parent );
break;
+ case GEOMOp::OpSurfaceFromFace: // SURFACE FROM FACE
+ aDlg = new EntityGUI_SurfFromFaceDlg( getGeometryGUI(), parent );
+ break;
case GEOMOp::OpExplode: // EXPLODE
aDlg = new EntityGUI_SubShapeDlg( getGeometryGUI(), parent );
break;
diff --git a/src/EntityGUI/EntityGUI_SurfFromFaceDlg.cxx b/src/EntityGUI/EntityGUI_SurfFromFaceDlg.cxx
new file mode 100644
index 000000000..3d217e4dd
--- /dev/null
+++ b/src/EntityGUI/EntityGUI_SurfFromFaceDlg.cxx
@@ -0,0 +1,225 @@
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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, or (at your option) any later version.
+//
+// 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 : EntityGUI_SurfFromFaceDlg.cxx
+
+#include "EntityGUI_SurfFromFaceDlg.h"
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+
+//=================================================================================
+// class : EntityGUI_SurfFromFaceDlg
+// purpose :
+//=================================================================================
+EntityGUI_SurfFromFaceDlg::EntityGUI_SurfFromFaceDlg
+ (GeometryGUI *theGeometryGUI,
+ QWidget *parent,
+ bool modal,
+ Qt::WindowFlags fl)
+ : GEOMBase_Skeleton (theGeometryGUI, parent, modal, fl),
+ myGroup (0)
+{
+ QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SURFACE_FROM_FACE")));
+ QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
+
+ setWindowTitle(tr("GEOM_SURF_FROM_FACE_TITLE"));
+
+ /***************************************************************/
+
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_SURF_FROM_FACE"));
+ mainFrame()->RadioButton1->setIcon(image0);
+ mainFrame()->RadioButton2->close();
+ mainFrame()->RadioButton3->close();
+
+ // Construct a group.
+ myGroup = new DlgRef_1Sel(centralWidget());
+ myGroup->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
+ myGroup->TextLabel1->setText(tr("GEOM_FACE"));
+ myGroup->PushButton1->setIcon(image1);
+ myGroup->LineEdit1->setReadOnly(true);
+
+ QVBoxLayout* layout = new QVBoxLayout(centralWidget());
+ layout->setMargin(0); layout->setSpacing(6);
+ layout->addWidget(myGroup);
+
+ setHelpFileName("create_surface_from_face_page.html");
+
+ Init();
+}
+
+//=================================================================================
+// function : ~EntityGUI_SurfFromFaceDlg()
+// purpose :
+//=================================================================================
+EntityGUI_SurfFromFaceDlg::~EntityGUI_SurfFromFaceDlg()
+{
+}
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void EntityGUI_SurfFromFaceDlg::Init()
+{
+ initName(tr("GEOM_SURF_FROM_FACE_NAME"));
+ showOnlyPreviewControl();
+
+ /* signals and slots connections */
+ connect(myGroup->PushButton1, SIGNAL(clicked()),
+ this, SLOT(SetEditCurrentArgument()));
+ connect(myGeomGUI->getApp()->selectionMgr(),
+ SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+ connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()),
+ this, SLOT(DeactivateActiveDialog()));
+ connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()),
+ this, SLOT(ClickOnCancel()));
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+
+ myEditCurrentArgument = myGroup->LineEdit1;
+ myGroup->LineEdit1->setReadOnly(true);
+ SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : SelectionIntoArgument
+// purpose : Called when selection is changed
+//=================================================================================
+void EntityGUI_SurfFromFaceDlg::SelectionIntoArgument()
+{
+ erasePreview();
+ myEditCurrentArgument->setText("");
+ myFace.nullify();
+
+ GEOM::GeomObjPtr aSelectedObject = getSelected(TopAbs_FACE);
+
+ if (aSelectedObject) {
+ myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject.get()));
+ myFace = aSelectedObject;
+ }
+
+ processPreview();
+}
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//=================================================================================
+void EntityGUI_SurfFromFaceDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+
+ if (send == myGroup->PushButton1) {
+ myEditCurrentArgument->setFocus();
+ SelectionIntoArgument();
+ }
+}
+
+//=================================================================================
+// function : ActivateThisDialog
+// purpose :
+//=================================================================================
+void EntityGUI_SurfFromFaceDlg::ActivateThisDialog()
+{
+ GEOMBase_Skeleton::ActivateThisDialog();
+ connect(myGeomGUI->getApp()->selectionMgr(),
+ SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+ SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void EntityGUI_SurfFromFaceDlg::enterEvent (QEvent*)
+{
+ if (!mainFrame()->GroupConstructors->isEnabled())
+ ActivateThisDialog();
+}
+
+//=================================================================================
+// function : createOperation
+// purpose :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr EntityGUI_SurfFromFaceDlg::createOperation()
+{
+ return myGeomGUI->GetGeomGen()->GetIShapesOperations(getStudyId());
+}
+
+//=================================================================================
+// function : isValid
+// purpose :
+//=================================================================================
+bool EntityGUI_SurfFromFaceDlg::isValid (QString& msg)
+{
+ return myFace;
+}
+
+//=================================================================================
+// function : execute
+// purpose :
+//=================================================================================
+bool EntityGUI_SurfFromFaceDlg::execute (ObjectList& objects)
+{
+ GEOM::GEOM_IShapesOperations_var anOper =
+ GEOM::GEOM_IShapesOperations::_narrow(getOperation());
+ GEOM::GEOM_Object_var anObj = anOper->MakeSurfaceFromFace(myFace.get());
+
+ if (!anObj->_is_nil()) {
+ objects.push_back(anObj._retn());
+ }
+
+ return true;
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void EntityGUI_SurfFromFaceDlg::ClickOnOk()
+{
+ setIsApplyAndClose(true);
+
+ if (ClickOnApply())
+ ClickOnCancel();
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+bool EntityGUI_SurfFromFaceDlg::ClickOnApply()
+{
+ if (!onAccept())
+ return false;
+
+ initName();
+
+ return true;
+}
diff --git a/src/EntityGUI/EntityGUI_SurfFromFaceDlg.h b/src/EntityGUI/EntityGUI_SurfFromFaceDlg.h
new file mode 100644
index 000000000..130a4d284
--- /dev/null
+++ b/src/EntityGUI/EntityGUI_SurfFromFaceDlg.h
@@ -0,0 +1,75 @@
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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, or (at your option) any later version.
+//
+// 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 : EntityGUI_SurfFromFaceDlg.h
+
+#ifndef ENTITYGUI_SURFFROMFACEDLG_H
+#define ENTITYGUI_SURFFROMFACEDLG_H
+
+
+#include
+
+class DlgRef_1Sel;
+
+//=================================================================================
+// class : EntityGUI_SurfFromFaceDlg
+// purpose :
+//=================================================================================
+class EntityGUI_SurfFromFaceDlg : public GEOMBase_Skeleton
+{
+ Q_OBJECT
+
+public:
+
+ EntityGUI_SurfFromFaceDlg (GeometryGUI *theGeometryGUI,
+ QWidget *parent = 0,
+ bool modal = false,
+ Qt::WindowFlags fl = 0);
+
+ ~EntityGUI_SurfFromFaceDlg();
+
+protected:
+
+ // redefined from GEOMBase_Helper
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid( QString& );
+ virtual bool execute( ObjectList& );
+
+private:
+
+ void Init();
+ void enterEvent( QEvent* );
+
+private:
+
+ DlgRef_1Sel *myGroup;
+ GEOM::GeomObjPtr myFace;
+
+private slots:
+
+ void ClickOnOk();
+ bool ClickOnApply();
+ void SelectionIntoArgument();
+ void SetEditCurrentArgument();
+ void ActivateThisDialog();
+
+};
+
+#endif // ENTITYGUI_SURFFROMFACEDLG_H
diff --git a/src/GEOMGUI/GEOM_images.ts b/src/GEOMGUI/GEOM_images.ts
index 7cf2826df..e0a9185eb 100644
--- a/src/GEOMGUI/GEOM_images.ts
+++ b/src/GEOMGUI/GEOM_images.ts
@@ -819,6 +819,10 @@
ICON_VERTEX_MARKER_13
marker_13.png
+
+ ICON_SURFACE_FROM_FACE
+ facetosurface.png
+
ICO_ARC
arc.png
@@ -1251,6 +1255,10 @@
ICO_ISOLINE_V
isoline_v.png
+
+ ICO_SURFACE_FROM_FACE
+ facetosurface.png
+
ICO_SOLID
build_solid.png
diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts
index 6b06a14d6..52e6b7809 100644
--- a/src/GEOMGUI/GEOM_msg_en.ts
+++ b/src/GEOMGUI/GEOM_msg_en.ts
@@ -2996,6 +2996,10 @@ Please, select face, shell or solid and try again
MEN_ISOLINE
Isoline
+
+ MEN_SURFACE_FROM_FACE
+ Surface From Face
+
MEN_SOLID
Solid
@@ -3880,6 +3884,10 @@ Please, select face, shell or solid and try again
STB_ISOLINE
Create U- or V-Isoline
+
+ STB_SURFACE_FROM_FACE
+ Create a Surface From Face
+
STB_SOLID
Build a solid
@@ -4444,6 +4452,10 @@ Please, select face, shell or solid and try again
TOP_ISOLINE
Isoline
+
+ TOP_SURFACE_FROM_FACE
+ Surface From Face
+
TOP_SOLID
Build solid
@@ -7093,4 +7105,19 @@ Do you want to create new material?
ExtendedFace
+
+ EntityGUI_SurfFromFaceDlg
+
+ GEOM_SURF_FROM_FACE_TITLE
+ Surface From Face Construction
+
+
+ GEOM_SURF_FROM_FACE
+ Surface From Face
+
+
+ GEOM_SURF_FROM_FACE_NAME
+ SurfaceFromFace
+
+
diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx
index 55c2d9681..44e7de635 100644
--- a/src/GEOMGUI/GeometryGUI.cxx
+++ b/src/GEOMGUI/GeometryGUI.cxx
@@ -554,6 +554,7 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
case GEOMOp::Op3dSketcher: // MENU ENTITY - 3D SKETCHER
case GEOMOp::OpIsoline: // MENU BASIC - ISOLINE
case GEOMOp::OpExplode: // MENU ENTITY - EXPLODE
+ case GEOMOp::OpSurfaceFromFace: // MENU ENTITY - SURFACE FROM FACE
#ifdef WITH_OPENCV
case GEOMOp::OpFeatureDetect: // MENU ENTITY - FEATURE DETECTION
#endif
@@ -905,6 +906,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( GEOMOp::OpPlane, "PLANE" );
createGeomAction( GEOMOp::OpLCS, "LOCAL_CS" );
createGeomAction( GEOMOp::OpOriginAndVectors, "ORIGIN_AND_VECTORS" );
+ createGeomAction( GEOMOp::OpSurfaceFromFace, "SURFACE_FROM_FACE" );
createGeomAction( GEOMOp::OpBox, "BOX" );
createGeomAction( GEOMOp::OpCylinder, "CYLINDER" );
@@ -936,7 +938,6 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( GEOMOp::Op2dSketcher, "SKETCH" );
createGeomAction( GEOMOp::Op3dSketcher, "3DSKETCH" );
- createGeomAction( GEOMOp::OpIsoline, "ISOLINE" );
createGeomAction( GEOMOp::OpExplode, "EXPLODE" );
#ifdef WITH_OPENCV
createGeomAction( GEOMOp::OpFeatureDetect,"FEATURE_DETECTION" );
@@ -1117,6 +1118,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createMenu( GEOMOp::Op2dSketcher, basicId, -1 );
createMenu( GEOMOp::Op3dSketcher, basicId, -1 );
createMenu( GEOMOp::OpIsoline, basicId, -1 );
+ createMenu( GEOMOp::OpSurfaceFromFace, basicId, -1 );
createMenu( separator(), basicId, -1 );
createMenu( GEOMOp::OpVector, basicId, -1 );
createMenu( GEOMOp::OpPlane, basicId, -1 );
@@ -1332,6 +1334,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createTool( GEOMOp::Op2dSketcher, basicTbId ); //rnc
createTool( GEOMOp::Op3dSketcher, basicTbId ); //rnc
createTool( GEOMOp::OpIsoline, basicTbId );
+ createTool( GEOMOp::OpSurfaceFromFace, basicTbId );
createTool( GEOMOp::OpPlane, basicTbId );
createTool( GEOMOp::OpLCS, basicTbId );
createTool( GEOMOp::OpOriginAndVectors, basicTbId );
diff --git a/src/GEOMGUI/GeometryGUI_Operations.h b/src/GEOMGUI/GeometryGUI_Operations.h
index ca604b2e7..f061eb812 100644
--- a/src/GEOMGUI/GeometryGUI_Operations.h
+++ b/src/GEOMGUI/GeometryGUI_Operations.h
@@ -94,6 +94,7 @@ namespace GEOMOp {
OpLCS = 3008, // MENU NEW ENTITY - BASIC - LOCAL COORDINATE SYSTEM
OpOriginAndVectors = 3009, // MENU NEW ENTITY - BASIC - ORIGIN AND BASE VECTORS
OpIsoline = 3010, // MENU NEW ENTITY - BASIC - ISOLINE
+ OpSurfaceFromFace = 3011, // MENU NEW ENTITY - BASIC - SURFACE FROM FACE
// PrimitiveGUI ----------------//--------------------------------
OpBox = 3100, // MENU NEW ENTITY - PRIMITIVES - BOX
OpCylinder = 3101, // MENU NEW ENTITY - PRIMITIVES - CYLINDER
diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx
index 637eac7d9..732d938e8 100644
--- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx
+++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx
@@ -4968,3 +4968,64 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::ExtendFace
return aResFace;
}
+
+//=======================================================================
+//function : MakeSurfaceFromFace
+//purpose :
+//=======================================================================
+Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeSurfaceFromFace
+ (const Handle(GEOM_Object) &theFace)
+{
+ SetErrorCode(KO);
+
+ if (theFace.IsNull()) {
+ return NULL;
+ }
+
+ //Add a new Face object
+ Handle(GEOM_Object) aResFace = GetEngine()->AddObject(GetDocID(), GEOM_FACE);
+
+ //Add a new Vector function
+ Handle(GEOM_Function) aFunction =
+ aResFace->AddFunction(GEOMImpl_ShapeDriver::GetID(), SURFACE_FROM_FACE);
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) {
+ return NULL;
+ }
+
+ GEOMImpl_IShapeExtend aCI (aFunction);
+
+ Handle(GEOM_Function) aFace = theFace->GetLastFunction();
+
+ if (aFace.IsNull()) {
+ return NULL;
+ }
+
+ aCI.SetShape(aFace);
+
+ //Compute the Face value
+ try {
+ OCC_CATCH_SIGNALS;
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Shape 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)
+ << aResFace << " = geompy.MakeSurfaceFromFace("
+ << theFace << ")";
+
+ SetErrorCode(OK);
+
+ return aResFace;
+}
diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx
index 22b3211ec..025646331 100644
--- a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx
+++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx
@@ -396,6 +396,9 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
const Standard_Real theVMin,
const Standard_Real theVMax);
+ Standard_EXPORT Handle(GEOM_Object)
+ MakeSurfaceFromFace(const Handle(GEOM_Object) &theFace);
+
private:
Handle(GEOM_Object) MakeShape (std::list theShapes,
const Standard_Integer theObjectType,
diff --git a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx
index 01c676407..a9baa2ee0 100644
--- a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx
+++ b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx
@@ -681,6 +681,47 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
aShape = ExtendFace(aFace, aSE.GetUMin(), aSE.GetUMax(),
aSE.GetVMin(), aSE.GetVMax());
}
+ } else if (aType == SURFACE_FROM_FACE) {
+#ifdef RESULT_TYPE_CHECK
+ anExpectedType = TopAbs_FACE;
+#endif
+
+ GEOMImpl_IShapeExtend aSE (aFunction);
+ Handle(GEOM_Function) aRefFace = aSE.GetShape();
+ TopoDS_Shape aShapeFace = aRefFace->GetValue();
+
+ if (aShapeFace.ShapeType() == TopAbs_FACE) {
+ TopoDS_Face aFace = TopoDS::Face(aShapeFace);
+ Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace);
+
+ if (aSurface.IsNull() == Standard_False) {
+ Handle(Standard_Type) aType = aSurface->DynamicType();
+ Standard_Real aU1;
+ Standard_Real aU2;
+ Standard_Real aV1;
+ Standard_Real aV2;
+
+ // Get U, V bounds of the face.
+ aFace.Orientation(TopAbs_FORWARD);
+ ShapeAnalysis::GetFaceUVBounds(aFace, aU1, aU2, aV1, aV2);
+
+ // Get the surface of original type
+ while (aType == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
+ Handle(Geom_RectangularTrimmedSurface) aTrSurface =
+ Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface);
+
+ aSurface = aTrSurface->BasisSurface();
+ aType = aSurface->DynamicType();
+ }
+
+ const Standard_Real aTol = BRep_Tool::Tolerance(aFace);
+ BRepBuilderAPI_MakeFace aMF(aSurface, aU1, aU2, aV1, aV2, aTol);
+
+ if (aMF.IsDone()) {
+ aShape = aMF.Shape();
+ }
+ }
+ }
}
else {
}
@@ -1573,6 +1614,14 @@ GetCreationInformation(std::string& theOperationName,
AddParam(theParams, "VMax", aSE.GetVMax());
break;
}
+ case SURFACE_FROM_FACE:
+ {
+ GEOMImpl_IShapeExtend aSE (function);
+
+ theOperationName = "SURFACE_FROM_FACE";
+ AddParam(theParams, "Face", aSE.GetShape());
+ break;
+ }
default:
return false;
}
diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx
index 86e186981..273ac2193 100644
--- a/src/GEOMImpl/GEOMImpl_Types.hxx
+++ b/src/GEOMImpl/GEOMImpl_Types.hxx
@@ -302,6 +302,7 @@
#define FACE_FROM_SURFACE 15
#define EDGE_UV 16
#define FACE_UV 17
+#define SURFACE_FROM_FACE 18
#define ARCHIMEDE_TYPE 1
diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.cc b/src/GEOM_I/GEOM_IShapesOperations_i.cc
index b2fae9ae4..4e619573c 100644
--- a/src/GEOM_I/GEOM_IShapesOperations_i.cc
+++ b/src/GEOM_I/GEOM_IShapesOperations_i.cc
@@ -2000,3 +2000,33 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ExtendFace
return GetObject(aNewFace);
}
+
+//=============================================================================
+/*!
+ * MakeSurfaceFromFace
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSurfaceFromFace
+ (GEOM::GEOM_Object_ptr theFace)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference object
+ Handle(GEOM_Object) aFace = GetObjectImpl(theFace);
+
+ if (aFace.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ //Get Shapes in place of aShapeWhat
+ Handle(GEOM_Object) aNewFace = GetOperations()->MakeSurfaceFromFace(aFace);
+
+ if (!GetOperations()->IsDone() || aNewFace.IsNull()) {
+ return aGEOMObject._retn();
+ }
+
+ return GetObject(aNewFace);
+}
diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.hh b/src/GEOM_I/GEOM_IShapesOperations_i.hh
index 72ac7b074..7587a6a2d 100644
--- a/src/GEOM_I/GEOM_IShapesOperations_i.hh
+++ b/src/GEOM_I/GEOM_IShapesOperations_i.hh
@@ -284,6 +284,8 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
CORBA::Double theVMin,
CORBA::Double theVMax);
+ GEOM::GEOM_Object_ptr MakeSurfaceFromFace(GEOM::GEOM_Object_ptr theFace);
+
::GEOMImpl_IShapesOperations* GetOperations()
{ return (::GEOMImpl_IShapesOperations*)GetImpl(); }
};
diff --git a/src/GEOM_SWIG/GEOM_TestAll.py b/src/GEOM_SWIG/GEOM_TestAll.py
index 9766171a1..cb9a9720a 100644
--- a/src/GEOM_SWIG/GEOM_TestAll.py
+++ b/src/GEOM_SWIG/GEOM_TestAll.py
@@ -257,6 +257,7 @@ def TestAll (geompy, math):
ProjOnWire = geompy.MakeProjectionOnWire(p0, Wire)
ExtEdge = geompy.ExtendEdge(Edge1, -0.3, 1.3)
ExtFace = geompy.ExtendFace(Face5, -0.3, 1.3, -0.1, 1.1)
+ Surface = geompy.MakeSurfaceFromFace(Face5)
#IDList for Fillet/Chamfer
prism_edges = geompy.ExtractShapes(Prism, geompy.ShapeType["EDGE"], True)
@@ -473,6 +474,7 @@ def TestAll (geompy, math):
id_ProjOnWire = geompy.addToStudy(ProjOnWire[1], "ProjOnWire")
id_ExtEdge = geompy.addToStudy(ExtEdge, "ExtendedEdge")
id_ExtFace = geompy.addToStudy(ExtFace, "ExtendedFace")
+ id_Surface = geompy.addToStudy(Surface, "Surface From Face")
id_Fillet = geompy.addToStudy(Fillet, "Fillet")
id_Fillet2 = geompy.addToStudy(Fillet2, "Fillet2")
diff --git a/src/GEOM_SWIG/geomBuilder.py b/src/GEOM_SWIG/geomBuilder.py
index 3e9b78b94..f1968ee10 100644
--- a/src/GEOM_SWIG/geomBuilder.py
+++ b/src/GEOM_SWIG/geomBuilder.py
@@ -5755,6 +5755,39 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
self._autoPublish(anObj, theName, "face")
return anObj
+ ## This function takes some face as input parameter and creates new
+ # GEOM_Object, i.e. topological shape by extracting underlying surface
+ # of the source face and limiting it by the Umin, Umax, Vmin, Vmax
+ # parameters of the source face (in the parametrical space).
+ # @param theFace the input face.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ # @return New GEOM.GEOM_Object, containing the created face.
+ #
+ # @ref tui_creation_surface "Example"
+ @ManageTransactions("ShapesOp")
+ def MakeSurfaceFromFace(self, theFace, theName=None):
+ """
+ This function takes some face as input parameter and creates new
+ GEOM_Object, i.e. topological shape by extracting underlying surface
+ of the source face and limiting it by the Umin, Umax, Vmin, Vmax
+ parameters of the source face (in the parametrical space).
+
+ Parameters:
+ theFace the input face.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM.GEOM_Object, containing the created face.
+ """
+ anObj = self.ShapesOp.MakeSurfaceFromFace(theFace)
+ RaiseIfFailed("MakeSurfaceFromFace", self.ShapesOp)
+ self._autoPublish(anObj, theName, "surface")
+ return anObj
+
# end of l4_obtain
## @}