# 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)
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
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>
\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
\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".
*/
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,
</message>
<message>
<source>GEOM_FILLING_COMPOUND</source>
- <translation>Input compound</translation>
+ <translation>Input contours</translation>
</message>
<message>
<source>GEOM_FILLING_MAX_DEG</source>
virtual bool isDraggable( const SUIT_DataObject* what ) const;
virtual bool isDropAccepted( const SUIT_DataObject* where ) const;
virtual void dropObjects( const DataObjectList& what,
- SUIT_DataObject* where,
- const int row, Qt::DropAction action );
+ SUIT_DataObject* where,
+ const int row, Qt::DropAction action );
public slots:
virtual bool deactivateModule( SUIT_Study* );
#include <Basics_OCCTVersion.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 <BRepBuilderAPI_MakeFace.hxx>
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
-#include <TopAbs.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Vertex.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 <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 <Precision.hxx>
+#include <ShapeFix_Face.hxx>
-#include <TColgp_SequenceOfPnt.hxx>
+#include <TColGeom_SequenceOfCurve.hxx>
#include <TColgp_Array1OfPnt.hxx>
+#include <TColgp_SequenceOfPnt.hxx>
-#include <Precision.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 <Standard_ConstructionError.hxx>
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();
+ Standard_Integer mindeg = IF.GetMinDeg();
+ Standard_Integer maxdeg = IF.GetMaxDeg();
+ Standard_Real tol3d = IF.GetTol3D();
Standard_Boolean isApprox = IF.GetApprox();
if (mindeg > maxdeg) {
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);
+ TopoDS_Edge NewEdge = BRepAlgo::ConcatenateWireC0(CurWire);
+ if (NewEdge.IsNull())
+ Standard_ConstructionError::Raise("Failed to join several edges into one");
+ Scurrent = NewEdge;
}
- if (NewEdge.IsNull()) {
- Standard_ConstructionError::Raise("The argument compound must contain only edges");
+ 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");
}
- Scurrent = NewEdge;
}
B.Add(aComp,Scurrent);
}
- aShape = aComp;
+ TopoDS_Shape 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_Real tol2d = IF.GetTol2D();
+ Standard_Integer nbiter = IF.GetNbIter();
Standard_Integer aMethod = IF.GetMethod();
GeomFill_SectionGenerator Section;
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" };
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRHA (Handle(GEOM_Object) thePnt,
- Handle(GEOM_Object) theVec,
- double theR, double theH, double theA)
+ Handle(GEOM_Object) theVec,
+ double theR, double theH, double theA)
{
SetErrorCode(KO);
* MakeFilling
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling
- (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg,
- double theTol2D, double theTol3D, int theNbIter,
- int theMethod, bool isApprox)
+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);
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);
//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);
Standard_EXPORT Handle(GEOM_Object) MakeDiskR (double theR, int theOrientation);
Standard_EXPORT Handle(GEOM_Object) MakeCylinderRH (double theR, double theH);
Standard_EXPORT Handle(GEOM_Object) MakeCylinderPntVecRH (Handle(GEOM_Object) thePnt,
- Handle(GEOM_Object) theVec,
- double theR, double theH);
+ Handle(GEOM_Object) theVec,
+ double theR, double theH);
Standard_EXPORT Handle(GEOM_Object) MakeCylinderRHA (double theR, double theH, double theA);
Standard_EXPORT Handle(GEOM_Object) MakeCylinderPntVecRHA (Handle(GEOM_Object) thePnt,
- Handle(GEOM_Object) theVec,
- double theR, double theH, double theA);
+ Handle(GEOM_Object) theVec,
+ double theR, double theH, double theA);
Standard_EXPORT Handle(GEOM_Object) MakeConeR1R2H (double theR1, double theR2, double theH);
Standard_EXPORT Handle(GEOM_Object) MakeConePntVecR1R2H (Handle(GEOM_Object) thePnt,
- Handle(GEOM_Object) theVec,
- double theR1, double theR2, double theH);
+ Handle(GEOM_Object) theVec,
+ double theR1, double theR2, double theH);
Standard_EXPORT Handle(GEOM_Object) MakeSphereR (double theR);
Standard_EXPORT Handle(GEOM_Object) MakeSpherePntR (Handle(GEOM_Object) thePnt, double theR);
Standard_EXPORT Handle(GEOM_Object) MakeTorusRR (double theRMajor, double theRMinor);
Standard_EXPORT Handle(GEOM_Object) MakeTorusPntVecRR (Handle(GEOM_Object) thePnt,
- Handle(GEOM_Object) theVec,
- double theRMajor, double theRMinor);
+ Handle(GEOM_Object) theVec,
+ double theRMajor, double theRMinor);
Standard_EXPORT Handle(GEOM_Object) MakePrismVecH (Handle(GEOM_Object) theBase,
Handle(GEOM_Object) theVec,
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,
//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) {}
-
+
void SetTol2D(double theTol2D) { _func->SetReal(FILL_ARG_TOL2D, theTol2D); }
- void SetTol3D(double theTol3D) { _func->SetReal(FILL_ARG_TOL3D, theTol3D); }
+ void SetTol3D(double theTol3D) { _func->SetReal(FILL_ARG_TOL3D, theTol3D); }
double GetTol2D() { return _func->GetReal(FILL_ARG_TOL2D); }
- double GetTol3D() { return _func->GetReal(FILL_ARG_TOL3D); }
-
+ double GetTol3D() { return _func->GetReal(FILL_ARG_TOL3D); }
+
void SetMinDeg(int theMinDeg) { _func->SetInteger(FILL_ARG_MINDEG, theMinDeg); }
void SetMaxDeg(int theMaxDeg) { _func->SetInteger(FILL_ARG_MAXDEG, theMaxDeg); }
int GetMinDeg() { return _func->GetInteger(FILL_ARG_MINDEG); }
int GetMaxDeg() { return _func->GetInteger(FILL_ARG_MAXDEG); }
void SetNbIter(int theNbIter) { _func->SetInteger(FILL_ARG_NBITER, theNbIter); }
- int GetNbIter() { return _func->GetInteger(FILL_ARG_NBITER); }
+ int GetNbIter() { return _func->GetInteger(FILL_ARG_NBITER); }
void SetApprox(bool theApprox) { _func->SetInteger(FILL_ARG_APPROX, theApprox); }
- bool GetApprox() { return _func->GetInteger(FILL_ARG_APPROX); }
+ bool GetApprox() { return _func->GetInteger(FILL_ARG_APPROX); }
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); }
Handle(GEOM_Function) GetShape() { return _func->GetReference(FILL_ARG_SHAPE); }
- private:
+private:
Handle(GEOM_Function) _func;
};
*/
//=============================================================================
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_I3DPrimOperations_i::MakeFilling(const GEOM::ListOfGO& theContours,
+ CORBA::Long theMinDeg,
+ CORBA::Long theMaxDeg,
+ CORBA::Double theTol2D,
+ CORBA::Double theTol3D,
+ CORBA::Long theNbIter,
GEOM::filling_oper_method theMethod,
- CORBA::Boolean theApprox)
+ CORBA::Boolean theApprox)
{
GEOM::GEOM_Object_var aGEOMObject;
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) {
//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();
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,
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;
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;
}
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" );
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;
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
# 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)
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)
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:
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:
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
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
-#include <TopoDS_Iterator.hxx>
+#include <TColStd_MapOfInteger.hxx>
+
#include <GEOMImpl_Types.hxx>
//=================================================================================
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setReadOnly(true);
- globalSelection(GEOM_COMPOUND);
+ initSelection();
int SpecificStep1 = 1;
double SpecificStep2 = 0.0001;
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
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();
}
GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
- globalSelection(GEOM_COMPOUND);
+ initSelection();
processPreview();
}
//=================================================================================
bool GenerationGUI_FillingDlg::isValid(QString& msg)
{
- 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;
+ 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()) &&
+ myObjects.count() );
return ok;
}
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;
+ case 0: aMethod = GEOM::FOM_Default; break;
+ case 1: aMethod = GEOM::FOM_UseOri; break;
+ case 2: aMethod = GEOM::FOM_AutoCorrect; 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 =
- anOper->MakeFilling(myCompound.get(),
- GroupPoints->SpinBox1->value(),
- GroupPoints->SpinBox4->value(),
- GroupPoints->SpinBox2->value(),
- GroupPoints->SpinBox5->value(),
- GroupPoints->SpinBox3->value(),
- aMethod,
- GroupPoints->CheckBox1->isChecked());
+ anOper->MakeFilling(objList,
+ GroupPoints->SpinBox1->value(),
+ GroupPoints->SpinBox4->value(),
+ GroupPoints->SpinBox2->value(),
+ GroupPoints->SpinBox5->value(),
+ GroupPoints->SpinBox3->value(),
+ aMethod,
+ GroupPoints->CheckBox1->isChecked());
if (!anObj->_is_nil())
{
if (!IsPreview())
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: