mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-27 23:30:34 +05:00
Mantis issue 0021541: EDF 2213 GEOM: Filling accuracy
This commit is contained in:
parent
f6d916275e
commit
12efffce9b
@ -18,7 +18,6 @@
|
||||
// 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 <Standard_Stream.hxx>
|
||||
|
||||
@ -98,14 +97,13 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const
|
||||
if (Label().IsNull()) return 0;
|
||||
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
|
||||
if (aFunction.IsNull()) return 0;
|
||||
|
||||
if (aFunction->GetType() != BASIC_FILLING) return 0;
|
||||
|
||||
GEOMImpl_IFilling IF (aFunction);
|
||||
Handle(GEOM_Function) aShapeFunction = IF.GetShape();
|
||||
if (aShapeFunction.IsNull()) return 0;
|
||||
TopoDS_Shape aShape;
|
||||
|
||||
TopoDS_Shape aShape;
|
||||
BRepBuilderAPI_Copy Copy (aShapeFunction->GetValue());
|
||||
if (Copy.IsDone())
|
||||
aShape = Copy.Shape();
|
||||
@ -114,11 +112,8 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const
|
||||
|
||||
Standard_Integer mindeg = IF.GetMinDeg();
|
||||
Standard_Integer maxdeg = IF.GetMaxDeg();
|
||||
Standard_Real tol3d = IF.GetTol2D();
|
||||
Standard_Real tol2d = IF.GetTol3D();
|
||||
Standard_Integer nbiter = IF.GetNbIter();
|
||||
Standard_Real tol3d = IF.GetTol3D();
|
||||
Standard_Boolean isApprox = IF.GetApprox();
|
||||
Standard_Integer aMethod = IF.GetMethod();
|
||||
|
||||
if (mindeg > maxdeg) {
|
||||
Standard_RangeError::Raise("Minimal degree can not be more than maximal degree");
|
||||
@ -134,6 +129,7 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const
|
||||
BRep_Builder B;
|
||||
B.MakeCompound(aComp);
|
||||
|
||||
// 1. Convert argument wires, if any, into BSpline edges
|
||||
TopoDS_Iterator It (aShape);
|
||||
for (; It.More(); It.Next()) {
|
||||
Scurrent = It.Value();
|
||||
@ -228,8 +224,14 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const
|
||||
}
|
||||
aShape = aComp;
|
||||
|
||||
// 2. The surface construction
|
||||
if (!isApprox) {
|
||||
// make filling as in old version of SALOME (before 4.1.1)
|
||||
|
||||
Standard_Real tol2d = IF.GetTol2D();
|
||||
Standard_Integer nbiter = IF.GetNbIter();
|
||||
Standard_Integer aMethod = IF.GetMethod();
|
||||
|
||||
GeomFill_SectionGenerator Section;
|
||||
Standard_Integer i = 0;
|
||||
Handle(Geom_Curve) aLastC;
|
||||
@ -301,8 +303,10 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const
|
||||
// implemented by skl 20.03.2008 for bug 16568
|
||||
// make approximation - try to create bspline surface
|
||||
// using GeomAPI_PointsToBSplineSurface
|
||||
|
||||
TColGeom_SequenceOfCurve aSeq;
|
||||
int MaxNbPoles = 0;
|
||||
|
||||
// add curves from edges to sequence and find maximal
|
||||
// number of poles if some of them are bsplines
|
||||
for (Ex.Init(aShape, TopAbs_EDGE); Ex.More(); Ex.Next()) {
|
||||
@ -337,7 +341,10 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const
|
||||
// value must be between 21(min) and 101(max)
|
||||
int nbc = aSeq.Length();
|
||||
int nbp = Max(21, 2*MaxNbPoles-1);
|
||||
if(nbp>101) nbp = 101;
|
||||
|
||||
// commented for Mantis issue 0021541
|
||||
//if (nbp > 101) nbp = 101;
|
||||
|
||||
TColgp_Array2OfPnt Points (1, nbc, 1, nbp);
|
||||
int ic = 1;
|
||||
for (; ic <= nbc; ic++) {
|
||||
@ -368,7 +375,7 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const
|
||||
|
||||
/* We test the validity of resulting shape */
|
||||
if (!BRepAlgo::IsValid((aShape))) {
|
||||
Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result");
|
||||
Standard_ConstructionError::Raise("Algorithm has produced an invalid shape result");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2481,9 +2481,9 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
||||
# @param theMethod Kind of method to perform filling operation(see GEOM::filling_oper_method())
|
||||
# @param isApprox if True, BSpline curves are generated in the process
|
||||
# of surface construction. By default it is False, that means
|
||||
# the surface is created using Besier curves. The usage of
|
||||
# the surface is created using given curves. The usage of
|
||||
# Approximation makes the algorithm work slower, but allows
|
||||
# building the surface for rather complex cases
|
||||
# building the surface for rather complex cases.
|
||||
# @return New GEOM.GEOM_Object, containing the created filling surface.
|
||||
#
|
||||
# @ref tui_creation_filling "Example"
|
||||
@ -2502,7 +2502,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
||||
theMethod Kind of method to perform filling operation(see GEOM::filling_oper_method())
|
||||
isApprox if True, BSpline curves are generated in the process
|
||||
of surface construction. By default it is False, that means
|
||||
the surface is created using Besier curves. The usage of
|
||||
the surface is created using given curves. The usage of
|
||||
Approximation makes the algorithm work slower, but allows
|
||||
building the surface for rather complex cases
|
||||
|
||||
@ -2521,6 +2521,41 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
||||
anObj.SetParameters(Parameters)
|
||||
return anObj
|
||||
|
||||
|
||||
## Create a filling from the given compound of contours.
|
||||
# This method corresponds to MakeFilling with isApprox=True
|
||||
# @param theShape the compound of contours
|
||||
# @param theMinDeg a minimal degree of BSpline surface to create
|
||||
# @param theMaxDeg a maximal degree of BSpline surface to create
|
||||
# @param theTol3D a 3d tolerance to be reached
|
||||
# @return New GEOM.GEOM_Object, containing the created filling surface.
|
||||
#
|
||||
# @ref tui_creation_filling "Example"
|
||||
def MakeFillingNew(self, theShape, theMinDeg, theMaxDeg, theTol3D):
|
||||
"""
|
||||
Create a filling from the given compound of contours.
|
||||
This method corresponds to MakeFilling with isApprox=True
|
||||
|
||||
Parameters:
|
||||
theShape the compound of contours
|
||||
theMinDeg a minimal degree of BSpline surface to create
|
||||
theMaxDeg a maximal degree of BSpline surface to create
|
||||
theTol3D a 3d tolerance to be reached
|
||||
|
||||
Returns:
|
||||
New GEOM.GEOM_Object, containing the created filling surface.
|
||||
|
||||
Example of usage:
|
||||
filling = geompy.MakeFillingNew(compound, 2, 5, 0.0001)
|
||||
"""
|
||||
# Example: see GEOM_TestAll.py
|
||||
theMinDeg,theMaxDeg,theTol3D,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol3D)
|
||||
anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg,
|
||||
0, theTol3D, 0, GEOM.FOM_Default, True)
|
||||
RaiseIfFailed("MakeFillingNew", self.PrimOp)
|
||||
anObj.SetParameters(Parameters)
|
||||
return anObj
|
||||
|
||||
## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
|
||||
# @param theSeqSections - set of specified sections.
|
||||
# @param theModeSolid - mode defining building solid or shell
|
||||
|
@ -18,12 +18,11 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
// File : GenerationGUI_FillingDlg.cxx
|
||||
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
|
||||
//
|
||||
|
||||
#include "GenerationGUI_FillingDlg.h"
|
||||
|
||||
#include <DlgRef.h>
|
||||
@ -165,7 +164,6 @@ void GenerationGUI_FillingDlg::SetDoubleSpinBoxStep( double step )
|
||||
GroupPoints->SpinBox5->setSingleStep(step);
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
@ -177,7 +175,6 @@ void GenerationGUI_FillingDlg::ClickOnOk()
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
@ -191,7 +188,6 @@ bool GenerationGUI_FillingDlg::ClickOnApply()
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection as changed or other case
|
||||
@ -234,7 +230,6 @@ void GenerationGUI_FillingDlg::SetEditCurrentArgument()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
@ -248,7 +243,6 @@ void GenerationGUI_FillingDlg::ActivateThisDialog()
|
||||
processPreview();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose :
|
||||
@ -259,7 +253,6 @@ void GenerationGUI_FillingDlg::enterEvent( QEvent* )
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ValueChangedInSpinBox()
|
||||
// purpose :
|
||||
@ -284,9 +277,31 @@ void GenerationGUI_FillingDlg::MethodChanged()
|
||||
//=================================================================================
|
||||
void GenerationGUI_FillingDlg::ApproxChanged()
|
||||
{
|
||||
processPreview();
|
||||
if (GroupPoints->CheckBox1->isChecked()) {
|
||||
// tol2d
|
||||
GroupPoints->TextLabel3->setEnabled(false);
|
||||
GroupPoints->SpinBox2->setEnabled(false);
|
||||
// nbIter
|
||||
GroupPoints->TextLabel4->setEnabled(false);
|
||||
GroupPoints->SpinBox3->setEnabled(false);
|
||||
// method
|
||||
GroupPoints->TextLabel7->setEnabled(false);
|
||||
GroupPoints->ComboBox1->setEnabled(false);
|
||||
}
|
||||
else {
|
||||
// tol2d
|
||||
GroupPoints->TextLabel3->setEnabled(true);
|
||||
GroupPoints->SpinBox2->setEnabled(true);
|
||||
// nbIter
|
||||
GroupPoints->TextLabel4->setEnabled(true);
|
||||
GroupPoints->SpinBox3->setEnabled(true);
|
||||
// method
|
||||
GroupPoints->TextLabel7->setEnabled(true);
|
||||
GroupPoints->ComboBox1->setEnabled(true);
|
||||
}
|
||||
|
||||
processPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : createOperation
|
||||
|
Loading…
Reference in New Issue
Block a user