NPAL15298: geompy.KindOfShape(aShape) first version implemented.

This commit is contained in:
jfa 2007-03-29 12:18:36 +00:00
parent f6a196817c
commit db3bc223f3
7 changed files with 608 additions and 2 deletions

View File

@ -2114,6 +2114,51 @@ module GEOM
out string_array thePatterns);
};
/*!
* GEOM_IKindOfShape: namespace for shape_kind enumeration.
*/
interface GEOM_IKindOfShape
{
enum shape_kind {
NO_SHAPE,
// COMPOSITEs
COMPOUND,
COMPSOLID,
SHELL,
WIRE,
// SOLIDs
SPHERE,
CYLINDER,
BOX,
ROTATED_BOX,
TORUS,
CONE,
POLYHEDRON,
SOLID,
// FACEs
SPHERE2D,
CYLINDER2D,
TORUS2D,
CONE2D,
DISK,
ELLIPSE2D,
POLYGON,
PLANAR,
FACE,
// EDGEs
CIRCLE,
ARC,
ELLIPSE,
ARC_ELLIPSE,
LINE, // infinite segment
SEGMENT,
EDGE,
// VERTEX
VERTEX
};
};
/*!
* GEOM_IMeasureOperations: Interface for measurement (distance, whatis) and
* properties calculation (like Centre of Mass, Inertia, etc.).
@ -2121,6 +2166,21 @@ module GEOM
*/
interface GEOM_IMeasureOperations : GEOM_IOperations
{
/*!
* Get kind of theShape.
* \param theShape Shape to get a kind of.
* \param theIntegers Output. Integer and enumerated shape's parameters
* (kind of surface, closed/unclosed, number of edges, etc.)
* \param theDoubles Output. Double shape's parameters (coordinates, dimensions, etc.)
* \note Concrete meaning of each value, returned via \a theIntegers
* or \a theDoubles list depends on the kind of the shape.
* \return Returns a kind of shape in terms of <VAR>GEOM_IKindOfShape.shape_kind</VAR> enumeration.
*/
//short KindOfShape (in GEOM_Object theShape,
GEOM_IKindOfShape::shape_kind KindOfShape (in GEOM_Object theShape,
out ListOfLong theIntegers,
out ListOfDouble theDoubles);
/*!
* Get position (LCS) of theShape.
* \param theShape Shape to calculate position of.

View File

@ -39,12 +39,14 @@
#include <TDF_Tool.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepBndLib.hxx>
#include <BRepCheck.hxx>
#include <BRepCheck_Result.hxx>
#include <BRepCheck_ListIteratorOfListOfStatus.hxx>
#include <BRepGProp.hxx>
#include <BRepBndLib.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
#include <BRepGProp.hxx>
#include <BRepTools.hxx>
#include <Bnd_Box.hxx>
@ -63,8 +65,20 @@
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <GeomAbs_SurfaceType.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Plane.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_ToroidalSurface.hxx>
#include <Geom_ConicalSurface.hxx>
#include <Geom_SurfaceOfLinearExtrusion.hxx>
#include <Geom_SurfaceOfRevolution.hxx>
#include <Geom_BezierSurface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_OffsetSurface.hxx>
#include <gp_Pln.hxx>
#include <Standard_Failure.hxx>
@ -91,6 +105,350 @@ GEOMImpl_IMeasureOperations::~GEOMImpl_IMeasureOperations()
MESSAGE("GEOMImpl_IMeasureOperations::~GEOMImpl_IMeasureOperations");
}
//=============================================================================
/*! Get kind and parameters of the given shape.
*/
//=============================================================================
GEOMImpl_IMeasureOperations::ShapeKind GEOMImpl_IMeasureOperations::KindOfShape
(Handle(GEOM_Object) theShape,
Handle(TColStd_HSequenceOfInteger)& theIntegers,
Handle(TColStd_HSequenceOfReal)& theDoubles)
{
SetErrorCode(KO);
ShapeKind aKind = SK_NO_SHAPE;
if (theIntegers.IsNull()) theIntegers = new TColStd_HSequenceOfInteger;
else theIntegers->Clear();
if (theDoubles.IsNull()) theDoubles = new TColStd_HSequenceOfReal;
else theDoubles->Clear();
if (theShape.IsNull())
return aKind;
Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
if (aRefShape.IsNull()) return aKind;
TopoDS_Shape aShape = aRefShape->GetValue();
if (aShape.IsNull()) return aKind;
TopAbs_ShapeEnum aType = aShape.ShapeType();
switch (aType)
{
//??? geompy.kind.compound nb_solids nb_faces nb_edges nb_vertices
//??? geompy.kind.compsolid nb_solids nb_faces nb_edges nb_vertices
//? "nb_faces" - all faces or only 'standalone' faces?
case TopAbs_COMPOUND:
aKind = SK_COMPOUND;
//
break;
case TopAbs_COMPSOLID:
aKind = SK_COMPSOLID;
//
break;
case TopAbs_SHELL:
//geompy.kind.shell geompy.info.closed nb_faces nb_edges nb_vertices
//geompy.kind.shell geompy.info.unclosed nb_faces nb_edges nb_vertices
aKind = SK_SHELL;
//
break;
case TopAbs_WIRE:
//geompy.kind.wire geompy.info.closed nb_edges nb_vertices
//geompy.kind.wire geompy.info.unclosed nb_edges nb_vertices
aKind = SK_WIRE;
//
break;
case TopAbs_SOLID:
//geompy.kind.sphere xc yc zc R
//geompy.kind.cylinder xb yb zb dx dy dz R H
//geompy.kind.box xc yc zc dx dy dz
//geompy.kind.rotated_box xo yo zo zx zy zz xx xy xz dx dy dz
//geompy.kind.torus xc yc zc dx dy dz R_1 R_2
//geompy.kind.cone xb yb zb dx dy dz H R_1 R_2
//geompy.kind.polyhedron nb_faces nb_edges nb_vertices
//geompy.kind.solid nb_faces nb_edges nb_vertices
aKind = SK_SOLID;
//if () {
// aKind = SK_SPHERE;
// aKind = SK_CYLINDER;
// aKind = SK_BOX;
// aKind = SK_ROTATED_BOX;
// aKind = SK_TORUS;
// aKind = SK_CONE;
// aKind = SK_POLYHEDRON;
//}
break;
case TopAbs_FACE:
// geompy.kind.sphere2d xc yc zc R
// + geompy.kind.cylinder2d xb yb zb dx dy dz R H
// geompy.kind.torus2d xc yc zc dx dy dz R_1 R_2
// geompy.kind.cone2d xc yc zc dx dy dz R_1 R_2
// geompy.kind.disk xc yc zc dx dy dz R
// geompy.kind.ellipse2d xc yc zc dx dy dz R_1 R_2
// geompy.kind.polygon xo yo zo dx dy dz nb_edges nb_vertices
// + geompy.kind.planar xo yo zo dx dy dz nb_edges nb_vertices
// + geompy.kind.face nb_edges nb_vertices _surface_type_id_
aKind = SK_FACE;
{
TopoDS_Face aF = TopoDS::Face(aShape);
int nbWires = 0, nbEdges = 0, nbVertices = 0;
TopTools_MapOfShape mapShape;
TopExp_Explorer expw (aF, TopAbs_WIRE);
for (; expw.More(); expw.Next()) {
if (mapShape.Add(expw.Current())) {
//listShape.Append(expw.Current());
nbWires++;
}
}
mapShape.Clear();
TopExp_Explorer expe (aF, TopAbs_EDGE);
for (; expe.More(); expe.Next()) {
if (mapShape.Add(expe.Current())) {
//listShape.Append(expe.Current());
nbEdges++;
}
}
mapShape.Clear();
TopExp_Explorer expf (aF, TopAbs_VERTEX);
for (; expf.More(); expf.Next()) {
if (mapShape.Add(expf.Current())) {
//listShape.Append(expf.Current());
nbVertices++;
}
}
// Geometry
Handle(Geom_Surface) aGS = BRep_Tool::Surface(aF);
if (!aGS.IsNull()) {
BRepAdaptor_Surface aBAS (aF);
if (aGS->IsKind(STANDARD_TYPE(Geom_Plane))) {
// planar
aKind = SK_PLANAR;
Handle(Geom_Plane) aGPlane = Handle(Geom_Plane)::DownCast(aGS);
gp_Pln aPln = aGPlane->Pln();
gp_Ax3 aPos = aPln.Position();
gp_Pnt anOri = aPos.Location();
gp_Dir aDirZ = aPos.Direction();
//gp_Dir aDirX = aPos.XDirection();
// xo yo zo
theDoubles->Append(anOri.X());
theDoubles->Append(anOri.Y());
theDoubles->Append(anOri.Z());
// dx dy dz
theDoubles->Append(aDirZ.X());
theDoubles->Append(aDirZ.Y());
theDoubles->Append(aDirZ.Z());
// nb_edges nb_vertices (for planar only)
theIntegers->Append(nbEdges);
theIntegers->Append(nbVertices);
//if () {
// aKind = SK_DISK;
// aKind = SK_ELLIPSE2D;
// aKind = SK_POLYGON;
//}
}
else if (aGS->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
//if (/*isSphere*/false) {
if (aBAS.IsUClosed() && aBAS.IsVClosed()) { // does not work
Handle(Geom_SphericalSurface) aGSph = Handle(Geom_SphericalSurface)::DownCast(aGS);
// parameters
gp_Pnt aLoc = aGSph->Location();
Standard_Real rr = aGSph->Radius();
// xc yc zc
theDoubles->Append(aLoc.X());
theDoubles->Append(aLoc.Y());
theDoubles->Append(aLoc.Z());
// R
theDoubles->Append(rr);
aKind = SK_SPHERE2D;
}
else {
// nb_edges nb_vertices (for spherical only)
theIntegers->Append(nbEdges);
theIntegers->Append(nbVertices);
theIntegers->Append((Standard_Integer)GeomAbs_Sphere);
}
}
else if (aGS->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
// Pure cylinder or just a piece of cylindric surface
TopLoc_Location aL;
Handle(Geom_Surface) aGSLoc = BRep_Tool::Surface(aF, aL);
//aF.Orientation(TopAbs_FORWARD);
TopExp_Explorer ex (aF, TopAbs_EDGE);
Standard_Real uMin, uMax, vMin, vMax;
bool isCylinder = true;
for (; ex.More(); ex.Next()) {
// check all edges: pure cylinder has only one seam edge
// and two edges with const v parameter
TopoDS_Edge E = TopoDS::Edge(ex.Current());
if (BRep_Tool::IsClosed(E, aGSLoc, aL)) {
// seam edge
//TopoDS_Edge ERevr = E;
//ERevr.Reverse();
//Handle(Geom2d_Curve) pcRepl1 = BRep_Tool::CurveOnSurface(E , aF, f,l);
//Handle(Geom2d_Curve) pcRepl2 = BRep_Tool::CurveOnSurface(ERevr, aF, f,l);
}
else {
BRepTools::UVBounds(aF, E, uMin, uMax, vMin, vMax);
if (Abs(vMin - vMax) > Precision::Confusion())
// neither seam, nor v-constant
isCylinder = false;
}
}
if (isCylinder) {
aKind = SK_CYLINDER2D;
Handle(Geom_CylindricalSurface) aGCyl = Handle(Geom_CylindricalSurface)::DownCast(aGS);
// parameters
gp_Pnt aLoc = aGCyl->Location();
gp_Ax1 anAx = aGCyl->Axis();
gp_Dir aDir = anAx.Direction();
Standard_Real rr = aGCyl->Radius();
// xb yb zb
theDoubles->Append(aLoc.X());
theDoubles->Append(aLoc.Y());
theDoubles->Append(aLoc.Z());
// dx dy dz
theDoubles->Append(aDir.X());
theDoubles->Append(aDir.Y());
theDoubles->Append(aDir.Z());
// R
theDoubles->Append(rr);
// H
Standard_Real hh = Abs(aBAS.FirstVParameter() - aBAS.LastVParameter());
theDoubles->Append(hh);
}
else {
// nb_edges nb_vertices (for cylinrical only)
theIntegers->Append(nbEdges);
theIntegers->Append(nbVertices);
theIntegers->Append((Standard_Integer)GeomAbs_Cylinder);
}
}
else if (aGS->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) {
// aKind = SK_TORUS2D;
theIntegers->Append(nbEdges);
theIntegers->Append(nbVertices);
theIntegers->Append((Standard_Integer)GeomAbs_Torus);
}
else if (aGS->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) {
// aKind = SK_CONE2D;
theIntegers->Append(nbEdges);
theIntegers->Append(nbVertices);
theIntegers->Append((Standard_Integer)GeomAbs_Cone);
}
else if (aGS->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) {
//
theIntegers->Append(nbEdges);
theIntegers->Append(nbVertices);
theIntegers->Append((Standard_Integer)GeomAbs_SurfaceOfExtrusion);
}
else if (aGS->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) {
//
theIntegers->Append(nbEdges);
theIntegers->Append(nbVertices);
theIntegers->Append((Standard_Integer)GeomAbs_SurfaceOfRevolution);
}
else if (aGS->IsKind(STANDARD_TYPE(Geom_BezierSurface))) {
//
theIntegers->Append(nbEdges);
theIntegers->Append(nbVertices);
theIntegers->Append((Standard_Integer)GeomAbs_BezierSurface);
}
else if (aGS->IsKind(STANDARD_TYPE(Geom_BSplineSurface))) {
//
theIntegers->Append(nbEdges);
theIntegers->Append(nbVertices);
theIntegers->Append((Standard_Integer)GeomAbs_BSplineSurface);
}
else if (aGS->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) {
//
theIntegers->Append(nbEdges);
theIntegers->Append(nbVertices);
theIntegers->Append((Standard_Integer)GeomAbs_OffsetSurface);
}
else if (aGS->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
//
theIntegers->Append(nbEdges);
theIntegers->Append(nbVertices);
theIntegers->Append((Standard_Integer)GeomAbs_OtherSurface);
}
else {
// ???
theIntegers->Append(nbEdges);
theIntegers->Append(nbVertices);
theIntegers->Append((Standard_Integer)GeomAbs_OtherSurface);
}
}
}
break;
case TopAbs_EDGE:
//geompy.kind.circle xc yc zc dx dy dz R
//geompy.kind.arc xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2
//geompy.kind.ellipse xc yc zc dx dy dz R_1 R_2
//geompy.kind.arcEllipse xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2
//geompy.kind.line x1 y1 z1 x2 y2 z2
//geompy.kind.segment x1 y1 z1 x2 y2 z2
//geompy.kind.edge nb_vertices _curve_type_id_
aKind = SK_EDGE;
//if () {
// aKind = SK_CIRCLE;
// aKind = SK_ARC;
// aKind = SK_ELLIPSE;
// aKind = SK_ARC_ELLIPSE;
// aKind = SK_LINE;
// aKind = SK_SEGMENT;
//}
break;
case TopAbs_VERTEX:
//geompy.kind.VERTEX x y z
aKind = SK_VERTEX;
{
TopoDS_Vertex aV = TopoDS::Vertex(aShape);
gp_Pnt aP = BRep_Tool::Pnt(aV);
theDoubles->Append(aP.X());
theDoubles->Append(aP.Y());
theDoubles->Append(aP.Z());
}
break;
}
SetErrorCode(OK);
return aKind;
}
//=============================================================================
/*! Get LCS, corresponding to the given shape.

View File

@ -28,6 +28,8 @@
#include <TopTools_HSequenceOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_HSequenceOfInteger.hxx>
#include <TColStd_HSequenceOfReal.hxx>
#include <gp_Ax3.hxx>
class GEOM_Engine;
@ -38,6 +40,48 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations {
Standard_EXPORT GEOMImpl_IMeasureOperations(GEOM_Engine* theEngine, int theDocID);
Standard_EXPORT ~GEOMImpl_IMeasureOperations();
enum ShapeKind {
SK_NO_SHAPE,
// COMPOSITEs
SK_COMPOUND,
SK_COMPSOLID,
SK_SHELL,
SK_WIRE,
// SOLIDs
SK_SPHERE,
SK_CYLINDER,
SK_BOX,
SK_ROTATED_BOX,
SK_TORUS,
SK_CONE,
SK_POLYHEDRON,
SK_SOLID,
// FACEs
SK_SPHERE2D,
SK_CYLINDER2D,
SK_TORUS2D,
SK_CONE2D,
SK_DISK,
SK_ELLIPSE2D,
SK_POLYGON,
SK_PLANAR,
SK_FACE,
// EDGEs
SK_CIRCLE,
SK_ARC,
SK_ELLIPSE,
SK_ARC_ELLIPSE,
SK_LINE, // infinite segment
SK_SEGMENT,
SK_EDGE,
// VERTEX
SK_VERTEX
};
Standard_EXPORT ShapeKind KindOfShape (Handle(GEOM_Object) theShape,
Handle(TColStd_HSequenceOfInteger)& theIntegers,
Handle(TColStd_HSequenceOfReal)& theDoubles);
Standard_EXPORT void GetPosition (Handle(GEOM_Object) theShape,
Standard_Real& Ox, Standard_Real& Oy, Standard_Real& Oz,
Standard_Real& Zx, Standard_Real& Zy, Standard_Real& Zz,

View File

@ -50,6 +50,52 @@ GEOM_IMeasureOperations_i::~GEOM_IMeasureOperations_i()
MESSAGE("GEOM_IMeasureOperations_i::~GEOM_IMeasureOperations_i");
}
//=============================================================================
/*!
* KindOfShape
*/
//=============================================================================
GEOM::GEOM_IKindOfShape::shape_kind GEOM_IMeasureOperations_i::KindOfShape
(GEOM::GEOM_Object_ptr theShape,
GEOM::ListOfLong_out theIntegers,
GEOM::ListOfDouble_out theDoubles)
{
GEOMImpl_IMeasureOperations::ShapeKind aKind = GEOMImpl_IMeasureOperations::SK_NO_SHAPE;
// allocate the CORBA arrays
GEOM::ListOfLong_var anIntegersArray = new GEOM::ListOfLong();
GEOM::ListOfDouble_var aDoublesArray = new GEOM::ListOfDouble();
//Get the reference shape
Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
(theShape->GetStudyID(), theShape->GetEntry());
if (!aShape.IsNull()) {
Handle(TColStd_HSequenceOfInteger) anIntegers = new TColStd_HSequenceOfInteger;
Handle(TColStd_HSequenceOfReal) aDoubles = new TColStd_HSequenceOfReal;
// Detect kind of shape and parameters
aKind = GetOperations()->KindOfShape(aShape, anIntegers, aDoubles);
int nbInts = anIntegers->Length();
int nbDbls = aDoubles->Length();
anIntegersArray->length(nbInts);
aDoublesArray->length(nbDbls);
for (int ii = 0; ii < nbInts; ii++) {
anIntegersArray[ii] = anIntegers->Value(ii + 1);
}
for (int id = 0; id < nbDbls; id++) {
aDoublesArray[id] = aDoubles->Value(id + 1);
}
}
// initialize out-parameters with local arrays
theIntegers = anIntegersArray._retn();
theDoubles = aDoublesArray._retn();
return (GEOM::GEOM_IKindOfShape::shape_kind)aKind;
}
//=============================================================================
/*!

View File

@ -39,6 +39,10 @@ class GEOM_IMeasureOperations_i :
::GEOMImpl_IMeasureOperations* theImpl);
~GEOM_IMeasureOperations_i();
GEOM::GEOM_IKindOfShape::shape_kind KindOfShape (GEOM::GEOM_Object_ptr theShape,
GEOM::ListOfLong_out theIntegers,
GEOM::ListOfDouble_out theDoubles);
void GetPosition (GEOM::GEOM_Object_ptr theShape,
CORBA::Double& Ox, CORBA::Double& Oy, CORBA::Double& Oz,
CORBA::Double& Zx, CORBA::Double& Zy, CORBA::Double& Zz,

View File

@ -128,4 +128,22 @@ def TestMeasureOperations (geompy, math):
print "Z axis: (", Pos[3], ", ", Pos[4], ", ", Pos[5], ")"
print "X axis: (", Pos[6], ", ", Pos[7], ", ", Pos[8], ")"
####### KindOfShape #######
Kind = geompy.KindOfShape(box)
print "\nKindOfShape(box 10x30x70):", Kind
#if Kind[0] != geompy.kind.BOX:
# print "Error: returned type is", Kind[0], "while must be", geompy.kind.BOX
Kind = geompy.KindOfShape(p137)
print "\nKindOfShape(p137):", Kind
if Kind[0] != geompy.kind.VERTEX:
print " Error: returned type is", Kind[0], "while must be", geompy.kind.VERTEX
else:
dx = math.fabs(Kind[1] - 10)
dy = math.fabs(Kind[2] - 30)
dz = math.fabs(Kind[3] - 70)
if (dx + dy + dz) > 1e-5:
print " Error: coordinates are (", Kind[1], ",", Kind[2], ",", Kind[3], ") while must be (10, 20, 30)"
pass

View File

@ -143,6 +143,12 @@ def addToStudyInFather(aFather, aShape, aName):
ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
# -----------------------------------------------------------------------------
# enumeration shape_kind
# -----------------------------------------------------------------------------
kind = GEOM.GEOM_IKindOfShape
# -----------------------------------------------------------------------------
# Basic primitives
# -----------------------------------------------------------------------------
@ -1964,6 +1970,76 @@ def GetPosition(theShape):
print "GetPosition : ", MeasuOp.GetErrorCode()
return aTuple
## Get kind of theShape.
#
# @param theShape Shape to get a kind of.
# @return Returns a kind of shape in terms of <VAR>GEOM_IKindOfShape.shape_kind</VAR> enumeration
# and a list of parameters, describing the shape.
# @note Concrete meaning of each value, returned via \a theIntegers
# or \a theDoubles list depends on the kind of the shape.
# The full list of possible outputs is:
# Currently implemented cases are marked with '+' sign:
#
# geompy.kind.COMPOUND nb_solids nb_faces nb_edges nb_vertices
# geompy.kind.COMPSOLID nb_solids nb_faces nb_edges nb_vertices
#
# geompy.kind.SHELL geompy.info.closed nb_faces nb_edges nb_vertices
# geompy.kind.SHELL geompy.info.unclosed nb_faces nb_edges nb_vertices
#
# geompy.kind.WIRE geompy.info.closed nb_edges nb_vertices
# geompy.kind.WIRE geompy.info.unclosed nb_edges nb_vertices
#
# geompy.kind.SPHERE xc yc zc R
# geompy.kind.CYLINDER xb yb zb dx dy dz R H
# geompy.kind.BOX xc yc zc dx dy dz
# geompy.kind.ROTATED_BOX xo yo zo zx zy zz xx xy xz dx dy dz
# geompy.kind.TORUS xc yc zc dx dy dz R_1 R_2
# geompy.kind.CONE xb yb zb dx dy dz H R_1 R_2
# geompy.kind.POLYHEDRON nb_faces nb_edges nb_vertices
# geompy.kind.SOLID nb_faces nb_edges nb_vertices
#
# geompy.kind.SPHERE2D xc yc zc R
# + geompy.kind.CYLINDER2D xb yb zb dx dy dz R H
# geompy.kind.TORUS2D xc yc zc dx dy dz R_1 R_2
# geompy.kind.CONE2D xc yc zc dx dy dz R_1 R_2
# geompy.kind.DISK xc yc zc dx dy dz R
# geompy.kind.ELLIPSE2D xc yc zc dx dy dz R_1 R_2
# geompy.kind.POLYGON xo yo zo dx dy dz nb_edges nb_vertices
# + geompy.kind.PLANAR xo yo zo dx dy dz nb_edges nb_vertices
# + geompy.kind.FACE nb_edges nb_vertices _surface_type_id_
#
# geompy.kind.CIRCLE xc yc zc dx dy dz R
# geompy.kind.ARC xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2
# geompy.kind.ELLIPSE xc yc zc dx dy dz R_1 R_2
# geompy.kind.ARC_ELLIPSE xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2
# geompy.kind.LINE x1 y1 z1 x2 y2 z2
# geompy.kind.SEGMENT x1 y1 z1 x2 y2 z2
# geompy.kind.EDGE nb_vertices _curve_
#
# + geompy.kind.VERTEX x y z
#
# Example: see GEOM_TestMeasures.py
def KindOfShape(theShape):
aRoughTuple = MeasuOp.KindOfShape(theShape)
if MeasuOp.IsDone() == 0:
print "KindOfShape : ", MeasuOp.GetErrorCode()
return []
aKind = aRoughTuple[0]
anInts = aRoughTuple[1]
aDbls = aRoughTuple[2]
# Now there is no exception from this rule:
aKindTuple = [aKind] + aDbls + anInts
# If they are we will regroup parameters for such kind of shape.
# For example:
#if aKind == kind.SOME_KIND:
# # SOME_KIND int int double int double double
# aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
return aKindTuple
# -----------------------------------------------------------------------------
# Import/Export objects
# -----------------------------------------------------------------------------