mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-25 05:40:34 +05:00
IMP 0020308: EDF 995 GEOM : Closed Polyline with tangence.
This commit is contained in:
parent
6a891e2286
commit
522b8bee22
@ -15,9 +15,10 @@ possible types of curves: Polyline, Besier or B-spline (Interpolated).
|
||||
<ul>
|
||||
<li><em>geompy.MakePolyline(ListOfShapes)</em></li>
|
||||
<li><em>geompy.MakeBezier(ListOfShapes)</em></li>
|
||||
<li><em>geompy.MakeInterpol(ListOfShapes)</em></li>
|
||||
<li><em>geompy.MakeInterpol(ListOfShapes,isClosed)</em></li>
|
||||
</ul>
|
||||
ListOfShape is a list of points through which the curve passes.
|
||||
If isClosed is True, MakeInterpol builds a closed edge.
|
||||
|
||||
<b>Arguments:</b> Name + at least 2 points which will serve as nodes
|
||||
on the curve.
|
||||
@ -38,4 +39,4 @@ on the curve.
|
||||
Our <b>TUI Scripts</b> provide you with useful examples of creation of
|
||||
\ref tui_creation_curve "Basic Geometric Objects".
|
||||
|
||||
*/
|
||||
*/
|
||||
|
@ -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")
|
||||
|
@ -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,
|
||||
|
@ -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) ;
|
||||
|
||||
|
@ -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 <DlgRef.h>
|
||||
@ -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<GEOM::GEOM_Object_var>& thePoints,
|
||||
GEOM::GEOM_Object_var& theObject )
|
||||
GEOM::GEOM_Object_var& theObject )
|
||||
{
|
||||
int len = thePoints.size();
|
||||
|
||||
|
||||
if ( len < 1 ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
for ( std::list<GEOM::GEOM_Object_var>::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<GEOM::GEOM_Object_var>& thePoints,
|
||||
*/
|
||||
//=================================================================================
|
||||
static void removeUnnecessaryPnt( std::list<GEOM::GEOM_Object_var>& theOldPoints,
|
||||
GEOM::ListOfGO_var& theNewPoints )
|
||||
GEOM::ListOfGO_var& theNewPoints )
|
||||
{
|
||||
std::list<GEOM::GEOM_Object_var> objs_to_remove;
|
||||
for ( std::list<GEOM::GEOM_Object_var>::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<GEOM::GEOM_Object_var>::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<GEOM::GEOM_Object_var>::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;
|
||||
}
|
||||
|
@ -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 <list>
|
||||
|
||||
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<GEOM::GEOM_Object_var> 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();
|
||||
};
|
||||
|
@ -3844,6 +3844,13 @@ Please, select face, shell or solid and try again</translation>
|
||||
<translation>Length unit in the file is not a 'meter'. Do you want to scale a model?</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BasicGUI_CurveDlg</name>
|
||||
<message>
|
||||
<source>GEOM_IS_CLOSED</source>
|
||||
<translation>Build a closed edge</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BasicGUI_EllipseDlg</name>
|
||||
<message>
|
||||
|
@ -664,7 +664,8 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineBezier
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation
|
||||
(list<Handle(GEOM_Object)> thePoints)
|
||||
(list<Handle(GEOM_Object)> 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
|
||||
|
@ -68,7 +68,8 @@ class GEOMImpl_ICurvesOperations : public GEOM_IOperations {
|
||||
Handle(GEOM_Object) thePnt3);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeSplineBezier (list<Handle(GEOM_Object)> thePoints);
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeSplineInterpolation (list<Handle(GEOM_Object)> thePoints);
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeSplineInterpolation (list<Handle(GEOM_Object)> thePoints,
|
||||
bool theIsClosed = false);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeSketcher (const char* theCommand,
|
||||
list<double> theWorkingPlane);
|
||||
|
@ -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:
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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<GEOM::ListOfGO>* aListImplP =
|
||||
dynamic_cast<GEOM_List_i<GEOM::ListOfGO>*>(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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user