To create a <b> Smoothing Surface</b> in the <b>Main Menu</b> select <b>New Entity - >
Advanced - > SmoothingSurface </b>
-Specify the \b Name of the surface and the list of \b Points, from which it is approximated and press "Apply" or "Apply & Close" button.
+To create a surface it is necessary to specify the \b Name of the surface, the list of \b Points
+from which it is approximated and some plate approximation parameters such as: <b>Max nbr of
+Bezier pieces</b>, <b>Max BSpline surface degree</b> and <b>Max plate criterion value</b>.
+And then press "Apply" or "Apply & Close" button.
\note The dialog accepts compounds of points as well as single nodes.
The result of the operation will be a GEOM_Object(Surface).
-<b>TUI Command:</b> <em>geompy.MakeSmoothingSurface(Points)</em>
+<b>TUI Command:</b> <em>geompy.MakeSmoothingSurface(thelPoints, theNbMax, theDegMax, theDMax)</em>, where:
+- \em thelPoints list of points. Compounds of points are accepted as well
+- \em theNbMax maximum number of Bezier pieces in the resulting surface
+- \em theDegMax maximum degree of the resulting BSpline surface
+- \em theDMax specifies maximum value of the GeomPlate_PlateG0Criterion criterion
\image html smoothingsurface_dlg.png
/*!
*
* Create a smoothing surface from a set of points
- * \param thelPoints list of points
+ * \param thelPoints list of points. Compounds of points are accepted as well.
+ * \param theNbMax maximum number of Bezier pieces in the resulting surface.
+ * \param theDegMax maximum degree of the resulting BSpline surface
+ * \param theDMax specifies maximum value of the GeomPlate_PlateG0Criterion criterion.
* \return New GEOM_Object, containing the created shape.
*/
- GEOM_Object MakeSmoothingSurface (in ListOfGO thelPoints);
+ GEOM_Object MakeSmoothingSurface (in ListOfGO thelPoints,
+ in long theNbMax,
+ in long theDegMax,
+ in double theDMax);
/*@@ insert new functions before this line @@ do not remove this line @@*/
};
/*!
* Create a smoothing surface from a set of points
* \param thelPoints list of points or compounds of points
+ * \param theNbMax maximum number of Bezier pieces in the resulting surface.
+ * \param theDegMax maximum degree of the resulting BSpline surface
+ * \param theDMax specifies maximum value of the GeomPlate_PlateG0Criterion criterion.
* \return New GEOM_Object, containing the created shape.
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeSmoothingSurface (std::list<Handle(GEOM_Object)> thelPoints)
+Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeSmoothingSurface (std::list<Handle(GEOM_Object)> thelPoints,
+ int theNbMax,
+ int theDegMax,
+ double theDMax)
{
SetErrorCode(KO);
aData.SetPntOrComp(ind, aRefObj);
}
+ aData.SetNbMax(theNbMax);
+ aData.SetDegMax(theDegMax);
+ aData.SetDMax(theDMax);
//Compute the resulting value
try {
while (it != thelPoints.end()) {
pd << ", " << (*it++);
}
- pd << "])";
+ pd << "], "
+ << theNbMax << ", "
+ << theDegMax << ", "
+ << theDMax <<")";
SetErrorCode(OK);
double theH,
int thePattern);
- Standard_EXPORT Handle(GEOM_Object) MakeSmoothingSurface (std::list<Handle(GEOM_Object)> thelPoints);
+ Standard_EXPORT Handle(GEOM_Object) MakeSmoothingSurface (std::list<Handle(GEOM_Object)> thelPoints,
+ int theNbMax,
+ int theDegMax,
+ double theDMax);
/*@@ insert new functions before this line @@ do not remove this line @@*/
};
#endif
#define SMOOTHINGSURFACE_ARG_LENG 1
#define SMOOTHINGSURFACE_ARG_LAST 2
+#define SMOOTHINGSURFACE_ARG_NB_MAX 3
+#define SMOOTHINGSURFACE_ARG_DEG_MAX 4
+#define SMOOTHINGSURFACE_ARG_D_MAX 5
class GEOMImpl_ISmoothingSurface
{
void SetPntOrComp(int theId, Handle(GEOM_Function) theP) { _func->SetReference(SMOOTHINGSURFACE_ARG_LAST + theId, theP); }
Handle(GEOM_Function) GetPntOrComp(int theId) { return _func->GetReference(SMOOTHINGSURFACE_ARG_LAST + theId); }
+ void SetNbMax(int theNbMax) { _func->SetInteger(SMOOTHINGSURFACE_ARG_NB_MAX, theNbMax); }
+ int GetNbMax() { return _func->GetInteger(SMOOTHINGSURFACE_ARG_NB_MAX); }
+
+ void SetDegMax(int theDegMax) { _func->SetInteger(SMOOTHINGSURFACE_ARG_DEG_MAX, theDegMax); }
+ int GetDegMax() { return _func->GetInteger(SMOOTHINGSURFACE_ARG_DEG_MAX); }
+
+ void SetDMax(double theDMax) { _func->SetReal(SMOOTHINGSURFACE_ARG_D_MAX, theDMax); }
+ double GetDMax() { return _func->GetReal(SMOOTHINGSURFACE_ARG_D_MAX); }
+
private:
Handle(GEOM_Function) _func;
};
//function : MakeSmoothingSurfaceUnClosed
//purpose :
//=======================================================================
-TopoDS_Shape GEOMImpl_SmoothingSurfaceDriver::MakeSmoothingSurfaceUnClosed(Handle_TColgp_HArray1OfPnt myListOfPoints) const
+TopoDS_Shape GEOMImpl_SmoothingSurfaceDriver::MakeSmoothingSurfaceUnClosed
+ (const Handle_TColgp_HArray1OfPnt &theListOfPoints,
+ const Standard_Integer theNbMax,
+ const Standard_Integer theDegMax,
+ const Standard_Real theDMax) const
{
TopoDS_Face aInitShape;
// Create an average Plane
- //Handle(TColgp_HArray1OfPnt) HAP = new TColgp_HArray1OfPnt(1,myListOfPoints.Length())
- GeomPlate_BuildAveragePlane gpbap(myListOfPoints,myListOfPoints->Length(),Precision::Confusion(),1,1);
+ //Handle(TColgp_HArray1OfPnt) HAP = new TColgp_HArray1OfPnt(1,theListOfPoints.Length())
+ GeomPlate_BuildAveragePlane gpbap(theListOfPoints,theListOfPoints->Length(),Precision::Confusion(),1,1);
Handle(Geom_Plane) plane(gpbap.Plane());
Standard_Real Umin, Umax, Vmin, Vmax;
gpbap.MinMaxBox(Umin,Umax,Vmin,Vmax);
Standard_Integer j, j1, j2;
// cout << "Init surface" << endl;
- j1 = myListOfPoints->Lower();
- j2 = myListOfPoints->Upper();
+ j1 = theListOfPoints->Lower();
+ j2 = theListOfPoints->Upper();
for (j=j1; j<=j2 ; j++)
{
- gp_Pnt aPnt = myListOfPoints->Value(j);
+ gp_Pnt aPnt = theListOfPoints->Value(j);
Handle(GeomPlate_PointConstraint) PCont = new GeomPlate_PointConstraint(aPnt,0);
aBuilder.Add(PCont);
}
// A ce niveau : surface algo
Handle(GeomPlate_Surface) gpPlate = aBuilder.Surface();
- Standard_Integer nbcarreau=2;
- Standard_Integer degmax=8;
- Standard_Real seuil;
- seuil = Max(0.0001,10*aBuilder.G0Error());
+ Standard_Integer nbcarreau = (theNbMax > 0 ? theNbMax : 2);
+ Standard_Integer degmax = (theDegMax > 0 ? theDegMax : 8);
+ Standard_Real seuil = theDMax;
+
+ if (seuil <= 0.) {
+ seuil = Max(0.0001,10*aBuilder.G0Error());
+ }
+
GeomPlate_MakeApprox Mapp(gpPlate,0.0001,nbcarreau,degmax,seuil);
// cout << "Approx surface" << endl;
anArrayofPnt->SetValue(i, aPnt);
}
+ const Standard_Integer aNbMax = aData.GetNbMax();
+ const Standard_Integer aDegMax = aData.GetDegMax();
+ const Standard_Real aDMax = aData.GetDMax();
+
// Make smoothing surface.
- TopoDS_Shape aShape =
- GEOMImpl_SmoothingSurfaceDriver::MakeSmoothingSurfaceUnClosed(anArrayofPnt);
+ TopoDS_Shape aShape = GEOMImpl_SmoothingSurfaceDriver::
+ MakeSmoothingSurfaceUnClosed(anArrayofPnt, aNbMax, aDegMax, aDMax);
if (aShape.IsNull()) return 0;
switch ( aType ) {
case SMOOTHINGSURFACE_LPOINTS:
- AddParam( theParams, "Points" );
- if ( aCI.GetLength() > 1 )
- theParams[0] << aCI.GetLength() << " points: ";
- for ( int i = 1, nb = aCI.GetLength(); i <= nb; ++i )
- theParams[0] << aCI.GetPntOrComp( i ) << " ";
+ {
+ AddParam( theParams, "Points" );
+ if ( aCI.GetLength() > 1 )
+ theParams[0] << aCI.GetLength() << " points: ";
+ for ( int i = 1, nb = aCI.GetLength(); i <= nb; ++i )
+ theParams[0] << aCI.GetPntOrComp( i ) << " ";
+
+ const Standard_Integer aNbMax = aCI.GetNbMax();
+ const Standard_Integer aDegMax = aCI.GetDegMax();
+ const Standard_Real aDMax = aCI.GetDMax();
+
+ AddParam(theParams, "Max nbr of Bezier pieces", aCI.GetNbMax());
+ AddParam(theParams, "Max BSpline surface degree", aCI.GetDegMax());
+ AddParam(theParams, "Max plate criterion value", aCI.GetDMax());
+ }
break;
default:
return false;
DEFINE_STANDARD_RTTI( GEOMImpl_SmoothingSurfaceDriver )
private:
- TopoDS_Shape MakeSmoothingSurfaceUnClosed(Handle_TColgp_HArray1OfPnt myListOfPoints) const;
+ TopoDS_Shape MakeSmoothingSurfaceUnClosed
+ (const Handle_TColgp_HArray1OfPnt &theListOfPoints,
+ const Standard_Integer theNbMax,
+ const Standard_Integer theDegMax,
+ const Standard_Real theDMax) const;
};
#endif // _GEOMImpl_SmoothingSurfaceDriver_HXX
/*!
*
* \param thelPoints list of points
+ * \param theNbMax maximum number of Bezier pieces in the resulting surface.
+ * \param theDegMax maximum degree of the resulting BSpline surface
+ * \param theDMax specifies maximum value of the GeomPlate_PlateG0Criterion criterion.
* \return New GEOM_Object, containing the created shape.
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeSmoothingSurface (const GEOM::ListOfGO& thelPoints)
+GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeSmoothingSurface (const GEOM::ListOfGO& thelPoints,
+ CORBA::Long theNbMax,
+ CORBA::Long theDegMax,
+ CORBA::Double theDMax)
{
GEOM::GEOM_Object_var aGEOMObject;
aPoints.push_back(aPnt);
}
//Create the SmoothingSurface
- Handle(GEOM_Object) anObject = GetOperations()->MakeSmoothingSurface(aPoints);
+ Handle(GEOM_Object) anObject = GetOperations()->MakeSmoothingSurface
+ (aPoints, theNbMax, theDegMax, theDMax);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
GEOM::GEOM_Object_ptr MakeDividedCylinder (CORBA::Double theR,
CORBA::Double theH,
GEOM::pattern thePattern);
- GEOM::GEOM_Object_ptr MakeSmoothingSurface (const GEOM::ListOfGO& thelPoints);
+ GEOM::GEOM_Object_ptr MakeSmoothingSurface (const GEOM::ListOfGO& thelPoints,
+ CORBA::Long theNbMax,
+ CORBA::Long theDegMax,
+ CORBA::Double theDMax);
/*@@ insert new functions before this line @@ do not remove this line @@*/
::GEOMImpl_IAdvancedOperations* GetOperations()
// Constructor
//=================================================================================
AdvancedGUI_SmoothingSurfaceDlg::AdvancedGUI_SmoothingSurfaceDlg (GeometryGUI* theGeometryGUI, QWidget* parent)
- : GEOMBase_Skeleton(theGeometryGUI, parent, false)
+ : GEOMBase_Skeleton(theGeometryGUI, parent, false),
+ myNbMaxSpin(0),
+ myDegMaxSpin(0),
+ myDMaxSpin(0)
{
QPixmap imageOp (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_SMOOTHINGSURFACE_LPOINTS")));
QPixmap imageSel (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true );
+ QLabel *aNbMax = new QLabel(tr("GEOM_SMOOTHINGSURFACE_ARG_NB_MAX"));
+ QLabel *aDegMax = new QLabel(tr("GEOM_SMOOTHINGSURFACE_ARG_DEG_MAX"));
+ QLabel *aDMax = new QLabel(tr("GEOM_SMOOTHINGSURFACE_ARG_D_MAX"));
+
+ myNbMaxSpin = new SalomeApp_IntSpinBox(0, 1000, 1, 0, true, true);
+ myDegMaxSpin = new SalomeApp_IntSpinBox(0, 1000, 1, 0, true, true);
+ myDMaxSpin = new SalomeApp_DoubleSpinBox;
+ GroupPoints->gridLayout1->addWidget(aNbMax, 1, 0);
+ GroupPoints->gridLayout1->addWidget(aDegMax, 2, 0);
+ GroupPoints->gridLayout1->addWidget(aDMax, 3, 0);
+ GroupPoints->gridLayout1->addWidget(myNbMaxSpin, 1, 1, 1, 2);
+ GroupPoints->gridLayout1->addWidget(myDegMaxSpin, 2, 1, 1, 2);
+ GroupPoints->gridLayout1->addWidget(myDMaxSpin, 3, 1, 1, 2);
+
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(GroupPoints);
{
// Get setting of step value from file configuration
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
+
+ initSpinBox(myDMaxSpin, 0., COORD_MAX, 0.00001, "parametric_precision" );
+
+ myNbMaxSpin->setValue(2);
+ myDegMaxSpin->setValue(8);
+ myDMaxSpin->setValue(0.);
//@@ initialize dialog box widgets here @@//
this, SLOT(SetDoubleSpinBoxStep(double)));
connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
-
+ connect(myNbMaxSpin, SIGNAL(valueChanged(const QString&)),
+ this, SLOT(processPreview()) );
+ connect(myDegMaxSpin, SIGNAL(valueChanged(const QString&)),
+ this, SLOT(processPreview()) );
+ connect(myDMaxSpin, SIGNAL(valueChanged(const QString&)),
+ this, SLOT(processPreview()) );
+
initName(tr("GEOM_SMOOTHINGSURFACE"));
//displayPreview();
}
//=================================================================================
bool AdvancedGUI_SmoothingSurfaceDlg::isValid (QString& msg)
{
- bool ok = true;
+ if (myPoints.empty()) {
+ msg += tr("GEOM_SMOOTHINGSURFACE_NO_POINTS");
+ return false;
+ }
- //@@ add custom validation actions here @@//
+ bool ok = myNbMaxSpin->isValid (msg, !IsPreview()) &&
+ myDegMaxSpin->isValid(msg, !IsPreview()) &&
+ myDMaxSpin->isValid (msg, !IsPreview());
return ok;
}
for ( int i = 0; i < myPoints.count(); i++ )
points[i] = myPoints[i].copy();
+ const int aNbMax = myNbMaxSpin->value();
+ const int aDegMax = myDegMaxSpin->value();
+ const double aDMax = myDMaxSpin->value();
// call engine function
- anObj = anOper->MakeSmoothingSurface(points);
+ anObj = anOper->MakeSmoothingSurface(points, aNbMax, aDegMax, aDMax);
res = !anObj->_is_nil();
if (res && !IsPreview())
{
#include <list>
class DlgRef_1Sel;
+class SalomeApp_IntSpinBox;
//=================================================================================
// class : AdvancedGUI_SmoothingSurfaceDlg
private:
DlgRef_1Sel* GroupPoints;
QList<GEOM::GeomObjPtr> myPoints;
+ SalomeApp_IntSpinBox *myNbMaxSpin;
+ SalomeApp_IntSpinBox *myDegMaxSpin;
+ SalomeApp_DoubleSpinBox *myDMaxSpin;
private slots:
void ClickOnOk();
</message>
<message>
<source>GEOM_SMOOTHINGSURFACE_ARG</source>
- <translation>Nodes</translation>
+ <translation>Arguments</translation>
</message>
<message>
<source>GEOM_SMOOTHINGSURFACE_ARG_POINTS</source>
<translation>Points</translation>
</message>
+ <message>
+ <source>GEOM_SMOOTHINGSURFACE_ARG_NB_MAX</source>
+ <translation>Max nbr of Bezier pieces</translation>
+ </message>
+ <message>
+ <source>GEOM_SMOOTHINGSURFACE_ARG_DEG_MAX</source>
+ <translation>Max BSpline surface degree</translation>
+ </message>
+ <message>
+ <source>GEOM_SMOOTHINGSURFACE_ARG_D_MAX</source>
+ <translation>Max plate criterion value</translation>
+ </message>
+ <message>
+ <source>GEOM_SMOOTHINGSURFACE_NO_POINTS</source>
+ <translation>No points selected</translation>
+ </message>
</context>
</TS>
if (GEOM_List_i<GEOM::ListOfGO>* aListImplP =
dynamic_cast<GEOM_List_i<GEOM::ListOfGO>*>(GetServant(thelPoints, myPOA).in())) {
getCurvesOp();
- GEOM::GEOM_Object_ptr anObj = myAdvancedOp->MakeSmoothingSurface(aListImplP->GetList());
+ GEOM::GEOM_Object_ptr anObj = myAdvancedOp->MakeSmoothingSurface(aListImplP->GetList(), 2, 8, 0.);
endService( " GEOM_Superv_i::MakeSmoothingSurface" );
return anObj;
}
## Create a surface from a cloud of points
# @param thelPoints list of points. Compounds of points are
# accepted as well.
+ # @param theNbMax maximum number of Bezier pieces in the resulting
+ # surface.
+ # @param theDegMax maximum degree of the resulting BSpline surface.
+ # @param theDMax specifies maximum value of the
+ # GeomPlate_PlateG0Criterion criterion.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
# @return New GEOM_Object, containing the created shape.
#
# @ref tui_creation_smoothingsurface "Example"
- def MakeSmoothingSurface(self, thelPoints):
- anObj = self.AdvOp.MakeSmoothingSurface(thelPoints)
+ def MakeSmoothingSurface(self, thelPoints, theNbMax=2, theDegMax=8,
+ theDMax=0.0, theName=None):
+ """
+ Create a surface from a cloud of points
+
+ Parameters:
+ thelPoints list of points. Compounds of points are
+ accepted as well.
+ theNbMax maximum number of Bezier pieces in the resulting
+ surface.
+ theDegMax maximum degree of the resulting BSpline surface.
+ theDMax specifies maximum value of the
+ GeomPlate_PlateG0Criterion criterion.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM_Object, containing the created shape.
+ """
+ anObj = self.AdvOp.MakeSmoothingSurface
+ (thelPoints, theNbMax, theDegMax, theDMax)
RaiseIfFailed("MakeSmoothingSurface", self.AdvOp)
+ self._autoPublish(anObj, theName, "smoothing")
return anObj
## Export a shape to XAO format