mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-26 01:10:36 +05:00
0022748: [EDF] Improvement of Filling operation
This commit is contained in:
parent
2c3b809cb7
commit
670c603478
@ -20,14 +20,12 @@ p3 = geompy.MakeVertex( -30., -30., 10.)
|
||||
|
||||
# create an arc from three points
|
||||
arc = geompy.MakeArc(p1, p2, p3)
|
||||
ShapeListCompound = []
|
||||
i = 0
|
||||
while i <= 3 :
|
||||
ContoursList = []
|
||||
for i in range(4):
|
||||
S = geompy.MakeTranslation(arc, i * 50., 0., 0.)
|
||||
ShapeListCompound.append(S)
|
||||
i = i + 1
|
||||
ContoursList.append(S)
|
||||
|
||||
compound = geompy.MakeCompound(ShapeListCompound)
|
||||
compound = geompy.MakeCompound(ContoursList)
|
||||
|
||||
# create a filling
|
||||
filling = geompy.MakeFilling(compound, mindeg, maxdeg, tol3d, tol2d, nbiter)
|
||||
|
BIN
doc/salome/gui/GEOM/images/filling.png
Executable file → Normal file
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 |
@ -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
|
||||
following parameters:
|
||||
\n <b>Input Compound</b> - the list of edges/wires used for creation
|
||||
of the surface. To prepare for the filling each wire of the compound
|
||||
is converted to an edge created on a BSpline curve built using curves
|
||||
from all edges of the wire.
|
||||
\n <b>Input Contours</b> - the list of edges/wires to use for creation
|
||||
of the surface. You can select either several edges/wires or a
|
||||
compound of them. To prepare for the filling, each input 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
|
||||
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
|
||||
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
|
||||
iterations are repeated until the required tolerance is reached. So, a
|
||||
greater number of iterations allows producing a better surface.
|
||||
\n <b>Method</b> - Kind of method to perform filling operation
|
||||
|
||||
<ol>
|
||||
<li>Default - the standard behaviour.</li>
|
||||
<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>
|
||||
</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
|
||||
GeomAPI_PointsToBSplineSurface functionality). By default the surface
|
||||
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 <b>TUI Command:</b> <em>geompy.MakeFilling(Edges, MinDegree, MaxDegree, Tol2D, Tol3D, NbIter)</em>
|
||||
\n <b>Arguments:</b> Name + 1 List of edges + 7 Parameters
|
||||
(Min. degree, Max. degree, Number of iterations, 2D tolerance, 3D
|
||||
tolerance, Number of iterations, Method, Approximation).
|
||||
\n <b>Advanced options</b> \ref preview_anchor "Preview"
|
||||
\n <b>TUI Command:</b> <em>geompy.MakeFilling(Contours, MinDegree, MaxDegree, Tol2D, Tol3D, NbIter)</em><br>
|
||||
<b>Arguments:</b> List/compound of edges/wires + 7 Parameters
|
||||
(Min. degree, Max. degree, 2D tolerance, 3D tolerance, Number of
|
||||
iterations, Method, Approximation).
|
||||
\n <b>Advanced options:</b> \ref preview_anchor "Preview"
|
||||
|
||||
\image html filling.png
|
||||
|
||||
@ -50,7 +49,7 @@ tolerance, Number of iterations, Method, Approximation).
|
||||
|
||||
\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".
|
||||
|
||||
*/
|
||||
|
@ -1682,18 +1682,18 @@ module GEOM
|
||||
in double theAngle);
|
||||
|
||||
/*!
|
||||
* \brief Create a filling from the given compound of contours.
|
||||
* \param theShape Initial shape on which to perform the feature.
|
||||
* \param theMinDeg a minimal 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 theTol3D a 3d tolerance to be reached
|
||||
* \param theNbIter a number of iteration of approximation algorithm
|
||||
* \brief Create a face from a given set of contours.
|
||||
* \param theContours either a list or a compound of edges/wires.
|
||||
* \param theMinDeg a minimal 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 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.
|
||||
* \param theApprox Boolean indicating if result should be approximated
|
||||
* \return New GEOM_Object, containing the created filling surface.
|
||||
* \param theApprox Boolean indicating if result should be approximated.
|
||||
* \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 double theTol2D, in double theTol3D,
|
||||
in long theNbIter,
|
||||
|
@ -790,7 +790,7 @@ Please, select face, shell or solid and try again</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_FILLING_COMPOUND</source>
|
||||
<translation>Input compound</translation>
|
||||
<translation>Input contours</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_FILLING_MAX_DEG</source>
|
||||
|
@ -30,44 +30,43 @@
|
||||
|
||||
#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 <BRep_Tool.hxx>
|
||||
#include <BRepAlgo.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <BRepBuilderAPI_Copy.hxx>
|
||||
#include <TColGeom_SequenceOfCurve.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
|
||||
#include <TopAbs.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Shape.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>
|
||||
|
||||
//=======================================================================
|
||||
@ -101,16 +100,6 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const
|
||||
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;
|
||||
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 maxdeg = IF.GetMaxDeg();
|
||||
Standard_Real tol3d = IF.GetTol3D();
|
||||
@ -130,25 +119,49 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const
|
||||
BRep_Builder B;
|
||||
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
|
||||
TopoDS_Iterator It (aShape);
|
||||
for (; It.More(); It.Next()) {
|
||||
Scurrent = It.Value();
|
||||
for ( int i = 1; i <= contours.Length(); ++i )
|
||||
{
|
||||
Scurrent = contours.Value( i );
|
||||
if (Scurrent.ShapeType() != TopAbs_EDGE) {
|
||||
TopoDS_Edge NewEdge;
|
||||
|
||||
if (Scurrent.ShapeType() == TopAbs_WIRE)
|
||||
{
|
||||
const TopoDS_Wire& CurWire = TopoDS::Wire(Scurrent);
|
||||
NewEdge = BRepAlgo::ConcatenateWireC0(CurWire);
|
||||
}
|
||||
if (NewEdge.IsNull()) {
|
||||
Standard_ConstructionError::Raise("The argument compound must contain only edges");
|
||||
}
|
||||
TopoDS_Edge NewEdge = BRepAlgo::ConcatenateWireC0(CurWire);
|
||||
if (NewEdge.IsNull())
|
||||
Standard_ConstructionError::Raise("Failed to join several edges into one");
|
||||
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);
|
||||
}
|
||||
aShape = aComp;
|
||||
TopoDS_Shape aShape = aComp;
|
||||
|
||||
// 2. The surface construction
|
||||
if (!isApprox) {
|
||||
@ -324,7 +337,7 @@ GetCreationInformation(std::string& theOperationName,
|
||||
switch ( aType ) {
|
||||
case BASIC_FILLING:
|
||||
{
|
||||
AddParam( theParams, "Input compound", aCI.GetShape() );
|
||||
AddParam( theParams, "Input compound", aCI.GetShapes() );
|
||||
AddParam( theParams, "Method", aCI.GetMethod() );
|
||||
const char* method[3] =
|
||||
{ "Standard", "Use edges orientation", "Correct edges orientation" };
|
||||
|
@ -1615,15 +1615,19 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle2Ways
|
||||
* MakeFilling
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling
|
||||
(Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg,
|
||||
Handle(GEOM_Object)
|
||||
GEOMImpl_I3DPrimOperations::MakeFilling (std::list< Handle(GEOM_Object)> & theContours,
|
||||
int theMinDeg, int theMaxDeg,
|
||||
double theTol2D, double theTol3D, int theNbIter,
|
||||
int theMethod, bool isApprox)
|
||||
{
|
||||
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
|
||||
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;
|
||||
|
||||
GEOMImpl_IFilling aFI (aFunction);
|
||||
|
||||
Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
|
||||
|
||||
if (aRefShape.IsNull()) return NULL;
|
||||
|
||||
aFI.SetShape(aRefShape);
|
||||
aFI.SetShapes(contours);
|
||||
aFI.SetMinDeg(theMinDeg);
|
||||
aFI.SetMaxDeg(theMaxDeg);
|
||||
aFI.SetTol2D(theTol2D);
|
||||
@ -1668,17 +1667,17 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling
|
||||
|
||||
//Make a Python command
|
||||
GEOM::TPythonDump pd (aFunction);
|
||||
pd << aFilling << " = geompy.MakeFilling(" << theShape ;
|
||||
pd << aFilling << " = geompy.MakeFilling(" << theContours ;
|
||||
if ( theMinDeg != 2 ) pd << ", theMinDeg=" << theMinDeg ;
|
||||
if ( theMaxDeg != 5 ) pd << ", theMaxDeg=" << theMaxDeg ;
|
||||
if ( fabs(theTol2D-0.0001) > Precision::Confusion() )
|
||||
pd << ", theTol2D=" << theTol2D ;
|
||||
{ pd << ", theTol2D=" << theTol2D ; }
|
||||
if ( fabs(theTol3D-0.0001) > Precision::Confusion() )
|
||||
pd << ", theTol3D=" << theTol3D ;
|
||||
{ pd << ", theTol3D=" << theTol3D ; }
|
||||
if ( theNbIter != 0 ) pd << ", theNbIter=" << theNbIter ;
|
||||
if ( theMethod==1 ) pd << ", theMethod=GEOM.FOM_UseOri";
|
||||
else if( theMethod==2 ) pd << ", theMethod=GEOM.FOM_AutoCorrect";
|
||||
if(isApprox) pd << ", isApprox=" << isApprox ;
|
||||
if ( isApprox ) pd << ", isApprox=" << isApprox ;
|
||||
pd << ")";
|
||||
|
||||
SetErrorCode(OK);
|
||||
|
@ -109,7 +109,7 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
|
||||
Handle(GEOM_Object) theAxis,
|
||||
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,
|
||||
double theTol2D, double theTol3D,
|
||||
int theNbIter, int theMethod,
|
||||
|
@ -23,19 +23,22 @@
|
||||
//NOTE: This is an intreface to a function for the Filling operation.
|
||||
//
|
||||
#include "GEOM_Function.hxx"
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
|
||||
#define FILL_ARG_MINDEG 1
|
||||
#define FILL_ARG_MAXDEG 2
|
||||
#define FILL_ARG_TOL2D 3
|
||||
#define FILL_ARG_TOL3D 4
|
||||
#define FILL_ARG_SHAPE 5
|
||||
#define FILL_ARG_NBITER 6
|
||||
#define FILL_ARG_APPROX 7
|
||||
#define FILL_ARG_METHOD 8
|
||||
enum GEOMImpl_IFilling_Arg {
|
||||
FILL_ARG_MINDEG = 1,
|
||||
FILL_ARG_MAXDEG = 2,
|
||||
FILL_ARG_TOL2D = 3,
|
||||
FILL_ARG_TOL3D = 4,
|
||||
FILL_ARG_SHAPE = 5,
|
||||
FILL_ARG_NBITER = 6,
|
||||
FILL_ARG_APPROX = 7,
|
||||
FILL_ARG_METHOD = 8
|
||||
};
|
||||
|
||||
class GEOMImpl_IFilling
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
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); }
|
||||
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); }
|
||||
Handle(GEOM_Function) GetShape() { return _func->GetReference(FILL_ARG_SHAPE); }
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
Handle(GEOM_Function) _func;
|
||||
};
|
||||
|
@ -880,7 +880,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
|
||||
*/
|
||||
//=============================================================================
|
||||
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 theMaxDeg,
|
||||
CORBA::Double theTol2D,
|
||||
@ -895,9 +895,9 @@ GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
//Get the reference objects
|
||||
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
|
||||
|
||||
if (aShape.IsNull()) return aGEOMObject._retn();
|
||||
std::list< Handle(GEOM_Object) > aShapes;
|
||||
if (! GetListOfObjectsImpl( theContours, aShapes ))
|
||||
return aGEOMObject._retn();
|
||||
|
||||
int aMethod = 0;
|
||||
switch (theMethod) {
|
||||
@ -925,8 +925,7 @@ GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
|
||||
|
||||
//Create the Solid
|
||||
Handle(GEOM_Object) anObject = GetOperations()->MakeFilling
|
||||
(aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter,
|
||||
aMethod, theApprox);
|
||||
(aShapes, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, aMethod, theApprox);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
|
@ -166,7 +166,7 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i :
|
||||
GEOM::GEOM_Object_ptr theAxis,
|
||||
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::Double theTol2D, CORBA::Double theTol3D,
|
||||
CORBA::Long theNbIter,
|
||||
|
@ -1453,8 +1453,11 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilling (GEOM::GEOM_Object_ptr theShape
|
||||
beginService( " GEOM_Superv_i::MakeFilling" );
|
||||
MESSAGE("GEOM_Superv_i::MakeFilling");
|
||||
get3DPrimOp();
|
||||
GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
|
||||
objList->length( 1 );
|
||||
objList[0] = theShape;
|
||||
GEOM::GEOM_Object_ptr anObj =
|
||||
my3DPrimOp->MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D,
|
||||
my3DPrimOp->MakeFilling(objList, theMinDeg, theMaxDeg, theTol2D, theTol3D,
|
||||
theNbIter, theMethod, theApprox);
|
||||
endService( " GEOM_Superv_i::MakeFilling" );
|
||||
return anObj;
|
||||
@ -2348,8 +2351,11 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFaces (GEOM::GEOM_Object_ptr theSha
|
||||
beginService( " GEOM_Superv_i::MakeGlueFaces" );
|
||||
MESSAGE("GEOM_Superv_i::MakeGlueFaces");
|
||||
getShapesOp();
|
||||
GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
|
||||
objList->length( 1 );
|
||||
objList[0] = theShape;
|
||||
GEOM::GEOM_Object_ptr anObj =
|
||||
myShapesOp->MakeGlueFaces(theShape, theTolerance, doKeepNonSolids);
|
||||
myShapesOp->MakeGlueFaces(objList, theTolerance, doKeepNonSolids);
|
||||
endService( " GEOM_Superv_i::MakeGlueFaces" );
|
||||
return anObj;
|
||||
}
|
||||
@ -2363,7 +2369,10 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::GetGlueFaces (GEOM::GEOM_Object_ptr theShape,
|
||||
beginService( " GEOM_Superv_i::GetGlueFaces" );
|
||||
MESSAGE("GEOM_Superv_i::GetGlueFaces");
|
||||
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));
|
||||
MESSAGE(" List of "<<aListPtr->GetList().length()<<" element(s)");
|
||||
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" );
|
||||
MESSAGE("GEOM_Superv_i::MakeGlueFacesByList");
|
||||
getShapesOp();
|
||||
GEOM::ListOfGO_var objList = new GEOM::ListOfGO;
|
||||
objList->length( 1 );
|
||||
objList[0] = theShape;
|
||||
GEOM::GEOM_Object_ptr anObj =
|
||||
myShapesOp->MakeGlueFacesByList(theShape, theTolerance, theFaces,
|
||||
myShapesOp->MakeGlueFacesByList(objList, theTolerance, theFaces,
|
||||
doKeepNonSolids, doGlueAllEdges);
|
||||
endService( " GEOM_Superv_i::MakeGlueFacesByList" );
|
||||
return anObj;
|
||||
|
@ -3725,14 +3725,15 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
self._autoPublish(anObj, theName, "revolution")
|
||||
return anObj
|
||||
|
||||
## Create a filling from the given compound of contours.
|
||||
# @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 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(see GEOM::filling_oper_method())
|
||||
## Create a face from a given set of contours.
|
||||
# @param theContours either a list or a compound of edges/wires.
|
||||
# @param theMinDeg a minimal 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 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
|
||||
# (see GEOM.filling_oper_method enum).
|
||||
# @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 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
|
||||
# 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"
|
||||
@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):
|
||||
"""
|
||||
Create a filling from the given compound of contours.
|
||||
Create a face from a given set of contours.
|
||||
|
||||
Parameters:
|
||||
theShape the compound of contours
|
||||
theMinDeg a minimal degree of BSpline surface to create
|
||||
theMaxDeg a maximal degree of BSpline surface to create
|
||||
theTol2D a 2d tolerance to be reached
|
||||
theTol3D a 3d tolerance to be reached
|
||||
theNbIter a number of iteration of approximation algorithm
|
||||
theMethod Kind of method to perform filling operation(see GEOM::filling_oper_method())
|
||||
theContours either a list or a compound of edges/wires.
|
||||
theMinDeg a minimal degree of BSpline surface to create.
|
||||
theMaxDeg a maximal degree of BSpline surface to create.
|
||||
theTol2D a 2d tolerance to be reached.
|
||||
theTol3D a 3d tolerance to be reached.
|
||||
theNbIter a number of iteration of approximation algorithm.
|
||||
theMethod Kind of method to perform filling operation
|
||||
(see GEOM.filling_oper_method enum).
|
||||
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 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.
|
||||
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.GEOM_Object, containing the created filling surface.
|
||||
New GEOM.GEOM_Object (face), containing the created filling surface.
|
||||
|
||||
Example of usage:
|
||||
filling = geompy.MakeFilling(compound, 2, 5, 0.0001, 0.0001, 5)
|
||||
"""
|
||||
# Example: see GEOM_TestAll.py
|
||||
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,
|
||||
theMethod, isApprox)
|
||||
RaiseIfFailed("MakeFilling", self.PrimOp)
|
||||
@ -3785,43 +3787,43 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
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
|
||||
## Create a face from a given set of contours.
|
||||
# This method corresponds to MakeFilling() with isApprox=True.
|
||||
# @param theContours either a list or a compound of edges/wires.
|
||||
# @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.
|
||||
# @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.GEOM_Object, containing the created filling surface.
|
||||
# @return New GEOM.GEOM_Object (face), containing the created filling surface.
|
||||
#
|
||||
# @ref tui_creation_filling "Example"
|
||||
@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.
|
||||
This method corresponds to MakeFilling with isApprox=True
|
||||
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
|
||||
theContours either a list or a compound of edges/wires.
|
||||
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.
|
||||
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.GEOM_Object, containing the created filling surface.
|
||||
New GEOM.GEOM_Object (face), 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,
|
||||
anObj = self.PrimOp.MakeFilling(theContours, theMinDeg, theMaxDeg,
|
||||
0, theTol3D, 0, GEOM.FOM_Default, True)
|
||||
RaiseIfFailed("MakeFillingNew", self.PrimOp)
|
||||
anObj.SetParameters(Parameters)
|
||||
@ -4500,7 +4502,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
New GEOM.GEOM_Object, containing the created face.
|
||||
"""
|
||||
# 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":
|
||||
print "WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built."
|
||||
else:
|
||||
@ -4574,6 +4576,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
New GEOM.GEOM_Object, containing the created solid.
|
||||
"""
|
||||
# Example: see GEOM_TestAll.py
|
||||
theShells = ToList(theShells)
|
||||
if len(theShells) == 1:
|
||||
descr = self._IsGoodForSolid(theShells[0])
|
||||
#if len(descr) > 0:
|
||||
@ -4609,7 +4612,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
New GEOM.GEOM_Object, containing the created compound.
|
||||
"""
|
||||
# Example: see GEOM_TestAll.py
|
||||
anObj = self.ShapesOp.MakeCompound(theShapes)
|
||||
anObj = self.ShapesOp.MakeCompound(ToList(theShapes))
|
||||
RaiseIfFailed("MakeCompound", self.ShapesOp)
|
||||
self._autoPublish(anObj, theName, "compound")
|
||||
return anObj
|
||||
|
@ -35,7 +35,8 @@
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
|
||||
//=================================================================================
|
||||
@ -105,7 +106,7 @@ void GenerationGUI_FillingDlg::Init()
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->LineEdit1->setReadOnly(true);
|
||||
|
||||
globalSelection(GEOM_COMPOUND);
|
||||
initSelection();
|
||||
|
||||
int SpecificStep1 = 1;
|
||||
double SpecificStep2 = 0.0001;
|
||||
@ -186,9 +187,24 @@ bool GenerationGUI_FillingDlg::ClickOnApply()
|
||||
return false;
|
||||
|
||||
initName();
|
||||
initSelection();
|
||||
|
||||
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()
|
||||
// purpose : Called when selection as changed or other case
|
||||
@ -199,18 +215,13 @@ void GenerationGUI_FillingDlg::SelectionIntoArgument()
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||
myCompound = getSelected(TopAbs_COMPOUND);
|
||||
if (myCompound) {
|
||||
if (myCompound->GetMaxShapeType() < GEOM::WIRE || myCompound->GetMinShapeType() > GEOM::EDGE) {
|
||||
myCompound.nullify();
|
||||
}
|
||||
else {
|
||||
QString aName = GEOMBase::GetName(myCompound.get());
|
||||
myEditCurrentArgument->setText(aName);
|
||||
QList<GEOM::GeomObjPtr> objs = getSelected(TopAbs_SHAPE, -1);
|
||||
GEOMBase::Synchronize(myObjects, objs);
|
||||
if ( !myObjects.isEmpty() ) {
|
||||
QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() );
|
||||
myEditCurrentArgument->setText( aName );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processPreview();
|
||||
}
|
||||
|
||||
@ -240,7 +251,7 @@ void GenerationGUI_FillingDlg::ActivateThisDialog()
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
globalSelection(GEOM_COMPOUND);
|
||||
initSelection();
|
||||
processPreview();
|
||||
}
|
||||
|
||||
@ -319,12 +330,12 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_FillingDlg::createOperation()
|
||||
//=================================================================================
|
||||
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->SpinBox3->isValid(msg, !IsPreview()) &&
|
||||
GroupPoints->SpinBox4->isValid(msg, !IsPreview()) &&
|
||||
GroupPoints->SpinBox5->isValid(msg, !IsPreview()) &&
|
||||
myCompound;
|
||||
myObjects.count() );
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -346,8 +357,13 @@ bool GenerationGUI_FillingDlg::execute(ObjectList& objects)
|
||||
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 =
|
||||
anOper->MakeFilling(myCompound.get(),
|
||||
anOper->MakeFilling(objList,
|
||||
GroupPoints->SpinBox1->value(),
|
||||
GroupPoints->SpinBox4->value(),
|
||||
GroupPoints->SpinBox2->value(),
|
||||
|
@ -53,9 +53,10 @@ protected:
|
||||
private:
|
||||
void Init();
|
||||
void enterEvent( QEvent* );
|
||||
void initSelection();
|
||||
|
||||
private:
|
||||
GEOM::GeomObjPtr myCompound; /* compound of curves */
|
||||
QList<GEOM::GeomObjPtr> myObjects;/* lit or compound of curves */
|
||||
DlgRef_1Sel5Spin1Check* GroupPoints;
|
||||
|
||||
private slots:
|
||||
|
Loading…
Reference in New Issue
Block a user