mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-15 10:08:35 +05:00
IMPs 19766 (Wire from unconnected edges) and 20004 (NumberOfSolids)
This commit is contained in:
parent
f465b18263
commit
8e1ef24a91
Binary file not shown.
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 16 KiB |
@ -6,12 +6,15 @@
|
||||
|
||||
\n You can create a \b Wire from several connected edges and wires by
|
||||
selecting them in the object browser or in the viewer holding Shift
|
||||
button.
|
||||
\n The \b Result will be a \b GEOM_Object (WIRE).
|
||||
button. Select \b Tolerance which will be used to check
|
||||
connections. If you use \b Tolerance more than 1e-07, and gap,
|
||||
covered by this tolerance, is detected, edges will be modified to
|
||||
connect in the middle of the gap.
|
||||
\n The \b Result will be a \b GEOM_Object (WIRE).
|
||||
|
||||
\n <b>TUI Command:</b> <em>geompy.MakeWire(ListOfShape)</em>
|
||||
\n <b>TUI Command:</b> <em>geompy.MakeWire(ListOfShape, Tolerance)</em>
|
||||
|
||||
<b>Arguments:</b> Name + List of connected wires or edges.
|
||||
<b>Arguments:</b> Name + List of connected wires or edges + Tolerance.
|
||||
|
||||
\n <b>Dialog Box:</b>
|
||||
|
||||
|
@ -40,11 +40,8 @@
|
||||
\anchor swig_MakeChamfer
|
||||
\until id_MakeChamfer
|
||||
|
||||
\anchor swig_NumberOfFaces
|
||||
\until Bad number of faces
|
||||
|
||||
\anchor swig_NumberOfEdges
|
||||
\until Bad number of edges
|
||||
\anchor swig_NumberOf
|
||||
\until Bad number of shapes
|
||||
|
||||
\anchor swig_MakeBlockExplode
|
||||
\until id_MakeBlockExplode
|
||||
|
@ -1202,9 +1202,12 @@ module GEOM
|
||||
/*!
|
||||
* Create a wire from the set of edges and wires.
|
||||
* \param theEdgesAndWires List of edge and/or wires.
|
||||
* \param theTolerance Maximum distance between vertices, that will be merged.
|
||||
* Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion()).
|
||||
* \return New GEOM_Object, containing the created wire.
|
||||
*/
|
||||
GEOM_Object MakeWire (in ListOfGO theEdgesAndWires);
|
||||
GEOM_Object MakeWire (in ListOfGO theEdgesAndWires,
|
||||
in double theTolerance);
|
||||
|
||||
/*!
|
||||
* Create a face on the given wire.
|
||||
@ -1358,6 +1361,15 @@ module GEOM
|
||||
*/
|
||||
long NumberOfEdges (in GEOM_Object theShape);
|
||||
|
||||
/*!
|
||||
* Count number of subshapes of type \a theShapeType in the given shape.
|
||||
* \param theShape Shape to count subshapes in.
|
||||
* \param theShapeType The type of subshapes to count.
|
||||
* \return Number of subshapes of type \a theShapeType in \a theShape.
|
||||
*/
|
||||
long NumberOfSubShapes (in GEOM_Object theShape,
|
||||
in long theShapeType);
|
||||
|
||||
/*!
|
||||
* Reverses an orientation the given shape.
|
||||
* \param theShape Shape to be reversed.
|
||||
|
@ -360,7 +360,8 @@ module GEOM
|
||||
//-----------------------------------------------------------//
|
||||
GEOM_Object MakeEdge (in GEOM_Object thePnt1,
|
||||
in GEOM_Object thePnt2) ;
|
||||
GEOM_Object MakeWire (in GEOM_List theEdgesAndWires) ;
|
||||
GEOM_Object MakeWire (in GEOM_List theEdgesAndWires,
|
||||
in double theTolerance) ;
|
||||
GEOM_Object MakeFace (in GEOM_Object theWire,
|
||||
in boolean isPlanarWanted) ;
|
||||
GEOM_Object MakeFaceWires (in GEOM_List theWires,
|
||||
|
@ -22,7 +22,7 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
// File : BuildGUI_WireDlg.cxx
|
||||
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
|
||||
//
|
||||
|
||||
#include "BuildGUI_WireDlg.h"
|
||||
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
@ -37,6 +37,7 @@
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
//=================================================================================
|
||||
// class : BuildGUI_WireDlg()
|
||||
@ -61,16 +62,22 @@ BuildGUI_WireDlg::BuildGUI_WireDlg( GeometryGUI* theGeometryGUI, QWidget* parent
|
||||
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
|
||||
mainFrame()->RadioButton3->close();
|
||||
|
||||
GroupPoints = new DlgRef_1Sel( centralWidget() );
|
||||
GroupArgs = new DlgRef_1Sel1Spin( centralWidget() );
|
||||
|
||||
GroupPoints->GroupBox1->setTitle( tr( "GEOM_WIRE_CONNECT" ) );
|
||||
GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
|
||||
GroupPoints->PushButton1->setIcon( image1 );
|
||||
GroupPoints->LineEdit1->setReadOnly( true );
|
||||
GroupArgs->GroupBox1->setTitle( tr( "GEOM_WIRE_CONNECT" ) );
|
||||
GroupArgs->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
|
||||
GroupArgs->PushButton1->setIcon( image1 );
|
||||
GroupArgs->LineEdit1->setReadOnly( true );
|
||||
|
||||
GroupArgs->TextLabel2->setText( tr( "GEOM_TOLERANCE" ) );
|
||||
double SpecificStep = 0.0001;
|
||||
double prec = Precision::Confusion();
|
||||
initSpinBox(GroupArgs->SpinBox_DX, prec, MAX_NUMBER, SpecificStep, 9);
|
||||
GroupArgs->SpinBox_DX->setValue(prec);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
|
||||
layout->setMargin( 0 ); layout->setSpacing( 6 );
|
||||
layout->addWidget( GroupPoints );
|
||||
layout->addWidget( GroupArgs );
|
||||
/***************************************************************/
|
||||
|
||||
setHelpFileName( "create_wire_page.html" );
|
||||
@ -97,8 +104,8 @@ BuildGUI_WireDlg::~BuildGUI_WireDlg()
|
||||
void BuildGUI_WireDlg::Init()
|
||||
{
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->LineEdit1->setReadOnly( true );
|
||||
myEditCurrentArgument = GroupArgs->LineEdit1;
|
||||
GroupArgs->LineEdit1->setReadOnly( true );
|
||||
|
||||
myOkEdgesAndWires = false;
|
||||
|
||||
@ -110,7 +117,7 @@ void BuildGUI_WireDlg::Init()
|
||||
/* signals and slots connections */
|
||||
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
|
||||
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( GroupArgs->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
@ -180,14 +187,14 @@ void BuildGUI_WireDlg::SelectionIntoArgument()
|
||||
void BuildGUI_WireDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
if ( send != GroupPoints->PushButton1 )
|
||||
if ( send != GroupArgs->PushButton1 )
|
||||
return;
|
||||
|
||||
TColStd_MapOfInteger aMap;
|
||||
aMap.Add( GEOM_WIRE );
|
||||
aMap.Add( GEOM_EDGE );
|
||||
globalSelection( aMap );
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
myEditCurrentArgument = GroupArgs->LineEdit1;
|
||||
|
||||
myEditCurrentArgument->setFocus();
|
||||
SelectionIntoArgument();
|
||||
@ -233,25 +240,25 @@ GEOM::GEOM_IOperations_ptr BuildGUI_WireDlg::createOperation()
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool BuildGUI_WireDlg::isValid( QString& )
|
||||
bool BuildGUI_WireDlg::isValid (QString& msg)
|
||||
{
|
||||
return myOkEdgesAndWires;
|
||||
bool ok = GroupArgs->SpinBox_DX->isValid(msg, !IsPreview());
|
||||
return myOkEdgesAndWires && ok;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : execute
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool BuildGUI_WireDlg::execute( ObjectList& objects )
|
||||
bool BuildGUI_WireDlg::execute (ObjectList& objects)
|
||||
{
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
anObj = GEOM::GEOM_IShapesOperations::_narrow(
|
||||
getOperation() )->MakeWire( myEdgesAndWires );
|
||||
anObj = GEOM::GEOM_IShapesOperations::_narrow(getOperation())->
|
||||
MakeWire(myEdgesAndWires, GroupArgs->SpinBox_DX->value());
|
||||
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -22,13 +22,13 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
// File : BuildGUI_WireDlg.h
|
||||
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
|
||||
//
|
||||
|
||||
#ifndef BUILDGUI_WIREDLG_H
|
||||
#define BUILDGUI_WIREDLG_H
|
||||
|
||||
#include <GEOMBase_Skeleton.h>
|
||||
|
||||
class DlgRef_1Sel;
|
||||
class DlgRef_1Sel1Spin;
|
||||
|
||||
//=================================================================================
|
||||
// class : BuildGUI_WireDlg
|
||||
@ -56,7 +56,7 @@ private:
|
||||
GEOM::ListOfGO myEdgesAndWires;
|
||||
bool myOkEdgesAndWires; /* to check when arguments is defined */
|
||||
|
||||
DlgRef_1Sel* GroupPoints;
|
||||
DlgRef_1Sel1Spin* GroupArgs;
|
||||
|
||||
private slots:
|
||||
void ClickOnOk();
|
||||
|
@ -18,7 +18,7 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
#include <GEOMImpl_I3DPrimOperations.hxx>
|
||||
@ -61,7 +61,6 @@
|
||||
#include <GEOMImpl_IPrism.hxx>
|
||||
#include <GEOMImpl_IPipe.hxx>
|
||||
#include <GEOMImpl_IRevolution.hxx>
|
||||
#include <GEOMImpl_IShapes.hxx>
|
||||
#include <GEOMImpl_IFilling.hxx>
|
||||
#include <GEOMImpl_IThruSections.hxx>
|
||||
#include <GEOMImpl_IPipeDiffSect.hxx>
|
||||
@ -1447,59 +1446,6 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle2Ways
|
||||
return aRevolution;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* MakeSolidShell
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSolidShell (Handle(GEOM_Object) theShell)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
if (theShell.IsNull()) return NULL;
|
||||
|
||||
//Add a new Solid object
|
||||
Handle(GEOM_Object) aSolid = GetEngine()->AddObject(GetDocID(), GEOM_SOLID);
|
||||
|
||||
//Add a new Solid function for creation a solid from a shell
|
||||
Handle(GEOM_Function) aFunction =
|
||||
aSolid->AddFunction(GEOMImpl_ShapeDriver::GetID(), SOLID_SHELL);
|
||||
if (aFunction.IsNull()) return NULL;
|
||||
|
||||
//Check if the function is set correctly
|
||||
if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL;
|
||||
|
||||
GEOMImpl_IShapes aCI (aFunction);
|
||||
|
||||
Handle(GEOM_Function) aRefShell = theShell->GetLastFunction();
|
||||
|
||||
if (aRefShell.IsNull()) return NULL;
|
||||
|
||||
aCI.SetBase(aRefShell);
|
||||
|
||||
//Compute the Solid value
|
||||
try {
|
||||
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||
OCC_CATCH_SIGNALS;
|
||||
#endif
|
||||
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||
SetErrorCode("Solid driver failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//Make a Python command
|
||||
GEOM::TPythonDump(aFunction) << aSolid << " = geompy.MakeSolid(" << theShell << ")";
|
||||
|
||||
SetErrorCode(OK);
|
||||
return aSolid;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* MakeFilling
|
||||
|
@ -18,7 +18,7 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#ifndef _GEOMImpl_I3DPrimOperations_HXX_
|
||||
#define _GEOMImpl_I3DPrimOperations_HXX_
|
||||
|
||||
@ -97,14 +97,16 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
|
||||
Handle(GEOM_Object) theAxis,
|
||||
double theAngle);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeSolidShell (Handle(GEOM_Object) theShell);
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeFilling (Handle(GEOM_Object) theShape,
|
||||
int theMinDeg, int theMaxDeg,
|
||||
double theTol2D, double theTol3D,
|
||||
int theNbIter, bool isApprox);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeFilling (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg, double theTol2D, double theTol3D, int theNbIter, bool isApprox);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeThruSections(const Handle(TColStd_HSequenceOfTransient)& theSeqSections,
|
||||
bool theModeSolid,
|
||||
double thePreci,
|
||||
bool theRuled);
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeThruSections
|
||||
(const Handle(TColStd_HSequenceOfTransient)& theSeqSections,
|
||||
bool theModeSolid,
|
||||
double thePreci,
|
||||
bool theRuled);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) MakePipeWithDifferentSections(
|
||||
const Handle(TColStd_HSequenceOfTransient)& theBases,
|
||||
|
@ -19,27 +19,27 @@
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// NOTE: This is an intreface to a function for the Shapes
|
||||
// (Wire, Face, Shell, Solid and Compound) creation.
|
||||
//
|
||||
// NOTE: This is an intreface to a function for the Shapes
|
||||
// (Wire, Face, Shell, Solid and Compound) creation.
|
||||
|
||||
#include "GEOM_Function.hxx"
|
||||
|
||||
#include "TColStd_HSequenceOfTransient.hxx"
|
||||
#include "TColStd_HArray1OfInteger.hxx"
|
||||
|
||||
#define SHAPE_ARG_SHAPES 1 // for Wire, Shell, Solid and Compound
|
||||
|
||||
#define SHAPE_ARG_BASE 2 // for Face, Solid and Sub-shape
|
||||
|
||||
#define SHAPE_ARG_PLANAR 3 // for Face
|
||||
|
||||
#define SHAPE_ARG_SUBTYPE 4 // for Sub-shape
|
||||
#define SHAPE_ARG_INDICES 5 // for Sub-shape
|
||||
|
||||
class GEOMImpl_IShapes
|
||||
{
|
||||
public:
|
||||
|
||||
enum {
|
||||
SHAPE_ARG_SHAPES = 1, // for Wire, Shell, Solid and Compound
|
||||
SHAPE_ARG_BASE = 2, // for Face, Solid and Sub-shape
|
||||
SHAPE_ARG_PLANAR = 3, // for Face
|
||||
SHAPE_ARG_SUBTYPE = 4, // for Sub-shape
|
||||
SHAPE_ARG_INDICES = 5, // for Sub-shape
|
||||
SHAPE_ARG_TOLERANCE = 6 // for Wire
|
||||
};
|
||||
|
||||
GEOMImpl_IShapes(Handle(GEOM_Function) theFunction): _func(theFunction) {}
|
||||
|
||||
void SetShapes(const Handle(TColStd_HSequenceOfTransient)& theShapes)
|
||||
@ -69,6 +69,11 @@ class GEOMImpl_IShapes
|
||||
Handle(TColStd_HArray1OfInteger) GetIndices()
|
||||
{ return _func->GetIntegerArray(SHAPE_ARG_INDICES); }
|
||||
|
||||
void SetTolerance(const Standard_Real theValue)
|
||||
{ _func->SetReal(SHAPE_ARG_TOLERANCE, theValue); }
|
||||
|
||||
Standard_Integer GetTolerance() { return _func->GetReal(SHAPE_ARG_TOLERANCE); }
|
||||
|
||||
private:
|
||||
|
||||
Handle(GEOM_Function) _func;
|
||||
|
@ -214,9 +214,71 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeEdge
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeWire
|
||||
(std::list<Handle(GEOM_Object)> theShapes)
|
||||
(std::list<Handle(GEOM_Object)> theShapes,
|
||||
const Standard_Real theTolerance)
|
||||
{
|
||||
return MakeShape(theShapes, GEOM_WIRE, WIRE_EDGES, "MakeWire");
|
||||
SetErrorCode(KO);
|
||||
|
||||
//Add a new object
|
||||
Handle(GEOM_Object) aWire = GetEngine()->AddObject(GetDocID(), GEOM_WIRE);
|
||||
|
||||
//Add a new function
|
||||
Handle(GEOM_Function) aFunction =
|
||||
aWire->AddFunction(GEOMImpl_ShapeDriver::GetID(), WIRE_EDGES);
|
||||
if (aFunction.IsNull()) return NULL;
|
||||
|
||||
//Check if the function is set correctly
|
||||
if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL;
|
||||
|
||||
GEOMImpl_IShapes aCI (aFunction);
|
||||
aCI.SetTolerance(theTolerance);
|
||||
|
||||
Handle(TColStd_HSequenceOfTransient) aShapesSeq = new TColStd_HSequenceOfTransient;
|
||||
|
||||
// Shapes
|
||||
std::list<Handle(GEOM_Object)>::iterator it = theShapes.begin();
|
||||
for (; it != theShapes.end(); it++) {
|
||||
Handle(GEOM_Function) aRefSh = (*it)->GetLastFunction();
|
||||
if (aRefSh.IsNull()) {
|
||||
SetErrorCode("NULL argument shape for the shape construction");
|
||||
return NULL;
|
||||
}
|
||||
aShapesSeq->Append(aRefSh);
|
||||
}
|
||||
aCI.SetShapes(aShapesSeq);
|
||||
|
||||
//Compute the shape
|
||||
try {
|
||||
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||
OCC_CATCH_SIGNALS;
|
||||
#endif
|
||||
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||
SetErrorCode("Shape driver failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//Make a Python command
|
||||
GEOM::TPythonDump pd (aFunction);
|
||||
pd << aWire << " = geompy.MakeWire([";
|
||||
|
||||
// Shapes
|
||||
it = theShapes.begin();
|
||||
if (it != theShapes.end()) {
|
||||
pd << (*it++);
|
||||
while (it != theShapes.end()) {
|
||||
pd << ", " << (*it++);
|
||||
}
|
||||
}
|
||||
pd << "])";
|
||||
|
||||
SetErrorCode(OK);
|
||||
return aWire;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -442,7 +504,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeCompound
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeShape
|
||||
(std::list<Handle(GEOM_Object)> theShapes,
|
||||
(std::list<Handle(GEOM_Object)> theShapes,
|
||||
const Standard_Integer theObjectType,
|
||||
const Standard_Integer theFunctionType,
|
||||
const TCollection_AsciiString& theMethodName)
|
||||
@ -1103,54 +1165,83 @@ TCollection_AsciiString GEOMImpl_IShapesOperations::GetShapeTypeString (Handle(G
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* NumberOfFaces
|
||||
* NumberOfSubShapes
|
||||
*/
|
||||
//=============================================================================
|
||||
Standard_Integer GEOMImpl_IShapesOperations::NumberOfFaces (Handle(GEOM_Object) theShape)
|
||||
Standard_Integer GEOMImpl_IShapesOperations::NumberOfSubShapes
|
||||
(Handle(GEOM_Object) theShape,
|
||||
const Standard_Integer theShapeType)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
Standard_Integer nb = 0;
|
||||
Standard_Integer nbShapes = 0;
|
||||
|
||||
if (theShape.IsNull()) return -1;
|
||||
TopoDS_Shape aShape = theShape->GetValue();
|
||||
if (aShape.IsNull()) return -1;
|
||||
|
||||
/*
|
||||
TopTools_MapOfShape mapShape;
|
||||
|
||||
TopExp_Explorer exp (aShape, TopAbs_FACE);
|
||||
for (; exp.More(); exp.Next())
|
||||
if (mapShape.Add(exp.Current()))
|
||||
nb++;
|
||||
if (aShape.ShapeType() == TopAbs_COMPOUND &&
|
||||
(TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE ||
|
||||
TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPSOLID ||
|
||||
TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPOUND)) {
|
||||
TopoDS_Iterator It (aShape, Standard_True, Standard_True);
|
||||
for (; It.More(); It.Next()) {
|
||||
if (mapShape.Add(It.Value())) {
|
||||
if (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE ||
|
||||
TopAbs_ShapeEnum(theShapeType) == It.Value().ShapeType()) {
|
||||
nbShapes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
TopExp_Explorer exp (aShape, TopAbs_ShapeEnum(theShapeType));
|
||||
for (; exp.More(); exp.Next())
|
||||
if (mapShape.Add(exp.Current()))
|
||||
nbShapes++;
|
||||
}
|
||||
*/
|
||||
|
||||
try {
|
||||
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||
OCC_CATCH_SIGNALS;
|
||||
#endif
|
||||
int iType, nbTypes [TopAbs_SHAPE];
|
||||
for (iType = 0; iType < TopAbs_SHAPE; ++iType)
|
||||
nbTypes[iType] = 0;
|
||||
nbTypes[aShape.ShapeType()]++;
|
||||
|
||||
TopTools_MapOfShape aMapOfShape;
|
||||
aMapOfShape.Add(aShape);
|
||||
TopTools_ListOfShape aListOfShape;
|
||||
aListOfShape.Append(aShape);
|
||||
|
||||
TopTools_ListIteratorOfListOfShape itL (aListOfShape);
|
||||
for (; itL.More(); itL.Next()) {
|
||||
TopoDS_Iterator it (itL.Value());
|
||||
for (; it.More(); it.Next()) {
|
||||
TopoDS_Shape s = it.Value();
|
||||
if (aMapOfShape.Add(s)) {
|
||||
aListOfShape.Append(s);
|
||||
nbTypes[s.ShapeType()]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE)
|
||||
nbShapes = aMapOfShape.Extent();
|
||||
else
|
||||
nbShapes = nbTypes[theShapeType];
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return -1;
|
||||
}
|
||||
|
||||
SetErrorCode(OK);
|
||||
return nb;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* NumberOfEdges
|
||||
*/
|
||||
//=============================================================================
|
||||
Standard_Integer GEOMImpl_IShapesOperations::NumberOfEdges (Handle(GEOM_Object) theShape)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
Standard_Integer nb = 0;
|
||||
|
||||
if (theShape.IsNull()) return -1;
|
||||
TopoDS_Shape aShape = theShape->GetValue();
|
||||
if (aShape.IsNull()) return -1;
|
||||
|
||||
TopTools_MapOfShape mapShape;
|
||||
|
||||
TopExp_Explorer exp (aShape, TopAbs_EDGE);
|
||||
for (; exp.More(); exp.Next())
|
||||
if (mapShape.Add(exp.Current()))
|
||||
nb++;
|
||||
|
||||
SetErrorCode(OK);
|
||||
return nb;
|
||||
return nbShapes;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -26,7 +26,7 @@
|
||||
// Project : SALOME
|
||||
// $Header$
|
||||
//=============================================================================
|
||||
//
|
||||
|
||||
#ifndef _GEOMImpl_IShapesOperations_HXX_
|
||||
#define _GEOMImpl_IShapesOperations_HXX_
|
||||
|
||||
@ -56,7 +56,8 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeEdge (Handle(GEOM_Object) thePoint1,
|
||||
Handle(GEOM_Object) thePoint2);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeWire (std::list<Handle(GEOM_Object)> theEdgesAndWires);
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeWire (std::list<Handle(GEOM_Object)> theEdgesAndWires,
|
||||
const Standard_Real theTolerance);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeFace (Handle(GEOM_Object) theWire, const bool isPlanarWanted);
|
||||
|
||||
@ -102,8 +103,8 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
|
||||
|
||||
Standard_EXPORT TCollection_AsciiString GetShapeTypeString (Handle(GEOM_Object) theShape);
|
||||
|
||||
Standard_EXPORT Standard_Integer NumberOfFaces (Handle(GEOM_Object) theShape);
|
||||
Standard_EXPORT Standard_Integer NumberOfEdges (Handle(GEOM_Object) theShape);
|
||||
Standard_EXPORT Standard_Integer NumberOfSubShapes (Handle(GEOM_Object) theShape,
|
||||
const Standard_Integer theShapeType);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) ReverseShape(Handle(GEOM_Object) theShapes);
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <GEOMImpl_ShapeDriver.hxx>
|
||||
|
||||
#include <GEOMImpl_IShapes.hxx>
|
||||
@ -29,6 +29,7 @@
|
||||
|
||||
// OCCT Includes
|
||||
#include <ShapeFix_Wire.hxx>
|
||||
#include <ShapeFix_Edge.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
@ -152,17 +153,37 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
||||
Standard_ConstructionError::Raise("Wire construction failed: several loops detected");
|
||||
} else if (aFW->StatusReorder(ShapeExtend_FAIL)) {
|
||||
Standard_ConstructionError::Raise("Wire construction failed");
|
||||
} else if (aFW->StatusReorder(ShapeExtend_DONE2)) {
|
||||
Standard_ConstructionError::Raise("Wire construction failed: some gaps detected");
|
||||
//} else if (aFW->StatusReorder(ShapeExtend_DONE2)) {
|
||||
// Standard_ConstructionError::Raise("Wire construction failed: some gaps detected");
|
||||
} else {
|
||||
}
|
||||
|
||||
// IMP 0019766: Building a Wire from unconnected edges by introducing a tolerance
|
||||
Standard_Real aTolerance = aCI.GetTolerance();
|
||||
if (aTolerance < Precision::Confusion())
|
||||
aTolerance = Precision::Confusion();
|
||||
|
||||
aFW->ClosedWireMode() = Standard_False;
|
||||
aFW->FixConnected();
|
||||
aFW->FixConnected(aTolerance);
|
||||
if (aFW->StatusConnected(ShapeExtend_FAIL)) {
|
||||
Standard_ConstructionError::Raise("Wire construction failed: cannot build connected wire");
|
||||
}
|
||||
|
||||
// IMP 0019766
|
||||
aFW->FixGapsByRangesMode() = Standard_True;
|
||||
if (aFW->FixGaps3d()) {
|
||||
Handle(ShapeExtend_WireData) sbwd = aFW->WireData();
|
||||
Handle(ShapeFix_Edge) aFe = new ShapeFix_Edge;
|
||||
for (Standard_Integer iedge = 1; iedge <= sbwd->NbEdges(); iedge++) {
|
||||
TopoDS_Edge aEdge = TopoDS::Edge(sbwd->Edge(iedge));
|
||||
aFe->FixVertexTolerance(aEdge);
|
||||
aFe->FixSameParameter(aEdge);
|
||||
}
|
||||
}
|
||||
else if (aFW->StatusGaps3d(ShapeExtend_FAIL)) {
|
||||
Standard_ConstructionError::Raise("Wire construction failed: cannot fix 3d gaps");
|
||||
}
|
||||
|
||||
aShape = aFW->WireAPIMake();
|
||||
}
|
||||
}
|
||||
@ -446,7 +467,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
||||
// Check shape validity
|
||||
BRepCheck_Analyzer ana (aShape, false);
|
||||
if (!ana.IsValid()) {
|
||||
Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result");
|
||||
//Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result");
|
||||
}
|
||||
|
||||
aFunction->SetValue(aShape);
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "GEOM_Object_i.hh"
|
||||
|
||||
#include <strstream>
|
||||
//#include <sstream>
|
||||
|
||||
#include "Utils_CorbaException.hxx"
|
||||
#include "OpUtil.hxx"
|
||||
@ -326,7 +327,8 @@ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
|
||||
// Prepare a file name to open
|
||||
TCollection_AsciiString aNameWithExt("");
|
||||
if (isMultiFile)
|
||||
aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath(theComponent->GetStudy()->URL())).c_str());
|
||||
aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath
|
||||
(theComponent->GetStudy()->URL())).c_str());
|
||||
aNameWithExt += TCollection_AsciiString("_GEOM.sgd");
|
||||
aSeq[0] = CORBA::string_dup(aNameWithExt.ToCString());
|
||||
// Build a full file name of temporary file
|
||||
@ -389,7 +391,8 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
|
||||
// Prepare a file name to open
|
||||
TCollection_AsciiString aNameWithExt("");
|
||||
if (isMultiFile)
|
||||
aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath(theComponent->GetStudy()->URL())).c_str());
|
||||
aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath
|
||||
(theComponent->GetStudy()->URL())).c_str());
|
||||
aNameWithExt += TCollection_AsciiString("_GEOM.sgd");
|
||||
TCollection_AsciiString aFullName = (TCollection_AsciiString((char*)aTmpDir.c_str()) + aNameWithExt);
|
||||
|
||||
@ -448,14 +451,16 @@ CORBA::Boolean GEOM_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) {
|
||||
// function : CopyFrom()
|
||||
// purpose :
|
||||
//============================================================================
|
||||
SALOMEDS::TMPFile* GEOM_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) {
|
||||
SALOMEDS::TMPFile* GEOM_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID)
|
||||
{
|
||||
// Declare a sequence of the byte to store the copied object
|
||||
SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile;
|
||||
|
||||
// Try to get GEOM_Object object by given SObject
|
||||
SALOMEDS::GenericAttribute_var anAttr;
|
||||
if (!theObject->FindAttribute(anAttr, "AttributeIOR")) return aStreamFile._retn();
|
||||
GEOM::GEOM_Object_var anObject = GEOM::GEOM_Object::_narrow(_orb->string_to_object(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value()));
|
||||
GEOM::GEOM_Object_var anObject = GEOM::GEOM_Object::_narrow
|
||||
(_orb->string_to_object(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value()));
|
||||
if (anObject->_is_nil()) return aStreamFile._retn();
|
||||
|
||||
aStreamFile = anObject->GetShapeStream();
|
||||
@ -1360,7 +1365,7 @@ char* GEOM_Gen_i::getObjectInfo(CORBA::Long studyId, const char* entry)
|
||||
aGeomObject = GEOM::GEOM_Object::_narrow(anObject);
|
||||
}
|
||||
|
||||
char* aTypeInfo = "Object";
|
||||
const char* aTypeInfo = "Object";
|
||||
if ( !aGeomObject->_is_nil() ) {
|
||||
GEOM::GEOM_IKindOfShape::shape_kind aKind;
|
||||
GEOM::ListOfLong_var anInts;
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "GEOM_Engine.hxx"
|
||||
#include "GEOM_Object.hxx"
|
||||
|
||||
#include <TopAbs.hxx>
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
|
||||
@ -90,7 +91,8 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdge
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeWire
|
||||
(const GEOM::ListOfGO& theEdgesAndWires)
|
||||
(const GEOM::ListOfGO& theEdgesAndWires,
|
||||
const CORBA::Double theTolerance)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
@ -110,7 +112,7 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeWire
|
||||
|
||||
// Make Solid
|
||||
Handle(GEOM_Object) anObject =
|
||||
GetOperations()->MakeWire(aShapes);
|
||||
GetOperations()->MakeWire(aShapes, theTolerance);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
@ -554,13 +556,7 @@ char* GEOM_IShapesOperations_i::GetShapeTypeString (GEOM::GEOM_Object_ptr theSha
|
||||
//=============================================================================
|
||||
CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theShape)
|
||||
{
|
||||
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
|
||||
if (aShape.IsNull()) return -1;
|
||||
|
||||
CORBA::Long aNb = GetOperations()->NumberOfFaces(aShape);
|
||||
if (!GetOperations()->IsDone()) return -1;
|
||||
|
||||
return aNb;
|
||||
return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_FACE));
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -569,11 +565,22 @@ CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theSh
|
||||
*/
|
||||
//=============================================================================
|
||||
CORBA::Long GEOM_IShapesOperations_i::NumberOfEdges (GEOM::GEOM_Object_ptr theShape)
|
||||
{
|
||||
return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_EDGE));
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* NumberOfSubShapes
|
||||
*/
|
||||
//=============================================================================
|
||||
CORBA::Long GEOM_IShapesOperations_i::NumberOfSubShapes (GEOM::GEOM_Object_ptr theShape,
|
||||
const CORBA::Long theShapeType)
|
||||
{
|
||||
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
|
||||
if (aShape.IsNull()) return -1;
|
||||
|
||||
CORBA::Long aNb = GetOperations()->NumberOfEdges(aShape);
|
||||
CORBA::Long aNb = GetOperations()->NumberOfSubShapes(aShape, theShapeType);
|
||||
if (!GetOperations()->IsDone()) return -1;
|
||||
|
||||
return aNb;
|
||||
|
@ -18,7 +18,7 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#ifndef _GEOM_IShapesOperations_i_HeaderFile
|
||||
#define _GEOM_IShapesOperations_i_HeaderFile
|
||||
|
||||
@ -45,7 +45,8 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
|
||||
GEOM::GEOM_Object_ptr MakeEdge (GEOM::GEOM_Object_ptr thePnt1,
|
||||
GEOM::GEOM_Object_ptr thePnt2);
|
||||
|
||||
GEOM::GEOM_Object_ptr MakeWire (const GEOM::ListOfGO& theEdgesAndWires);
|
||||
GEOM::GEOM_Object_ptr MakeWire (const GEOM::ListOfGO& theEdgesAndWires,
|
||||
const CORBA::Double theTolerance);
|
||||
|
||||
GEOM::GEOM_Object_ptr MakeFace (GEOM::GEOM_Object_ptr theWire,
|
||||
CORBA::Boolean isPlanarWanted);
|
||||
@ -63,7 +64,7 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
|
||||
|
||||
GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape,
|
||||
CORBA::Double theTolerance,
|
||||
CORBA::Boolean doKeepNonSolids);
|
||||
CORBA::Boolean doKeepNonSolids);
|
||||
|
||||
GEOM::ListOfGO* GetGlueFaces (GEOM::GEOM_Object_ptr theShape,
|
||||
CORBA::Double theTolerance);
|
||||
@ -95,6 +96,8 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
|
||||
|
||||
CORBA::Long NumberOfFaces (GEOM::GEOM_Object_ptr theShape);
|
||||
CORBA::Long NumberOfEdges (GEOM::GEOM_Object_ptr theShape);
|
||||
CORBA::Long NumberOfSubShapes (GEOM::GEOM_Object_ptr theShape,
|
||||
const CORBA::Long theShapeType);
|
||||
|
||||
GEOM::GEOM_Object_ptr ChangeOrientation (GEOM::GEOM_Object_ptr theShape);
|
||||
|
||||
|
@ -18,17 +18,17 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_OStream.hxx>
|
||||
|
||||
#include <GEOM_Object_i.hh>
|
||||
//#include <GEOM_Gen_i.hh>
|
||||
#include <GEOM_ISubShape.hxx>
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
|
||||
#include "utilities.h"
|
||||
#include <fstream>
|
||||
#include <strstream>
|
||||
//#include <sstream>
|
||||
|
||||
#include <OpUtil.hxx>
|
||||
#include <Utils_ExceptHandlers.hxx>
|
||||
|
@ -1886,14 +1886,15 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeEdge (GEOM::GEOM_Object_ptr thePnt1,
|
||||
//=============================================================================
|
||||
// MakeWire:
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeWire (GEOM::GEOM_List_ptr theEdgesAndWires)
|
||||
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeWire (GEOM::GEOM_List_ptr theEdgesAndWires,
|
||||
CORBA::Double theTolerance)
|
||||
{
|
||||
beginService( " GEOM_Superv_i::MakeWire" );
|
||||
MESSAGE("GEOM_Superv_i::MakeWire");
|
||||
if (GEOM_List_i<GEOM::ListOfGO>* aListImplEW =
|
||||
dynamic_cast<GEOM_List_i<GEOM::ListOfGO>*>(GetServant(theEdgesAndWires, myPOA).in())) {
|
||||
getShapesOp();
|
||||
GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeWire(aListImplEW->GetList());
|
||||
GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeWire(aListImplEW->GetList(), theTolerance);
|
||||
endService( " GEOM_Superv_i::MakeWire" );
|
||||
return anObj;
|
||||
}
|
||||
|
@ -438,7 +438,8 @@ public:
|
||||
//-----------------------------------------------------------//
|
||||
GEOM::GEOM_Object_ptr MakeEdge (GEOM::GEOM_Object_ptr thePnt1,
|
||||
GEOM::GEOM_Object_ptr thePnt2);
|
||||
GEOM::GEOM_Object_ptr MakeWire (GEOM::GEOM_List_ptr theEdgesAndWires);
|
||||
GEOM::GEOM_Object_ptr MakeWire (GEOM::GEOM_List_ptr theEdgesAndWires,
|
||||
CORBA::Double theTolerance);
|
||||
GEOM::GEOM_Object_ptr MakeFace (GEOM::GEOM_Object_ptr theWire,
|
||||
CORBA::Boolean isPlanarWanted);
|
||||
GEOM::GEOM_Object_ptr MakeFaceWires (GEOM::GEOM_List_ptr theWires,
|
||||
|
@ -203,16 +203,23 @@ def TestOtherOperations (geompy, math):
|
||||
[f_ind_1, f_ind_2, f_ind_3])
|
||||
id_MakeChamfer = geompy.addToStudy(MakeChamfer, "MakeChamfer")
|
||||
|
||||
# NumberOfFaces
|
||||
# NumberOf
|
||||
NumberOfFaces = geompy.NumberOfFaces(Box)
|
||||
if NumberOfFaces != 6:
|
||||
print "Bad number of faces in BOX!"
|
||||
|
||||
# NumberOfEdges
|
||||
NumberOfEdges = geompy.NumberOfEdges(Box)
|
||||
if NumberOfEdges != 12:
|
||||
print "Bad number of edges in BOX!"
|
||||
|
||||
NumberOfSolids = geompy.NumberOfSolids(Box)
|
||||
if NumberOfSolids != 1:
|
||||
print "Bad number of solids in BOX!"
|
||||
|
||||
NumberOfShapes = geompy.NumberOfSubShapes(Box, geompy.ShapeType["SHAPE"])
|
||||
if NumberOfShapes != 34:
|
||||
print "Bad number of shapes in BOX!"
|
||||
|
||||
# MakeBlockExplode
|
||||
Compound = geompy.MakeCompound([Box, Sphere])
|
||||
MakeBlockExplode = geompy.MakeBlockExplode(Compound, 6, 6)
|
||||
|
@ -1388,12 +1388,14 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
||||
|
||||
## Create a wire from the set of edges and wires.
|
||||
# @param theEdgesAndWires List of edges and/or wires.
|
||||
# @param theTolerance Maximum distance between vertices, that will be merged.
|
||||
# Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion()).
|
||||
# @return New GEOM_Object, containing the created wire.
|
||||
#
|
||||
# @ref tui_creation_wire "Example"
|
||||
def MakeWire(self,theEdgesAndWires):
|
||||
def MakeWire(self, theEdgesAndWires, theTolerance = 1e-07):
|
||||
# Example: see GEOM_TestAll.py
|
||||
anObj = self.ShapesOp.MakeWire(theEdgesAndWires)
|
||||
anObj = self.ShapesOp.MakeWire(theEdgesAndWires, theTolerance)
|
||||
RaiseIfFailed("MakeWire", self.ShapesOp)
|
||||
return anObj
|
||||
|
||||
@ -1475,8 +1477,8 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
||||
# @param theShape Shape to count faces of.
|
||||
# @return Quantity of faces.
|
||||
#
|
||||
# @ref swig_NumberOfFaces "Example"
|
||||
def NumberOfFaces(self,theShape):
|
||||
# @ref swig_NumberOf "Example"
|
||||
def NumberOfFaces(self, theShape):
|
||||
# Example: see GEOM_TestOthers.py
|
||||
nb_faces = self.ShapesOp.NumberOfFaces(theShape)
|
||||
RaiseIfFailed("NumberOfFaces", self.ShapesOp)
|
||||
@ -1486,13 +1488,36 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
||||
# @param theShape Shape to count edges of.
|
||||
# @return Quantity of edges.
|
||||
#
|
||||
# @ref swig_NumberOfEdges "Example"
|
||||
def NumberOfEdges(self,theShape):
|
||||
# @ref swig_NumberOf "Example"
|
||||
def NumberOfEdges(self, theShape):
|
||||
# Example: see GEOM_TestOthers.py
|
||||
nb_edges = self.ShapesOp.NumberOfEdges(theShape)
|
||||
RaiseIfFailed("NumberOfEdges", self.ShapesOp)
|
||||
return nb_edges
|
||||
|
||||
## Gives quantity of subshapes of type theShapeType in the given shape.
|
||||
# @param theShape Shape to count subshapes of.
|
||||
# @param theShapeType Type of subshapes to count.
|
||||
# @return Quantity of subshapes of given type.
|
||||
#
|
||||
# @ref swig_NumberOf "Example"
|
||||
def NumberOfSubShapes(self, theShape, theShapeType):
|
||||
# Example: see GEOM_TestOthers.py
|
||||
nb_ss = self.ShapesOp.NumberOfSubShapes(theShape, theShapeType)
|
||||
RaiseIfFailed("NumberOfSubShapes", self.ShapesOp)
|
||||
return nb_ss
|
||||
|
||||
## Gives quantity of solids in the given shape.
|
||||
# @param theShape Shape to count solids in.
|
||||
# @return Quantity of solids.
|
||||
#
|
||||
# @ref swig_NumberOf "Example"
|
||||
def NumberOfSolids(self, theShape):
|
||||
# Example: see GEOM_TestOthers.py
|
||||
nb_solids = self.ShapesOp.NumberOfSubShapes(theShape, ShapeType["SOLID"])
|
||||
RaiseIfFailed("NumberOfSolids", self.ShapesOp)
|
||||
return nb_solids
|
||||
|
||||
# end of l2_measure
|
||||
## @}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user