0022748: [EDF] Improvement of Filling operation

This commit is contained in:
eap 2014-10-15 17:00:48 +04:00 committed by vsr
parent 2c3b809cb7
commit 670c603478
16 changed files with 273 additions and 216 deletions

View File

@ -20,14 +20,12 @@ p3 = geompy.MakeVertex( -30., -30., 10.)
# create an arc from three points # create an arc from three points
arc = geompy.MakeArc(p1, p2, p3) arc = geompy.MakeArc(p1, p2, p3)
ShapeListCompound = [] ContoursList = []
i = 0 for i in range(4):
while i <= 3 :
S = geompy.MakeTranslation(arc, i * 50., 0., 0.) S = geompy.MakeTranslation(arc, i * 50., 0., 0.)
ShapeListCompound.append(S) ContoursList.append(S)
i = i + 1
compound = geompy.MakeCompound(ShapeListCompound) compound = geompy.MakeCompound(ContoursList)
# create a filling # create a filling
filling = geompy.MakeFilling(compound, mindeg, maxdeg, tol3d, tol2d, nbiter) filling = geompy.MakeFilling(compound, mindeg, maxdeg, tol3d, tol2d, nbiter)

BIN
doc/salome/gui/GEOM/images/filling.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -6,19 +6,18 @@ To generate a \b Filling in the <b>Main Menu</b> select <b>New Entity - > Genera
To create a curvilinear face from several edges you need to define the To create a curvilinear face from several edges you need to define the
following parameters: following parameters:
\n <b>Input Compound</b> - the list of edges/wires used for creation \n <b>Input Contours</b> - the list of edges/wires to use for creation
of the surface. To prepare for the filling each wire of the compound of the surface. You can select either several edges/wires or a
is converted to an edge created on a BSpline curve built using curves compound of them. To prepare for the filling, each input wire
from all edges of the wire. is converted into a single BSpline curve by concatenating its edges.
\n \b Minimum and <b>Maximum Degree</b> of equation of the resulting \n \b Minimum and <b>Maximum Degree</b> of equation of the resulting
BSpline or Besier curves describing the surface; BSpline or Besier curves describing the surface.
\n \b Tolerance for \b 2D and for \b 3D - minimum distance between the \n \b Tolerance for \b 2D and for \b 3D - minimum distance between the
created surface and the reference edge; created surface and the input contours.
\n <b>Number of Iterations</b> - defines the maximum number of iterations. The \n <b>Number of Iterations</b> - defines the maximum number of iterations. The
iterations are repeated until the required tolerance is reached. So, a iterations are repeated until the required tolerance is reached. So, a
greater number of iterations allows producing a better surface. greater number of iterations allows producing a better surface.
\n <b>Method</b> - Kind of method to perform filling operation \n <b>Method</b> - Kind of method to perform filling operation
<ol> <ol>
<li>Default - the standard behaviour.</li> <li>Default - the standard behaviour.</li>
<li>Use edges orientation - the edges orientation is used: if an edge is <li>Use edges orientation - the edges orientation is used: if an edge is
@ -28,7 +27,7 @@ algorithm.</li>
minimize the sum of distances between ends points of edges.</li> minimize the sum of distances between ends points of edges.</li>
</ol> </ol>
\n <b>Approximation</b> - if checked, BSpline curves are generated in <b>Approximation</b> - if checked, BSpline curves are generated in
the process of surface construction (using the process of surface construction (using
GeomAPI_PointsToBSplineSurface functionality). By default the surface GeomAPI_PointsToBSplineSurface functionality). By default the surface
is created using Besier curves. The usage of <b>Approximation</b> is created using Besier curves. The usage of <b>Approximation</b>
@ -36,11 +35,11 @@ slows the algorithm, but allows building the surface for complex cases.
\n The \b Result of the operation will be a GEOM_Object (face). \n The \b Result of the operation will be a GEOM_Object (face).
\n <b>TUI Command:</b> <em>geompy.MakeFilling(Edges, MinDegree, MaxDegree, Tol2D, Tol3D, NbIter)</em> \n <b>TUI Command:</b> <em>geompy.MakeFilling(Contours, MinDegree, MaxDegree, Tol2D, Tol3D, NbIter)</em><br>
\n <b>Arguments:</b> Name + 1 List of edges + 7 Parameters <b>Arguments:</b> List/compound of edges/wires + 7 Parameters
(Min. degree, Max. degree, Number of iterations, 2D tolerance, 3D (Min. degree, Max. degree, 2D tolerance, 3D tolerance, Number of
tolerance, Number of iterations, Method, Approximation). iterations, Method, Approximation).
\n <b>Advanced options</b> \ref preview_anchor "Preview" \n <b>Advanced options:</b> \ref preview_anchor "Preview"
\image html filling.png \image html filling.png
@ -50,7 +49,7 @@ tolerance, Number of iterations, Method, Approximation).
\image html fillingsn.png "Resulting surface" \image html fillingsn.png "Resulting surface"
Our <b>TUI Scripts</b> provide you with useful examples of creation of Sample <b>TUI Scripts</b> provide you with useful examples of creation of
\ref tui_creation_filling "Complex Geometric Objects". \ref tui_creation_filling "Complex Geometric Objects".
*/ */

View File

@ -1682,18 +1682,18 @@ module GEOM
in double theAngle); in double theAngle);
/*! /*!
* \brief Create a filling from the given compound of contours. * \brief Create a face from a given set of contours.
* \param theShape Initial shape on which to perform the feature. * \param theContours either a list or a compound of edges/wires.
* \param theMinDeg a minimal degree of BSpline surface to create * \param theMinDeg a minimal degree of BSpline surface to create.
* \param theMaxDeg a maximal degree of BSpline surface to create * \param theMaxDeg a maximal degree of BSpline surface to create.
* \param theTol2D a 2d tolerance to be reached * \param theTol2D a 2d tolerance to be reached.
* \param theTol3D a 3d tolerance to be reached * \param theTol3D a 3d tolerance to be reached.
* \param theNbIter a number of iteration of approximation algorithm * \param theNbIter a number of iteration of approximation algorithm.
* \param theMethod Kind of method to perform filling operation. * \param theMethod Kind of method to perform filling operation.
* \param theApprox Boolean indicating if result should be approximated * \param theApprox Boolean indicating if result should be approximated.
* \return New GEOM_Object, containing the created filling surface. * \return New GEOM_Object (face), containing the created filling surface.
*/ */
GEOM_Object MakeFilling (in GEOM_Object theShape, GEOM_Object MakeFilling (in ListOfGO theContours,
in long theMinDeg, in long theMaxDeg, in long theMinDeg, in long theMaxDeg,
in double theTol2D, in double theTol3D, in double theTol2D, in double theTol3D,
in long theNbIter, in long theNbIter,

View File

@ -790,7 +790,7 @@ Please, select face, shell or solid and try again</translation>
</message> </message>
<message> <message>
<source>GEOM_FILLING_COMPOUND</source> <source>GEOM_FILLING_COMPOUND</source>
<translation>Input compound</translation> <translation>Input contours</translation>
</message> </message>
<message> <message>
<source>GEOM_FILLING_MAX_DEG</source> <source>GEOM_FILLING_MAX_DEG</source>

View File

@ -30,44 +30,43 @@
#include <Basics_OCCTVersion.hxx> #include <Basics_OCCTVersion.hxx>
#include <BRepAlgo.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <GeomAPI_PointsToBSpline.hxx>
#include <GeomAPI_PointsToBSplineSurface.hxx>
#include <GeomFill_AppSurf.hxx>
#include <GeomFill_Line.hxx>
#include <GeomFill_SectionGenerator.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_BezierCurve.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Ellipse.hxx>
#include <Geom_Line.hxx>
#include <Geom_Surface.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Precision.hxx>
#include <ShapeFix_Face.hxx> #include <ShapeFix_Face.hxx>
#include <BRep_Tool.hxx> #include <TColGeom_SequenceOfCurve.hxx>
#include <BRepAlgo.hxx> #include <TColgp_Array1OfPnt.hxx>
#include <BRep_Builder.hxx> #include <TColgp_SequenceOfPnt.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <TopAbs.hxx> #include <TopAbs.hxx>
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <TopoDS_Compound.hxx> #include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx> #include <TopoDS_Edge.hxx>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx> #include <TopoDS_Vertex.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom_Line.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Ellipse.hxx>
#include <Geom_BezierCurve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_BSplineSurface.hxx>
#include <GeomFill_Line.hxx>
#include <GeomFill_AppSurf.hxx>
#include <GeomFill_SectionGenerator.hxx>
#include <GeomAPI_PointsToBSplineSurface.hxx>
#include <GeomAPI_PointsToBSpline.hxx>
#include <TColGeom_SequenceOfCurve.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <Precision.hxx>
#include <Standard_ConstructionError.hxx> #include <Standard_ConstructionError.hxx>
//======================================================================= //=======================================================================
@ -101,16 +100,6 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const
if (aFunction->GetType() != BASIC_FILLING) return 0; if (aFunction->GetType() != BASIC_FILLING) return 0;
GEOMImpl_IFilling IF (aFunction); GEOMImpl_IFilling IF (aFunction);
Handle(GEOM_Function) aShapeFunction = IF.GetShape();
if (aShapeFunction.IsNull()) return 0;
TopoDS_Shape aShape;
BRepBuilderAPI_Copy Copy (aShapeFunction->GetValue());
if (Copy.IsDone())
aShape = Copy.Shape();
if (aShape.IsNull() || aShape.ShapeType() != TopAbs_COMPOUND) return 0;
Standard_Integer mindeg = IF.GetMinDeg(); Standard_Integer mindeg = IF.GetMinDeg();
Standard_Integer maxdeg = IF.GetMaxDeg(); Standard_Integer maxdeg = IF.GetMaxDeg();
Standard_Real tol3d = IF.GetTol3D(); Standard_Real tol3d = IF.GetTol3D();
@ -130,25 +119,49 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const
BRep_Builder B; BRep_Builder B;
B.MakeCompound(aComp); B.MakeCompound(aComp);
// input is either a list or compound of contours
TopTools_SequenceOfShape contours;
Handle(TColStd_HSequenceOfTransient) aShapeFunctions = IF.GetShapes();
if ( aShapeFunctions.IsNull() || aShapeFunctions->IsEmpty() ) return 0;
for ( int i = 1; i <= aShapeFunctions->Length(); ++i )
{
Handle(GEOM_Function) fun = Handle(GEOM_Function)::DownCast( aShapeFunctions->Value( i ));
if ( fun.IsNull() ) return 0;
TopoDS_Shape s = fun->GetValue();
if ( s.IsNull() ) return 0;
BRepBuilderAPI_Copy Copy (s);
if ( Copy.IsDone() )
contours.Append( Copy.Shape() );
}
// 1. Convert argument wires, if any, into BSpline edges // 1. Convert argument wires, if any, into BSpline edges
TopoDS_Iterator It (aShape); for ( int i = 1; i <= contours.Length(); ++i )
for (; It.More(); It.Next()) { {
Scurrent = It.Value(); Scurrent = contours.Value( i );
if (Scurrent.ShapeType() != TopAbs_EDGE) { if (Scurrent.ShapeType() != TopAbs_EDGE) {
TopoDS_Edge NewEdge;
if (Scurrent.ShapeType() == TopAbs_WIRE) if (Scurrent.ShapeType() == TopAbs_WIRE)
{ {
const TopoDS_Wire& CurWire = TopoDS::Wire(Scurrent); const TopoDS_Wire& CurWire = TopoDS::Wire(Scurrent);
NewEdge = BRepAlgo::ConcatenateWireC0(CurWire); TopoDS_Edge NewEdge = BRepAlgo::ConcatenateWireC0(CurWire);
} if (NewEdge.IsNull())
if (NewEdge.IsNull()) { Standard_ConstructionError::Raise("Failed to join several edges into one");
Standard_ConstructionError::Raise("The argument compound must contain only edges");
}
Scurrent = NewEdge; Scurrent = NewEdge;
} }
else if (Scurrent.ShapeType() == TopAbs_COMPOUND)
{
for ( TopoDS_Iterator It( Scurrent ); It.More(); It.Next() )
contours.Append( It.Value() );
continue;
}
else
{
Standard_ConstructionError::Raise("Input must contain only edges or/and wires");
}
}
B.Add(aComp,Scurrent); B.Add(aComp,Scurrent);
} }
aShape = aComp; TopoDS_Shape aShape = aComp;
// 2. The surface construction // 2. The surface construction
if (!isApprox) { if (!isApprox) {
@ -324,7 +337,7 @@ GetCreationInformation(std::string& theOperationName,
switch ( aType ) { switch ( aType ) {
case BASIC_FILLING: case BASIC_FILLING:
{ {
AddParam( theParams, "Input compound", aCI.GetShape() ); AddParam( theParams, "Input compound", aCI.GetShapes() );
AddParam( theParams, "Method", aCI.GetMethod() ); AddParam( theParams, "Method", aCI.GetMethod() );
const char* method[3] = const char* method[3] =
{ "Standard", "Use edges orientation", "Correct edges orientation" }; { "Standard", "Use edges orientation", "Correct edges orientation" };

View File

@ -1615,15 +1615,19 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle2Ways
* MakeFilling * MakeFilling
*/ */
//============================================================================= //=============================================================================
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling Handle(GEOM_Object)
(Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg, GEOMImpl_I3DPrimOperations::MakeFilling (std::list< Handle(GEOM_Object)> & theContours,
int theMinDeg, int theMaxDeg,
double theTol2D, double theTol3D, int theNbIter, double theTol2D, double theTol3D, int theNbIter,
int theMethod, bool isApprox) int theMethod, bool isApprox)
{ {
SetErrorCode(KO); SetErrorCode(KO);
if (theShape.IsNull()) return NULL; Handle(TColStd_HSequenceOfTransient) contours = GEOM_Object::GetLastFunctions( theContours );
if ( contours.IsNull() || contours->IsEmpty() ) {
SetErrorCode("NULL argument shape");
return NULL;
}
//Add a new Filling object //Add a new Filling object
Handle(GEOM_Object) aFilling = GetEngine()->AddObject(GetDocID(), GEOM_FILLING); Handle(GEOM_Object) aFilling = GetEngine()->AddObject(GetDocID(), GEOM_FILLING);
@ -1635,12 +1639,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling
if (aFunction->GetDriverGUID() != GEOMImpl_FillingDriver::GetID()) return NULL; if (aFunction->GetDriverGUID() != GEOMImpl_FillingDriver::GetID()) return NULL;
GEOMImpl_IFilling aFI (aFunction); GEOMImpl_IFilling aFI (aFunction);
aFI.SetShapes(contours);
Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
if (aRefShape.IsNull()) return NULL;
aFI.SetShape(aRefShape);
aFI.SetMinDeg(theMinDeg); aFI.SetMinDeg(theMinDeg);
aFI.SetMaxDeg(theMaxDeg); aFI.SetMaxDeg(theMaxDeg);
aFI.SetTol2D(theTol2D); aFI.SetTol2D(theTol2D);
@ -1668,17 +1667,17 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling
//Make a Python command //Make a Python command
GEOM::TPythonDump pd (aFunction); GEOM::TPythonDump pd (aFunction);
pd << aFilling << " = geompy.MakeFilling(" << theShape ; pd << aFilling << " = geompy.MakeFilling(" << theContours ;
if ( theMinDeg != 2 ) pd << ", theMinDeg=" << theMinDeg ; if ( theMinDeg != 2 ) pd << ", theMinDeg=" << theMinDeg ;
if ( theMaxDeg != 5 ) pd << ", theMaxDeg=" << theMaxDeg ; if ( theMaxDeg != 5 ) pd << ", theMaxDeg=" << theMaxDeg ;
if ( fabs(theTol2D-0.0001) > Precision::Confusion() ) if ( fabs(theTol2D-0.0001) > Precision::Confusion() )
pd << ", theTol2D=" << theTol2D ; { pd << ", theTol2D=" << theTol2D ; }
if ( fabs(theTol3D-0.0001) > Precision::Confusion() ) if ( fabs(theTol3D-0.0001) > Precision::Confusion() )
pd << ", theTol3D=" << theTol3D ; { pd << ", theTol3D=" << theTol3D ; }
if ( theNbIter != 0 ) pd << ", theNbIter=" << theNbIter ; if ( theNbIter != 0 ) pd << ", theNbIter=" << theNbIter ;
if ( theMethod==1 ) pd << ", theMethod=GEOM.FOM_UseOri"; if ( theMethod==1 ) pd << ", theMethod=GEOM.FOM_UseOri";
else if( theMethod==2 ) pd << ", theMethod=GEOM.FOM_AutoCorrect"; else if( theMethod==2 ) pd << ", theMethod=GEOM.FOM_AutoCorrect";
if(isApprox) pd << ", isApprox=" << isApprox ; if ( isApprox ) pd << ", isApprox=" << isApprox ;
pd << ")"; pd << ")";
SetErrorCode(OK); SetErrorCode(OK);

View File

@ -109,7 +109,7 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
Handle(GEOM_Object) theAxis, Handle(GEOM_Object) theAxis,
double theAngle); double theAngle);
Standard_EXPORT Handle(GEOM_Object) MakeFilling (Handle(GEOM_Object) theShape, Standard_EXPORT Handle(GEOM_Object) MakeFilling (std::list< Handle(GEOM_Object)> & theContours,
int theMinDeg, int theMaxDeg, int theMinDeg, int theMaxDeg,
double theTol2D, double theTol3D, double theTol2D, double theTol3D,
int theNbIter, int theMethod, int theNbIter, int theMethod,

View File

@ -23,19 +23,22 @@
//NOTE: This is an intreface to a function for the Filling operation. //NOTE: This is an intreface to a function for the Filling operation.
// //
#include "GEOM_Function.hxx" #include "GEOM_Function.hxx"
#include <TColStd_HSequenceOfTransient.hxx>
#define FILL_ARG_MINDEG 1 enum GEOMImpl_IFilling_Arg {
#define FILL_ARG_MAXDEG 2 FILL_ARG_MINDEG = 1,
#define FILL_ARG_TOL2D 3 FILL_ARG_MAXDEG = 2,
#define FILL_ARG_TOL3D 4 FILL_ARG_TOL2D = 3,
#define FILL_ARG_SHAPE 5 FILL_ARG_TOL3D = 4,
#define FILL_ARG_NBITER 6 FILL_ARG_SHAPE = 5,
#define FILL_ARG_APPROX 7 FILL_ARG_NBITER = 6,
#define FILL_ARG_METHOD 8 FILL_ARG_APPROX = 7,
FILL_ARG_METHOD = 8
};
class GEOMImpl_IFilling class GEOMImpl_IFilling
{ {
public: public:
GEOMImpl_IFilling(Handle(GEOM_Function) theFunction): _func(theFunction) {} GEOMImpl_IFilling(Handle(GEOM_Function) theFunction): _func(theFunction) {}
@ -57,10 +60,24 @@ class GEOMImpl_IFilling
void SetMethod(int theMethod) { _func->SetInteger(FILL_ARG_METHOD, theMethod); } void SetMethod(int theMethod) { _func->SetInteger(FILL_ARG_METHOD, theMethod); }
int GetMethod() { return _func->GetInteger(FILL_ARG_METHOD); } int GetMethod() { return _func->GetInteger(FILL_ARG_METHOD); }
void SetShapes(const Handle(TColStd_HSequenceOfTransient)& theShapes)
{ _func->SetReferenceList(FILL_ARG_SHAPE, theShapes); }
Handle(TColStd_HSequenceOfTransient) GetShapes()
{
Handle(TColStd_HSequenceOfTransient) aSeq = _func->GetReferenceList(FILL_ARG_SHAPE);
if ( aSeq.IsNull() ) {
Handle(GEOM_Function) fun = GetShape();
if ( !fun.IsNull() ) {
aSeq = new TColStd_HSequenceOfTransient;
aSeq->Append( fun );
}
}
return aSeq;
}
void SetShape(Handle(GEOM_Function) theShape) { _func->SetReference(FILL_ARG_SHAPE, theShape); } void SetShape(Handle(GEOM_Function) theShape) { _func->SetReference(FILL_ARG_SHAPE, theShape); }
Handle(GEOM_Function) GetShape() { return _func->GetReference(FILL_ARG_SHAPE); } Handle(GEOM_Function) GetShape() { return _func->GetReference(FILL_ARG_SHAPE); }
private: private:
Handle(GEOM_Function) _func; Handle(GEOM_Function) _func;
}; };

View File

@ -880,7 +880,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM::GEOM_Object_ptr
GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape, GEOM_I3DPrimOperations_i::MakeFilling(const GEOM::ListOfGO& theContours,
CORBA::Long theMinDeg, CORBA::Long theMinDeg,
CORBA::Long theMaxDeg, CORBA::Long theMaxDeg,
CORBA::Double theTol2D, CORBA::Double theTol2D,
@ -895,9 +895,9 @@ GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
GetOperations()->SetNotDone(); GetOperations()->SetNotDone();
//Get the reference objects //Get the reference objects
Handle(GEOM_Object) aShape = GetObjectImpl(theShape); std::list< Handle(GEOM_Object) > aShapes;
if (! GetListOfObjectsImpl( theContours, aShapes ))
if (aShape.IsNull()) return aGEOMObject._retn(); return aGEOMObject._retn();
int aMethod = 0; int aMethod = 0;
switch (theMethod) { switch (theMethod) {
@ -925,8 +925,7 @@ GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
//Create the Solid //Create the Solid
Handle(GEOM_Object) anObject = GetOperations()->MakeFilling Handle(GEOM_Object) anObject = GetOperations()->MakeFilling
(aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, (aShapes, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, aMethod, theApprox);
aMethod, theApprox);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();

View File

@ -166,7 +166,7 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i :
GEOM::GEOM_Object_ptr theAxis, GEOM::GEOM_Object_ptr theAxis,
CORBA::Double theAngle); CORBA::Double theAngle);
GEOM::GEOM_Object_ptr MakeFilling(GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr MakeFilling(const GEOM::ListOfGO& theContours,
CORBA::Long theMinDeg, CORBA::Long theMaxDeg, CORBA::Long theMinDeg, CORBA::Long theMaxDeg,
CORBA::Double theTol2D, CORBA::Double theTol3D, CORBA::Double theTol2D, CORBA::Double theTol3D,
CORBA::Long theNbIter, CORBA::Long theNbIter,

View File

@ -1453,8 +1453,11 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilling (GEOM::GEOM_Object_ptr theShape
beginService( " GEOM_Superv_i::MakeFilling" ); beginService( " GEOM_Superv_i::MakeFilling" );
MESSAGE("GEOM_Superv_i::MakeFilling"); MESSAGE("GEOM_Superv_i::MakeFilling");
get3DPrimOp(); get3DPrimOp();
GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
objList->length( 1 );
objList[0] = theShape;
GEOM::GEOM_Object_ptr anObj = GEOM::GEOM_Object_ptr anObj =
my3DPrimOp->MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, my3DPrimOp->MakeFilling(objList, theMinDeg, theMaxDeg, theTol2D, theTol3D,
theNbIter, theMethod, theApprox); theNbIter, theMethod, theApprox);
endService( " GEOM_Superv_i::MakeFilling" ); endService( " GEOM_Superv_i::MakeFilling" );
return anObj; return anObj;
@ -2348,8 +2351,11 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFaces (GEOM::GEOM_Object_ptr theSha
beginService( " GEOM_Superv_i::MakeGlueFaces" ); beginService( " GEOM_Superv_i::MakeGlueFaces" );
MESSAGE("GEOM_Superv_i::MakeGlueFaces"); MESSAGE("GEOM_Superv_i::MakeGlueFaces");
getShapesOp(); getShapesOp();
GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
objList->length( 1 );
objList[0] = theShape;
GEOM::GEOM_Object_ptr anObj = GEOM::GEOM_Object_ptr anObj =
myShapesOp->MakeGlueFaces(theShape, theTolerance, doKeepNonSolids); myShapesOp->MakeGlueFaces(objList, theTolerance, doKeepNonSolids);
endService( " GEOM_Superv_i::MakeGlueFaces" ); endService( " GEOM_Superv_i::MakeGlueFaces" );
return anObj; return anObj;
} }
@ -2363,7 +2369,10 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::GetGlueFaces (GEOM::GEOM_Object_ptr theShape,
beginService( " GEOM_Superv_i::GetGlueFaces" ); beginService( " GEOM_Superv_i::GetGlueFaces" );
MESSAGE("GEOM_Superv_i::GetGlueFaces"); MESSAGE("GEOM_Superv_i::GetGlueFaces");
getShapesOp(); getShapesOp();
GEOM::ListOfGO* aList = myShapesOp->GetGlueFaces(theShape, theTolerance); GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
objList->length( 1 );
objList[0] = theShape;
GEOM::ListOfGO* aList = myShapesOp->GetGlueFaces(objList, theTolerance);
GEOM_List_i<GEOM::ListOfGO>* aListPtr = new GEOM_List_i<GEOM::ListOfGO>(*(aList)); GEOM_List_i<GEOM::ListOfGO>* aListPtr = new GEOM_List_i<GEOM::ListOfGO>(*(aList));
MESSAGE(" List of "<<aListPtr->GetList().length()<<" element(s)"); MESSAGE(" List of "<<aListPtr->GetList().length()<<" element(s)");
endService( " GEOM_Superv_i::GetGlueFaces" ); endService( " GEOM_Superv_i::GetGlueFaces" );
@ -2382,8 +2391,11 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFacesByList (GEOM::GEOM_Object_ptr
beginService( " GEOM_Superv_i::MakeGlueFacesByList" ); beginService( " GEOM_Superv_i::MakeGlueFacesByList" );
MESSAGE("GEOM_Superv_i::MakeGlueFacesByList"); MESSAGE("GEOM_Superv_i::MakeGlueFacesByList");
getShapesOp(); getShapesOp();
GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
objList->length( 1 );
objList[0] = theShape;
GEOM::GEOM_Object_ptr anObj = GEOM::GEOM_Object_ptr anObj =
myShapesOp->MakeGlueFacesByList(theShape, theTolerance, theFaces, myShapesOp->MakeGlueFacesByList(objList, theTolerance, theFaces,
doKeepNonSolids, doGlueAllEdges); doKeepNonSolids, doGlueAllEdges);
endService( " GEOM_Superv_i::MakeGlueFacesByList" ); endService( " GEOM_Superv_i::MakeGlueFacesByList" );
return anObj; return anObj;

View File

@ -3725,14 +3725,15 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
self._autoPublish(anObj, theName, "revolution") self._autoPublish(anObj, theName, "revolution")
return anObj return anObj
## Create a filling from the given compound of contours. ## Create a face from a given set of contours.
# @param theShape the compound of contours # @param theContours either a list or a compound of edges/wires.
# @param theMinDeg a minimal degree of BSpline surface to create # @param theMinDeg a minimal degree of BSpline surface to create.
# @param theMaxDeg a maximal degree of BSpline surface to create # @param theMaxDeg a maximal degree of BSpline surface to create.
# @param theTol2D a 2d tolerance to be reached # @param theTol2D a 2d tolerance to be reached.
# @param theTol3D a 3d tolerance to be reached # @param theTol3D a 3d tolerance to be reached.
# @param theNbIter a number of iteration of approximation algorithm # @param theNbIter a number of iteration of approximation algorithm.
# @param theMethod Kind of method to perform filling operation(see GEOM::filling_oper_method()) # @param theMethod Kind of method to perform filling operation
# (see GEOM.filling_oper_method enum).
# @param isApprox if True, BSpline curves are generated in the process # @param isApprox if True, BSpline curves are generated in the process
# of surface construction. By default it is False, that means # of surface construction. By default it is False, that means
# the surface is created using given curves. The usage of # the surface is created using given curves. The usage of
@ -3742,41 +3743,42 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# for result publication in the study. Otherwise, if automatic # for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name. # publication is switched on, default value is used for result name.
# #
# @return New GEOM.GEOM_Object, containing the created filling surface. # @return New GEOM.GEOM_Object (face), containing the created filling surface.
# #
# @ref tui_creation_filling "Example" # @ref tui_creation_filling "Example"
@ManageTransactions("PrimOp") @ManageTransactions("PrimOp")
def MakeFilling(self, theShape, theMinDeg=2, theMaxDeg=5, theTol2D=0.0001, def MakeFilling(self, theContours, theMinDeg=2, theMaxDeg=5, theTol2D=0.0001,
theTol3D=0.0001, theNbIter=0, theMethod=GEOM.FOM_Default, isApprox=0, theName=None): theTol3D=0.0001, theNbIter=0, theMethod=GEOM.FOM_Default, isApprox=0, theName=None):
""" """
Create a filling from the given compound of contours. Create a face from a given set of contours.
Parameters: Parameters:
theShape the compound of contours theContours either a list or a compound of edges/wires.
theMinDeg a minimal degree of BSpline surface to create theMinDeg a minimal degree of BSpline surface to create.
theMaxDeg a maximal degree of BSpline surface to create theMaxDeg a maximal degree of BSpline surface to create.
theTol2D a 2d tolerance to be reached theTol2D a 2d tolerance to be reached.
theTol3D a 3d tolerance to be reached theTol3D a 3d tolerance to be reached.
theNbIter a number of iteration of approximation algorithm theNbIter a number of iteration of approximation algorithm.
theMethod Kind of method to perform filling operation(see GEOM::filling_oper_method()) theMethod Kind of method to perform filling operation
(see GEOM.filling_oper_method enum).
isApprox if True, BSpline curves are generated in the process isApprox if True, BSpline curves are generated in the process
of surface construction. By default it is False, that means of surface construction. By default it is False, that means
the surface is created using given curves. The usage of the surface is created using given curves. The usage of
Approximation makes the algorithm work slower, but allows Approximation makes the algorithm work slower, but allows
building the surface for rather complex cases building the surface for rather complex cases.
theName Object name; when specified, this parameter is used theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name. publication is switched on, default value is used for result name.
Returns: Returns:
New GEOM.GEOM_Object, containing the created filling surface. New GEOM.GEOM_Object (face), containing the created filling surface.
Example of usage: Example of usage:
filling = geompy.MakeFilling(compound, 2, 5, 0.0001, 0.0001, 5) filling = geompy.MakeFilling(compound, 2, 5, 0.0001, 0.0001, 5)
""" """
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter) theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter)
anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg, anObj = self.PrimOp.MakeFilling(ToList(theContours), theMinDeg, theMaxDeg,
theTol2D, theTol3D, theNbIter, theTol2D, theTol3D, theNbIter,
theMethod, isApprox) theMethod, isApprox)
RaiseIfFailed("MakeFilling", self.PrimOp) RaiseIfFailed("MakeFilling", self.PrimOp)
@ -3785,43 +3787,43 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
return anObj return anObj
## Create a filling from the given compound of contours. ## Create a face from a given set of contours.
# This method corresponds to MakeFilling with isApprox=True # This method corresponds to MakeFilling() with isApprox=True.
# @param theShape the compound of contours # @param theContours either a list or a compound of edges/wires.
# @param theMinDeg a minimal degree of BSpline surface to create # @param theMinDeg a minimal degree of BSpline surface to create.
# @param theMaxDeg a maximal degree of BSpline surface to create # @param theMaxDeg a maximal degree of BSpline surface to create.
# @param theTol3D a 3d tolerance to be reached # @param theTol3D a 3d tolerance to be reached.
# @param theName Object name; when specified, this parameter is used # @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic # for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name. # publication is switched on, default value is used for result name.
# #
# @return New GEOM.GEOM_Object, containing the created filling surface. # @return New GEOM.GEOM_Object (face), containing the created filling surface.
# #
# @ref tui_creation_filling "Example" # @ref tui_creation_filling "Example"
@ManageTransactions("PrimOp") @ManageTransactions("PrimOp")
def MakeFillingNew(self, theShape, theMinDeg=2, theMaxDeg=5, theTol3D=0.0001, theName=None): def MakeFillingNew(self, theContours, theMinDeg=2, theMaxDeg=5, theTol3D=0.0001, theName=None):
""" """
Create a filling from the given compound of contours. Create a filling from the given compound of contours.
This method corresponds to MakeFilling with isApprox=True This method corresponds to MakeFilling() with isApprox=True.
Parameters: Parameters:
theShape the compound of contours theContours either a list or a compound of edges/wires.
theMinDeg a minimal degree of BSpline surface to create theMinDeg a minimal degree of BSpline surface to create.
theMaxDeg a maximal degree of BSpline surface to create theMaxDeg a maximal degree of BSpline surface to create.
theTol3D a 3d tolerance to be reached theTol3D a 3d tolerance to be reached.
theName Object name; when specified, this parameter is used theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name. publication is switched on, default value is used for result name.
Returns: Returns:
New GEOM.GEOM_Object, containing the created filling surface. New GEOM.GEOM_Object (face), containing the created filling surface.
Example of usage: Example of usage:
filling = geompy.MakeFillingNew(compound, 2, 5, 0.0001) filling = geompy.MakeFillingNew(compound, 2, 5, 0.0001)
""" """
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
theMinDeg,theMaxDeg,theTol3D,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol3D) theMinDeg,theMaxDeg,theTol3D,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol3D)
anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg, anObj = self.PrimOp.MakeFilling(theContours, theMinDeg, theMaxDeg,
0, theTol3D, 0, GEOM.FOM_Default, True) 0, theTol3D, 0, GEOM.FOM_Default, True)
RaiseIfFailed("MakeFillingNew", self.PrimOp) RaiseIfFailed("MakeFillingNew", self.PrimOp)
anObj.SetParameters(Parameters) anObj.SetParameters(Parameters)
@ -4500,7 +4502,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
New GEOM.GEOM_Object, containing the created face. New GEOM.GEOM_Object, containing the created face.
""" """
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
anObj = self.ShapesOp.MakeFaceWires(theWires, isPlanarWanted) anObj = self.ShapesOp.MakeFaceWires(ToList(theWires), isPlanarWanted)
if isPlanarWanted and anObj is not None and self.ShapesOp.GetErrorCode() == "MAKE_FACE_TOLERANCE_TOO_BIG": if isPlanarWanted and anObj is not None and self.ShapesOp.GetErrorCode() == "MAKE_FACE_TOLERANCE_TOO_BIG":
print "WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built." print "WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built."
else: else:
@ -4574,6 +4576,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
New GEOM.GEOM_Object, containing the created solid. New GEOM.GEOM_Object, containing the created solid.
""" """
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
theShells = ToList(theShells)
if len(theShells) == 1: if len(theShells) == 1:
descr = self._IsGoodForSolid(theShells[0]) descr = self._IsGoodForSolid(theShells[0])
#if len(descr) > 0: #if len(descr) > 0:
@ -4609,7 +4612,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
New GEOM.GEOM_Object, containing the created compound. New GEOM.GEOM_Object, containing the created compound.
""" """
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
anObj = self.ShapesOp.MakeCompound(theShapes) anObj = self.ShapesOp.MakeCompound(ToList(theShapes))
RaiseIfFailed("MakeCompound", self.ShapesOp) RaiseIfFailed("MakeCompound", self.ShapesOp)
self._autoPublish(anObj, theName, "compound") self._autoPublish(anObj, theName, "compound")
return anObj return anObj

View File

@ -35,7 +35,8 @@
#include <SalomeApp_Application.h> #include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h> #include <LightApp_SelectionMgr.h>
#include <TopoDS_Iterator.hxx> #include <TColStd_MapOfInteger.hxx>
#include <GEOMImpl_Types.hxx> #include <GEOMImpl_Types.hxx>
//================================================================================= //=================================================================================
@ -105,7 +106,7 @@ void GenerationGUI_FillingDlg::Init()
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setReadOnly(true); GroupPoints->LineEdit1->setReadOnly(true);
globalSelection(GEOM_COMPOUND); initSelection();
int SpecificStep1 = 1; int SpecificStep1 = 1;
double SpecificStep2 = 0.0001; double SpecificStep2 = 0.0001;
@ -186,9 +187,24 @@ bool GenerationGUI_FillingDlg::ClickOnApply()
return false; return false;
initName(); initName();
initSelection();
return true; return true;
} }
//=================================================================================
// function : initSelection
// purpose :
//=================================================================================
void GenerationGUI_FillingDlg::initSelection()
{
TColStd_MapOfInteger aTypes;
aTypes.Add( GEOM_EDGE );
aTypes.Add( GEOM_WIRE );
aTypes.Add( GEOM_COMPOUND );
globalSelection( aTypes );
}
//================================================================================= //=================================================================================
// function : SelectionIntoArgument() // function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case // purpose : Called when selection as changed or other case
@ -199,18 +215,13 @@ void GenerationGUI_FillingDlg::SelectionIntoArgument()
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
if (myEditCurrentArgument == GroupPoints->LineEdit1) { if (myEditCurrentArgument == GroupPoints->LineEdit1) {
myCompound = getSelected(TopAbs_COMPOUND); QList<GEOM::GeomObjPtr> objs = getSelected(TopAbs_SHAPE, -1);
if (myCompound) { GEOMBase::Synchronize(myObjects, objs);
if (myCompound->GetMaxShapeType() < GEOM::WIRE || myCompound->GetMinShapeType() > GEOM::EDGE) { if ( !myObjects.isEmpty() ) {
myCompound.nullify(); QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() );
} myEditCurrentArgument->setText( aName );
else {
QString aName = GEOMBase::GetName(myCompound.get());
myEditCurrentArgument->setText(aName);
} }
} }
}
processPreview(); processPreview();
} }
@ -240,7 +251,7 @@ void GenerationGUI_FillingDlg::ActivateThisDialog()
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
globalSelection(GEOM_COMPOUND); initSelection();
processPreview(); processPreview();
} }
@ -319,12 +330,12 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_FillingDlg::createOperation()
//================================================================================= //=================================================================================
bool GenerationGUI_FillingDlg::isValid(QString& msg) bool GenerationGUI_FillingDlg::isValid(QString& msg)
{ {
bool ok = GroupPoints->SpinBox1->isValid(msg, !IsPreview()) && bool ok = ( GroupPoints->SpinBox1->isValid(msg, !IsPreview()) &&
GroupPoints->SpinBox2->isValid(msg, !IsPreview()) && GroupPoints->SpinBox2->isValid(msg, !IsPreview()) &&
GroupPoints->SpinBox3->isValid(msg, !IsPreview()) && GroupPoints->SpinBox3->isValid(msg, !IsPreview()) &&
GroupPoints->SpinBox4->isValid(msg, !IsPreview()) && GroupPoints->SpinBox4->isValid(msg, !IsPreview()) &&
GroupPoints->SpinBox5->isValid(msg, !IsPreview()) && GroupPoints->SpinBox5->isValid(msg, !IsPreview()) &&
myCompound; myObjects.count() );
return ok; return ok;
} }
@ -346,8 +357,13 @@ bool GenerationGUI_FillingDlg::execute(ObjectList& objects)
default: break; default: break;
} }
GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
objList->length( myObjects.count() );
for ( int i = 0; i < myObjects.count(); ++i )
objList[i] = myObjects[i].copy();
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
anOper->MakeFilling(myCompound.get(), anOper->MakeFilling(objList,
GroupPoints->SpinBox1->value(), GroupPoints->SpinBox1->value(),
GroupPoints->SpinBox4->value(), GroupPoints->SpinBox4->value(),
GroupPoints->SpinBox2->value(), GroupPoints->SpinBox2->value(),

View File

@ -53,9 +53,10 @@ protected:
private: private:
void Init(); void Init();
void enterEvent( QEvent* ); void enterEvent( QEvent* );
void initSelection();
private: private:
GEOM::GeomObjPtr myCompound; /* compound of curves */ QList<GEOM::GeomObjPtr> myObjects;/* lit or compound of curves */
DlgRef_1Sel5Spin1Check* GroupPoints; DlgRef_1Sel5Spin1Check* GroupPoints;
private slots: private slots: