From 402eaa1b92aac5587b7caa530b4c833eb277503e Mon Sep 17 00:00:00 2001 From: gdd Date: Wed, 18 Apr 2012 09:17:03 +0000 Subject: [PATCH] Update doc --- doc/salome/gui/GEOM/input/angle.doc | 2 + doc/salome/gui/GEOM/input/basic_prop.doc | 2 + doc/salome/gui/GEOM/input/boudaries.doc | 2 + doc/salome/gui/GEOM/input/bounding_box.doc | 2 + doc/salome/gui/GEOM/input/center_mass.doc | 2 + ...pound.doc => check_compound_of_blocks.doc} | 4 +- ...tions.doc => check_self_intersections.doc} | 2 + doc/salome/gui/GEOM/input/check_shape.doc | 4 +- doc/salome/gui/GEOM/input/free_faces.doc | 4 +- doc/salome/gui/GEOM/input/inertia.doc | 2 + doc/salome/gui/GEOM/input/min_distance.doc | 2 + doc/salome/gui/GEOM/input/normal.doc | 6 + .../gui/GEOM/input/point_coordinates.doc | 2 + doc/salome/gui/GEOM/input/tolerance.doc | 2 + doc/salome/gui/GEOM/input/tui_angle.doc | 53 +++ .../gui/GEOM/input/tui_basic_properties.doc | 26 ++ .../gui/GEOM/input/tui_bounding_box.doc | 17 + .../gui/GEOM/input/tui_center_of_mass.doc | 25 + .../input/tui_check_compound_of_blocks.doc | 27 ++ .../input/tui_check_self_intersections.doc | 17 + doc/salome/gui/GEOM/input/tui_check_shape.doc | 17 + .../gui/GEOM/input/tui_free_boundaries.doc | 85 ++++ doc/salome/gui/GEOM/input/tui_free_faces.doc | 52 +++ doc/salome/gui/GEOM/input/tui_inertia.doc | 20 + .../gui/GEOM/input/tui_measurement_tools.doc | 437 +----------------- .../gui/GEOM/input/tui_min_distance.doc | 15 + doc/salome/gui/GEOM/input/tui_normal_face.doc | 23 + .../gui/GEOM/input/tui_point_coordinates.doc | 27 ++ .../gui/GEOM/input/tui_swig_examples.doc | 1 + .../gui/GEOM/input/tui_test_measures.doc | 54 +++ doc/salome/gui/GEOM/input/tui_tolerance.doc | 20 + doc/salome/gui/GEOM/input/tui_whatis.doc | 15 + .../GEOM/input/using_measurement_tools.doc | 6 +- doc/salome/gui/GEOM/input/whatis.doc | 2 + 34 files changed, 551 insertions(+), 426 deletions(-) rename doc/salome/gui/GEOM/input/{check_compound.doc => check_compound_of_blocks.doc} (87%) rename doc/salome/gui/GEOM/input/{self-intersections.doc => check_self_intersections.doc} (91%) create mode 100644 doc/salome/gui/GEOM/input/tui_angle.doc create mode 100644 doc/salome/gui/GEOM/input/tui_basic_properties.doc create mode 100644 doc/salome/gui/GEOM/input/tui_bounding_box.doc create mode 100644 doc/salome/gui/GEOM/input/tui_center_of_mass.doc create mode 100644 doc/salome/gui/GEOM/input/tui_check_compound_of_blocks.doc create mode 100644 doc/salome/gui/GEOM/input/tui_check_self_intersections.doc create mode 100644 doc/salome/gui/GEOM/input/tui_check_shape.doc create mode 100644 doc/salome/gui/GEOM/input/tui_free_boundaries.doc create mode 100644 doc/salome/gui/GEOM/input/tui_free_faces.doc create mode 100644 doc/salome/gui/GEOM/input/tui_inertia.doc create mode 100644 doc/salome/gui/GEOM/input/tui_min_distance.doc create mode 100644 doc/salome/gui/GEOM/input/tui_normal_face.doc create mode 100644 doc/salome/gui/GEOM/input/tui_point_coordinates.doc create mode 100644 doc/salome/gui/GEOM/input/tui_test_measures.doc create mode 100644 doc/salome/gui/GEOM/input/tui_tolerance.doc create mode 100644 doc/salome/gui/GEOM/input/tui_whatis.doc diff --git a/doc/salome/gui/GEOM/input/angle.doc b/doc/salome/gui/GEOM/input/angle.doc index d2c2f456f..17e6c94de 100644 --- a/doc/salome/gui/GEOM/input/angle.doc +++ b/doc/salome/gui/GEOM/input/angle.doc @@ -13,6 +13,8 @@ Shape1 and Shape2 are shapes between which the angle is computed. Another TUI command is geompy.GetAngleRadians(shape1,shape2), which returns the value of angle in radians. +See also a \ref tui_angle_page "TUI example". + \image html angle.png */ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/basic_prop.doc b/doc/salome/gui/GEOM/input/basic_prop.doc index 1245a8e85..2821eabd3 100644 --- a/doc/salome/gui/GEOM/input/basic_prop.doc +++ b/doc/salome/gui/GEOM/input/basic_prop.doc @@ -10,6 +10,8 @@ Python Tuple. \nTUI Command: geompy.BasicProperties(Shape), where \em Shape is a shape whose properties are inquired. +See also a \ref tui_basic_properties_page "TUI example". + \image html neo-basicprop.png */ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/boudaries.doc b/doc/salome/gui/GEOM/input/boudaries.doc index 6c7bdd631..65acdc06a 100644 --- a/doc/salome/gui/GEOM/input/boudaries.doc +++ b/doc/salome/gui/GEOM/input/boudaries.doc @@ -11,6 +11,8 @@ checked, \em NoError is false if an error occurred while checking free boundaries, \em ClosedWires is a list of closed free boundary wires, \em OpenWires is a list of open free boundary wires. +See also a \ref tui_free_boundaries_page "TUI example". + \image html repair9.png */ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/bounding_box.doc b/doc/salome/gui/GEOM/input/bounding_box.doc index 0cbfad142..fbb097781 100644 --- a/doc/salome/gui/GEOM/input/bounding_box.doc +++ b/doc/salome/gui/GEOM/input/bounding_box.doc @@ -18,6 +18,8 @@ Ymax, Zmin, Zmax). \n TUI Command: geompy.BoundingBox(Shape), where \em Shape is a shape for which a bounding box is computed. +See also a \ref tui_bounding_box_page "TUI example". + \image html measures5.png */ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/center_mass.doc b/doc/salome/gui/GEOM/input/center_mass.doc index 380b067ae..b4d8ce4e7 100644 --- a/doc/salome/gui/GEOM/input/center_mass.doc +++ b/doc/salome/gui/GEOM/input/center_mass.doc @@ -9,6 +9,8 @@ the selected geometrical object. \n TUI Command: geompy.MakeCDG(Shape), where \em Shape is the shape for which a center of gravity is computed. +See also a \ref tui_center_of_mass_page "TUI example". + \image html measures3.png */ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/check_compound.doc b/doc/salome/gui/GEOM/input/check_compound_of_blocks.doc similarity index 87% rename from doc/salome/gui/GEOM/input/check_compound.doc rename to doc/salome/gui/GEOM/input/check_compound_of_blocks.doc index 2557af09d..81d8379a0 100644 --- a/doc/salome/gui/GEOM/input/check_compound.doc +++ b/doc/salome/gui/GEOM/input/check_compound_of_blocks.doc @@ -1,6 +1,6 @@ /*! -\page check_compound_page Check Compound of Blocks +\page check_compound_of_blocks_page Check Compound of Blocks Checks whether a shape is a compound of glued blocks. To be considered as a compound of blocks, the given shape must satisfy the @@ -26,6 +26,8 @@ following conditions: is a valid compound of blocks. If it is true, then the validity flag is returned, and encountered errors are printed in the python console. +See also a \ref tui_check_compound_of_blocks_page "TUI example". + \image html measures10.png */ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/self-intersections.doc b/doc/salome/gui/GEOM/input/check_self_intersections.doc similarity index 91% rename from doc/salome/gui/GEOM/input/self-intersections.doc rename to doc/salome/gui/GEOM/input/check_self_intersections.doc index e5d2dea53..d1477bd66 100644 --- a/doc/salome/gui/GEOM/input/self-intersections.doc +++ b/doc/salome/gui/GEOM/input/check_self_intersections.doc @@ -15,6 +15,8 @@ and their limitations refer to this document. \n TUI Command: geompy.CheckSelfIntersections(theShape), where \em theShape is the shape checked for validity. +See also a \ref tui_check_self_intersections_page "TUI example". + \image html measures11.png */ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/check_shape.doc b/doc/salome/gui/GEOM/input/check_shape.doc index 46669f023..9ffbf5b9a 100644 --- a/doc/salome/gui/GEOM/input/check_shape.doc +++ b/doc/salome/gui/GEOM/input/check_shape.doc @@ -1,6 +1,6 @@ /*! -\page check_page Check Shape +\page check_shape_page Check Shape \n Checks the topology of the selected geometrical object and returns True if it is valid. Check also geometry checkbox allows to test the @@ -10,6 +10,8 @@ geometry as well. \n TUI Command: geompy.CheckShape(theShape, theIsCheckGeom = 0), where \em theShape is the shape checked for validity. +See also a \ref tui_check_shape_page "TUI example". + \image html measures9.png diff --git a/doc/salome/gui/GEOM/input/free_faces.doc b/doc/salome/gui/GEOM/input/free_faces.doc index 1985495b4..9ec0cb1f8 100644 --- a/doc/salome/gui/GEOM/input/free_faces.doc +++ b/doc/salome/gui/GEOM/input/free_faces.doc @@ -1,6 +1,6 @@ /*! -\page faces_page Check Free Faces +\page free_faces_page Check Free Faces Highlights all free faces of a given shape. A free face is a face which is not shared between two objects of the shape. @@ -12,6 +12,8 @@ face is a face which is not shared between two objects of the shape. TUI Command: GetFreeFacesIDs(Shape), where \em Shape is a shape to be checked. +See also a \ref tui_free_faces_page "TUI example". + \image html repair10.png */ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/inertia.doc b/doc/salome/gui/GEOM/input/inertia.doc index 2141c8b10..e489b029a 100644 --- a/doc/salome/gui/GEOM/input/inertia.doc +++ b/doc/salome/gui/GEOM/input/inertia.doc @@ -14,6 +14,8 @@ the relative moments of inertia in the form of Python Tuple a shape for which the own matrix of inertia and the relative moments of inertia are returned. +See also a \ref tui_inertia_page "TUI example". + \image html measures4.png */ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/min_distance.doc b/doc/salome/gui/GEOM/input/min_distance.doc index afcf7e926..690a17f3a 100644 --- a/doc/salome/gui/GEOM/input/min_distance.doc +++ b/doc/salome/gui/GEOM/input/min_distance.doc @@ -9,6 +9,8 @@ the coordinates of the vector of distance and shows the vector in the viewer. where \em Shape1 and \em Shape2 are shapes between which the minimal distance is computed. +See also a \ref tui_min_distance_page "TUI example". + \image html distance.png */ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/normal.doc b/doc/salome/gui/GEOM/input/normal.doc index 8127b38f0..aa2950b1f 100644 --- a/doc/salome/gui/GEOM/input/normal.doc +++ b/doc/salome/gui/GEOM/input/normal.doc @@ -5,6 +5,12 @@ \n Calculates the normal vector to the selected \b Face. The \b Point is a point of the \b Face, where the Normal should be calculated. +\n TUI Command: geompy.GetNormal(Face, OptionalPoint = None), where \em Face is +the face to define normale of and \em OptionalPoint is the point to compute the normal at. +If the point is not given, the normale is calculated at the center of mass. + +See also a \ref tui_normal_face_page "TUI example". + \image html normaletoface.png */ diff --git a/doc/salome/gui/GEOM/input/point_coordinates.doc b/doc/salome/gui/GEOM/input/point_coordinates.doc index b1dddfcde..d83f62ee1 100644 --- a/doc/salome/gui/GEOM/input/point_coordinates.doc +++ b/doc/salome/gui/GEOM/input/point_coordinates.doc @@ -8,6 +8,8 @@ Returns the coordinates of a point. \nTUI Command: geompy.PointCoordinates(Point), where \em Point is a point whose coordinates are inquired. +See also a \ref tui_point_coordinates_page "TUI example". + \image html measures1.png */ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/tolerance.doc b/doc/salome/gui/GEOM/input/tolerance.doc index 37b37ab72..3b84055f8 100644 --- a/doc/salome/gui/GEOM/input/tolerance.doc +++ b/doc/salome/gui/GEOM/input/tolerance.doc @@ -10,6 +10,8 @@ FaceMaxTol, EgdeMinTol, EgdeMaxTol, VertexMinTol, VertexMaxTol). \n TUI Command: geompy.Tolerance(Shape), where \em Shape is a shape for which minimal and maximal tolerances are returned. +See also a \ref tui_tolerance_page "TUI example". + \image html new-tolerance.png */ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/tui_angle.doc b/doc/salome/gui/GEOM/input/tui_angle.doc new file mode 100644 index 000000000..120000a68 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_angle.doc @@ -0,0 +1,53 @@ +/*! + +\page tui_angle_page Angle + +\code +import salome +salome.salome_init() + +import math +import geompy +geompy.init_geom(salome.myStudy) + +OX = geompy.MakeVectorDXDYDZ(10, 0,0) +OXY = geompy.MakeVectorDXDYDZ(10,10,0) + +# in one plane +Angle = geompy.GetAngle(OX, OXY) + +print "\nAngle between OX and OXY = ", Angle +if math.fabs(Angle - 45.0) > 1e-05: + print " Error: returned angle is", Angle, "while must be 45.0" + pass + +Angle = geompy.GetAngleRadians(OX, OXY) + +print "\nAngle between OX and OXY in radians = ", Angle +if math.fabs(Angle - math.pi/4) > 1e-05: + print " Error: returned angle is", Angle, "while must be pi/4" + pass + +# not in one plane +OXY_shift = geompy.MakeTranslation(OXY,10,-10,20) +Angle = geompy.GetAngle(OX, OXY_shift) + +print "Angle between OX and OXY_shift = ", Angle +if math.fabs(Angle - 45.0) > 1e-05: + print " Error: returned angle is", Angle, "while must be 45.0" + pass + +# not linear +pnt1 = geompy.MakeVertex(0, 0, 0) +pnt2 = geompy.MakeVertex(10, 0, 0) +pnt3 = geompy.MakeVertex(20, 10, 0) +arc = geompy.MakeArc(pnt1, pnt2, pnt3) +Angle = geompy.GetAngle(OX, arc) + +if (math.fabs(Angle + 1.0) > 1e-6 or geompy.MeasuOp.IsDone()): + print "Error. Angle must not be computed on curvilinear edges" + pass + +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_basic_properties.doc b/doc/salome/gui/GEOM/input/tui_basic_properties.doc new file mode 100644 index 000000000..4c01ec438 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_basic_properties.doc @@ -0,0 +1,26 @@ +/*! + +\page tui_basic_properties_page Basic Properties + +\code +import geompy +import math + +# create a box +box = geompy.MakeBoxDXDYDZ(100,30,100) +props = geompy.BasicProperties(box) +print "\nBox 100x30x100 Basic Properties:" +print " Wires length: ", props[0] +print " Surface area: ", props[1] +print " Volume : ", props[2] +length = math.sqrt((props[0] - 1840)*(props[0] - 1840)) +area = math.sqrt((props[1] - 32000)*(props[1] - 32000)) +volume = math.sqrt((props[2] - 300000)*(props[2] - 300000)) +if length > 1e-7 or area > 1e-7 or volume > 1e-7: + print "While must be:" + print " Wires length: ", 1840 + print " Surface area: ", 32000 + print " Volume : ", 300000. +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_bounding_box.doc b/doc/salome/gui/GEOM/input/tui_bounding_box.doc new file mode 100644 index 000000000..232ab13b4 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_bounding_box.doc @@ -0,0 +1,17 @@ +/*! + +\page tui_bounding_box_page Bounding Box + +\code +import geompy + +# create a box +box = geompy.MakeBoxDXDYDZ(100,30,100) +bb = geompy.BoundingBox(box) +print "\nBounding Box of box 100x30x100:" +print " Xmin = ", bb[0], ", Xmax = ", bb[1] +print " Ymin = ", bb[2], ", Ymax = ", bb[3] +print " Zmin = ", bb[4], ", Zmax = ", bb[5] +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_center_of_mass.doc b/doc/salome/gui/GEOM/input/tui_center_of_mass.doc new file mode 100644 index 000000000..9c9b6f659 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_center_of_mass.doc @@ -0,0 +1,25 @@ +/*! + +\page tui_center_of_mass_page Center of masses + +\code +import geompy +import math + +# create a box +box = geompy.MakeBoxDXDYDZ(100,30,100) +cm = geompy.MakeCDG(box) +if cm is None: + raise RuntimeError, "MakeCDG(box) failed" +else: + print "\nCentre of gravity of box has been successfully obtained:" + coords = geompy.PointCoordinates(cm) + print "(", coords[0], ", ", coords[1], ", ", coords[2], ")" + dx = math.sqrt((coords[0] - 50)*(coords[0] - 50)) + dy = math.sqrt((coords[1] - 15)*(coords[1] - 15)) + dz = math.sqrt((coords[2] - 50)*(coords[2] - 50)) + if dx > 1e-7 or dy > 1e-7 or dz > 1e-7: + print "But must be (50, 15, 50)" +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_check_compound_of_blocks.doc b/doc/salome/gui/GEOM/input/tui_check_compound_of_blocks.doc new file mode 100644 index 000000000..1bd2fe9bb --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_check_compound_of_blocks.doc @@ -0,0 +1,27 @@ +/*! + +\page tui_check_compound_of_blocks_page Check Compound of Blocks + +\code +import geompy +import salome +gg = salome.ImportComponentGUI("GEOM") + +# create boxes +box1 = geompy.MakeBox(0,0,0,100,50,100) +box2 = geompy.MakeBox(100,0,0,250,50,100) + +# make a compound +compound = geompy.MakeCompound([box1, box2]) + +# glue the faces of the compound +tolerance = 1e-5 +glue = geompy.MakeGlueFaces(compound, tolerance) +IsValid = geompy.CheckCompoundOfBlocks(glue) +if IsValid == 0: + raise RuntimeError, "Invalid compound created" +else: + print "\nCompound is valid" +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_check_self_intersections.doc b/doc/salome/gui/GEOM/input/tui_check_self_intersections.doc new file mode 100644 index 000000000..e49de0a30 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_check_self_intersections.doc @@ -0,0 +1,17 @@ +/*! + +\page tui_check_self_intersections_page Detect Self-intersections + +\code +import geompy + +# create a box +box = geompy.MakeBoxDXDYDZ(100,30,100) +IsValid = geompy.CheckSelfIntersections(box) +if IsValid == 0: + raise RuntimeError, "Box with self-intersections created" +else: + print "\nBox is valid" +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_check_shape.doc b/doc/salome/gui/GEOM/input/tui_check_shape.doc new file mode 100644 index 000000000..f9ca32c97 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_check_shape.doc @@ -0,0 +1,17 @@ +/*! + +\page tui_check_shape_page Check Shape + +\code +import geompy + +# create a box +box = geompy.MakeBoxDXDYDZ(100,30,100) +IsValid = geompy.CheckShape(box) +if IsValid == 0: + raise RuntimeError, "Invalid box created" +else: + print "\nBox is valid" +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_free_boundaries.doc b/doc/salome/gui/GEOM/input/tui_free_boundaries.doc new file mode 100644 index 000000000..b764df1b2 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_free_boundaries.doc @@ -0,0 +1,85 @@ +/*! + +\page tui_free_boundaries_page Check Free Boundaries + +\code +import os +import geompy +import salome +gg = salome.ImportComponentGUI("GEOM") + +# create boxes +box1 = geompy.MakeBox(0,0,0,100,50,100) +box2 = geompy.MakeBox(100,0,0,250,50,100) + +# make a compound +compound = geompy.MakeCompound([box1, box2]) + +# import from *.brep +ImportFromBREP = geompy.ImportBREP(os.getenv("DATA_DIR")+"/Shapes/Brep/flight_solid.brep") + +# get a face +faces = geompy.SubShapeAllSortedCentres(ImportFromBREP, geompy.ShapeType["FACE"]) + +# get the free boundary for face 32 +Res = geompy.GetFreeBoundary(faces[32]) +isSuccess = Res[0] +ClosedWires = Res[1] +OpenWires = Res[2] + +if isSuccess == 1 : + print "Checking free boudaries is OK." +else : + print "Checking free boudaries is KO!" +print "len(ClosedWires) = ", len(ClosedWires) + +i = 0 +for wire in ClosedWires : + wire_name = "Face 32 -> Close wires : WIRE %d"%(i+1) + geompy.addToStudy(ClosedWires[i], wire_name) + if i < len(ClosedWires) : + i = i+ 1 + +print "len(OpenWires) = ", len(OpenWires) + +i = 0 +for wire in OpenWires : + wire_name = "Face 32 -> Open wires : WIRE %d"%(i+1) + geompy.addToStudy(OpenWires[i], wire_name) + if i < len(OpenWires) : + i = i+ 1 + +# get the free boundary for face 41 +Res = geompy.GetFreeBoundary(faces[41]) +isSuccess = Res[0] +ClosedWires = Res[1] +OpenWires = Res[2] + +if isSuccess == 1 : + print "Checking free boudaries is OK." +else : + print "Checking free boudaries is KO!" +print "len(ClosedWires) = ", len(ClosedWires) + +i = 0 +for wire in ClosedWires : + wire_name = "Face 41 -> Close wires : WIRE %d"%(i+1) + geompy.addToStudy(ClosedWires[i], wire_name) + if i < len(ClosedWires) : + i = i+ 1 + +print "len(OpenWires) = ", len(OpenWires) + +i = 0 +for wire in OpenWires : + wire_name = "Face 41 -> Open wires : WIRE %d"%(i+1) + geompy.addToStudy(OpenWires[i], wire_name) + if i < len(OpenWires) : + i = i+ 1 + +# add the imported object to the study +id_ImportFromBREP = geompy.addToStudy(ImportFromBREP, "ImportFromBREP") +salome.sg.updateObjBrowser(1) +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_free_faces.doc b/doc/salome/gui/GEOM/input/tui_free_faces.doc new file mode 100644 index 000000000..7fd302288 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_free_faces.doc @@ -0,0 +1,52 @@ +/*! + +\page tui_free_faces_page Check Free Faces + +\code +import geompy +import salome +gg = salome.ImportComponentGUI("GEOM") + +# create a vertex and a vector +p1 = geompy.MakeVertex(35, 35, 0) +p2 = geompy.MakeVertex(35, 35, 50) +v = geompy.MakeVector(p1, p2) + +# create a cylinder +cylinder = geompy.MakeCone(p1, v, 30, 20, 20) + +# create a cone +cone = geompy.MakeCone(p1, v, 70, 40, 60) + +# make cut +cut = geompy.MakeCut(cone, cylinder) + +# get faces as sub-shapes +faces = [] +faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"]) +f_2 = geompy.GetSubShapeID(cut, faces[0]) + +# remove one face from the shape +cut_without_f_2 = geompy.SuppressFaces(cut, [f_2]) + +# suppress the specified wire +result = geompy.GetFreeFacesIDs(cut_without_f_2) +print "A number of free faces is ", len(result) + +# add objects in the study +all_faces = geompy.SubShapeAllSortedCentres(cut_without_f_2, geompy.ShapeType["FACE"]) +for face in all_faces : + sub_shape_id = geompy.GetSubShapeID(cut_without_f_2, face) + if result.count(sub_shape_id) > 0 : + face_name = "Free face %d"%(sub_shape_id) + geompy.addToStudy(face, face_name) + +# in this example all faces from cut_without_f_2 are free +id_cut_without_f_2 = geompy.addToStudy(cut_without_f_2, "Cut without f_2") + +# display the results +gg.createAndDisplayGO(id_cut_without_f_2) +gg.setDisplayMode(id_cut_without_f_2,1) +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_inertia.doc b/doc/salome/gui/GEOM/input/tui_inertia.doc new file mode 100644 index 000000000..29530e292 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_inertia.doc @@ -0,0 +1,20 @@ +/*! + +\page tui_inertia_page Inertia + +\code +import geompy +import math + +# create a box +box = geompy.MakeBoxDXDYDZ(100,30,100) +In = geompy.Inertia(box) +print "\nInertia matrix of box 100x30x100:" +print " (", In[0], ", ", In[1], ", ", In[2], ")" +print " (", In[3], ", ", In[4], ", ", In[5], ")" +print " (", In[6], ", ", In[7], ", ", In[8], ")" +print "Main moments of inertia of box 100x30x100:" +print " Ix = ", In[9], ", Iy = ", In[10], ", Iz = ", In[11] +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_measurement_tools.doc b/doc/salome/gui/GEOM/input/tui_measurement_tools.doc index c36edc455..4ce9b4239 100644 --- a/doc/salome/gui/GEOM/input/tui_measurement_tools.doc +++ b/doc/salome/gui/GEOM/input/tui_measurement_tools.doc @@ -2,425 +2,22 @@ \page tui_measurement_tools_page Measurement Tools -

Point Coordinates

- -\code -import math -import geompy - -# create a point -point = geompy.MakeVertex(15., 23., 80.) - -# get the coordinates of the point and check its values -coords = geompy.PointCoordinates(point) - -# check the obtained coordinate values -tolerance = 1.e-07 -def IsEqual(val1, val2): return (math.fabs(val1 - val2) < tolerance) - -if IsEqual(coords[0], 15.) and IsEqual(coords[1], 23.) and IsEqual(coords[2], 80.): - print "All values are OK." -else : - print "Coordinates of point must be (15, 23, 80), but returned (", - print coords[0], ", ", coords[1], ", ", coords[2], ")" - pass -\endcode - -

Basic Properties

- -\code -import geompy -import math - -# create a box -box = geompy.MakeBoxDXDYDZ(100,30,100) -props = geompy.BasicProperties(box) -print "\nBox 100x30x100 Basic Properties:" -print " Wires length: ", props[0] -print " Surface area: ", props[1] -print " Volume : ", props[2] -length = math.sqrt((props[0] - 1840)*(props[0] - 1840)) -area = math.sqrt((props[1] - 32000)*(props[1] - 32000)) -volume = math.sqrt((props[2] - 300000)*(props[2] - 300000)) -if length > 1e-7 or area > 1e-7 or volume > 1e-7: - print "While must be:" - print " Wires length: ", 1840 - print " Surface area: ", 32000 - print " Volume : ", 300000. -\endcode - -

Center of masses

- -\code -import geompy -import math - -# create a box -box = geompy.MakeBoxDXDYDZ(100,30,100) -cm = geompy.MakeCDG(box) -if cm is None: - raise RuntimeError, "MakeCDG(box) failed" -else: - print "\nCentre of gravity of box has been successfully obtained:" - coords = geompy.PointCoordinates(cm) - print "(", coords[0], ", ", coords[1], ", ", coords[2], ")" - dx = math.sqrt((coords[0] - 50)*(coords[0] - 50)) - dy = math.sqrt((coords[1] - 15)*(coords[1] - 15)) - dz = math.sqrt((coords[2] - 50)*(coords[2] - 50)) - if dx > 1e-7 or dy > 1e-7 or dz > 1e-7: - print "But must be (50, 15, 50)" -\endcode - -

Get vertex by index

- -\code -import geompy - -# Create auxiliary objects -Vertex_1 = geompy.MakeVertex(0, 0, 0) -Vertex_2 = geompy.MakeVertex(10, 20, 0) -Vertex_3 = geompy.MakeVertex(0, 40, 0) -Vertex_4 = geompy.MakeVertex(-10, 60, 0) -Vertex_5 = geompy.MakeVertex(0, 80, 0) -Curve_1 = geompy.MakeInterpol([Vertex_1, Vertex_2, Vertex_3]) -Curve_2 = geompy.MakeInterpol([Vertex_5, Vertex_4, Vertex_3]) -Wire_1 = geompy.MakeWire([Curve_1, Curve_2]) -Reversed_Wire = geompy.ChangeOrientationShellCopy(Wire_1) - -# Get The vertexes from Reversed Wire by different functions -vertex_0 = geompy.GetFirstVertex(Reversed_Wire) -vertex_1 = geompy.GetVertexByIndex(Reversed_Wire, 1) -vertex_2 = geompy.GetLastVertex(Reversed_Wire) - -# Publish objects in study -geompy.addToStudy( Wire_1, "Wire_1" ) -geompy.addToStudy( Reversed_Wire, "Reversed_Wire" ) -geompy.addToStudy( vertex_0, "vertex_0" ) -geompy.addToStudy( vertex_1, "vertex_1" ) -geompy.addToStudy( vertex_2, "vertex_2" ) -\endcode - -

Inertia

- -\code -import geompy -import math - -# create a box -box = geompy.MakeBoxDXDYDZ(100,30,100) -In = geompy.Inertia(box) -print "\nInertia matrix of box 100x30x100:" -print " (", In[0], ", ", In[1], ", ", In[2], ")" -print " (", In[3], ", ", In[4], ", ", In[5], ")" -print " (", In[6], ", ", In[7], ", ", In[8], ")" -print "Main moments of inertia of box 100x30x100:" -print " Ix = ", In[9], ", Iy = ", In[10], ", Iz = ", In[11] -\endcode - -

Check Free Boundaries

- -\code -import os -import geompy -import salome -gg = salome.ImportComponentGUI("GEOM") - -# create boxes -box1 = geompy.MakeBox(0,0,0,100,50,100) -box2 = geompy.MakeBox(100,0,0,250,50,100) - -# make a compound -compound = geompy.MakeCompound([box1, box2]) - -# import from *.brep -ImportFromBREP = geompy.ImportBREP(os.getenv("DATA_DIR")+"/Shapes/Brep/flight_solid.brep") - -# get a face -faces = geompy.SubShapeAllSortedCentres(ImportFromBREP, geompy.ShapeType["FACE"]) - -# get the free boundary for face 32 -Res = geompy.GetFreeBoundary(faces[32]) -isSuccess = Res[0] -ClosedWires = Res[1] -OpenWires = Res[2] - -if isSuccess == 1 : - print "Checking free boudaries is OK." -else : - print "Checking free boudaries is KO!" -print "len(ClosedWires) = ", len(ClosedWires) - -i = 0 -for wire in ClosedWires : - wire_name = "Face 32 -> Close wires : WIRE %d"%(i+1) - geompy.addToStudy(ClosedWires[i], wire_name) - if i < len(ClosedWires) : - i = i+ 1 - -print "len(OpenWires) = ", len(OpenWires) - -i = 0 -for wire in OpenWires : - wire_name = "Face 32 -> Open wires : WIRE %d"%(i+1) - geompy.addToStudy(OpenWires[i], wire_name) - if i < len(OpenWires) : - i = i+ 1 - -# get the free boundary for face 41 -Res = geompy.GetFreeBoundary(faces[41]) -isSuccess = Res[0] -ClosedWires = Res[1] -OpenWires = Res[2] - -if isSuccess == 1 : - print "Checking free boudaries is OK." -else : - print "Checking free boudaries is KO!" -print "len(ClosedWires) = ", len(ClosedWires) - -i = 0 -for wire in ClosedWires : - wire_name = "Face 41 -> Close wires : WIRE %d"%(i+1) - geompy.addToStudy(ClosedWires[i], wire_name) - if i < len(ClosedWires) : - i = i+ 1 - -print "len(OpenWires) = ", len(OpenWires) - -i = 0 -for wire in OpenWires : - wire_name = "Face 41 -> Open wires : WIRE %d"%(i+1) - geompy.addToStudy(OpenWires[i], wire_name) - if i < len(OpenWires) : - i = i+ 1 - -# add the imported object to the study -id_ImportFromBREP = geompy.addToStudy(ImportFromBREP, "ImportFromBREP") -salome.sg.updateObjBrowser(1) -\endcode - - -

Check Free Faces

- -\code -import geompy -import salome -gg = salome.ImportComponentGUI("GEOM") - -# create a vertex and a vector -p1 = geompy.MakeVertex(35, 35, 0) -p2 = geompy.MakeVertex(35, 35, 50) -v = geompy.MakeVector(p1, p2) - -# create a cylinder -cylinder = geompy.MakeCone(p1, v, 30, 20, 20) - -# create a cone -cone = geompy.MakeCone(p1, v, 70, 40, 60) - -# make cut -cut = geompy.MakeCut(cone, cylinder) - -# get faces as sub-shapes -faces = [] -faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"]) -f_2 = geompy.GetSubShapeID(cut, faces[0]) - -# remove one face from the shape -cut_without_f_2 = geompy.SuppressFaces(cut, [f_2]) - -# suppress the specified wire -result = geompy.GetFreeFacesIDs(cut_without_f_2) -print "A number of free faces is ", len(result) - -# add objects in the study -all_faces = geompy.SubShapeAllSortedCentres(cut_without_f_2, geompy.ShapeType["FACE"]) -for face in all_faces : - sub_shape_id = geompy.GetSubShapeID(cut_without_f_2, face) - if result.count(sub_shape_id) > 0 : - face_name = "Free face %d"%(sub_shape_id) - geompy.addToStudy(face, face_name) - -# in this example all faces from cut_without_f_2 are free -id_cut_without_f_2 = geompy.addToStudy(cut_without_f_2, "Cut without f_2") - -# display the results -gg.createAndDisplayGO(id_cut_without_f_2) -gg.setDisplayMode(id_cut_without_f_2,1) -\endcode - - - -

Bounding Box

- -\code -import geompy - -# create a box -box = geompy.MakeBoxDXDYDZ(100,30,100) -bb = geompy.BoundingBox(box) -print "\nBounding Box of box 100x30x100:" -print " Xmin = ", bb[0], ", Xmax = ", bb[1] -print " Ymin = ", bb[2], ", Ymax = ", bb[3] -print " Zmin = ", bb[4], ", Zmax = ", bb[5] -\endcode - -

Minimal Distance

- -\code -import geompy - -# create boxes -box1 = geompy.MakeBoxDXDYDZ(100,30,100) -box2 = geompy.MakeBox(105,0,0,200,30,100) -min_dist = geompy.MinDistance(box1,box2) -print "\nMinimal distance between box1 and box2 = ", min_dist -\endcode - -

Tolerance

- -\code -import geompy - -# create a box -box = geompy.MakeBoxDXDYDZ(100,30,100) -Toler = geompy.Tolerance(box) -print "\nBox 100x30x100 tolerance:" -print " Face min. tolerance: ", Toler[0] -print " Face max. tolerance: ", Toler[1] -print " Edge min. tolerance: ", Toler[2] -print " Edge max. tolerance: ", Toler[3] -print " Vertex min. tolerance: ", Toler[4] -print " Vertex max. tolerance: ", Toler[5] -\endcode - -

Angle

- -\code -import salome -salome.salome_init() - -import math -import geompy -geompy.init_geom(salome.myStudy) - -OX = geompy.MakeVectorDXDYDZ(10, 0,0) -OXY = geompy.MakeVectorDXDYDZ(10,10,0) - -# in one plane -Angle = geompy.GetAngle(OX, OXY) - -print "\nAngle between OX and OXY = ", Angle -if math.fabs(Angle - 45.0) > 1e-05: - print " Error: returned angle is", Angle, "while must be 45.0" - pass - -Angle = geompy.GetAngleRadians(OX, OXY) - -print "\nAngle between OX and OXY in radians = ", Angle -if math.fabs(Angle - math.pi/4) > 1e-05: - print " Error: returned angle is", Angle, "while must be pi/4" - pass - -# not in one plane -OXY_shift = geompy.MakeTranslation(OXY,10,-10,20) -Angle = geompy.GetAngle(OX, OXY_shift) - -print "Angle between OX and OXY_shift = ", Angle -if math.fabs(Angle - 45.0) > 1e-05: - print " Error: returned angle is", Angle, "while must be 45.0" - pass - -# not linear -pnt1 = geompy.MakeVertex(0, 0, 0) -pnt2 = geompy.MakeVertex(10, 0, 0) -pnt3 = geompy.MakeVertex(20, 10, 0) -arc = geompy.MakeArc(pnt1, pnt2, pnt3) -Angle = geompy.GetAngle(OX, arc) - -if (math.fabs(Angle + 1.0) > 1e-6 or geompy.MeasuOp.IsDone()): - print "Error. Angle must not be computed on curvilinear edges" - pass - -\endcode - - -

What Is

- -\code -import geompy - -# create a box -box = geompy.MakeBoxDXDYDZ(100,30,100) -Descr = geompy.WhatIs(box) -print "\nBox 100x30x100 description:" -print Descr -\endcode - -

NbShapes and ShapeInfo

- -\code -import geompy - -# create a box -box = geompy.MakeBoxDXDYDZ(100,30,100) -nbSolids = geompy.NbShapes(box, geompy.ShapeType["SOLID"]) -print "\nBox 100x30x100 quantity of solids:", nbSolids -boxInfo = geompy.ShapeInfo(box) -print "\nBox 100x30x100 shapes:" -print boxInfo -\endcode - -

Check Shape

- -\code -import geompy - -# create a box -box = geompy.MakeBoxDXDYDZ(100,30,100) -IsValid = geompy.CheckShape(box) -if IsValid == 0: - raise RuntimeError, "Invalid box created" -else: - print "\nBox is valid" -\endcode - -

Detect Self-intersections

- -\code -import geompy - -# create a box -box = geompy.MakeBoxDXDYDZ(100,30,100) -IsValid = geompy.CheckSelfIntersections(box) -if IsValid == 0: - raise RuntimeError, "Box with self-intersections created" -else: - print "\nBox is valid" -\endcode - -

Check Compound of Blocks

- -\code -import geompy -import salome -gg = salome.ImportComponentGUI("GEOM") - -# create boxes -box1 = geompy.MakeBox(0,0,0,100,50,100) -box2 = geompy.MakeBox(100,0,0,250,50,100) - -# make a compound -compound = geompy.MakeCompound([box1, box2]) - -# glue the faces of the compound -tolerance = 1e-5 -glue = geompy.MakeGlueFaces(compound, tolerance) -IsValid = geompy.CheckCompoundOfBlocks(glue) -if IsValid == 0: - raise RuntimeError, "Invalid compound created" -else: - print "\nCompound is valid" -\endcode + */ diff --git a/doc/salome/gui/GEOM/input/tui_min_distance.doc b/doc/salome/gui/GEOM/input/tui_min_distance.doc new file mode 100644 index 000000000..e26e219f9 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_min_distance.doc @@ -0,0 +1,15 @@ +/*! + +\page tui_min_distance_page Minimal Distance + +\code +import geompy + +# create boxes +box1 = geompy.MakeBoxDXDYDZ(100,30,100) +box2 = geompy.MakeBox(105,0,0,200,30,100) +min_dist = geompy.MinDistance(box1,box2) +print "\nMinimal distance between box1 and box2 = ", min_dist +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_normal_face.doc b/doc/salome/gui/GEOM/input/tui_normal_face.doc new file mode 100644 index 000000000..0c81116a8 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_normal_face.doc @@ -0,0 +1,23 @@ +/*! + +\page tui_normal_face_page Normal to a Face + +\code +import geompy +import math + +# create a box +box = geompy.MakeBoxDXDYDZ(100,30,100) + +faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"]) +face0 = faces[0] +vnorm = geompy.GetNormal(face0) +if vnorm is None: + raise RuntimeError, "GetNormal(face0) failed" +else: + geompy.addToStudy(face0, "Face0") + geompy.addToStudy(vnorm, "Normale to Face0") + print "\nNormale of face has been successfully obtained" +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_point_coordinates.doc b/doc/salome/gui/GEOM/input/tui_point_coordinates.doc new file mode 100644 index 000000000..0f138367b --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_point_coordinates.doc @@ -0,0 +1,27 @@ +/*! + +\page tui_point_coordinates_page Point Coordinates + +\code +import math +import geompy + +# create a point +point = geompy.MakeVertex(15., 23., 80.) + +# get the coordinates of the point and check its values +coords = geompy.PointCoordinates(point) + +# check the obtained coordinate values +tolerance = 1.e-07 +def IsEqual(val1, val2): return (math.fabs(val1 - val2) < tolerance) + +if IsEqual(coords[0], 15.) and IsEqual(coords[1], 23.) and IsEqual(coords[2], 80.): + print "All values are OK." +else : + print "Coordinates of point must be (15, 23, 80), but returned (", + print coords[0], ", ", coords[1], ", ", coords[2], ")" + pass +\endcode + +*/ \ No newline at end of file diff --git a/doc/salome/gui/GEOM/input/tui_swig_examples.doc b/doc/salome/gui/GEOM/input/tui_swig_examples.doc index 43b003d42..4385c1174 100644 --- a/doc/salome/gui/GEOM/input/tui_swig_examples.doc +++ b/doc/salome/gui/GEOM/input/tui_swig_examples.doc @@ -6,6 +6,7 @@
  • \subpage tui_test_others_page
  • \subpage tui_test_spanner_page
  • \subpage tui_test_all_page
  • +
  • \subpage tui_test_measures_page
  • */ diff --git a/doc/salome/gui/GEOM/input/tui_test_measures.doc b/doc/salome/gui/GEOM/input/tui_test_measures.doc new file mode 100644 index 000000000..90dafb538 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_test_measures.doc @@ -0,0 +1,54 @@ +/*! + +\page tui_test_measures_page GEOM_TestMeasures.py + +\anchor swig_TestMeasures +

    GEOM_TestMeasures.py

    + +\dontinclude GEOM_TestMeasures.py +\skipline def TestMeasureOperations + +\until PointCoordinates + +\anchor swig_PointCoordinates +\until CheckShape + +\anchor swig_CheckShape +\until MakeCompound + +\anchor swig_CheckSelfIntersections +\until WhatIs + +\anchor swig_WhatIs +\until BasicProperties + +\anchor swig_BasicProperties +\until BoundingBox + +\anchor swig_BoundingBox +\until Inertia + +\anchor swig_Inertia +\until Tolerance + +\anchor swig_Tolerance +\until MakeCDG + +\anchor swig_MakeCDG +\until But must be + +\until face0 + +\anchor swig_GetNormal +\until MinDistance + +\anchor swig_MinDistance +\until in one plane + +\anchor swig_GetAngle +\until Error + +\anchor swig_GetAngleRadians +\until pass + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_tolerance.doc b/doc/salome/gui/GEOM/input/tui_tolerance.doc new file mode 100644 index 000000000..55151302a --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_tolerance.doc @@ -0,0 +1,20 @@ +/*! + +\page tui_tolerance_page Tolerance + +\code +import geompy + +# create a box +box = geompy.MakeBoxDXDYDZ(100,30,100) +Toler = geompy.Tolerance(box) +print "\nBox 100x30x100 tolerance:" +print " Face min. tolerance: ", Toler[0] +print " Face max. tolerance: ", Toler[1] +print " Edge min. tolerance: ", Toler[2] +print " Edge max. tolerance: ", Toler[3] +print " Vertex min. tolerance: ", Toler[4] +print " Vertex max. tolerance: ", Toler[5] +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_whatis.doc b/doc/salome/gui/GEOM/input/tui_whatis.doc new file mode 100644 index 000000000..e89e8bf18 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_whatis.doc @@ -0,0 +1,15 @@ +/*! + +\page tui_whatis_page What Is + +\code +import geompy + +# create a box +box = geompy.MakeBoxDXDYDZ(100,30,100) +Descr = geompy.WhatIs(box) +print "\nBox 100x30x100 description:" +print Descr +\endcode + +*/ diff --git a/doc/salome/gui/GEOM/input/using_measurement_tools.doc b/doc/salome/gui/GEOM/input/using_measurement_tools.doc index eb3aca303..7e18a1ddf 100644 --- a/doc/salome/gui/GEOM/input/using_measurement_tools.doc +++ b/doc/salome/gui/GEOM/input/using_measurement_tools.doc @@ -22,9 +22,9 @@ concerning created or imported geometrical objects : diff --git a/doc/salome/gui/GEOM/input/whatis.doc b/doc/salome/gui/GEOM/input/whatis.doc index 6bf3028f0..faa183032 100644 --- a/doc/salome/gui/GEOM/input/whatis.doc +++ b/doc/salome/gui/GEOM/input/whatis.doc @@ -9,6 +9,8 @@ the shape. \n TUI Command: geompy.WhatIs(Shape), where \em Shape is a shape from which a description is returned. +See also a \ref tui_whatis_page "TUI example". + \image html measures8.png \n Kind of Shape field characterises the -- 2.39.2