0022754: [EDF] Surface of a face

This commit is contained in:
skv 2014-10-28 13:19:15 +03:00 committed by vsr
parent d37d50070c
commit bff7674ef5
26 changed files with 610 additions and 1 deletions

View File

@ -37,6 +37,7 @@ SET(GOOD_TESTS
basic_geom_objs_ex07.py basic_geom_objs_ex07.py
basic_geom_objs_ex08.py basic_geom_objs_ex08.py
basic_geom_objs_ex09.py basic_geom_objs_ex09.py
basic_geom_objs_ex10.py
basic_operations_ex01.py basic_operations_ex01.py
basic_operations_ex02.py basic_operations_ex02.py
basic_operations_ex03.py basic_operations_ex03.py

View File

@ -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" )

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -16,6 +16,7 @@ geometrical objects as:
<li>\subpage create_sketcher_page</li> <li>\subpage create_sketcher_page</li>
<li>\subpage create_3dsketcher_page</li> <li>\subpage create_3dsketcher_page</li>
<li>\subpage create_polyline_page</li> <li>\subpage create_polyline_page</li>
<li>\subpage create_surface_from_face_page</li>
<li>\subpage create_vector_page</li> <li>\subpage create_vector_page</li>
<li>\subpage create_plane_page</li> <li>\subpage create_plane_page</li>
<li>\subpage create_lcs_page</li> <li>\subpage create_lcs_page</li>

View File

@ -0,0 +1,27 @@
/*!
\page create_surface_from_face_page Surface From Face
To create a <b>Surface From Face</B> in the <b>Main Menu</b> select <b>New Entity - > Basic - > Surface From Face</b>
\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 <b>TUI Command:</b> <em>geompy.MakeSurfaceFromFace(theFace)</em>,
where \em theFace the input face.
\n <b>Arguments:</b> Name + Object (Face).
\image html surface_from_face1.png "Surface From Face"
\n <b>Example:</b>
\image html surface_from_face_example.png "Original Face (white) and Created Surface"
Our <b>TUI Scripts</b> provide you with useful examples of the use of
\ref tui_creation_surface "Surface From Face" creation.
*/

View File

@ -38,4 +38,8 @@
<br><h2>Creation of a Local Coordinate System</h2> <br><h2>Creation of a Local Coordinate System</h2>
\tui_script{basic_geom_objs_ex09.py} \tui_script{basic_geom_objs_ex09.py}
\anchor tui_creation_surface
<br><h2>Creation of a Surface From Face</h2>
\tui_script{basic_geom_objs_ex10.py}
*/ */

View File

@ -2575,6 +2575,17 @@ module GEOM
in double theVMin, in double theVMin,
in double theVMax); 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: // # GEOM_IBlocksOperations:

View File

@ -94,6 +94,7 @@ SET( _res_files
eraseall.png eraseall.png
extruded_boss.png extruded_boss.png
extruded_cut.png extruded_cut.png
facetosurface.png
faceextension.png faceextension.png
face_hw.png face_hw.png
face_vechw.png face_vechw.png

BIN
resources/facetosurface.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

View File

@ -108,6 +108,7 @@ SET(EntityGUI_HEADERS
EntityGUI_PolylineDlg.h EntityGUI_PolylineDlg.h
EntityGUI_3DSketcherDlg.h EntityGUI_3DSketcherDlg.h
EntityGUI_IsolineDlg.h EntityGUI_IsolineDlg.h
EntityGUI_SurfFromFaceDlg.h
EntityGUI_SubShapeDlg.h EntityGUI_SubShapeDlg.h
EntityGUI_FeatureDetectorDlg.h EntityGUI_FeatureDetectorDlg.h
EntityGUI_PictureImportDlg.h EntityGUI_PictureImportDlg.h
@ -121,6 +122,7 @@ SET(_moc_HEADERS
EntityGUI_PolylineDlg.h EntityGUI_PolylineDlg.h
EntityGUI_3DSketcherDlg.h EntityGUI_3DSketcherDlg.h
EntityGUI_IsolineDlg.h EntityGUI_IsolineDlg.h
EntityGUI_SurfFromFaceDlg.h
EntityGUI_SubShapeDlg.h EntityGUI_SubShapeDlg.h
EntityGUI_PictureImportDlg.h EntityGUI_PictureImportDlg.h
${FeatureDetectorDlg_moc_h} ${FeatureDetectorDlg_moc_h}
@ -142,6 +144,7 @@ SET(EntityGUI_SOURCES
EntityGUI_PolylineDlg.cxx EntityGUI_PolylineDlg.cxx
EntityGUI_3DSketcherDlg.cxx EntityGUI_3DSketcherDlg.cxx
EntityGUI_IsolineDlg.cxx EntityGUI_IsolineDlg.cxx
EntityGUI_SurfFromFaceDlg.cxx
EntityGUI_SubShapeDlg.cxx EntityGUI_SubShapeDlg.cxx
EntityGUI_PictureImportDlg.cxx EntityGUI_PictureImportDlg.cxx
${FeatureDetectorDlg_Sources} ${FeatureDetectorDlg_Sources}

View File

@ -55,6 +55,7 @@
#include "EntityGUI_SketcherDlg.h" // Sketcher #include "EntityGUI_SketcherDlg.h" // Sketcher
#include "EntityGUI_3DSketcherDlg.h" // Sketcher #include "EntityGUI_3DSketcherDlg.h" // Sketcher
#include "EntityGUI_IsolineDlg.h" // Isoline #include "EntityGUI_IsolineDlg.h" // Isoline
#include "EntityGUI_SurfFromFaceDlg.h" // Surface From Face
#include "EntityGUI_SubShapeDlg.h" // Method SUBSHAPE #include "EntityGUI_SubShapeDlg.h" // Method SUBSHAPE
#include "EntityGUI_FeatureDetectorDlg.h" // Feature Detection #include "EntityGUI_FeatureDetectorDlg.h" // Feature Detection
#include "EntityGUI_PictureImportDlg.h" // Import Picture in viewer #include "EntityGUI_PictureImportDlg.h" // Import Picture in viewer
@ -106,6 +107,9 @@ bool EntityGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
case GEOMOp::OpIsoline: // ISOLINE case GEOMOp::OpIsoline: // ISOLINE
aDlg = new EntityGUI_IsolineDlg( getGeometryGUI(), parent ); aDlg = new EntityGUI_IsolineDlg( getGeometryGUI(), parent );
break; break;
case GEOMOp::OpSurfaceFromFace: // SURFACE FROM FACE
aDlg = new EntityGUI_SurfFromFaceDlg( getGeometryGUI(), parent );
break;
case GEOMOp::OpExplode: // EXPLODE case GEOMOp::OpExplode: // EXPLODE
aDlg = new EntityGUI_SubShapeDlg( getGeometryGUI(), parent ); aDlg = new EntityGUI_SubShapeDlg( getGeometryGUI(), parent );
break; break;

View File

@ -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 <GeometryGUI.h>
#include <DlgRef.h>
#include <GEOMBase.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
//=================================================================================
// 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;
}

View File

@ -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 <GEOMBase_Skeleton.h>
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

View File

@ -819,6 +819,10 @@
<source>ICON_VERTEX_MARKER_13</source> <source>ICON_VERTEX_MARKER_13</source>
<translation>marker_13.png</translation> <translation>marker_13.png</translation>
</message> </message>
<message>
<source>ICON_SURFACE_FROM_FACE</source>
<translation>facetosurface.png</translation>
</message>
<message> <message>
<source>ICO_ARC</source> <source>ICO_ARC</source>
<translation>arc.png</translation> <translation>arc.png</translation>
@ -1255,6 +1259,10 @@
<source>ICO_ISOLINE_V</source> <source>ICO_ISOLINE_V</source>
<translation>isoline_v.png</translation> <translation>isoline_v.png</translation>
</message> </message>
<message>
<source>ICO_SURFACE_FROM_FACE</source>
<translation>facetosurface.png</translation>
</message>
<message> <message>
<source>ICO_SOLID</source> <source>ICO_SOLID</source>
<translation>build_solid.png</translation> <translation>build_solid.png</translation>

View File

@ -2996,6 +2996,10 @@ Please, select face, shell or solid and try again</translation>
<source>MEN_ISOLINE</source> <source>MEN_ISOLINE</source>
<translation>Isoline</translation> <translation>Isoline</translation>
</message> </message>
<message>
<source>MEN_SURFACE_FROM_FACE</source>
<translation>Surface From Face</translation>
</message>
<message> <message>
<source>MEN_SOLID</source> <source>MEN_SOLID</source>
<translation>Solid</translation> <translation>Solid</translation>
@ -3880,6 +3884,10 @@ Please, select face, shell or solid and try again</translation>
<source>STB_ISOLINE</source> <source>STB_ISOLINE</source>
<translation>Create U- or V-Isoline</translation> <translation>Create U- or V-Isoline</translation>
</message> </message>
<message>
<source>STB_SURFACE_FROM_FACE</source>
<translation>Create a Surface From Face</translation>
</message>
<message> <message>
<source>STB_SOLID</source> <source>STB_SOLID</source>
<translation>Build a solid</translation> <translation>Build a solid</translation>
@ -4444,6 +4452,10 @@ Please, select face, shell or solid and try again</translation>
<source>TOP_ISOLINE</source> <source>TOP_ISOLINE</source>
<translation>Isoline</translation> <translation>Isoline</translation>
</message> </message>
<message>
<source>TOP_SURFACE_FROM_FACE</source>
<translation>Surface From Face</translation>
</message>
<message> <message>
<source>TOP_SOLID</source> <source>TOP_SOLID</source>
<translation>Build solid</translation> <translation>Build solid</translation>
@ -7053,4 +7065,19 @@ Do you want to create new material?</translation>
<translation>ExtendedFace</translation> <translation>ExtendedFace</translation>
</message> </message>
</context> </context>
<context>
<name>EntityGUI_SurfFromFaceDlg</name>
<message>
<source>GEOM_SURF_FROM_FACE_TITLE</source>
<translation>Surface From Face Construction</translation>
</message>
<message>
<source>GEOM_SURF_FROM_FACE</source>
<translation>Surface From Face</translation>
</message>
<message>
<source>GEOM_SURF_FROM_FACE_NAME</source>
<translation>SurfaceFromFace</translation>
</message>
</context>
</TS> </TS>

View File

@ -553,6 +553,7 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
case GEOMOp::Op3dSketcher: // MENU ENTITY - 3D SKETCHER case GEOMOp::Op3dSketcher: // MENU ENTITY - 3D SKETCHER
case GEOMOp::OpIsoline: // MENU BASIC - ISOLINE case GEOMOp::OpIsoline: // MENU BASIC - ISOLINE
case GEOMOp::OpExplode: // MENU ENTITY - EXPLODE case GEOMOp::OpExplode: // MENU ENTITY - EXPLODE
case GEOMOp::OpSurfaceFromFace: // MENU ENTITY - SURFACE FROM FACE
#ifdef WITH_OPENCV #ifdef WITH_OPENCV
case GEOMOp::OpFeatureDetect: // MENU ENTITY - FEATURE DETECTION case GEOMOp::OpFeatureDetect: // MENU ENTITY - FEATURE DETECTION
#endif #endif
@ -901,6 +902,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( GEOMOp::OpPlane, "PLANE" ); createGeomAction( GEOMOp::OpPlane, "PLANE" );
createGeomAction( GEOMOp::OpLCS, "LOCAL_CS" ); createGeomAction( GEOMOp::OpLCS, "LOCAL_CS" );
createGeomAction( GEOMOp::OpOriginAndVectors, "ORIGIN_AND_VECTORS" ); createGeomAction( GEOMOp::OpOriginAndVectors, "ORIGIN_AND_VECTORS" );
createGeomAction( GEOMOp::OpSurfaceFromFace, "SURFACE_FROM_FACE" );
createGeomAction( GEOMOp::OpBox, "BOX" ); createGeomAction( GEOMOp::OpBox, "BOX" );
createGeomAction( GEOMOp::OpCylinder, "CYLINDER" ); createGeomAction( GEOMOp::OpCylinder, "CYLINDER" );
@ -932,7 +934,6 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( GEOMOp::Op2dSketcher, "SKETCH" ); createGeomAction( GEOMOp::Op2dSketcher, "SKETCH" );
createGeomAction( GEOMOp::Op3dSketcher, "3DSKETCH" ); createGeomAction( GEOMOp::Op3dSketcher, "3DSKETCH" );
createGeomAction( GEOMOp::OpIsoline, "ISOLINE" );
createGeomAction( GEOMOp::OpExplode, "EXPLODE" ); createGeomAction( GEOMOp::OpExplode, "EXPLODE" );
#ifdef WITH_OPENCV #ifdef WITH_OPENCV
createGeomAction( GEOMOp::OpFeatureDetect,"FEATURE_DETECTION" ); createGeomAction( GEOMOp::OpFeatureDetect,"FEATURE_DETECTION" );
@ -1111,6 +1112,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createMenu( GEOMOp::Op2dPolylineEditor, basicId, -1 ); createMenu( GEOMOp::Op2dPolylineEditor, basicId, -1 );
createMenu( GEOMOp::Op3dSketcher, basicId, -1 ); createMenu( GEOMOp::Op3dSketcher, basicId, -1 );
createMenu( GEOMOp::OpIsoline, basicId, -1 ); createMenu( GEOMOp::OpIsoline, basicId, -1 );
createMenu( GEOMOp::OpSurfaceFromFace, basicId, -1 );
createMenu( separator(), basicId, -1 ); createMenu( separator(), basicId, -1 );
createMenu( GEOMOp::OpVector, basicId, -1 ); createMenu( GEOMOp::OpVector, basicId, -1 );
createMenu( GEOMOp::OpPlane, basicId, -1 ); createMenu( GEOMOp::OpPlane, basicId, -1 );
@ -1322,6 +1324,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createTool( GEOMOp::Op2dPolylineEditor, basicTbId ); createTool( GEOMOp::Op2dPolylineEditor, basicTbId );
createTool( GEOMOp::Op3dSketcher, basicTbId ); //rnc createTool( GEOMOp::Op3dSketcher, basicTbId ); //rnc
createTool( GEOMOp::OpIsoline, basicTbId ); createTool( GEOMOp::OpIsoline, basicTbId );
createTool( GEOMOp::OpSurfaceFromFace, basicTbId );
createTool( GEOMOp::OpPlane, basicTbId ); createTool( GEOMOp::OpPlane, basicTbId );
createTool( GEOMOp::OpLCS, basicTbId ); createTool( GEOMOp::OpLCS, basicTbId );
createTool( GEOMOp::OpOriginAndVectors, basicTbId ); createTool( GEOMOp::OpOriginAndVectors, basicTbId );

View File

@ -94,6 +94,7 @@ namespace GEOMOp {
OpLCS = 3008, // MENU NEW ENTITY - BASIC - LOCAL COORDINATE SYSTEM OpLCS = 3008, // MENU NEW ENTITY - BASIC - LOCAL COORDINATE SYSTEM
OpOriginAndVectors = 3009, // MENU NEW ENTITY - BASIC - ORIGIN AND BASE VECTORS OpOriginAndVectors = 3009, // MENU NEW ENTITY - BASIC - ORIGIN AND BASE VECTORS
OpIsoline = 3010, // MENU NEW ENTITY - BASIC - ISOLINE OpIsoline = 3010, // MENU NEW ENTITY - BASIC - ISOLINE
OpSurfaceFromFace = 3011, // MENU NEW ENTITY - BASIC - SURFACE FROM FACE
// PrimitiveGUI ----------------//-------------------------------- // PrimitiveGUI ----------------//--------------------------------
OpBox = 3100, // MENU NEW ENTITY - PRIMITIVES - BOX OpBox = 3100, // MENU NEW ENTITY - PRIMITIVES - BOX
OpCylinder = 3101, // MENU NEW ENTITY - PRIMITIVES - CYLINDER OpCylinder = 3101, // MENU NEW ENTITY - PRIMITIVES - CYLINDER

View File

@ -4921,3 +4921,64 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::ExtendFace
return aResFace; 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;
}

View File

@ -396,6 +396,9 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
const Standard_Real theVMin, const Standard_Real theVMin,
const Standard_Real theVMax); const Standard_Real theVMax);
Standard_EXPORT Handle(GEOM_Object)
MakeSurfaceFromFace(const Handle(GEOM_Object) &theFace);
private: private:
Handle(GEOM_Object) MakeShape (std::list<Handle(GEOM_Object)> theShapes, Handle(GEOM_Object) MakeShape (std::list<Handle(GEOM_Object)> theShapes,
const Standard_Integer theObjectType, const Standard_Integer theObjectType,

View File

@ -603,6 +603,47 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
aShape = ExtendFace(aFace, aSE.GetUMin(), aSE.GetUMax(), aShape = ExtendFace(aFace, aSE.GetUMin(), aSE.GetUMax(),
aSE.GetVMin(), aSE.GetVMax()); 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 { else {
} }
@ -1538,6 +1579,14 @@ GetCreationInformation(std::string& theOperationName,
AddParam(theParams, "VMax", aSE.GetVMax()); AddParam(theParams, "VMax", aSE.GetVMax());
break; break;
} }
case SURFACE_FROM_FACE:
{
GEOMImpl_IShapeExtend aSE (function);
theOperationName = "SURFACE_FROM_FACE";
AddParam(theParams, "Face", aSE.GetShape());
break;
}
default: default:
return false; return false;
} }

View File

@ -306,6 +306,7 @@
#define FACE_FROM_SURFACE 15 #define FACE_FROM_SURFACE 15
#define EDGE_UV 16 #define EDGE_UV 16
#define FACE_UV 17 #define FACE_UV 17
#define SURFACE_FROM_FACE 18
#define ARCHIMEDE_TYPE 1 #define ARCHIMEDE_TYPE 1

View File

@ -2000,3 +2000,33 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ExtendFace
return GetObject(aNewFace); 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);
}

View File

@ -284,6 +284,8 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
CORBA::Double theVMin, CORBA::Double theVMin,
CORBA::Double theVMax); CORBA::Double theVMax);
GEOM::GEOM_Object_ptr MakeSurfaceFromFace(GEOM::GEOM_Object_ptr theFace);
::GEOMImpl_IShapesOperations* GetOperations() ::GEOMImpl_IShapesOperations* GetOperations()
{ return (::GEOMImpl_IShapesOperations*)GetImpl(); } { return (::GEOMImpl_IShapesOperations*)GetImpl(); }
}; };

View File

@ -257,6 +257,7 @@ def TestAll (geompy, math):
ProjOnWire = geompy.MakeProjectionOnWire(p0, Wire) ProjOnWire = geompy.MakeProjectionOnWire(p0, Wire)
ExtEdge = geompy.ExtendEdge(Edge1, -0.3, 1.3) ExtEdge = geompy.ExtendEdge(Edge1, -0.3, 1.3)
ExtFace = geompy.ExtendFace(Face5, -0.3, 1.3, -0.1, 1.1) ExtFace = geompy.ExtendFace(Face5, -0.3, 1.3, -0.1, 1.1)
Surface = geompy.MakeSurfaceFromFace(Face5)
#IDList for Fillet/Chamfer #IDList for Fillet/Chamfer
prism_edges = geompy.ExtractShapes(Prism, geompy.ShapeType["EDGE"], True) 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_ProjOnWire = geompy.addToStudy(ProjOnWire[1], "ProjOnWire")
id_ExtEdge = geompy.addToStudy(ExtEdge, "ExtendedEdge") id_ExtEdge = geompy.addToStudy(ExtEdge, "ExtendedEdge")
id_ExtFace = geompy.addToStudy(ExtFace, "ExtendedFace") id_ExtFace = geompy.addToStudy(ExtFace, "ExtendedFace")
id_Surface = geompy.addToStudy(Surface, "Surface From Face")
id_Fillet = geompy.addToStudy(Fillet, "Fillet") id_Fillet = geompy.addToStudy(Fillet, "Fillet")
id_Fillet2 = geompy.addToStudy(Fillet2, "Fillet2") id_Fillet2 = geompy.addToStudy(Fillet2, "Fillet2")

View File

@ -5774,6 +5774,39 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
self._autoPublish(anObj, theName, "face") self._autoPublish(anObj, theName, "face")
return anObj 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 # end of l4_obtain
## @} ## @}