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
--- /dev/null
+# 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" )
<li>\subpage create_sketcher_page</li>
<li>\subpage create_3dsketcher_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_plane_page</li>
<li>\subpage create_lcs_page</li>
--- /dev/null
+/*!
+
+\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.
+
+*/
<br><h2>Creation of a Local Coordinate System</h2>
\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}
+
*/
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:
eraseall.png
extruded_boss.png
extruded_cut.png
+ facetosurface.png
faceextension.png
face_hw.png
face_vechw.png
EntityGUI_PolylineDlg.h
EntityGUI_3DSketcherDlg.h
EntityGUI_IsolineDlg.h
+ EntityGUI_SurfFromFaceDlg.h
EntityGUI_SubShapeDlg.h
EntityGUI_FeatureDetectorDlg.h
EntityGUI_PictureImportDlg.h
EntityGUI_PolylineDlg.h
EntityGUI_3DSketcherDlg.h
EntityGUI_IsolineDlg.h
+ EntityGUI_SurfFromFaceDlg.h
EntityGUI_SubShapeDlg.h
EntityGUI_PictureImportDlg.h
${FeatureDetectorDlg_moc_h}
EntityGUI_PolylineDlg.cxx
EntityGUI_3DSketcherDlg.cxx
EntityGUI_IsolineDlg.cxx
+ EntityGUI_SurfFromFaceDlg.cxx
EntityGUI_SubShapeDlg.cxx
EntityGUI_PictureImportDlg.cxx
${FeatureDetectorDlg_Sources}
#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
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;
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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
<source>ICON_VERTEX_MARKER_13</source>
<translation>marker_13.png</translation>
</message>
+ <message>
+ <source>ICON_SURFACE_FROM_FACE</source>
+ <translation>facetosurface.png</translation>
+ </message>
<message>
<source>ICO_ARC</source>
<translation>arc.png</translation>
<source>ICO_ISOLINE_V</source>
<translation>isoline_v.png</translation>
</message>
+ <message>
+ <source>ICO_SURFACE_FROM_FACE</source>
+ <translation>facetosurface.png</translation>
+ </message>
<message>
<source>ICO_SOLID</source>
<translation>build_solid.png</translation>
<source>MEN_ISOLINE</source>
<translation>Isoline</translation>
</message>
+ <message>
+ <source>MEN_SURFACE_FROM_FACE</source>
+ <translation>Surface From Face</translation>
+ </message>
<message>
<source>MEN_SOLID</source>
<translation>Solid</translation>
<source>STB_ISOLINE</source>
<translation>Create U- or V-Isoline</translation>
</message>
+ <message>
+ <source>STB_SURFACE_FROM_FACE</source>
+ <translation>Create a Surface From Face</translation>
+ </message>
<message>
<source>STB_SOLID</source>
<translation>Build a solid</translation>
<source>TOP_ISOLINE</source>
<translation>Isoline</translation>
</message>
+ <message>
+ <source>TOP_SURFACE_FROM_FACE</source>
+ <translation>Surface From Face</translation>
+ </message>
<message>
<source>TOP_SOLID</source>
<translation>Build solid</translation>
<translation>ExtendedFace</translation>
</message>
</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>
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
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" );
createGeomAction( GEOMOp::Op2dSketcher, "SKETCH" );
createGeomAction( GEOMOp::Op3dSketcher, "3DSKETCH" );
- createGeomAction( GEOMOp::OpIsoline, "ISOLINE" );
createGeomAction( GEOMOp::OpExplode, "EXPLODE" );
#ifdef WITH_OPENCV
createGeomAction( GEOMOp::OpFeatureDetect,"FEATURE_DETECTION" );
createMenu( GEOMOp::Op2dPolylineEditor, 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 );
createTool( GEOMOp::Op2dPolylineEditor, basicTbId );
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 );
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
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;
+}
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<Handle(GEOM_Object)> theShapes,
const Standard_Integer theObjectType,
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 {
}
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;
}
#define FACE_FROM_SURFACE 15
#define EDGE_UV 16
#define FACE_UV 17
+#define SURFACE_FROM_FACE 18
#define ARCHIMEDE_TYPE 1
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);
+}
CORBA::Double theVMin,
CORBA::Double theVMax);
+ GEOM::GEOM_Object_ptr MakeSurfaceFromFace(GEOM::GEOM_Object_ptr theFace);
+
::GEOMImpl_IShapesOperations* GetOperations()
{ return (::GEOMImpl_IShapesOperations*)GetImpl(); }
};
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)
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")
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
## @}