From 48993d6de411f24574aa16e053bf1ececcdcdad8 Mon Sep 17 00:00:00 2001 From: dmv Date: Tue, 19 Jan 2010 15:09:43 +0000 Subject: [PATCH] 0020654: [CEA 386] GetType() function --- .../input/geometrical_object_properties.doc | 85 +++++++++++++++ doc/salome/gui/GEOM/input/index.doc | 1 + src/GEOM_SWIG/geompyDC.py | 101 ++++++++++++++++++ 3 files changed, 187 insertions(+) create mode 100644 doc/salome/gui/GEOM/input/geometrical_object_properties.doc diff --git a/doc/salome/gui/GEOM/input/geometrical_object_properties.doc b/doc/salome/gui/GEOM/input/geometrical_object_properties.doc new file mode 100644 index 000000000..21b72f7f5 --- /dev/null +++ b/doc/salome/gui/GEOM/input/geometrical_object_properties.doc @@ -0,0 +1,85 @@ +/*! + +\page geometrical_obj_prop_page Geometrical Object Properties + +

Geometrical Object Type

+ +The Type property of the geometrical object specifies the +way the object has been created. It is an integer identifier that +has predefined value depending on the function type used for the +object creation. The type of the object can be retrieved using the +GetType() function. + +For example: the geometrical object created using MakeBox() +functions has type equal to 7. The shape imported from the BREP, +IGES, STEP or other CAD file, has type equal to 1. + +The possible values of the geometrical objects are listed in the table below: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IDSTRING
0COPY
1IMPORT
2POINT
3VECTOR
4PLANE
5LINE
6TORUS
7BOX
8CYLINDER
9CONE
10SPHERE
11PRISM
12REVOLUTION
13BOOLEAN
14PARTITION
15POLYLINE
16CIRCLE
17SPLINE
18ELLIPSE
19CIRC_ARC
20FILLET
21CHAMFER
22EDGE
23WIRE
24FACE
25SHELL
26SOLID
27COMPOUND
28SUBSHAPE
29PIPE
30ARCHIMEDE
31FILLING
32EXPLODE
33GLUED
34SKETCHER
35CDG
36FREE_BOUNDS
37GROUP
38BLOCK
39MARKER
40THRUSECTIONS
41COMPOUNDFILTER
42SHAPES_ON_SHAPE
43ELLIPSE_ARC
443DSKETCHER
45FILLET_2D
46FILLET_1D
+ +Also geompy.py module provides a helper function ShapeIdToType() +that allows converting of the geometrical object type id value +to its string representation. + +For example: +\code +import geompy +box = geompy.MakeBoxDXDYDZ(10,10,10) +type = geompy.ShapeIdToType(box.GetType()) +print type +\endcode + +The above code prints "BOX" value. + +*/ diff --git a/doc/salome/gui/GEOM/input/index.doc b/doc/salome/gui/GEOM/input/index.doc index 96045dd6f..d1485ef14 100644 --- a/doc/salome/gui/GEOM/input/index.doc +++ b/doc/salome/gui/GEOM/input/index.doc @@ -13,6 +13,7 @@ using a wide range of functions;
  • \subpage transform_geom_obj_page "transformation of geometrical objects" using various algorithms;
  • \subpage repairing_operations_page "optimization of geometrical objects";
  • +
  • \subpage geometrical_obj_prop_page "Geometrical object properties".
  • \subpage using_measurement_tools_page "provision of information about geometrical objects".
  • \subpage using_notebook_geom_page.
  • diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 1788293dd..13a4c5ef6 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -3898,6 +3898,107 @@ class geompyDC(GEOM._objref_GEOM_Gen): RaiseIfFailed("GetType", self.GroupOp) return aType + ## Convert a type of geom object from id to string value + # @param theId is a GEOM obect type id. + # + # @ref swig_GetType "Example" + def ShapeIdToType(self, theId): + if theId == 0: + return "COPY" + if theId == 1: + return "IMPORT" + if theId == 2: + return "POINT" + if theId == 3: + return "VECTOR" + if theId == 4: + return "PLANE" + if theId == 5: + return "LINE" + if theId == 6: + return "TORUS" + if theId == 7: + return "BOX" + if theId == 8: + return "CYLINDER" + if theId == 9: + return "CONE" + if theId == 10: + return "SPHERE" + if theId == 11: + return "PRISM" + if theId == 12: + return "REVOLUTION" + if theId == 13: + return "BOOLEAN" + if theId == 14: + return "PARTITION" + if theId == 15: + return "POLYLINE" + if theId == 16: + return "CIRCLE" + if theId == 17: + return "SPLINE" + if theId == 18: + return "ELLIPSE" + if theId == 19: + return "CIRC_ARC" + if theId == 20: + return "FILLET" + if theId == 21: + return "CHAMFER" + if theId == 22: + return "EDGE" + if theId == 23: + return "WIRE" + if theId == 24: + return "FACE" + if theId == 25: + return "SHELL" + if theId == 26: + return "SOLID" + if theId == 27: + return "COMPOUND" + if theId == 28: + return "SUBSHAPE" + if theId == 29: + return "PIPE" + if theId == 30: + return "ARCHIMEDE" + if theId == 31: + return "FILLING" + if theId == 32: + return "EXPLODE" + if theId == 33: + return "GLUED" + if theId == 34: + return "SKETCHER" + if theId == 35: + return "CDG" + if theId == 36: + return "FREE_BOUNDS" + if theId == 37: + return "GROUP" + if theId == 38: + return "BLOCK" + if theId == 39: + return "MARKER" + if theId == 40: + return "THRUSECTIONS" + if theId == 41: + return "COMPOUNDFILTER" + if theId == 42: + return "SHAPES_ON_SHAPE" + if theId == 43: + return "ELLIPSE_ARC" + if theId == 44: + return "3DSKETCHER" + if theId == 45: + return "FILLET_2D" + if theId == 46: + return "FILLET_1D" + return "Shape Id not exist." + ## Returns a main shape associated with the group # @param theGroup is a GEOM group for which a main shape object is requested # @return a GEOM object which is a main shape for theGroup -- 2.39.2