Iterations</b> - defines the maximum number of iterations. The
iterations are repeated until the required tolerance is reached. So, a
greater number of iterations allows producing a better surface.
-\n <b>Use orientation</b> - if checked, orientation of edges are used:
-if edge is reversed curve from this edge is reversed before using in
-filling algorithm.
+\n <b>Method</b> - Kind of method to perform filling operation
+1. Default - standard behaviour
+2. Use edges orientation - orientation of edges are used: if edge is
+reversed curve from this edge is reversed before using in filling
+algorithm.
+3. Auto-correct edges orientation - change orientation of curves using
+minimization of sum of distances between ends points of edges.
\n <b>Approximation</b> - if checked, BSpline curves are generated in
the process of surface construction (using
GeomAPI_PointsToBSplineSurface functionality). By default the surface
FSM_GetInPlaceByHistory
};
+ /*!
+ * Kind of method to perform filling operation
+ * Is used in functions GEOM_Gen.MakeFilling<xxx>()
+ */
+ enum filling_oper_method
+ {
+ /*! Default (standard behaviour) */
+ FOM_Default,
+
+ /*! Use edges orientation */
+ FOM_UseOri,
+
+ /*! Auto-correct edges orientation */
+ FOM_AutoCorrect
+ };
+
typedef sequence<string> string_array;
typedef sequence<short> short_array;
* \param theTol2D a 2d tolerance to be reached
* \param theTol3D a 3d tolerance to be reached
* \param theNbIter a number of iteration of approximation algorithm
+ * \param theMethod Kind of method to perform filling operation.
* \return New GEOM_Object, containing the created filling surface.
*/
GEOM_Object MakeFilling (in GEOM_Object theShape,
in long theMinDeg, in long theMaxDeg,
in double theTol2D, in double theTol3D,
- in long theNbIter, in boolean theUseOri,
+ in long theNbIter,
+ in filling_oper_method theMethod,
in boolean theApprox);
/*!
GEOM_Object MakeFilling (in GEOM_Object theShape,
in long theMinDeg, in long theMaxDeg,
in double theTol2D, in double theTol3D,
- in long theNbIter, in boolean theUseOri,
+ in long theNbIter,
+ in filling_oper_method theMethod,
in boolean theApprox) ;
GEOM_Object MakeThruSections(in ListOfGO theSeqSections,
in boolean theModeSolid,
<x>0</x>
<y>0</y>
<width>200</width>
- <height>153</height>
+ <height>162</height>
</rect>
</property>
<property name="windowTitle">
<string/>
</property>
- <layout class="QGridLayout">
+ <layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>0</number>
</property>
</item>
</layout>
</item>
- <item row="1" column="0" colspan="2">
- <widget class="QCheckBox" name="CheckBox2">
+ <item row="1" column="0">
+ <widget class="QLabel" name="TextLabel7">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="text">
- <string/>
+ <string>TL7</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
</property>
</widget>
</item>
+ <item row="1" column="1">
+ <widget class="QComboBox" name="ComboBox1"/>
+ </item>
<item row="2" column="0" colspan="2">
<layout class="QGridLayout">
<item row="0" column="0">
<tabstops>
<tabstop>PushButton1</tabstop>
<tabstop>LineEdit1</tabstop>
- <tabstop>CheckBox2</tabstop>
+ <tabstop>ComboBox1</tabstop>
<tabstop>SpinBox1</tabstop>
<tabstop>SpinBox2</tabstop>
<tabstop>SpinBox4</tabstop>
<source>GEOM_FILLING_APPROX</source>
<translation>Approximation</translation>
</message>
+ <message>
+ <source>GEOM_FILLING_METHOD</source>
+ <translation>Method</translation>
+ </message>
+ <message>
+ <source>GEOM_FILLING_DEFAULT</source>
+ <translation>Default (standard behaviour)</translation>
+ </message>
<message>
<source>GEOM_FILLING_USEORI</source>
- <translation>Use orientation</translation>
+ <translation>Use edges orientation</translation>
+ </message>
+ <message>
+ <source>GEOM_FILLING_AUTO</source>
+ <translation>Auto-correct edges orientation</translation>
</message>
<message>
<source>GEOM_WRN_NO_APPROPRIATE_SELECTION</source>
Standard_Real tol2d = IF.GetTol3D();
Standard_Integer nbiter = IF.GetNbIter();
Standard_Boolean isApprox = IF.GetApprox();
- Standard_Boolean isUseOri = IF.GetUseOri();
+ Standard_Integer aMethod = IF.GetMethod();
if (mindeg > maxdeg) {
Standard_RangeError::Raise("Minimal degree can not be more than maximal degree");
// make filling as in old version of SALOME (before 4.1.1)
GeomFill_SectionGenerator Section;
Standard_Integer i = 0;
+ Handle(Geom_Curve) aLastC;
+ gp_Pnt PL1,PL2;
for (Ex.Init(aShape, TopAbs_EDGE); Ex.More(); Ex.Next()) {
Scurrent = Ex.Current();
if (Scurrent.IsNull() || Scurrent.ShapeType() != TopAbs_EDGE) return 0;
//else
// C = new Geom_TrimmedCurve(C, First, Last);
C = new Geom_TrimmedCurve(C, First, Last);
- if( isUseOri && Scurrent.Orientation() == TopAbs_REVERSED ) {
+ gp_Pnt P1,P2;
+ C->D0(First,P1);
+ C->D0(Last,P2);
+
+ if( aMethod==1 && Scurrent.Orientation() == TopAbs_REVERSED ) {
C->Reverse();
}
+ else if( aMethod==2 ) {
+ if( i==0 ) {
+ PL1 = P1;
+ PL2 = P2;
+ }
+ else {
+ double d1 = PL1.Distance(P1) + PL2.Distance(P2);
+ double d2 = PL1.Distance(P2) + PL2.Distance(P1);
+ if(d2<d1) {
+ C->Reverse();
+ PL1 = P2;
+ PL2 = P1;
+ }
+ else {
+ PL1 = P1;
+ PL2 = P2;
+ }
+ }
+ }
+
Section.AddCurve(C);
i++;
}
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling
(Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg,
double theTol2D, double theTol3D, int theNbIter,
- bool isUseOri, bool isApprox)
+ int theMethod, bool isApprox)
{
SetErrorCode(KO);
aFI.SetTol3D(theTol3D);
aFI.SetNbIter(theNbIter);
aFI.SetApprox(isApprox);
- aFI.SetUseOri(isUseOri);
+ aFI.SetMethod(theMethod);
//Compute the Solid value
try {
Standard_EXPORT Handle(GEOM_Object) MakeFilling (Handle(GEOM_Object) theShape,
int theMinDeg, int theMaxDeg,
double theTol2D, double theTol3D,
- int theNbIter, bool isUseOri,
+ int theNbIter, int theMethod,
bool isApprox);
Standard_EXPORT Handle(GEOM_Object) MakeThruSections
#define FILL_ARG_SHAPE 5
#define FILL_ARG_NBITER 6
#define FILL_ARG_APPROX 7
-#define FILL_ARG_USEORI 8
+#define FILL_ARG_METHOD 8
class GEOMImpl_IFilling
{
void SetApprox(bool theApprox) { _func->SetInteger(FILL_ARG_APPROX, theApprox); }
bool GetApprox() { return _func->GetInteger(FILL_ARG_APPROX); }
- void SetUseOri(bool theUseOri) { _func->SetInteger(FILL_ARG_USEORI, theUseOri); }
- bool GetUseOri() { return _func->GetInteger(FILL_ARG_USEORI); }
+ void SetMethod(int theMethod) { _func->SetInteger(FILL_ARG_METHOD, theMethod); }
+ int GetMethod() { return _func->GetInteger(FILL_ARG_METHOD); }
void SetShape(Handle(GEOM_Function) theShape) { _func->SetReference(FILL_ARG_SHAPE, theShape); }
Handle(GEOM_Function) GetShape() { return _func->GetReference(FILL_ARG_SHAPE); }
* MakeFilling
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
- CORBA::Long theMinDeg,
- CORBA::Long theMaxDeg,
- CORBA::Double theTol2D,
- CORBA::Double theTol3D,
- CORBA::Long theNbIter,
- CORBA::Boolean theUseOri,
- CORBA::Boolean theApprox)
+GEOM::GEOM_Object_ptr
+GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
+ CORBA::Long theMinDeg,
+ CORBA::Long theMaxDeg,
+ CORBA::Double theTol2D,
+ CORBA::Double theTol3D,
+ CORBA::Long theNbIter,
+ GEOM::filling_oper_method theMethod,
+ CORBA::Boolean theApprox)
{
GEOM::GEOM_Object_var aGEOMObject;
if (aShape.IsNull()) return aGEOMObject._retn();
+ int aMethod = 0;
+ switch (theMethod) {
+ case GEOM::FOM_Default:
+ {
+ // Default (standard behaviour)
+ aMethod = 0;
+ }
+ break;
+ case GEOM::FOM_UseOri:
+ {
+ // Use edges orientation
+ aMethod = 1;
+ }
+ break;
+ case GEOM::FOM_AutoCorrect:
+ {
+ // Auto-correct edges orientation
+ aMethod = 2;
+ }
+ break;
+ default:
+ {}
+ }
+
//Create the Solid
Handle(GEOM_Object) anObject = GetOperations()->MakeFilling
(aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter,
- theUseOri, theApprox);
+ aMethod, theApprox);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
GEOM::GEOM_Object_ptr MakeFilling(GEOM::GEOM_Object_ptr theShape,
CORBA::Long theMinDeg, CORBA::Long theMaxDeg,
CORBA::Double theTol2D, CORBA::Double theTol3D,
- CORBA::Long theNbIter, CORBA::Boolean theUseOri,
+ CORBA::Long theNbIter,
+ GEOM::filling_oper_method theMethod,
CORBA::Boolean theApprox);
GEOM::GEOM_Object_ptr MakeThruSections(const GEOM::ListOfGO& theSeqSections,
CORBA::Double theTol2D,
CORBA::Double theTol3D,
CORBA::Long theNbIter,
- CORBA::Boolean theUseOri,
+ GEOM::filling_oper_method theMethod,
CORBA::Boolean theApprox)
{
beginService( " GEOM_Superv_i::MakeFilling" );
get3DPrimOp();
GEOM::GEOM_Object_ptr anObj =
my3DPrimOp->MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D,
- theNbIter, theUseOri, theApprox);
+ theNbIter, theMethod, theApprox);
endService( " GEOM_Superv_i::MakeFilling" );
return anObj;
}
GEOM::GEOM_Object_ptr MakeFilling (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theMinDeg, CORBA::Long theMaxDeg,
CORBA::Double theTol2D, CORBA::Double theTol3D,
- CORBA::Long theNbIter, CORBA::Boolean theUseOri,
+ CORBA::Long theNbIter,
+ GEOM::filling_oper_method theMethod,
CORBA::Boolean theApprox);
GEOM::GEOM_Object_ptr MakeThruSections(const GEOM::ListOfGO& theSeqSections,
GroupPoints->TextLabel5->setText( tr( "GEOM_FILLING_MAX_DEG" ) );
GroupPoints->TextLabel6->setText( tr( "GEOM_FILLING_TOL_3D" ) );
GroupPoints->CheckBox1->setText( tr( "GEOM_FILLING_APPROX" ) );
- GroupPoints->CheckBox2->setText( tr( "GEOM_FILLING_USEORI" ) );
+ GroupPoints->TextLabel7->setText( tr( "GEOM_FILLING_METHOD" ) );
GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true );
myTol3D = 0.0001;
myTol2D = 0.0001;
myNbIter = 0;
- myIsUseOri = false;
+ myMethod = 0;
myIsApprox = false;
myOkCompound = false;
GroupPoints->SpinBox4->setValue( myMaxDeg );
GroupPoints->SpinBox5->setValue( myTol3D );
+ GroupPoints->ComboBox1->addItem(tr("GEOM_FILLING_DEFAULT"));
+ GroupPoints->ComboBox1->addItem(tr("GEOM_FILLING_USEORI"));
+ GroupPoints->ComboBox1->addItem(tr("GEOM_FILLING_AUTO"));
+
/* signals and slots connections */
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
+ connect( GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(MethodChanged()));
+
connect( GroupPoints->SpinBox1, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect( GroupPoints->SpinBox2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect( GroupPoints->SpinBox3, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect( GroupPoints->CheckBox1, SIGNAL( stateChanged( int ) ),
this, SLOT( ApproxChanged() ) );
- connect( GroupPoints->CheckBox2, SIGNAL( stateChanged( int ) ),
- this, SLOT( UseOriChanged() ) );
-
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
}
//=================================================================================
-// function : UseOriChanged()
+// function : MethodChanged
// purpose :
//=================================================================================
-void GenerationGUI_FillingDlg::UseOriChanged()
+void GenerationGUI_FillingDlg::MethodChanged()
{
- myIsUseOri = GroupPoints->CheckBox2->isChecked();
+ myMethod = GroupPoints->ComboBox1->currentIndex();
displayPreview();
}
{
GEOM::GEOM_I3DPrimOperations_var anOper =
GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
+
+ GEOM::filling_oper_method aMethod;
+ switch (GroupPoints->ComboBox1->currentIndex())
+ {
+ case 0: aMethod = GEOM::FOM_Default; break;
+ case 1: aMethod = GEOM::FOM_UseOri; break;
+ case 2: aMethod = GEOM::FOM_AutoCorrect; break;
+ default: break;
+ }
+
GEOM::GEOM_Object_var anObj =
anOper->MakeFilling( myCompound, myMinDeg, myMaxDeg, myTol2D, myTol3D,
- myNbIter, myIsUseOri, myIsApprox );
+ myNbIter, aMethod, myIsApprox );
if ( !anObj->_is_nil() )
{
if ( !IsPreview() )
Standard_Real myTol2D;
Standard_Integer myNbIter;
bool myIsApprox;
- bool myIsUseOri;
+ int myMethod;
bool myOkCompound; /* to check when curv. compound is defined */
DlgRef_1Sel5Spin1Check* GroupPoints;
void SelectionIntoArgument();
void SetEditCurrentArgument();
void ValueChangedInSpinBox( double );
- void UseOriChanged();
+ void MethodChanged();
void ApproxChanged();
void SetDoubleSpinBoxStep( double );
};