From: jfa Date: Tue, 25 Aug 2009 12:37:33 +0000 (+0000) Subject: IMP 0020308: EDF 995 GEOM : Closed Polyline with tangence. X-Git-Tag: V5_1_3rc1~44 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=522b8bee2266d0688108a4e7084ec857385212f4;p=modules%2Fgeom.git IMP 0020308: EDF 995 GEOM : Closed Polyline with tangence. --- diff --git a/doc/salome/gui/GEOM/input/creating_curve.doc b/doc/salome/gui/GEOM/input/creating_curve.doc index e442851bf..6cf48d947 100644 --- a/doc/salome/gui/GEOM/input/creating_curve.doc +++ b/doc/salome/gui/GEOM/input/creating_curve.doc @@ -15,9 +15,10 @@ possible types of curves: Polyline, Besier or B-spline (Interpolated). ListOfShape is a list of points through which the curve passes. +If isClosed is True, MakeInterpol builds a closed edge. Arguments: Name + at least 2 points which will serve as nodes on the curve. @@ -38,4 +39,4 @@ on the curve. Our TUI Scripts provide you with useful examples of creation of \ref tui_creation_curve "Basic Geometric Objects". -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc b/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc index a6eb9bf18..f36714256 100644 --- a/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc +++ b/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc @@ -199,7 +199,7 @@ polyline = geompy.MakePolyline([p0, p1, p2, p3, p4]) bezier = geompy.MakeBezier([p0, p1, p2, p3, p4]) #create a b-spline curve from a list of points -interpol = geompy.MakeInterpol([p0, p1, p2, p3, p4]) +interpol = geompy.MakeInterpol([p0, p1, p2, p3, p4], False) # add objects in the study id_p0 = geompy.addToStudy(p0, "Point1") diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 5ab6a4070..f7c1a49a6 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -2209,9 +2209,11 @@ module GEOM /*! * Create B-Spline curve on the set of points. * \param thePoints Sequence of points for the B-Spline curve. + * \param theIsClosed If TRUE, build a closed curve. * \return New GEOM_Object, containing the created B-Spline curve. */ - GEOM_Object MakeSplineInterpolation (in ListOfGO thePoints); + GEOM_Object MakeSplineInterpolation (in ListOfGO thePoints, + in boolean theIsClosed); /*! * Create a sketcher (wire or face), following the textual description, diff --git a/idl/GEOM_Superv.idl b/idl/GEOM_Superv.idl index 1f6d2f769..516f14110 100644 --- a/idl/GEOM_Superv.idl +++ b/idl/GEOM_Superv.idl @@ -502,7 +502,8 @@ module GEOM in GEOM_Object thePnt2) ; GEOM_Object MakePolyline (in GEOM_List thePoints) ; GEOM_Object MakeSplineBezier (in GEOM_List thePoints) ; - GEOM_Object MakeSplineInterpolation (in GEOM_List thePoints) ; + GEOM_Object MakeSplineInterpolation (in GEOM_List thePoints, + in boolean theIsClosed) ; GEOM_Object MakeSketcher (in string theCommand, in GEOM_List theWorkingPlane) ; diff --git a/src/BasicGUI/BasicGUI_CurveDlg.cxx b/src/BasicGUI/BasicGUI_CurveDlg.cxx index 0212cdb31..a2c17827b 100644 --- a/src/BasicGUI/BasicGUI_CurveDlg.cxx +++ b/src/BasicGUI/BasicGUI_CurveDlg.cxx @@ -22,7 +22,7 @@ // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_CurveDlg.cxx // Author : Lucien PIGNOLONI, Open CASCADE S.A.S. -// + #include "BasicGUI_CurveDlg.h" #include @@ -48,13 +48,13 @@ //================================================================================= // class : BasicGUI_CurveDlg() -// purpose : Constructs a BasicGUI_CurveDlg which is a child of 'parent', with the +// purpose : Constructs a BasicGUI_CurveDlg which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= BasicGUI_CurveDlg::BasicGUI_CurveDlg( GeometryGUI* theGeometryGUI, QWidget* parent, - bool modal, Qt::WindowFlags fl ) + bool modal, Qt::WindowFlags fl ) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) { QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POLYLINE" ) ) ); @@ -69,7 +69,7 @@ BasicGUI_CurveDlg::BasicGUI_CurveDlg( GeometryGUI* theGeometryGUI, QWidget* pare mainFrame()->RadioButton2->setIcon( image3 ); mainFrame()->RadioButton3->setIcon( image2 ); - GroupPoints = new DlgRef_1Sel( centralWidget() ); + GroupPoints = new DlgRef_1Sel1Check( centralWidget() ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_NODES" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_POINTS" ) ); @@ -78,6 +78,10 @@ BasicGUI_CurveDlg::BasicGUI_CurveDlg( GeometryGUI* theGeometryGUI, QWidget* pare GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) ); + GroupPoints->CheckButton1->setChecked(false); + GroupPoints->CheckButton1->hide(); + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); layout->setMargin( 0 ); layout->setSpacing( 6 ); layout->addWidget( GroupPoints ); @@ -116,7 +120,7 @@ void BasicGUI_CurveDlg::Init() /* signals and slots connections */ 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() ) ); @@ -125,9 +129,11 @@ void BasicGUI_CurveDlg::Init() connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); - connect( myGeomGUI->getApp()->selectionMgr(), - SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ) ; - + connect( GroupPoints->CheckButton1,SIGNAL( toggled(bool) ), this, SLOT( CheckButtonToggled() ) ); + + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + initName( tr( "GEOM_CURVE" ) ); resize(100,100); ConstructorsClicked( 0 ); @@ -141,9 +147,14 @@ void BasicGUI_CurveDlg::ConstructorsClicked( int id ) { QString aTitle = tr( id == 0 ? "GEOM_POLYLINE" : id == 1 ? "GEOM_BEZIER" : "GEOM_INTERPOL" ); mainFrame()->GroupConstructors->setTitle( aTitle ); - + + if (id == 2) // b-spline + GroupPoints->CheckButton1->show(); + else + GroupPoints->CheckButton1->hide(); + myPoints = new GEOM::ListOfGO(); - myPoints->length( 0 ); + myPoints->length( 0 ); myEditCurrentArgument->setText( "" ); } @@ -155,7 +166,7 @@ void BasicGUI_CurveDlg::ConstructorsClicked( int id ) //================================================================================= void BasicGUI_CurveDlg::SetEditCurrentArgument() { - if ( sender() == GroupPoints->PushButton1 ) + if ( sender() == GroupPoints->PushButton1 ) myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument->setFocus(); SelectionIntoArgument(); @@ -168,13 +179,22 @@ void BasicGUI_CurveDlg::SetEditCurrentArgument() //================================================================================= void BasicGUI_CurveDlg::LineEditReturnPressed() { - if ( sender() == GroupPoints->LineEdit1 ) + if ( sender() == GroupPoints->LineEdit1 ) { myEditCurrentArgument = GroupPoints->LineEdit1; GEOMBase_Skeleton::LineEditReturnPressed(); } } +//================================================================================= +// function : CheckButtonToggled() +// purpose : +//================================================================================= +void BasicGUI_CurveDlg::CheckButtonToggled() +{ + displayPreview(); +} + //================================================================================= // function : ClickOnOk() // purpose : @@ -208,14 +228,14 @@ bool BasicGUI_CurveDlg::ClickOnApply() */ //================================================================================= static int isPointInList( std::list& thePoints, - GEOM::GEOM_Object_var& theObject ) + GEOM::GEOM_Object_var& theObject ) { int len = thePoints.size(); - + if ( len < 1 ) { return -1; } - + for ( std::list::iterator i = thePoints.begin(); i != thePoints.end(); i++ ) { if ( std::string( (*i)->GetEntry() ) == std::string( theObject->GetEntry() ) ) { return 1; @@ -233,14 +253,14 @@ static int isPointInList( std::list& thePoints, */ //================================================================================= static void removeUnnecessaryPnt( std::list& theOldPoints, - GEOM::ListOfGO_var& theNewPoints ) + GEOM::ListOfGO_var& theNewPoints ) { std::list objs_to_remove; for ( std::list::iterator i = theOldPoints.begin(); i != theOldPoints.end(); i++ ) { bool found = false; for ( int j = 0; j < theNewPoints->length() && !found ; j++ ) { if ( std::string( (*i)->GetEntry() ) == std::string( theNewPoints[j]->GetEntry() ) ) { - found = true; + found = true; } } if ( !found ) { @@ -281,56 +301,56 @@ void BasicGUI_CurveDlg::SelectionIntoArgument() // bool is_append = myPoints->length() < IOC; // if true - add point, else remove // myPoints->length( IOC ); // this length may be greater than number of objects, // that will actually be put into myPoints - + for (SALOME_ListIteratorOfListIO anIt (selected); anIt.More(); anIt.Next()) { GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIt.Value(), aRes); if (!CORBA::is_nil(aSelectedObject) && aRes) { if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) { - aSelMgr->GetIndexes(anIt.Value(), aMapIndexes); - - if (aMapIndexes.Extent() > 0) { - for (int ii = 1; ii <= aMapIndexes.Extent(); ii++) { - anIndex = aMapIndexes(ii); - QString aName = GEOMBase::GetName( aSelectedObject ); - aName = aName + ":vertex_" + QString::number( anIndex ); - anObject = aShapesOp->GetSubShape( aSelectedObject, anIndex ); - //Find Object in study - _PTR(SObject) obj ( aDStudy->FindObjectID( anIt.Value()->getEntry() ) ); - bool inStudy = false; + aSelMgr->GetIndexes(anIt.Value(), aMapIndexes); + + if (aMapIndexes.Extent() > 0) { + for (int ii = 1; ii <= aMapIndexes.Extent(); ii++) { + anIndex = aMapIndexes(ii); + QString aName = GEOMBase::GetName( aSelectedObject ); + aName = aName + ":vertex_" + QString::number( anIndex ); + anObject = aShapesOp->GetSubShape( aSelectedObject, anIndex ); + //Find Object in study + _PTR(SObject) obj ( aDStudy->FindObjectID( anIt.Value()->getEntry() ) ); + bool inStudy = false; _PTR(ChildIterator) iit( aDStudy->NewChildIterator( obj ) ); for (; iit->More() && !inStudy; iit->Next()) { - _PTR(SObject) child( iit->Value() ); - QString aChildName = child->GetName().c_str(); - if ( aChildName == aName ) { - inStudy = true; - CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( iit->Value() ); - anObject = GEOM::GEOM_Object::_narrow( corbaObj ); - } - } - - if ( !inStudy ) - GeometryGUI::GetGeomGen()->AddInStudy( GeometryGUI::ClientStudyToStudy( aDStudy ), - anObject, aName.toLatin1().data(), aSelectedObject ); - - int pos = isPointInList( myOrderedSel, anObject ); - if ( pos == -1 ) { - myOrderedSel.push_back( anObject ); - } - // if (!inStudy) - aList.push_back(anObject); - } - } - else { // aMap.Extent() == 0 - int pos = isPointInList( myOrderedSel, aSelectedObject ); - if ( pos == -1 ) - myOrderedSel.push_back( aSelectedObject ); - aList.push_back( aSelectedObject ); - } + _PTR(SObject) child( iit->Value() ); + QString aChildName = child->GetName().c_str(); + if ( aChildName == aName ) { + inStudy = true; + CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( iit->Value() ); + anObject = GEOM::GEOM_Object::_narrow( corbaObj ); + } + } + + if ( !inStudy ) + GeometryGUI::GetGeomGen()->AddInStudy( GeometryGUI::ClientStudyToStudy( aDStudy ), + anObject, aName.toLatin1().data(), aSelectedObject ); + + int pos = isPointInList( myOrderedSel, anObject ); + if ( pos == -1 ) { + myOrderedSel.push_back( anObject ); + } + // if (!inStudy) + aList.push_back(anObject); + } + } + else { // aMap.Extent() == 0 + int pos = isPointInList( myOrderedSel, aSelectedObject ); + if ( pos == -1 ) + myOrderedSel.push_back( aSelectedObject ); + aList.push_back( aSelectedObject ); + } } } } - - myPoints->length( aList.size() ); + + myPoints->length( aList.size() ); int k = 0; for ( std::list::iterator j = aList.begin(); j != aList.end(); j++ ) @@ -342,7 +362,7 @@ void BasicGUI_CurveDlg::SelectionIntoArgument() removeUnnecessaryPnt( myOrderedSel, myPoints ); // if ( myOrderedSel.size() == myPoints->length() ) { - myPoints->length( myOrderedSel.size() ); + myPoints->length( myOrderedSel.size() ); k = 0; for ( std::list::iterator j = myOrderedSel.begin(); j != myOrderedSel.end(); j++ ) myPoints[k++] = *j; @@ -350,8 +370,8 @@ void BasicGUI_CurveDlg::SelectionIntoArgument() if ( myPoints->length() > 0 ) GroupPoints->LineEdit1->setText( QString::number( myPoints->length() ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) ); - -displayPreview(); + + displayPreview(); } @@ -363,7 +383,7 @@ void BasicGUI_CurveDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + this, SLOT( SelectionIntoArgument() ) ); globalSelection(); // close local contexts, if any localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); @@ -429,7 +449,8 @@ bool BasicGUI_CurveDlg::execute( ObjectList& objects ) res = true; break; case 2 : - anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeSplineInterpolation( myPoints ); + anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )-> + MakeSplineInterpolation( myPoints, GroupPoints->CheckButton1->isChecked() ); res = true; break; } diff --git a/src/BasicGUI/BasicGUI_CurveDlg.h b/src/BasicGUI/BasicGUI_CurveDlg.h index 5c3730859..f0308d634 100644 --- a/src/BasicGUI/BasicGUI_CurveDlg.h +++ b/src/BasicGUI/BasicGUI_CurveDlg.h @@ -22,7 +22,7 @@ // GEOM GEOMGUI : GUI for Geometry component // File : BasicGUI_CurveDlg.h // Author : Alexander SLADKOV, Open CASCADE S.A.S. (alexander.sladkov@opencascade.com) -// + #ifndef BASICGUI_CURVEDLG_H #define BASICGUI_CURVEDLG_H @@ -30,20 +30,20 @@ #include -class DlgRef_1Sel; +class DlgRef_1Sel1Check; //================================================================================= // class : BasicGUI_CurveDlg // purpose : //================================================================================= class BasicGUI_CurveDlg : public GEOMBase_Skeleton -{ +{ Q_OBJECT public: BasicGUI_CurveDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 ); ~BasicGUI_CurveDlg(); - + protected: // redefined from GEOMBase_Helper virtual GEOM::GEOM_IOperations_ptr createOperation(); @@ -55,19 +55,20 @@ private: void enterEvent( QEvent* ); private: - DlgRef_1Sel* GroupPoints; + DlgRef_1Sel1Check* GroupPoints; GEOM::ListOfGO_var myPoints; std::list myOrderedSel; //!< This list used for managing orderes selection private slots: void ClickOnOk(); bool ClickOnApply(); - + void ActivateThisDialog(); - void DeactivateActiveDialog(); - + void DeactivateActiveDialog(); + void ConstructorsClicked( int ); void LineEditReturnPressed(); + void CheckButtonToggled(); void SelectionIntoArgument(); void SetEditCurrentArgument(); }; diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index a63dd13e1..eeb6052eb 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -3844,6 +3844,13 @@ Please, select face, shell or solid and try again Length unit in the file is not a 'meter'. Do you want to scale a model? + + BasicGUI_CurveDlg + + GEOM_IS_CLOSED + Build a closed edge + + BasicGUI_EllipseDlg diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx index 72fb49c63..654a12a31 100644 --- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx @@ -664,7 +664,8 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineBezier */ //============================================================================= Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation - (list thePoints) + (list thePoints, + bool theIsClosed) { SetErrorCode(KO); @@ -694,6 +695,8 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation aCI.SetPoint(ind, aRefPnt); } + aCI.SetIsClosed(theIsClosed); + //Compute the Spline value try { #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx index dbf5ecee0..14a29f561 100644 --- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx @@ -68,7 +68,8 @@ class GEOMImpl_ICurvesOperations : public GEOM_IOperations { Handle(GEOM_Object) thePnt3); Standard_EXPORT Handle(GEOM_Object) MakeSplineBezier (list thePoints); - Standard_EXPORT Handle(GEOM_Object) MakeSplineInterpolation (list thePoints); + Standard_EXPORT Handle(GEOM_Object) MakeSplineInterpolation (list thePoints, + bool theIsClosed = false); Standard_EXPORT Handle(GEOM_Object) MakeSketcher (const char* theCommand, list theWorkingPlane); diff --git a/src/GEOMImpl/GEOMImpl_ISpline.hxx b/src/GEOMImpl/GEOMImpl_ISpline.hxx index 3694a556d..b89910358 100644 --- a/src/GEOMImpl/GEOMImpl_ISpline.hxx +++ b/src/GEOMImpl/GEOMImpl_ISpline.hxx @@ -19,12 +19,13 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -//NOTE: This is an intreface to a function for the Spline creation. -// +// NOTE: This is an interface to a function for the Spline creation. + #include "GEOM_Function.hxx" #define SPL_ARG_LENG 1 -#define SPL_ARG_LAST 1 +#define SPL_ARG_CLOS 2 +#define SPL_ARG_LAST 2 class GEOMImpl_ISpline { @@ -34,10 +35,14 @@ class GEOMImpl_ISpline void SetLength(int theLen) { _func->SetInteger(SPL_ARG_LENG, theLen); } + void SetIsClosed(bool theIsClosed) { _func->SetInteger(SPL_ARG_CLOS, (int)theIsClosed); } + void SetPoint(int theId, Handle(GEOM_Function) theP) { _func->SetReference(SPL_ARG_LAST + theId, theP); } int GetLength() { return _func->GetInteger(SPL_ARG_LENG); } + bool GetIsClosed() { return (bool)_func->GetInteger(SPL_ARG_CLOS); } + Handle(GEOM_Function) GetPoint(int theId) { return _func->GetReference(SPL_ARG_LAST + theId); } private: diff --git a/src/GEOMImpl/GEOMImpl_SplineDriver.cxx b/src/GEOMImpl/GEOMImpl_SplineDriver.cxx index 11aaea41f..4e91baf37 100644 --- a/src/GEOMImpl/GEOMImpl_SplineDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_SplineDriver.cxx @@ -107,13 +107,14 @@ Standard_Integer GEOMImpl_SplineDriver::Execute(TFunction_Logbook& log) const Handle(Geom_BezierCurve) GBC = new Geom_BezierCurve(CurvePoints); aShape = BRepBuilderAPI_MakeEdge(GBC).Edge(); } else { -// GeomAPI_PointsToBSpline GBC (CurvePoints); -// aShape = BRepBuilderAPI_MakeEdge(GBC).Edge(); + //GeomAPI_PointsToBSpline GBC (CurvePoints); + //aShape = BRepBuilderAPI_MakeEdge(GBC).Edge(); Handle(TColgp_HArray1OfPnt) aHCurvePoints = new TColgp_HArray1OfPnt(1, aLen); for (ind = 1; ind <= aLen; ind++) { aHCurvePoints->SetValue(ind, CurvePoints.Value(ind)); } - GeomAPI_Interpolate GBC (aHCurvePoints, Standard_False, gp::Resolution()); + int isClosed = aCI.GetIsClosed(); + GeomAPI_Interpolate GBC (aHCurvePoints, isClosed, gp::Resolution()); GBC.Perform(); if (GBC.IsDone()) aShape = BRepBuilderAPI_MakeEdge(GBC.Curve()).Edge(); diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.cc b/src/GEOM_I/GEOM_ICurvesOperations_i.cc index 5d47fcdf9..daf9be27b 100644 --- a/src/GEOM_I/GEOM_ICurvesOperations_i.cc +++ b/src/GEOM_I/GEOM_ICurvesOperations_i.cc @@ -397,7 +397,8 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineBezier */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolation - (const GEOM::ListOfGO& thePoints) + (const GEOM::ListOfGO& thePoints, + CORBA::Boolean theIsClosed) { GEOM::GEOM_Object_var aGEOMObject; @@ -416,7 +417,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolation // Make Polyline Handle(GEOM_Object) anObject = - GetOperations()->MakeSplineInterpolation(aPoints); + GetOperations()->MakeSplineInterpolation(aPoints, theIsClosed); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.hh b/src/GEOM_I/GEOM_ICurvesOperations_i.hh index 728f567e0..aa8982df0 100644 --- a/src/GEOM_I/GEOM_ICurvesOperations_i.hh +++ b/src/GEOM_I/GEOM_ICurvesOperations_i.hh @@ -79,7 +79,8 @@ class GEOM_I_EXPORT GEOM_ICurvesOperations_i : GEOM::GEOM_Object_ptr MakeSplineBezier (const GEOM::ListOfGO& thePoints); - GEOM::GEOM_Object_ptr MakeSplineInterpolation (const GEOM::ListOfGO& thePoints); + GEOM::GEOM_Object_ptr MakeSplineInterpolation (const GEOM::ListOfGO& thePoints, + CORBA::Boolean theIsClosed); GEOM::GEOM_Object_ptr MakeSketcher (const char* theCommand, const GEOM::ListOfDouble& theWorkingPlane); diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index 199f1e693..6c8dc843f 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -2679,14 +2679,15 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSplineBezier (GEOM::GEOM_List_ptr thePo //============================================================================= // MakeSplineInterpolation: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSplineInterpolation (GEOM::GEOM_List_ptr thePoints) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSplineInterpolation (GEOM::GEOM_List_ptr thePoints, + CORBA::Boolean theIsClosed) { beginService( " GEOM_Superv_i::MakeSplineInterpolation" ); MESSAGE("GEOM_Superv_i::MakeSplineInterpolation"); if (GEOM_List_i* aListImplP = dynamic_cast*>(GetServant(thePoints, myPOA).in())) { getCurvesOp(); - GEOM::GEOM_Object_ptr anObj = myCurvesOp->MakeSplineInterpolation(aListImplP->GetList()); + GEOM::GEOM_Object_ptr anObj = myCurvesOp->MakeSplineInterpolation(aListImplP->GetList(), theIsClosed); endService( " GEOM_Superv_i::MakeSplineInterpolation" ); return anObj; } diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index 4ac9969b6..5198fa024 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -584,7 +584,8 @@ public: GEOM::GEOM_Object_ptr thePnt3); GEOM::GEOM_Object_ptr MakePolyline (GEOM::GEOM_List_ptr thePoints); GEOM::GEOM_Object_ptr MakeSplineBezier (GEOM::GEOM_List_ptr thePoints); - GEOM::GEOM_Object_ptr MakeSplineInterpolation (GEOM::GEOM_List_ptr thePoints); + GEOM::GEOM_Object_ptr MakeSplineInterpolation (GEOM::GEOM_List_ptr thePoints, + CORBA::Boolean theIsClosed); GEOM::GEOM_Object_ptr MakeSketcher (const char* theCommand, GEOM::GEOM_List_ptr theWorkingPlane); GEOM::GEOM_Object_ptr Make3DSketcher (GEOM::GEOM_List_ptr theCoordinates); diff --git a/src/GEOM_SWIG/GEOM_TestAll.py b/src/GEOM_SWIG/GEOM_TestAll.py index a278b54a9..0d6ff0bd6 100644 --- a/src/GEOM_SWIG/GEOM_TestAll.py +++ b/src/GEOM_SWIG/GEOM_TestAll.py @@ -102,7 +102,7 @@ def TestAll (geompy, math): Ellipse = geompy.MakeEllipse(p0, vy, radius2, radius1) #(2 GEOM_Object_ptr, 2 Doubles)->GEOM_Object_ptr Polyline = geompy.MakePolyline([p0, pz, py, p200]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr Bezier = geompy.MakeBezier([p0, pz, p200, px]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr - Interpol = geompy.MakeInterpol([px, py, p200, pxyz]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr + Interpol = geompy.MakeInterpol([px, py, p200, pxyz], True) #(List of GEOM_Object_ptr,Boolean)->GEOM_Object_ptr Sketcher = geompy.MakeSketcher("Sketcher:F -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WW", [100,0,0, 1,1,1, -1,1,0]) #(String, List of Doubles)->GEOM_Object_ptr Sketcher3d = geompy.Make3DSketcher([0,0,0, 50,50,50, 0,50,50, 10,0,0]) @@ -121,7 +121,7 @@ def TestAll (geompy, math): tan_vertex_2 = geompy.MakeVertex(0, 90, 30) tan_vertex_3 = geompy.MakeVertex(100, 90, 0) tan_vertex_4 = geompy.MakeVertex(-100, 90, 0) - tan_curve = geompy.MakeInterpol([tan_vertex_4, tan_vertex_2, tan_vertex_3, tan_vertex_1]) + tan_curve = geompy.MakeInterpol([tan_vertex_4, tan_vertex_2, tan_vertex_3, tan_vertex_1], False) tan_extrusion = geompy.MakePrismDXDYDZ(tan_curve, 0, 30, -60) tan_on_face = geompy.MakeTangentPlaneOnFace(tan_extrusion, 0.7, 0.5, 150) diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 879b02292..154d15457 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -747,12 +747,13 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## Create B-Spline curve on the set of points. # @param thePoints Sequence of points for the B-Spline curve. + # @param theIsClosed If True, build a closed curve. # @return New GEOM_Object, containing the created B-Spline curve. # # @ref tui_creation_curve "Example" - def MakeInterpol(self,thePoints): + def MakeInterpol(self, thePoints, theIsClosed=False): # Example: see GEOM_TestAll.py - anObj = self.CurvesOp.MakeSplineInterpolation(thePoints) + anObj = self.CurvesOp.MakeSplineInterpolation(thePoints, theIsClosed) RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp) return anObj