in double theVMin,
in double theVMax);
+ /*!
+ * \brief Make a surface from a face. This function takes some face as
+ * input parameter and create 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_SketcherDlg.h
EntityGUI_3DSketcherDlg.h
EntityGUI_IsolineDlg.h
+ EntityGUI_SurfFromFaceDlg.h
EntityGUI_SubShapeDlg.h
EntityGUI_FeatureDetectorDlg.h
EntityGUI_PictureImportDlg.h
EntityGUI_SketcherDlg.h
EntityGUI_3DSketcherDlg.h
EntityGUI_IsolineDlg.h
+ EntityGUI_SurfFromFaceDlg.h
EntityGUI_SubShapeDlg.h
EntityGUI_PictureImportDlg.h
${FeatureDetectorDlg_moc_h}
EntityGUI_SketcherDlg.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::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 );
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 );
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(); }
};