From: fps Date: Thu, 13 Oct 2011 10:08:36 +0000 (+0000) Subject: initialization of smoothing surface X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5aead5a14cfd1059963bf108f2e5f8c9b0705c0b;p=modules%2Fgeom.git initialization of smoothing surface --- diff --git a/doc/salome/gui/GEOM/input/creating_adv_obj.doc b/doc/salome/gui/GEOM/input/creating_adv_obj.doc index 030b88666..eeac2a750 100644 --- a/doc/salome/gui/GEOM/input/creating_adv_obj.doc +++ b/doc/salome/gui/GEOM/input/creating_adv_obj.doc @@ -18,6 +18,7 @@ entities: diff --git a/doc/salome/gui/GEOM/input/creating_smoothingsurface.doc b/doc/salome/gui/GEOM/input/creating_smoothingsurface.doc new file mode 100644 index 000000000..4326aeefb --- /dev/null +++ b/doc/salome/gui/GEOM/input/creating_smoothingsurface.doc @@ -0,0 +1,27 @@ +/*! + +\page create_smoothingsurface_page SmoothingSurface + +To create a \b SmoothingSurface in the Main Menu select New Entity - > +Advanced - > SmoothingSurface + +Specify the parameters of the SmoothingSurface object creation in the opened dialog +box and press "Apply" or "Apply & Close" button. +Result of each operation will be a GEOM_Object. + +TUI Command: geompy.MakeSmoothingSurface(Points, isClosed) + +Arguments: +- \b Points - list of points +- \b isClosed - Define if the created surface must be closed + +\image html smoothingsurface_dlg.png + +Example: + +\image html smoothingsurface.png + +Our TUI Scripts provide you with useful examples of creation of +\ref tui_creation_smoothingsurface "Advanced objects". + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc b/doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc index 1be354d79..a23126b43 100644 --- a/doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc +++ b/doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc @@ -336,5 +336,23 @@ gg.createAndDisplayGO(id_pipetshapefillet_position) \endcode +\anchor tui_creation_smoothingsurface +

Creation of SmoothingSurface

+ +\code +import geompy +import salome +gg = salome.ImportComponentGUI("GEOM") + +# create SmoothingSurface object +smoothingsurface = geompy.MakeSmoothingSurface([value], false) + +# add object in the study +id_smoothingsurface = geompy.addToStudy(smoothingsurface,"SmoothingSurface") + +# display smoothingsurface +gg.createAndDisplayGO(id_smoothingsurface) +\endcode + */ diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index e1ce70642..6becd7fa2 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -3600,6 +3600,14 @@ module GEOM in double theR2, in double theW2, in double theL2, in double theRF, in boolean theHexMesh, in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3); + /*! + * Create a smoothing surface from a set of points + * \param thePoints list of points + * \param theisClosed Define if the created surface must be closed + * \return New GEOM_Object, containing the created shape. + */ + GEOM_Object MakeSmoothingSurface (in ListOfGO thePoints, in boolean theisClosed); + /*@@ insert new functions before this line @@ do not remove this line @@*/ }; diff --git a/idl/GEOM_Superv.idl b/idl/GEOM_Superv.idl index fa6ef3a03..1a6df6f7b 100644 --- a/idl/GEOM_Superv.idl +++ b/idl/GEOM_Superv.idl @@ -617,6 +617,8 @@ module GEOM in double theRF, in boolean theHexMesh, in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3); + GEOM_Object MakeSmoothingSurface (in GEOM_List thePoints, in boolean theisClosed); + /*@@ insert new functions before this line @@ do not remove this line @@*/ }; }; diff --git a/resources/GEOMCatalog.xml.in b/resources/GEOMCatalog.xml.in index 9552fdae5..aa69ed6d6 100644 --- a/resources/GEOMCatalog.xml.in +++ b/resources/GEOMCatalog.xml.in @@ -5225,6 +5225,33 @@ + + MakeSmoothingSurface + + + unknown + 0 + + + thePoints + GEOM_List + list of points + + + theisClosed + boolean + Define if the created surface must be closed + + + + + return + GEOM_Object + Result object + + + + diff --git a/resources/Makefile.am b/resources/Makefile.am index 6313fd6c7..98c44046a 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -241,6 +241,7 @@ ADVANCED_RESOURCES += dlg_pipetshapechamferh.png dlg_pipetshapechamferw.png ADVANCED_RESOURCES += dlg_pipetshapefilletl1.png dlg_pipetshapefilletr1.png dlg_pipetshapefilletw1.png ADVANCED_RESOURCES += dlg_pipetshapefilletl2.png dlg_pipetshapefilletr2.png dlg_pipetshapefilletw2.png ADVANCED_RESOURCES += dlg_pipetshapefilletrf.png +#ADVANCED_RESOURCES += smoothingsurface.png smoothingsurface_points_isclosed.png tree_smoothingsurface.png ##@@ insert new functions before this line @@ do not remove this line @@## dist_salomeres_DATA += $(ADVANCED_RESOURCES) diff --git a/src/AdvancedGUI/AdvancedGUI.cxx b/src/AdvancedGUI/AdvancedGUI.cxx index 29b7a7e1f..3f8a10f78 100644 --- a/src/AdvancedGUI/AdvancedGUI.cxx +++ b/src/AdvancedGUI/AdvancedGUI.cxx @@ -29,6 +29,7 @@ #include #include "AdvancedGUI_PipeTShapeDlg.h" +#include "AdvancedGUI_SmoothingSurfaceDlg.h" //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@// #include @@ -69,6 +70,9 @@ bool AdvancedGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) // case GEOMOp::OpPipeTShapeGroups: // aDlg = new AdvancedGUI_PipeTShapeGroupsDlg( getGeometryGUI(), parent ); // break; + case GEOMOp::OpSmoothingSurface: + aDlg = new AdvancedGUI_SmoothingSurfaceDlg( getGeometryGUI(), parent ); + break; //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@// default: app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); diff --git a/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.cxx b/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.cxx new file mode 100644 index 000000000..d0b414c62 --- /dev/null +++ b/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.cxx @@ -0,0 +1,292 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#include "AdvancedGUI_SmoothingSurfaceDlg.h" + +#include +#include +#include + +#include +#include +#include +//#include +#include + +//#include +//#include + +// OCCT Includes +#include +#include +#include +#include +#include + +#include + +//================================================================================= +// Constructor +//================================================================================= +AdvancedGUI_SmoothingSurfaceDlg::AdvancedGUI_SmoothingSurfaceDlg (GeometryGUI* theGeometryGUI, QWidget* parent) + : GEOMBase_Skeleton(theGeometryGUI, parent, false) +{ + QPixmap imageOp (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_SMOOTHINGSURFACE_POINTS_ISCLOSED"))); + QPixmap imageSel (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + + setWindowTitle(tr("GEOM_SMOOTHINGSURFACE_TITLE")); + + /***************************************************************/ + mainFrame()->GroupConstructors->setTitle(tr("GEOM_SMOOTHINGSURFACE")); + mainFrame()->RadioButton1->setIcon(imageOp); + mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->RadioButton3->close(); + + GroupPoints = new DlgRef_1Sel1Check( centralWidget() ); + + GroupPoints->GroupBox1->setTitle( tr( "GEOM_NODES" ) ); + GroupPoints->TextLabel1->setText( tr( "GEOM_POINTS" ) ); + GroupPoints->PushButton1->setIcon( image1 ); + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) ); + GroupPoints->CheckButton1->setChecked(false); + + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); + layout->setMargin(0); layout->setSpacing(6); + layout->addWidget(GroupPoints); + /***************************************************************/ + + setHelpFileName("create_smoothingsurface_page.html"); + + Init(); +} + +//================================================================================= +// Destructor +//================================================================================= +AdvancedGUI_SmoothingSurfaceDlg::~AdvancedGUI_SmoothingSurfaceDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void AdvancedGUI_SmoothingSurfaceDlg::Init() +{ + // Get setting of step value from file configuration + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100); + + //@@ initialize dialog box widgets here @@// + + // Signal/slot connections + connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), + this, SLOT(SetDoubleSpinBoxStep(double))); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + + initName(tr("GEOM_SMOOTHINGSURFACE")); + //displayPreview(); +} + +/*//================================================================================= +// function : SetDoubleSpinBoxStep() +// purpose : Double spin box management +//================================================================================= +void AdvancedGUI_SmoothingSurfaceDlg::SetDoubleSpinBoxStep (double step) +{ + //@@ set double spin box step for all spin boxes here @@// +}*/ + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void AdvancedGUI_SmoothingSurfaceDlg::ClickOnOk() +{ + if (ClickOnApply()) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool AdvancedGUI_SmoothingSurfaceDlg::ClickOnApply() +{ + if (!onAccept()) + return false; + + initName(); + + return true; +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void AdvancedGUI_SmoothingSurfaceDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + //displayPreview(); +} + +//================================================================================= +// function : enterEvent [REDEFINED] +// purpose : +//================================================================================= +void AdvancedGUI_SmoothingSurfaceDlg::enterEvent (QEvent*) +{ + if (!mainFrame()->GroupConstructors->isEnabled()) + ActivateThisDialog(); +} + +/*//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void AdvancedGUI_SmoothingSurfaceDlg::ValueChangedInSpinBox() +{ + //@@ connect custom spin boxes or other widget to this slot in the Init() method for automatic preview update @@// + //displayPreview(); +}*/ + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr AdvancedGUI_SmoothingSurfaceDlg::createOperation() +{ + return getGeomEngine()->GetIAdvancedOperations(getStudyId()); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool AdvancedGUI_SmoothingSurfaceDlg::isValid (QString& msg) +{ + bool ok = true; + + //@@ add custom validation actions here @@// + + return ok; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool AdvancedGUI_SmoothingSurfaceDlg::execute (ObjectList& objects) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + GEOM::GEOM_IAdvancedOperations_var anOper = GEOM::GEOM_IAdvancedOperations::_narrow(getOperation()); + + //@@ retrieve input values from the widgets here @@// + GEOM::ListOfGO_var points = new GEOM::ListOfGO(); + points->length( myPoints.count() ); + for ( int i = 0; i < myPoints.count(); i++ ) + points[i] = myPoints[i].copy(); + + CORBA::Boolean theisClosed = GroupPoints->CheckButton1->isChecked(); + + // call engine function + anObj = anOper->MakeSmoothingSurface(points, theisClosed); + res = !anObj->_is_nil(); + if (res && !IsPreview()) + { + QStringList aParameters; + //@@ put stringified input parameters to the string list here to store in the data model for notebook @@// + /*aParameters << @@ stringified parameter value @@; // Points parameter + aParameters << @@ stringified parameter value @@; // isClosed parameter*/ + if ( aParameters.count() > 0 ) anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + } + + if (res) + objects.push_back(anObj._retn()); + + return res; +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void AdvancedGUI_SmoothingSurfaceDlg::SelectionIntoArgument() +{ + QList points = getSelected( TopAbs_VERTEX, -1 ); + synchronize( myPoints, points ); + if ( !myPoints.isEmpty() ) + GroupPoints->LineEdit1->setText( QString::number( myPoints.count() ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) ); + else + GroupPoints->LineEdit1->setText( "" ); + processPreview(); +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void AdvancedGUI_SmoothingSurfaceDlg::SetEditCurrentArgument() +{ + if ( sender() == GroupPoints->PushButton1 ) + myEditCurrentArgument = GroupPoints->LineEdit1; + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + +void AdvancedGUI_SmoothingSurfaceDlg::synchronize( QList& left, QList& right ) +{ + // 1. remove items from the "left" list that are not in the "right" list + QMutableListIterator it1( left ); + while ( it1.hasNext() ) { + GEOM::GeomObjPtr o1 = it1.next(); + bool found = false; + QMutableListIterator it2( right ); + while ( it2.hasNext() && !found ) + found = o1 == it2.next(); + if ( !found ) + it1.remove(); + } + // 2. add items from the "right" list that are not in the "left" list (to keep selection order) + it1 = right; + while ( it1.hasNext() ) { + GEOM::GeomObjPtr o1 = it1.next(); + bool found = false; + QMutableListIterator it2( left ); + while ( it2.hasNext() && !found ) + found = o1 == it2.next(); + if ( !found ) + left << o1; + } +} + diff --git a/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.h b/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.h new file mode 100644 index 000000000..2f0229441 --- /dev/null +++ b/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.h @@ -0,0 +1,73 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef ADVANCEDGUI_SMOOTHINGSURFACEDLG_H +#define ADVANCEDGUI_SMOOTHINGSURFACEDLG_H + +#include +#include "GEOM_GenericObjPtr.h" + +#include + +class DlgRef_1Sel1Check; + +//================================================================================= +// class : AdvancedGUI_SmoothingSurfaceDlg +// purpose : +//================================================================================= +class AdvancedGUI_SmoothingSurfaceDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + AdvancedGUI_SmoothingSurfaceDlg( GeometryGUI*, QWidget* = 0 ); + ~AdvancedGUI_SmoothingSurfaceDlg(); + +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* ); + void synchronize( QList& left, QList& right ); + +private: + DlgRef_1Sel1Check* GroupPoints; + QList myPoints; + +private slots: + void ClickOnOk(); + bool ClickOnApply(); + + void ActivateThisDialog(); + void DeactivateActiveDialog(); + + void CheckButtonToggled(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + //void ValueChangedInSpinBox(); + //void SetDoubleSpinBoxStep( double ); +}; + +#endif // ADVANCEDGUI_SMOOTHINGSURFACEDLG_H diff --git a/src/AdvancedGUI/Makefile.am b/src/AdvancedGUI/Makefile.am index 08326de25..f35185cba 100644 --- a/src/AdvancedGUI/Makefile.am +++ b/src/AdvancedGUI/Makefile.am @@ -28,6 +28,7 @@ salomeinclude_HEADERS = \ ADVANCED_INCLUDES = ADVANCED_INCLUDES += AdvancedGUI_PipeTShapeDlg.h +ADVANCED_INCLUDES += AdvancedGUI_SmoothingSurfaceDlg.h ##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@## salomeinclude_HEADERS += $(ADVANCED_INCLUDES) @@ -41,6 +42,7 @@ dist_libAdvancedGUI_la_SOURCES = \ ADVANCED_SOURCES = ADVANCED_SOURCES += AdvancedGUI_PipeTShapeDlg.h AdvancedGUI_PipeTShapeDlg.cxx +ADVANCED_SOURCES += AdvancedGUI_SmoothingSurfaceDlg.h AdvancedGUI_SmoothingSurfaceDlg.cxx ##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@## dist_libAdvancedGUI_la_SOURCES += $(ADVANCED_SOURCES) @@ -49,6 +51,7 @@ MOC_FILES = ADVANCED_MOC_FILES = ADVANCED_MOC_FILES += AdvancedGUI_PipeTShapeDlg_moc.cxx +ADVANCED_MOC_FILES += AdvancedGUI_SmoothingSurfaceDlg_moc.cxx ##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@## MOC_FILES += $(ADVANCED_MOC_FILES) @@ -80,4 +83,7 @@ libAdvancedGUI_la_CPPFLAGS = \ libAdvancedGUI_la_LDFLAGS = \ ../GEOMFiltersSelection/libGEOMFiltersSelection.la \ - ../GEOMBase/libGEOMBase.la + ../GEOMBase/libGEOMBase.la \ + ../GEOMGUI/libGEOM.la \ + $(CAS_LDFLAGS) -lTKGeomBase \ + $(GUI_LDFLAGS) -lsuit diff --git a/src/GEOMGUI/GEOM_images.ts b/src/GEOMGUI/GEOM_images.ts index 2fc4d646c..a58b00f3d 100644 --- a/src/GEOMGUI/GEOM_images.ts +++ b/src/GEOMGUI/GEOM_images.ts @@ -1228,6 +1228,18 @@ pipetshapegroups.png --> + + ICON_DLG_SMOOTHINGSURFACE_POINTS_ISCLOSED + smoothingsurface_points_isclosed.png + + + ICO_SMOOTHINGSURFACE + smoothingsurface.png + + + ICON_OBJBROWSER_ADVANCED_202 + tree_smoothingsurface.png + diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 5d138bbf7..96134e566 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -544,7 +544,7 @@ void GeometryGUI::OnGUIEvent( int id ) case GEOMOp::OpAdvancedNoOp: // NO OPERATION (advanced operations base) case GEOMOp::OpPipeTShape: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE // case GEOMOp::OpPipeTShapeGroups: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS - //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@// + case GEOMOp::OpSmoothingSurface: // MENU NEW ENTITY - ADVANCED - SMOOTHINGSURFACE libName = "AdvancedGUI"; break; default: @@ -810,6 +810,7 @@ void GeometryGUI::initialize( CAM_Application* app ) createGeomAction( GEOMOp::OpPointMarker, "POP_POINT_MARKER" ); createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" ); + createGeomAction( GEOMOp::OpSmoothingSurface, "SMOOTHINGSURFACE" ); // Create actions for increase/decrease transparency shortcuts createGeomAction( GEOMOp::OpIncrTransparency, "", "", 0, false, @@ -870,6 +871,7 @@ void GeometryGUI::initialize( CAM_Application* app ) int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 ); createMenu( GEOMOp::OpPipeTShape, advId, -1 ); // createMenu( GEOMOp::OpPipeTShapeGroups, advId, -1 ); + createMenu( GEOMOp::OpSmoothingSurface, advId, -1 ); //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@// createMenu( separator(), newEntId, -1 ); @@ -1104,6 +1106,7 @@ void GeometryGUI::initialize( CAM_Application* app ) int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) ); createTool( GEOMOp::OpPipeTShape, advancedTbId ); + createTool( GEOMOp::OpSmoothingSurface, advancedTbId ); //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@// // ---- create popup menus -------------------------- diff --git a/src/GEOMGUI/GeometryGUI_Operations.h b/src/GEOMGUI/GeometryGUI_Operations.h index 73b68f2f2..6a50d6e09 100644 --- a/src/GEOMGUI/GeometryGUI_Operations.h +++ b/src/GEOMGUI/GeometryGUI_Operations.h @@ -167,6 +167,7 @@ namespace GEOMOp { OpAdvancedNoOp = 10000, // NO OPERATION (advanced operations base) OpPipeTShape = 10001, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE // OpPipeTShapeGroups = 10002, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS + OpSmoothingSurface = 10003, // MENU NEW ENTITY - ADVANCED - SMOOTHINGSURFACE //@@ insert new functions before this line @@ do not remove this line @@// }; } diff --git a/src/GEOMImpl/GEOMImpl_Gen.cxx b/src/GEOMImpl/GEOMImpl_Gen.cxx index 281165e9d..dd3a47a60 100644 --- a/src/GEOMImpl/GEOMImpl_Gen.cxx +++ b/src/GEOMImpl/GEOMImpl_Gen.cxx @@ -83,6 +83,7 @@ #include // Advanced operations #include +#include /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ //============================================================================= @@ -166,6 +167,7 @@ GEOMImpl_Gen::GEOMImpl_Gen() // Advanced operations TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PipeTShapeDriver::GetID(), new GEOMImpl_PipeTShapeDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SmoothingSurfaceDriver::GetID(), new GEOMImpl_SmoothingSurfaceDriver()); /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ SetEngine(this); diff --git a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx index 4cbd6611f..52fe64cd4 100644 --- a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx @@ -45,6 +45,8 @@ #include "GEOMImpl_PipeTShapeDriver.hxx" #include "GEOMImpl_IPipeTShape.hxx" +#include +#include /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ #include @@ -2182,4 +2184,73 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeFilletWithPosition(double theR1, dou return aSeq; } +//============================================================================= +/*! + * Create a smoothing surface from a set of points + * \param thePoints list of points + * \param theisClosed Define if the created surface must be closed + * \return New GEOM_Object, containing the created shape. + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeSmoothingSurface (std::list thePoints, bool theisClosed) +{ + SetErrorCode(KO); + + //Add a new object + Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_SMOOTHINGSURFACE); + + //Add a new shape function with parameters + Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_SmoothingSurfaceDriver::GetID(), SMOOTHINGSURFACE_POINTS_ISCLOSED); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_SmoothingSurfaceDriver::GetID()) return NULL; + + GEOMImpl_ISmoothingSurface aData (aFunction); + + int aLen = thePoints.size(); + aData.SetLength(aLen); + int ind = 1; + std::list::iterator it = thePoints.begin(); + for (; it != thePoints.end(); it++, ind++) { + Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction(); + if (aRefPnt.IsNull()) { + SetErrorCode("NULL point for bSplineFaceShape"); + return NULL; + } + aData.SetPoint(ind, aRefPnt); + } + + aData.SetisClosed(theisClosed); + + //Compute the resulting value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("SmoothingSurface driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aShape << " = geompy.MakeSmoothingSurface(["; + it = thePoints.begin(); + pd << (*it++); + while (it != thePoints.end()) { + pd << ", " << (*it++); + } + pd << "], " << theisClosed << ")"; + + SetErrorCode(OK); + + return aShape; +} /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ diff --git a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx index 5c644a2b8..7095b05a4 100644 --- a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx @@ -27,6 +27,8 @@ #include "GEOM_Engine.hxx" #include "GEOM_Object.hxx" +#include + class GEOMImpl_IBasicOperations; class GEOMImpl_IBooleanOperations; class GEOMImpl_IShapesOperations; @@ -109,6 +111,7 @@ public: Handle(GEOM_Object) P1 = 0, Handle(GEOM_Object) P2 = 0, Handle(GEOM_Object) P3 = 0); + Standard_EXPORT Handle(GEOM_Object) MakeSmoothingSurface (std::list thePoints, bool theisClosed); /*@@ insert new functions before this line @@ do not remove this line @@*/ }; #endif diff --git a/src/GEOMImpl/GEOMImpl_ISmoothingSurface.hxx b/src/GEOMImpl/GEOMImpl_ISmoothingSurface.hxx new file mode 100644 index 000000000..4683a973d --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ISmoothingSurface.hxx @@ -0,0 +1,49 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _GEOMImpl_ISmoothingSurface_HXX_ +#define _GEOMImpl_ISmoothingSurface_HXX_ + +#include "GEOM_Function.hxx" + +#define SMOOTHINGSURFACE_ARG_LENG 1 +#define SMOOTHINGSURFACE_ARG_LAST 2 +#define SMOOTHINGSURFACE_ARG_ISCLOSED 3 + +class GEOMImpl_ISmoothingSurface +{ +public: + GEOMImpl_ISmoothingSurface(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetLength(int theLen) { _func->SetInteger(SMOOTHINGSURFACE_ARG_LENG, theLen); } + int GetLength() { return _func->GetInteger(SMOOTHINGSURFACE_ARG_LENG); } + + void SetPoint(int theId, Handle(GEOM_Function) theP) { _func->SetReference(SMOOTHINGSURFACE_ARG_LAST + theId, theP); } + Handle(GEOM_Function) GetPoint(int theId) { return _func->GetReference(SMOOTHINGSURFACE_ARG_LAST + theId); } + + void SetisClosed(bool theisClosed) { _func->SetInteger(SMOOTHINGSURFACE_ARG_ISCLOSED, theisClosed); } + bool GetisClosed() { return _func->GetInteger(SMOOTHINGSURFACE_ARG_ISCLOSED); } + +private: + Handle(GEOM_Function) _func; +}; + +#endif // _GEOMImpl_ISmoothingSurface_HXX_ diff --git a/src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.cxx b/src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.cxx new file mode 100644 index 000000000..0ea77cb95 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.cxx @@ -0,0 +1,147 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#include + +#include +#include +#include +#include + +#include +#include + +//@@ include required header files here @@// +#include +#include +#include +#include +#include +#include +/*#include +#include +#include +#include +#include */ + + + + + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_SmoothingSurfaceDriver::GetID() +{ + static Standard_GUID aGUID("1C3A0F3F-729D-4E83-8232-78E74FC5637C"); + return aGUID; +} + +//======================================================================= +//function : GEOMImpl_SmoothingSurfaceDriver +//purpose : +//======================================================================= +GEOMImpl_SmoothingSurfaceDriver::GEOMImpl_SmoothingSurfaceDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_SmoothingSurfaceDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + if (aFunction.IsNull()) return 0; + + Standard_Integer aType = aFunction->GetType(); + cout << "Type : " << aType << endl; + + if (aType != SMOOTHINGSURFACE_POINTS_ISCLOSED) return 0; + cout << "Youhou : " << aType << endl; + + GEOMImpl_ISmoothingSurface aData (aFunction); + + /*bool isClosed = aData.GetisClosed(); + int nbPoints = aData.GetLength();*/ + + TopoDS_Shape aShape; + + /*if (isClosed) + { + // Surface initiale : Sphere + } + else + { + // Surface initiale : Plane + + }*/ + + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + +//======================================================================= +//function : GEOMImpl_SmoothingSurfaceDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_SmoothingSurfaceDriver_Type_() +{ + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_SmoothingSurfaceDriver", + sizeof(GEOMImpl_SmoothingSurfaceDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_SmoothingSurfaceDriver) Handle(GEOMImpl_SmoothingSurfaceDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_SmoothingSurfaceDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_SmoothingSurfaceDriver))) { + _anOtherObject = Handle(GEOMImpl_SmoothingSurfaceDriver)((Handle(GEOMImpl_SmoothingSurfaceDriver)&)AnObject); + } + } + + return _anOtherObject; +} diff --git a/src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.hxx b/src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.hxx new file mode 100644 index 000000000..800d4e350 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.hxx @@ -0,0 +1,129 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _GEOMImpl_SmoothingSurfaceDriver_HXX +#define _GEOMImpl_SmoothingSurfaceDriver_HXX + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class Handle_Standard_Type; +class GEOMImpl_SmoothingSurfaceDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_SmoothingSurfaceDriver); + +class Handle(GEOMImpl_SmoothingSurfaceDriver) : public Handle(TFunction_Driver) { +public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_SmoothingSurfaceDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_SmoothingSurfaceDriver)(const Handle(GEOMImpl_SmoothingSurfaceDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + {} + + Handle(GEOMImpl_SmoothingSurfaceDriver)(const GEOMImpl_SmoothingSurfaceDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + {} + + Handle(GEOMImpl_SmoothingSurfaceDriver)& operator=(const Handle(GEOMImpl_SmoothingSurfaceDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_SmoothingSurfaceDriver)& operator=(const GEOMImpl_SmoothingSurfaceDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_SmoothingSurfaceDriver* operator->() + { + return (GEOMImpl_SmoothingSurfaceDriver *)ControlAccess(); + } + + GEOMImpl_SmoothingSurfaceDriver* operator->() const + { + return (GEOMImpl_SmoothingSurfaceDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_SmoothingSurfaceDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_SmoothingSurfaceDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +class GEOMImpl_SmoothingSurfaceDriver : public TFunction_Driver { +public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // + Standard_EXPORT GEOMImpl_SmoothingSurfaceDriver(); + Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; + Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} + Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const + { + return Standard_True; + } + Standard_EXPORT static const Standard_GUID& GetID(); + Standard_EXPORT ~GEOMImpl_SmoothingSurfaceDriver() {}; + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_SmoothingSurfaceDriver_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const + { + return STANDARD_TYPE(GEOMImpl_SmoothingSurfaceDriver); + } + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const + { + return (STANDARD_TYPE(GEOMImpl_SmoothingSurfaceDriver) == AType || TFunction_Driver::IsKind(AType)); + } +}; + +#endif // _GEOMImpl_SmoothingSurfaceDriver_HXX diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index 66b6f5372..02fcfbea4 100755 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -318,9 +318,11 @@ // Advanced functions (base = 200) #define ADVANCED_BASE 200 // NO OPERATION (advanced operations base) #define GEOM_TSHAPE 201 +#define GEOM_SMOOTHINGSURFACE 202 /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ // Advanced functions sub-operations codes #define TSHAPE_BASIC 1 #define TSHAPE_CHAMFER 2 #define TSHAPE_FILLET 3 +#define SMOOTHINGSURFACE_POINTS_ISCLOSED 1 /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ diff --git a/src/GEOMImpl/Makefile.am b/src/GEOMImpl/Makefile.am index c4bc7cec7..119013c5b 100644 --- a/src/GEOMImpl/Makefile.am +++ b/src/GEOMImpl/Makefile.am @@ -146,6 +146,7 @@ salomeinclude_HEADERS = \ ADVANCED_INCLUDES = ADVANCED_INCLUDES += GEOMImpl_IPipeTShape.hxx GEOMImpl_PipeTShapeDriver.hxx +ADVANCED_INCLUDES += GEOMImpl_ISmoothingSurface.hxx GEOMImpl_SmoothingSurfaceDriver.hxx ##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@## salomeinclude_HEADERS += $(ADVANCED_INCLUDES) @@ -216,6 +217,7 @@ dist_libGEOMimpl_la_SOURCES = \ ADVANCED_SOURCES = ADVANCED_SOURCES += GEOMImpl_PipeTShapeDriver.cxx +ADVANCED_SOURCES += GEOMImpl_SmoothingSurfaceDriver.cxx ##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@## dist_libGEOMimpl_la_SOURCES += $(ADVANCED_SOURCES) diff --git a/src/GEOM_I/GEOM_IAdvancedOperations_i.cc b/src/GEOM_I/GEOM_IAdvancedOperations_i.cc index bc17d5b32..b516e47ab 100644 --- a/src/GEOM_I/GEOM_IAdvancedOperations_i.cc +++ b/src/GEOM_I/GEOM_IAdvancedOperations_i.cc @@ -321,4 +321,37 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFilletWithPosition (CO return aSeq._retn(); } +//============================================================================= +/*! + * Create a smoothing surface from a set of points + * \param thePoints list of points + * \param theisClosed Define if the created surface must be closed + * \return New GEOM_Object, containing the created shape. + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeSmoothingSurface (const GEOM::ListOfGO& thePoints, CORBA::Boolean theisClosed) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference point + int ind = 0; + int aLen = thePoints.length(); + std::list aPoints; + for (; ind < aLen; ind++) { + Handle(GEOM_Object) aPnt = GetObjectImpl(thePoints[ind]); + if (aPnt.IsNull()) return aGEOMObject._retn(); + aPoints.push_back(aPnt); + } + + //Create the SmoothingSurface + Handle(GEOM_Object) anObject = GetOperations()->MakeSmoothingSurface(aPoints, theisClosed); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + /*@@ insert new functions before this line @@ do not remove this line @@*/ diff --git a/src/GEOM_I/GEOM_IAdvancedOperations_i.hh b/src/GEOM_I/GEOM_IAdvancedOperations_i.hh index 6d91d86ac..a277149ab 100644 --- a/src/GEOM_I/GEOM_IAdvancedOperations_i.hh +++ b/src/GEOM_I/GEOM_IAdvancedOperations_i.hh @@ -63,6 +63,7 @@ class GEOM_I_EXPORT GEOM_IAdvancedOperations_i : CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, CORBA::Double theRF, CORBA::Boolean theHexMesh, GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3); + GEOM::GEOM_Object_ptr MakeSmoothingSurface (const GEOM::ListOfGO& thePoints, CORBA::Boolean theisClosed); /*@@ insert new functions before this line @@ do not remove this line @@*/ ::GEOMImpl_IAdvancedOperations* GetOperations() diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index 1cf1761ee..7494f67b0 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -3402,6 +3402,26 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::MakePipeTShapeFilletWithPosition return aSeqPtr->_this(); } +//============================================================================= +// MakeSmoothingSurface +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSmoothingSurface (GEOM::GEOM_List_ptr thePoints, CORBA::Boolean theisClosed) +{ + beginService( " GEOM_Superv_i::MakeSmoothingSurface" ); + MESSAGE("GEOM_Superv_i::MakeSmoothingSurface"); + getAdvancedOp(); + //GEOM::GEOM_Object_ptr anObj = myAdvancedOp->MakeSmoothingSurface(thePoints, theisClosed); + if (GEOM_List_i* aListImplP = + dynamic_cast*>(GetServant(thePoints, myPOA).in())) { + getCurvesOp(); + GEOM::GEOM_Object_ptr anObj = myAdvancedOp->MakeSmoothingSurface(aListImplP->GetList(), theisClosed); + endService( " GEOM_Superv_i::MakeSmoothingSurface" ); + return anObj; + } + endService( " GEOM_Superv_i::MakeSmoothingSurface" ); + return NULL; +} + /*@@ insert new functions before this line @@ do not remove this line @@*/ //===================================================================================== diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index d593be290..9d82c6dff 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -701,6 +701,7 @@ public: CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, CORBA::Double theRF, CORBA::Boolean theHexMesh, GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3); + GEOM::GEOM_Object_ptr MakeSmoothingSurface (GEOM::GEOM_List_ptr thePoints, CORBA::Boolean theisClosed); /*@@ insert new functions before this line @@ do not remove this line @@*/ private: diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 983773905..396074980 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -4691,6 +4691,19 @@ class geompyDC(GEOM._objref_GEOM_Gen): if Parameters: anObj[0].SetParameters(Parameters) return anObj + ## Create a smoothing surface from a set of points + # @param thePoints list of points + # @param theisClosed Define if the created surface must be closed + # @return New GEOM_Object, containing the created shape. + # + # @ref tui_creation_smoothingsurface "Example" + def MakeSmoothingSurface(self, thePoints, theisClosed): + thePoints, theisClosed, Parameters = ParseParameters(thePoints, theisClosed) + anObj = self.AdvOp.MakeSmoothingSurface(thePoints, theisClosed) + RaiseIfFailed("MakeSmoothingSurface", self.AdvOp) + if Parameters: anObj.SetParameters(Parameters) + return anObj + #@@ insert new functions before this line @@ do not remove this line @@# # end of l4_advanced