Salome HOME
Merge from V6_main (04/10/2012) V7_0_0 V7_0_0rc1
authorvsr <vsr@opencascade.com>
Mon, 8 Oct 2012 11:16:36 +0000 (11:16 +0000)
committervsr <vsr@opencascade.com>
Mon, 8 Oct 2012 11:16:36 +0000 (11:16 +0000)
119 files changed:
doc/salome/gui/GEOM/doxyfile_py.in
doc/salome/gui/GEOM/images/3dsketch2.png
doc/salome/gui/GEOM/images/bool1.png
doc/salome/gui/GEOM/images/bool2.png
doc/salome/gui/GEOM/images/bool3.png
doc/salome/gui/GEOM/images/divided_disk_PntVecR_dlg.png
doc/salome/gui/GEOM/images/divided_disk_dlg.png
doc/salome/gui/GEOM/images/dividedcylinder_dlg.png
doc/salome/gui/GEOM/images/groups_cut_dlg.png [new file with mode: 0644]
doc/salome/gui/GEOM/images/groups_intersect_dlg.png [new file with mode: 0644]
doc/salome/gui/GEOM/images/groups_union_dlg.png [new file with mode: 0644]
doc/salome/gui/GEOM/images/measures2.png [new file with mode: 0644]
doc/salome/gui/GEOM/images/neo-section.png
doc/salome/gui/GEOM/images/ob_popup_menu.png
doc/salome/gui/GEOM/images/partition1.png
doc/salome/gui/GEOM/images/partition2.png
doc/salome/gui/GEOM/input/creating_3dsketcher.doc
doc/salome/gui/GEOM/input/creating_dividedcylinder.doc
doc/salome/gui/GEOM/input/creating_divideddisk.doc
doc/salome/gui/GEOM/input/creating_point.doc
doc/salome/gui/GEOM/input/get_non_blocks.doc [new file with mode: 0644]
doc/salome/gui/GEOM/input/tui_3dsketcher.doc
doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc
doc/salome/gui/GEOM/input/tui_get_non_blocks.doc [new file with mode: 0644]
doc/salome/gui/GEOM/input/tui_measurement_tools.doc
doc/salome/gui/GEOM/input/tui_test_all.doc
doc/salome/gui/GEOM/input/tui_test_others.doc
doc/salome/gui/GEOM/input/tui_test_spanner.doc
doc/salome/gui/GEOM/input/tui_working_with_groups.doc
doc/salome/gui/GEOM/input/using_measurement_tools.doc
doc/salome/gui/GEOM/input/viewing_geom_obj.doc
doc/salome/gui/GEOM/input/working_with_groups.doc
idl/GEOM_Gen.idl
resources/Makefile.am
resources/SalomeApp.xml.in
resources/get_non_blocks.png [new file with mode: 0644]
src/BooleanGUI/BooleanGUI_Dialog.cxx
src/DisplayGUI/DisplayGUI.cxx
src/DisplayGUI/DisplayGUI.h
src/EntityGUI/EntityGUI_3DSketcherDlg.cxx
src/EntityGUI/EntityGUI_3DSketcherDlg.h
src/EntityGUI/EntityGUI_Controls_QTD.ui
src/EntityGUI/EntityGUI_SketcherDlg.cxx
src/GEOM/GEOM_Engine.cxx
src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx
src/GEOMGUI/GEOMGUI_Selection.cxx
src/GEOMGUI/GEOMGUI_Selection.h
src/GEOMGUI/GEOM_Displayer.cxx
src/GEOMGUI/GEOM_Displayer.h
src/GEOMGUI/GEOM_images.ts
src/GEOMGUI/GEOM_msg_en.ts
src/GEOMGUI/GeometryGUI.cxx
src/GEOMGUI/GeometryGUI_Operations.h
src/GEOMGUI/GeometryGUI_Swig.cxx [deleted file]
src/GEOMGUI/GeometryGUI_Swig.hxx [deleted file]
src/GEOMGUI/GeometryGUI_Swig.i [deleted file]
src/GEOMGUI/Makefile.am
src/GEOMImpl/GEOMImpl_3DSketcherDriver.cxx
src/GEOMImpl/GEOMImpl_BlockDriver.cxx
src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx
src/GEOMImpl/GEOMImpl_I3DSketcher.hxx
src/GEOMImpl/GEOMImpl_IBasicOperations.cxx
src/GEOMImpl/GEOMImpl_IBasicOperations.hxx
src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx
src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx
src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx
src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx
src/GEOMImpl/GEOMImpl_IGroupOperations.cxx
src/GEOMImpl/GEOMImpl_IGroupOperations.hxx
src/GEOMImpl/GEOMImpl_IInsertOperations.cxx
src/GEOMImpl/GEOMImpl_IInsertOperations.hxx
src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx
src/GEOMImpl/GEOMImpl_ImportDriver.cxx
src/GEOMImpl/GEOMImpl_ImportDriver.hxx
src/GEOMImpl/GEOMImpl_PipeDriver.cxx
src/GEOMImpl/GEOMImpl_PointDriver.cxx
src/GEOMImpl/GEOMImpl_ShapeDriver.cxx
src/GEOMImpl/GEOMImpl_Types.hxx
src/GEOMToolsGUI/GEOMToolsGUI.cxx
src/GEOMToolsGUI/GEOMToolsGUI.h
src/GEOMToolsGUI/GEOMToolsGUI_1.cxx
src/GEOM_I/GEOM_IBasicOperations_i.cc
src/GEOM_I/GEOM_IBasicOperations_i.hh
src/GEOM_I/GEOM_IBlocksOperations_i.cc
src/GEOM_I/GEOM_IBlocksOperations_i.hh
src/GEOM_I/GEOM_ICurvesOperations_i.cc
src/GEOM_I/GEOM_ICurvesOperations_i.hh
src/GEOM_I/GEOM_IGroupOperations_i.cc
src/GEOM_I/GEOM_IGroupOperations_i.hh
src/GEOM_I/GEOM_IInsertOperations_i.cc
src/GEOM_I/GEOM_IInsertOperations_i.hh
src/GEOM_SWIG/GEOM_Spanner.py
src/GEOM_SWIG/GEOM_TestAll.py
src/GEOM_SWIG/GEOM_TestOthers.py
src/GEOM_SWIG/Makefile.am
src/GEOM_SWIG/geompy.py
src/GEOM_SWIG/geompyDC.py
src/GEOM_SWIG/gsketcher.py [new file with mode: 0644]
src/GEOM_SWIG_WITHIHM/Makefile.am
src/GEOM_SWIG_WITHIHM/libGEOM_Swig.cxx [new file with mode: 0644]
src/GEOM_SWIG_WITHIHM/libGEOM_Swig.h [new file with mode: 0644]
src/GEOM_SWIG_WITHIHM/libGEOM_Swig.i
src/GroupGUI/GroupGUI.cxx
src/GroupGUI/GroupGUI_BooleanDlg.cxx [new file with mode: 0644]
src/GroupGUI/GroupGUI_BooleanDlg.h [new file with mode: 0644]
src/GroupGUI/Makefile.am
src/IGESImport/IGESImport.cxx
src/MeasureGUI/Makefile.am
src/MeasureGUI/MeasureGUI.cxx
src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx
src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx
src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.cxx
src/MeasureGUI/MeasureGUI_GetNonBlocksDlg.cxx [new file with mode: 0644]
src/MeasureGUI/MeasureGUI_GetNonBlocksDlg.h [new file with mode: 0644]
src/OBJECT/GEOM_AISShape.cxx
src/OBJECT/GEOM_TopWireframeShape.cxx
src/OBJECT/GEOM_TopWireframeShape.hxx
src/OperationGUI/OperationGUI_PartitionDlg.cxx
src/STEPImport/STEPImport.cxx

index c35ee2024c84b195f1731e7b85f0bc4c2379a409..bd50daa50e2129dabac8e52873c7e29b50b4b6d8 100755 (executable)
@@ -99,8 +99,8 @@ EXAMPLE_RECURSIVE      = NO
 #---------------------------------------------------------------------------
 #Input related options
 #---------------------------------------------------------------------------
-INPUT             = . @top_srcdir@/idl
-FILE_PATTERNS     = geompy.py GEOM_Gen.idl
+INPUT             = geompy.py @top_srcdir@/src/GEOM_SWIG/gsketcher.py @top_srcdir@/idl/GEOM_Gen.idl
+FILE_PATTERNS     = 
 IMAGE_PATH        = @srcdir@/images
 EXAMPLE_PATH      = @top_srcdir@/src/GEOM_SWIG
 RECURSIVE         = NO
index 51f171d9f16d5d32fba0322c9e4c496c4f28f7a7..1925ecfd833e23971b95dc5315e1435cabecde15 100755 (executable)
Binary files a/doc/salome/gui/GEOM/images/3dsketch2.png and b/doc/salome/gui/GEOM/images/3dsketch2.png differ
index 5dac3ca2440916ce5cbd0365510641eee1df295a..704a7a37db235057f37284279a6f39b6e5d66131 100755 (executable)
Binary files a/doc/salome/gui/GEOM/images/bool1.png and b/doc/salome/gui/GEOM/images/bool1.png differ
index a14fec4e8e6cf362e76c0997f3823c40fe38d6a0..026e607054f993e30d6aabfd92a146b1a112affd 100755 (executable)
Binary files a/doc/salome/gui/GEOM/images/bool2.png and b/doc/salome/gui/GEOM/images/bool2.png differ
index 1e8941a3ccef42fe121a17d28dc7f7b7baf1a475..11c5ade724c02d474a6c54bb414ee86c6cda90bf 100755 (executable)
Binary files a/doc/salome/gui/GEOM/images/bool3.png and b/doc/salome/gui/GEOM/images/bool3.png differ
index c57f8f6b5f951eb89d4bb57e3deb80db155680a1..bb5155e25aa62eb8b98b30963af04a8567bbaa14 100644 (file)
Binary files a/doc/salome/gui/GEOM/images/divided_disk_PntVecR_dlg.png and b/doc/salome/gui/GEOM/images/divided_disk_PntVecR_dlg.png differ
index 3a8b8baadd2a0db1bb9fe4c461a538ebddc856e2..71c17bedf4a73deec1fff39febe5c8fa85c8441c 100644 (file)
Binary files a/doc/salome/gui/GEOM/images/divided_disk_dlg.png and b/doc/salome/gui/GEOM/images/divided_disk_dlg.png differ
index 95b96d00e4e038590fc9fc2773a139d2970029d4..36004257151c651e98940bc7c060a3f65f90fa7d 100644 (file)
Binary files a/doc/salome/gui/GEOM/images/dividedcylinder_dlg.png and b/doc/salome/gui/GEOM/images/dividedcylinder_dlg.png differ
diff --git a/doc/salome/gui/GEOM/images/groups_cut_dlg.png b/doc/salome/gui/GEOM/images/groups_cut_dlg.png
new file mode 100644 (file)
index 0000000..248eeba
Binary files /dev/null and b/doc/salome/gui/GEOM/images/groups_cut_dlg.png differ
diff --git a/doc/salome/gui/GEOM/images/groups_intersect_dlg.png b/doc/salome/gui/GEOM/images/groups_intersect_dlg.png
new file mode 100644 (file)
index 0000000..0109f67
Binary files /dev/null and b/doc/salome/gui/GEOM/images/groups_intersect_dlg.png differ
diff --git a/doc/salome/gui/GEOM/images/groups_union_dlg.png b/doc/salome/gui/GEOM/images/groups_union_dlg.png
new file mode 100644 (file)
index 0000000..9df9cd6
Binary files /dev/null and b/doc/salome/gui/GEOM/images/groups_union_dlg.png differ
diff --git a/doc/salome/gui/GEOM/images/measures2.png b/doc/salome/gui/GEOM/images/measures2.png
new file mode 100644 (file)
index 0000000..21e5218
Binary files /dev/null and b/doc/salome/gui/GEOM/images/measures2.png differ
index 532d1f835329a2bb8ae77ffe4d2fd129bff2c5c9..901b1f3c2526e6cac1a79587717413cd0d559031 100755 (executable)
Binary files a/doc/salome/gui/GEOM/images/neo-section.png and b/doc/salome/gui/GEOM/images/neo-section.png differ
index 51ae305d72372e5db3a74aad35957f109464b0e4..1d9f0e321674d3df40f8b16843a05637b8be76fc 100644 (file)
Binary files a/doc/salome/gui/GEOM/images/ob_popup_menu.png and b/doc/salome/gui/GEOM/images/ob_popup_menu.png differ
index baf8c4ac951e091cf87a0a34d94f9a287a873bfa..b0136adb88f353073d9726ee0a6a2911f393821e 100755 (executable)
Binary files a/doc/salome/gui/GEOM/images/partition1.png and b/doc/salome/gui/GEOM/images/partition1.png differ
index 12b92335b02d3779b17ad3b37ec03d868d5b3ab2..38b3dd474958a946db34ea35d0f96591ff6226a7 100755 (executable)
Binary files a/doc/salome/gui/GEOM/images/partition2.png and b/doc/salome/gui/GEOM/images/partition2.png differ
index fcc0ba56d3c711e01d8775ac8f3617db4327e6c5..651ebc461f5d08852e90e26c624c1523d5f545d5 100755 (executable)
@@ -2,41 +2,56 @@
 
 \page create_3dsketcher_page 3D Sketcher
 
-3D Sketcher allows creating a closed or unclosed 3D wire from a list of points.
+3D Sketcher allows creating a closed or unclosed 3D wire, made of
+consequent straight segments.
 
 To create a 3D Sketch, select in the main menu <em>New Entity -> Basic -> 3D Sketch</em>.
 
 \image html 3dsketch2.png
 
-In this dialog it is possible to define the coordinates of the points.
+The first sketcher point can be defined by \b Absolute coordinates X, Y and Z.
+When the first point is defined, it is possible to add straight segments.
+Each segment will start at the end point of previous segment or at the
+sketcher first point, if there are no validated segments.
 
-The position of each point can be defined by \b  Absolute coordinates X, Y, Z or
-by \b Relative coordinates DX, DY, DZ with respect to the previous Applied point.
-The type of coordinates can be selected by the <b>Coordinates Type</b>
+Segment can be defined by:
+ - \b Absolute coordinates X, Y and Z of its second end,
+ - \b Relative coordinates DX, DY and DZ of its second end with
+   respect to the previous applied point,
+ - \b Direction and \b Length of the segment. Direction is set by two
+   \b Angles in selected coordinate system.
+
+The way of segment construction can be selected by the <b>Coordinates Type</b>
 radio buttons.
 
-To add the point in the list of points and to proceed with the
-definition of the next point, click <b>Apply</b> button. \b Undo and
-\b Redo buttons, respectively, remove or restore the last point in the list.
+To validate the segment and to proceed with the definition of the next
+segment, click <b>Apply</b> button. \b Undo and \b Redo buttons,
+respectively, remove or restore the last segment in the wire.
 
 \n <b>"Sketch Validation"</b> button applies the wire, built by the
 user, "as is".
 \n <b>"Sketch Closure"</b> closes the Sketch by a straight line from
 the start to the end point and applies it. 
 
-To make a closed wire using the TUI command, the first and the last point should 
-have the same coordinates.
-
-The Result of the operation will be a \b GEOM_Object.
-
-<b>TUI Command:</b> <em>geompy.Make3DSketcher( [ PointsList ] )</em>
-This algorithm creates a wire from the list of real values, which define XYZ 
-coordinates of points.
-
 <b>Example:</b>
 
 \image html 3dsketch1.png
 
+<b>TUI Command:</b> <em>geompy.Make3DSketcher( [ PointsList ] )</em>
+This algorithm creates a wire from the list of real values, which
+define absolute XYZ coordinates of points. The Result of the operation
+will be a \b GEOM_Object.
+
+\note To make a closed wire using this TUI command, the first and the
+last point should have the same coordinates.
+
+\n Another way to create the 3D Sketcher in TUI is using Sketcher3D
+interface.
+<b>TUI Command:</b> <em>sk = geompy.Sketcher3D()</em>
+Returns an instance of Sketcher3D interface <i>sk</i>.
+Use the below examples and see the \ref gsketcher.Sketcher3D "Sketcher3D"
+interface documentation for more information.
+
 Our <b>TUI Scripts</b> provide you with useful examples of the use of
 \ref tui_3dsketcher_page "3D Sketcher".
 */
index 1b9de1e2d39bba2de4a258eabfbc76eb27611ede..169666a390136a36b7d7f23e6e31b47e996bcc31 100644 (file)
@@ -2,7 +2,12 @@
 
 \page create_dividedcylinder_page DividedCylinder
 
-The <b>Divided cylinder</b> object is a cylinder divided into \b blocks for easy hexaedral meshing</b>.
+The <b>Divided cylinder</b> object is a cylinder divided into \b blocks for easy hexaedral meshing.Two division patterns are available :
+
+<ul>
+<li> A square pattern which is frequently used </li>
+<li> An hexagonal pattern which ensures a better mesh quality and especially less acute or obtuse angles </li>
+</ul>
 
 \image html dividedcylinder.png
 
@@ -13,11 +18,12 @@ Specify the parameters of the DividedCylinder object creation in the opened dial
 box and press "Apply" or "Apply & Close" button.
 Result of each operation will be a GEOM_Object.
 
-<b>TUI Command:</b> <em>geompy.MakeDividedCylinder(R, H)</em>
+<b>TUI Command:</b> <em>geompy.MakeDividedCylinder(R, H, Pattern)</em>
 
 <b>Arguments:</b>
 - \b R - Radius of the cylinder
 - \b H - Height of the cylinder
+- \b Pattern - Division pattern
 
 \image html dividedcylinder_dlg.png
 
index b42460f40ac06346afc2b656cc65626e0260bea4..2d471e6a1840e36c735f6e2255cac66df19ec8fb 100644 (file)
@@ -2,10 +2,17 @@
 
 \page create_divideddisk_page DividedDisk
 
-The <b>Divided disk</b> object is a disk divided into \b blocks. It means that it's a shape <b>prepared for hexaedral meshing</b>.
+The <b>Divided disk</b> object is a disk divided into \b blocks. It means that it's a shape <b>prepared for hexaedral meshing</b>. Two division patterns are available :
+
+<ul>
+<li> A square pattern which is frequently used </li>
+<li> An hexagonal pattern which ensures a better mesh quality and especially less acute or obtuse angles </li>
+</ul>
+
 
 \n Moreover this shape can be used as a basis in an \ref create_extrusion_alongpath_page "Extrusion along a path" operation in order to obtain any <b>tube shape</b> prepared for hexaedral meshing 
-(see example below). 
+(see example below). (Another alternative is to create a 2D mesh on the divided disk and create a 3D mesh by extrusion in the SMESH module.)
+
 
 Example:
 
@@ -18,27 +25,29 @@ Advanced - > DividedDisk </b>
 \n For both operations : 
 Specify the parameters of the DividedDisk object creation in the opened dialog
 box and press "Apply" or "Apply & Close" button.
-Result of each operation will be a GEOM_Object.
+The result of each operation will be a GEOM_Object.
 
 \n First way : by radius and orientation (plane "OXY", "OYZ" or "OZX"). The resulting disk is located at the origin of coordinates
 
-<b>TUI Command:</b> <em>geompy.MakeDividedDisk(Radius, Orientation)</em>
+<b>TUI Command:</b> <em>geompy.MakeDividedDisk(Radius, Orientation, Pattern)</em>
 
 <b>Arguments:</b>
 - \b Radius - Radius of the disk
 - \b Orientation - Plane on wich the disk will be built
+- \b Pattern - Division pattern
 
 \image html divided_disk_dlg.png
 
 \n Second way : by giving its center, normal and radius.
 
 <b>TUI Command:</b> <em>geompy.MakeDividedDiskPntVecR(Center, Vector,
-Radius)</em>
+Radius, Pattern)</em>
 
 <b>Arguments:</b>
 - \b Center - Center of the disk
 - \b Vector - Normal to the plane of the disk
 - \b Radius - Radius of the disk
+- \b Pattern - Division pattern
 
 \image html divided_disk_PntVecR_dlg.png
 
index 9844a3cff6892564c7c6416b6ff829df0ad8ff9a..46da866283907ebefb3a6142575e42d575ad6518 100644 (file)
@@ -73,7 +73,7 @@ position of the point on the given face.
 \image html point5.png
 
 Alternatively, it is possible to define 3D coordinates of the point projected on the given face.
-\n <b>TUI Command:</b> <em>geompy.MakeVertexOnSurface(myFace,X,Y,Z).</em>
+\n <b>TUI Command:</b> <em>geompy.MakeVertexOnSurfaceByCoord(myFace,X,Y,Z).</em>
 \n <b>Arguments:</b> Name + 1 face  + 3 coordinate values
 to project point on the given face.
 
diff --git a/doc/salome/gui/GEOM/input/get_non_blocks.doc b/doc/salome/gui/GEOM/input/get_non_blocks.doc
new file mode 100644 (file)
index 0000000..8df0e32
--- /dev/null
@@ -0,0 +1,23 @@
+/*! 
+
+\page get_non_blocks_page Get Non Blocks
+
+\image html measures2.png
+
+Retrieve all non blocks solids and faces from the given shape.
+Collect them in two groups: solids and faces separately.
+
+\n <b>Result:</b> Two or less groups are published in the Object
+                  Browser under the processed object. Reports error if
+                  no bad sub-shapes (solids and faces) have been found.
+
+\n <b>TUI Command:</b>
+<em>geompy.GetNonBlocks(Compound).</em> Returns a tuple of two
+    GEOM_Objects. The first object is a group of all non block solids
+    (= not 6 faces, or with 6 faces, but with the presence of
+    non-quadrangular faces). The second object is a group of all non
+    quadrangular faces.
+
+See also a \ref tui_get_non_blocks_page "TUI example".
+
+*/
index c9760fbcfba3d8ce29044d30f138191edc46e590..4916dfce2d4037dfa69d771bfca836a015904d18 100755 (executable)
@@ -7,14 +7,43 @@ import geompy
 import salome
 gg = salome.ImportComponentGUI("GEOM")
 
-# create a 3D sketcher (wire) of the given points coordinates
+# Create a 3D sketcher (wire) on the given points coordinates
 sketcher1 = geompy.Make3DSketcher([ 0,0,0, 50,50,50, 0,50,0, 50,0,50, 10,20,100, 0,0,0 ])
 
 # add object in the study
-id_sketcher1 = geompy.addToStudy(sketcher1,"Sketcher1")
+id_sketcher1 = geompy.addToStudy(sketcher1, "Sketcher1")
 
 # display the sketcher
 gg.createAndDisplayGO(id_sketcher1)
+
+# Create a 3D sketcher (wire) with Sketcher3D interface
+
+# get the interface instance
+sk = geompy.Sketcher3D()
+
+# add three points with absolute coordinates
+# the first point will be the start point of sketcher
+# two segments will be added by this command
+sk.addPointsAbsolute(1,2,3, 7,0,0, 10,-3.5,-11)
+
+# add one segment, defined by two angles in "OXY" coordinate system and length
+sk.addPointAnglesLength("OXY", 45, 0, 100)
+
+# add three points with relative coordinates
+# three segments will be added by this command
+sk.addPointsRelative(20,0,0, 20,0,100, -40,0,-50)
+
+# set to close the sketcher
+sk.close()
+
+# obtain the sketcher result
+sketcher2 = sk.wire()
+
+# add object in the study
+id_sketcher2 = geompy.addToStudy(sketcher2, "Sketcher2")
+
+# display the sketcher
+gg.createAndDisplayGO(id_sketcher2)
 \endcode
 
-*/
\ No newline at end of file
+*/
index 0cb092228a0c33ed24b13c2a0e3d94785ac3567b..7f230b14265d8baea6289e7a7da29e9745c0a988 100644 (file)
@@ -37,6 +37,7 @@ Add_line = geompy.MakeLineTwoPnt(px, py)
 arc_face = geompy.MakeFaceWires([Arc, Add_line], 1)
 p_on_face1 = geompy.MakeVertexOnSurface(arc_face, 0.5, 0.5)
 p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(arc_face, 35, 35, 35)
+p_on_face3 = geompy.MakeVertexInsideFace(arc_face)
 
 
 # add objects in the study
@@ -54,6 +55,7 @@ id_p_on_arc3  = geompy.addToStudy(p_on_arc3, "Vertex on Arc by point projection"
 id_p_inter    = geompy.addToStudy(p_inter,   "Vertex on Lines Intersection")
 id_p_on_face1 = geompy.addToStudy(p_on_face1, "Vertex on face by parameter")
 id_p_on_face2 = geompy.addToStudy(p_on_face2, "Vertex on face by point projection")
+id_p_on_face3 = geompy.addToStudy(p_on_face3, "Vertex inside face")
 
 # display vertices
 gg.createAndDisplayGO(id_p0)
diff --git a/doc/salome/gui/GEOM/input/tui_get_non_blocks.doc b/doc/salome/gui/GEOM/input/tui_get_non_blocks.doc
new file mode 100644 (file)
index 0000000..6f648f9
--- /dev/null
@@ -0,0 +1,32 @@
+/*!
+
+\page tui_get_non_blocks_page Get Non Blocks
+
+\code
+import geompy
+import salome
+
+# create solids
+box = geompy.MakeBoxDXDYDZ(100, 100, 100)
+cyl = geompy.MakeCylinderRH(100, 200)
+
+geompy.addToStudy(box, 'box')
+geompy.addToStudy(cyl, 'cyl')
+
+# make a compound
+compound = geompy.MakeCompound([box1, box2])
+geompy.addToStudy(compound, 'compound')
+
+# explore the compound
+pair = geompy.GetNonBlocks(compound)
+
+if pair[0] is not None:
+  geompy.addToStudyInFather(compound, pair[0], "GrNonBlocks")
+  pass
+
+if pair[1] is not None:
+  geompy.addToStudyInFather(compound, pair[1], "GrNonQuads")
+  pass
+\endcode
+
+*/
index 4ce9b423914b2b18ce5b3e1562e67c585c19e1fa..583f3de0f56e4071941db96b1ad0f97ac10cc280 100644 (file)
@@ -17,6 +17,7 @@
 <li>\subpage tui_free_faces_page</li>
 <li>\subpage tui_check_shape_page</li>
 <li>\subpage tui_check_compound_of_blocks_page</li>
+<li>\subpage tui_get_non_blocks_page</li>
 <li>\subpage tui_check_self_intersections_page</li>
 </ul>
 
index 2fe8d76236df7f967ca3453655d54e3cfd4a1ac2..56beffc5de137abc085ccd13e4cef45f6f23419e 100644 (file)
@@ -40,6 +40,9 @@
 \anchor swig_MakeVertexOnSurfaceByCoord
 \until p_on_face2
 
+\anchor swig_MakeVertexInsideFace
+\until p_on_face3
+
 \until S = geompy.MakeRotation
 
 \anchor swig_MakeLineTwoFaces
index 2b1b44c7c108d889954405d7072155267000af3d..e89f8995785fd25352681be1541ebee094d81c6a 100644 (file)
@@ -79,6 +79,9 @@
 \anchor swig_UnionIDs
 \until print " ", ObjectID
 
+\anchor swig_bop_on_groups
+\until Box, Group_CL_2_4
+
 \anchor swig_GetType
 \until Type of elements
 
index 5c9df4651b7fa4a1d16479acad44a152b519cc75..81b212de6683bfae936ee243e8378354fa6b90a5 100644 (file)
 \anchor swig_GetOppositeFace
 \until id_face41
 
+\until id_glueALL
+
+\anchor swig_GetNonBlocks
+\until Spanner is a
+
 \anchor spanner_continue
 \until return Spanner
 
index e608a092358cf69fb4a42cb1fda76d45efd5e788..37813417c41ad96f5432df931976de9a0fc40326 100644 (file)
@@ -2,7 +2,9 @@
 
 \page tui_working_with_groups_page Working with Groups
 
-<br><h2>Creation of a group</h2>
+<br>
+\anchor tui_create_groups_anchor
+<h2>Creation of a group</h2>
 
 \code
 import geompy
@@ -42,6 +44,8 @@ gg.createAndDisplayGO(id_group1)
 salome.sg.updateObjBrowser(1)
 \endcode
 
+\anchor tui_edit_groups_anchor
+
 <br><h2>Adding an object to the group</h2>
 
 \code
@@ -107,4 +111,108 @@ gg.createAndDisplayGO(id_group1)
 salome.sg.updateObjBrowser(1) 
 \endcode
 
+<br>
+\anchor tui_union_groups_anchor
+<h2>Union Groups</h2>
+
+\code
+import geompy
+import salome
+
+# create a box and some groups of faces on it
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_1, [13, 23])
+Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_2, [3, 27])
+Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_3, [33, 23])
+Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_4, [31, 27])
+
+# union groups
+Group_U_1_2 = geompy.UnionGroups(Group_1, Group_2)
+Group_UL_3_4 = geompy.UnionListOfGroups([Group_3, Group_4])
+
+# publish shapes
+geompy.addToStudy(Box_1, 'Box_1')
+geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
+geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
+geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
+geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
+geompy.addToStudyInFather(Box_1, Group_U_1_2, 'Group_U_1_2')
+geompy.addToStudyInFather(Box_1, Group_UL_3_4, 'Group_UL_3_4')
+salome.sg.updateObjBrowser(1) 
+\endcode
+
+<br>
+\anchor tui_intersect_groups_anchor
+<h2>Intersect Groups</h2>
+
+\code
+import geompy
+import salome
+
+# create a box and some groups of faces on it
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_1, [13, 23])
+Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_2, [3, 27])
+Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_3, [33, 23])
+Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_4, [31, 27])
+
+# intersect groups
+Group_I_1_3 = geompy.IntersectGroups(Group_1, Group_3)
+Group_IL_1_3 = geompy.IntersectListOfGroups([Group_1, Group_3])
+
+# publish shapes
+geompy.addToStudy(Box_1, 'Box_1')
+geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
+geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
+geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
+geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
+geompy.addToStudyInFather(Box_1, Group_I_1_3, 'Group_I_1_3')
+geompy.addToStudyInFather(Box_1, Group_IL_1_3, 'Group_IL_1_3')
+salome.sg.updateObjBrowser(1) 
+
+\endcode
+
+<br>
+\anchor tui_cut_groups_anchor
+<h2>Cut Groups</h2>
+
+\code
+import geompy
+import salome
+
+# create a box and some groups of faces on it
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_1, [13, 23])
+Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_2, [3, 27])
+Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_3, [33, 23])
+Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_4, [31, 27])
+
+# cut groups
+Group_C_2_4 = geompy.CutGroups(Group_2, Group_4)
+Group_CL_2_4 = geompy.CutListOfGroups([Group_2], [Group_4])
+
+# publish shapes
+geompy.addToStudy(Box_1, 'Box_1')
+geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
+geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
+geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
+geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
+geompy.addToStudyInFather(Box_1, Group_C_2_4, 'Group_C_2_4')
+geompy.addToStudyInFather(Box_1, Group_CL_2_4, 'Group_CL_2_4')
+salome.sg.updateObjBrowser(1) 
+
+\endcode
+
 */
index 7e18a1ddf5aa39384e5dac56674527d5131d118e..513f6077f41f6783447bd74c0d00deb2a191b3d7 100644 (file)
@@ -25,6 +25,7 @@ concerning created or imported geometrical objects :
 <li>\subpage free_faces_page "Check Free Faces"</li>
 <li>\subpage check_shape_page "Check Shape"</li>
 <li>\subpage check_compound_of_blocks_page "Check compound of blocks"</li>
+<li>\subpage get_non_blocks_page "Get non blocks"</li>
 <li>\subpage check_self_intersections_page "Detect Self-intersections"</li>
 </ul>
 
@@ -32,4 +33,4 @@ concerning created or imported geometrical objects :
 \ref tui_measurement_tools_page "Measurement Tools" with <b>TUI
 commands</b>.
 
-*/
\ No newline at end of file
+*/
index 44cea48a674f9ba6e6bbb881606aef050e1084fb..ada09fef1568daf54eb448929aeec7133f21d627 100644 (file)
@@ -74,18 +74,23 @@ on the viewer background:
 <li><b>Select Only</b> provides a filter for exclusive selection of objects of a certain type.</li>
 </ul>
 
-The the following commands appear in the Object Browser context menu
+The following commands appear in the Object Browser context menu
 under certain conditions:
 
 \image html ob_popup_menu.png <br>
 
 <ul>
 <li>\ref work_with_groups_page "Create Group" - allows creating groups of geometrical objects.</li>
-<li><b>Hide Children</b> / <b>Show Children</b> - hides / shows child
+
+<li><b>Conceal child items</b> / <b>Disclose child items</b> - hides / shows child
 sub-objects in the Object Browser, if the selected geometric object has
 child objects. When some child objects are hidden, the name of the
 parent object is hilghlighted with bold font.</li>
 
+<li><b>Show Only Children</b> - erase in current viewer all objects
+and then display only children of the selected object(s).
+</li>
+
 <li><b>Unpublish</b> - unpublish the selected geometric object from the Object Browser 
 and erase it from all viewers. To publish unpublished geometric objects select in the 
 context menu of the <b>Geometry</b> root object <b>Publish...</b> item. 
index 07838d585bbb74f1f7217f1e0226074d3315fdee..a09865efa9a46bc1f19e8078c89cc51f64208aa8 100644 (file)
@@ -3,13 +3,25 @@
 \page work_with_groups_page Working with groups
 
 Creation and editing groups of sub-shapes of a geometrical object makes
-handling sub-shapes much easier. This functionality is available in OCC
-viewer only.
+handling sub-shapes much easier. Also some Boolean operations on
+groups are available.
 
-<br><h2>Create a group</h2>
+<ul>
+<li>\ref create_groups_anchor "Create a Group"</li>
+<li>\ref edit_groups_anchor "Edit a Group"</li>
+<li>\ref union_groups_anchor "Union Groups"</li>
+<li>\ref intersect_groups_anchor "Intersect Groups"</li>
+<li>\ref cut_groups_anchor "Cut Groups"</li>
+</ul>
+
+<br>
+\anchor create_groups_anchor
+<h2>Create a group</h2>
 
 \image html image56.png
 
+This functionality is available in OCC viewer only.
+
 To create a group of sub-shapes of a geometrical object in the main
 menu select <b>New entity > Group > Create</b>
 \n The following menu will appear:
@@ -72,19 +84,29 @@ ShapeType),</em> where MainShape is a shape for which the group is
 created, ShapeType is a type of shapes in the created group.
 \n <b>Arguments:</b> 1 Shape + Type of sub-shape.
 
+Our <b>TUI Scripts</b> provide you with useful examples of 
+\ref tui_create_groups_anchor "Create a Group" operation.
+
 <b>Example:</b>
 
 \image html image193.png "Groups on a cylinder"
 
-
-<br><h2>Edit a group</h2>
+<br>
+\anchor edit_groups_anchor
+<h2>Edit a group</h2>
 
 \image html image57.png
 
+This functionality is available in OCC viewer only.
+
 To \b Edit an existing group in the main menu select <b>New entity >
 Group > Edit</b>. This menu is designed in the same way as the
 <b>Create a group</b> menu.
 
+\n <b>Dialog Box:</b> 
+
+\image html editgroup.png
+
 \n The \b Result of the operation will be a \b GEOM_Object.
 
 \n <b>TUI Command:</b>
@@ -101,11 +123,80 @@ the sub-shape to be removed from the group.</li>
 
 \n <b>Arguments:</b> 1 Shape + its sub-shapes.
 
-\n <b>Dialog Box:</b> 
+Our <b>TUI Scripts</b> provide you with useful examples of 
+\ref tui_edit_groups_anchor "Edit a Group" operation.
 
-\image html editgroup.png
+<br>
+\anchor union_groups_anchor
+<h2>Union of groups</h2>
+
+This operation allows to create a new group in such a way that all
+sub-shapes that are present in the initial groups will be added to
+the new one.
+
+<em>To union groups:</em>
+<ol>
+<li>In the <b>New Entity</b> menu select the \b Group - <b>Union Groups</b> item.
+The following dialog box will appear:
+
+\image html groups_union_dlg.png
+
+In this dialog box you should specify the name of the resulting group
+and set of groups which will be united.
+</li>
+<li>Click the \b Apply or <b>Apply and Close</b> button to confirm creation of the group.</li>
+</ol>
+
+<b>See Also</b> a sample TUI Script of a 
+\ref tui_union_groups_anchor "Union of Groups" operation.
+
+<br>
+\anchor intersect_groups_anchor
+<h2>Intersection of groups</h2>
+
+This operation allows to create a new group in such a way that only
+sub-shapes that are present in all initial groups together are added to the
+new one.
+
+<em>To intersect groups:</em>
+<ol>
+<li>In the <b>New Entity</b> menu select the \b Group - <b>Intersect Groups</b> item.
+The following dialog box will appear:
+
+\image html groups_intersect_dlg.png
+
+In this dialog box you should specify the name of the resulting group
+and set of groups which will be intersected.
+</li>
+<li>Click the \b Apply or <b>Apply and Close</b> button to confirm creation of the group.</li>
+</ol>
+
+<b>See Also</b> a sample TUI Script of an  
+\ref tui_intersect_groups_anchor "Intersection of Groups" operation.
+
+<br>
+\anchor cut_groups_anchor
+<h2>Cut of groups</h2>
+
+This operation allows to create a new group in such a way that all
+sub-shapes that are present in the main groups but are absent in the
+tool groups are added to the new one.
+
+<em>To cut groups:</em>
+<ol>
+<li>In the <b>New Entity</b> menu select the \b Group - <b>Cut Groups</b> item.
+The following dialog box will appear:
+
+\image html groups_cut_dlg.png
+
+In this dialog box you should specify the name of the resulting group
+and groups which will be cut.
+</li>
+<li>Click the \b Apply or <b>Apply and Close</b> button to confirm creation of the
+group.</li>
+</ol>
 
 Our <b>TUI Scripts</b> provide you with useful examples of 
-\ref tui_working_with_groups_page "Working with Groups".
+\ref tui_cut_groups_anchor "Cut of Groups" operation.
 
 */
index f3a41ad16011e42f7dd4069fd7b07be6e0a65f88..8f90021eb75fdc531bd9e2afb90a426f80fd0fce 100644 (file)
@@ -360,7 +360,8 @@ module GEOM
  //   # Internal methods (For sub-shape identification)
  //   ######################################################################
     /*!
-     *  \brief Get geometric shape of the object as a byte stream
+     *  \brief Get geometric shape of the object as a byte stream in BRep format
+     *  \note GEOM_IInsertOperations::RestoreShape() method can be used to restore shape from a BRep stream.
      */
     SALOMEDS::TMPFile GetShapeStream();
 
@@ -540,6 +541,16 @@ module GEOM
                                            in double theYParameter,
                                            in double theZParameter);
 
+    /*!
+     *  \brief Create a point, which lays on the given face.
+     *         The point will lay in arbitrary place of the face.
+     *         The only condition on it is a non-zero distance to the face boundary.
+     *         Such point can be used to uniquely identify the face inside any
+     *         shape in case, when the shape does not contain overlapped faces.
+     *  \param theFace The referenced face.
+     *  \return New GEOM_Object, containing the created point.
+     */
+    GEOM_Object MakePointOnFace (in GEOM_Object theFace);
 
     /*!
      *  \brief Create a point, on two lines intersection.
@@ -2403,6 +2414,17 @@ module GEOM
     string PrintBCErrors (in GEOM_Object theCompound,
                           in BCErrors    theErrors);
 
+    /*!
+     *  \brief Retrieve all non blocks solids and faces from a shape.
+     *
+     *  \param theShape The shape to explore.
+     *  \param theNonQuads Output parameter. Group of all non quadrangular faces.
+     *
+     *  \return Group of all non block solids (= not 6 faces, or with 6
+     *          faces, but with the presence of non-quadrangular faces).
+     */
+    GEOM_Object GetNonBlocks (in GEOM_Object theShape, out GEOM_Object theNonQuads);
+
     /*!
      *  \brief Remove all seam and degenerated edges from \a theShape.
      *
@@ -2774,10 +2796,10 @@ module GEOM
 
     /*!
      *  \brief Create a sketcher (wire or face), following the textual description,
-     *  passed through \a theCommand argument.
+     *         passed through \a theCommand argument.
      *
      *  Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
-     *  Format of the description string have to be the following:
+     *  Format of the description string has to be the following:
      *
      *  "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
      *
@@ -2805,32 +2827,60 @@ module GEOM
      *                    coordinates of the working plane.
      *  \param theWorkingPlane Nine double values, defining origin,
      *                         OZ and OX directions of the working plane.
-     *  \return New GEOM_Object, containing the created wire.
+     *  \return New GEOM_Object, containing the created wire or face.
      */
     GEOM_Object MakeSketcher (in string theCommand, in ListOfDouble theWorkingPlane);
 
     /*!
-     *  \brief Create a 3D sketcher, following the numerical description,
-     *  passed through points created by \a theCoordinates argument. 
+     *  \brief Create a sketcher (wire or face), following the textual description,
+     *         passed through \a theCommand argument. 
      *
-     *  Format of the description string have to be the following:
+     *  For format of the description string see the previous method.\n
      *
-     *  "Make3DSketcher[x1, y1, z1, x2, y2, z2, ..., xN, yN, zN]"
+     *  \param theCommand String, defining the sketcher in local
+     *                    coordinates of the working plane.
+     *  \param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
+     *  \return New GEOM_Object, containing the created wire or face.
      */
+    GEOM_Object MakeSketcherOnPlane (in string theCommand, in GEOM_Object theWorkingPlane);
 
-    GEOM_Object Make3DSketcher (in ListOfDouble theCoordinates);
-
-      /*!
-     *  \brief Create a sketcher (wire or face), following the textual description,
-     *  passed through \a theCommand argument. 
+    /*!
+     *  \brief Create a 3D sketcher, following the textual description,
+     *         passed through \a theCommand argument. 
+     *
+     *  Format of the description string has to be the following:
+     *
+     *  "3DSketcher:CMD[:CMD[:CMD...]]"
+     *
+     *  Where CMD is one of
+     *     - "TT x y z" : Create segment by point at X & Y or set the first point
+     *     - "T dx dy dz" : Create segment by point with DX & DY
+     *     .
+     *       \n
+     *     - "OXY angleX angle2 length" : Create segment by two angles and length
+     *     - "OYZ angleY angle2 length" : Create segment by two angles and length
+     *     - "OXZ angleX angle2 length" : Create segment by two angles and length
+     *     .
+     *       \n
+     *     - "WW" : Close Wire (to finish)
      *
-     *  For format of the description string see the previous method.\n
      *  \param theCommand String, defining the sketcher in local
      *                    coordinates of the working plane.
-     *  \param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
      *  \return New GEOM_Object, containing the created wire.
      */
-    GEOM_Object MakeSketcherOnPlane (in string theCommand, in GEOM_Object theWorkingPlane);
+    GEOM_Object Make3DSketcherCommand (in string theCommand);
+
+    /*!
+     *  \brief Create a 3D sketcher, made of a straight segments, joining points
+     *         with coordinates passed through \a theCoordinates argument. 
+     *
+     *  Order of coordinates has to be the following:
+     *  x1, y1, z1, x2, y2, z2, ..., xN, yN, zN
+     *
+     *  \param theCoordinates List of double values.
+     *  \return New GEOM_Object, containing the created wire.
+     */
+    GEOM_Object Make3DSketcher (in ListOfDouble theCoordinates);
   };
 
  // # GEOM_ILocalOperations:
@@ -3200,6 +3250,17 @@ module GEOM
      */
     GEOM_Object ImportFile (in string theFileName, in string theFormatName);
 
+    /*!
+     *  \brief Read a value of parameter from a file, containing a shape.
+     *  \param theFileName The file, containing the shape.
+     *  \param theFormatName Specify format for the file reading.
+     *         Available formats can be obtained with <VAR>ImportTranslators()</VAR> method.
+     *  \param theParameterName Specify the parameter. For example, pass "LEN_UNITS"
+     *                          to obtain length units, in which the file is written.
+     *  \return Value of requested parameter in form of text string.
+     */
+    string ReadValue (in string theFileName, in string theFormatName, in string theParameterName);
+
     /*!
      *  \brief Get the supported import formats and corresponding patterns for File dialog.
      *  \param theFormats Output. List of formats, available for import.
@@ -3218,6 +3279,14 @@ module GEOM
     void ExportTranslators (out string_array theFormats,
                             out string_array thePatterns);
 
+    /*!
+     *  \brief Read a shape from the binary stream, containing its bounding representation (BRep).
+     *  \note GEOM_Object::GetShapeStream() method can be used to obtain the shape's BRep stream.
+     *  \param theStream The BRep binary stream.
+     *  \return New GEOM_Object, containing the shape, read from theStream.
+     */
+    GEOM_Object RestoreShape (in SALOMEDS::TMPFile theStream);
+
     /*!
      * \brief Load texture from file
      * \param theTextureFile texture file name
@@ -3635,6 +3704,65 @@ module GEOM
      */
     void DifferenceIDs (in GEOM_Object theGroup, in ListOfLong theSubShapes);
 
+    /*!
+     *  \brief Union of two groups.
+     *  New group is created. It will contain all entities
+     *  which are present in groups theGroup1 and theGroup2.
+     *  \param theGroup1, theGroup2 are the initial GEOM groups
+     *                              to create the united group from.
+     *  \return a newly created GEOM group.
+     */
+    GEOM_Object UnionGroups (in GEOM_Object theGroup1, in GEOM_Object theGroup2);
+
+    /*!
+     *  \brief Intersection of two groups.
+     *  New group is created. It will contain only those entities
+     *  which are present in both groups theGroup1 and theGroup2.
+     *  \param theGroup1, theGroup2 are the initial GEOM groups to get common part of.
+     *  \return a newly created GEOM group.
+     */
+    GEOM_Object IntersectGroups (in GEOM_Object theGroup1, in GEOM_Object theGroup2);
+
+    /*!
+     *  \brief Cut of two groups.
+     *  New group is created. It will contain entities which are
+     *  present in group theGroup1 but are not present in group theGroup2.
+     *  \param theGroup1 is a GEOM group to include elements of.
+     *  \param theGroup2 is a GEOM group to exclude elements of.
+     *  \return a newly created GEOM group.
+     */
+    GEOM_Object CutGroups (in GEOM_Object theGroup1, in GEOM_Object theGroup2);
+
+    /*!
+     *  \brief Union of list of groups.
+     *  New group is created. It will contain all entities that are
+     *  present in groups listed in theGList.
+     *  \param theGList is a list of GEOM groups to create the united group from.
+     *  \return a newly created GEOM group.
+     */
+    GEOM_Object UnionListOfGroups (in ListOfGO theGList);
+
+    /*!
+     *  \brief Intersection of list of groups.
+     *  New group is created. It will contain only entities
+     *  which are simultaneously present in the groups listed in theGList.
+     *  \param theGList is a list of GEOM groups to get common part of.
+     *  \return a newly created GEOM group.
+     */
+    GEOM_Object IntersectListOfGroups (in ListOfGO theGList);
+
+    /*!
+     *  \brief Cut of lists of groups.
+     *  New group is created. It will contain only entities
+     *  which are present in groups listed in theGList1 but 
+     *  are not present in groups from theGList2.
+     *  \param theGList1 is a list of GEOM groups to include elements of.
+     *  \param theGList2 is a list of GEOM groups to exclude elements of.
+     *  \return a newly created GEOM group.
+     */
+    GEOM_Object CutListOfGroups (in ListOfGO theGList1,
+                                 in ListOfGO theGList2);
+
     /*!
      *  \brief Returns a type of sub-objects stored in the group
      *  \param theGroup is a GEOM group which type is returned.
index d5aab779ca87db29719d67a97fd2e1ef8da64ccf..57c92dd2d02afad08d27bf0bda501bcef1c51aca 100644 (file)
@@ -232,6 +232,7 @@ group_new.png                       \
 group_edit.png                 \
 glue.png                       \
 check_blocks_compound.png      \
+get_non_blocks.png             \
 check_self_intersections.png   \
 free_faces.png                 \
 propagate.png                  \
index dd0dfdfd225d22db56855a551b5372306e34aa92..6fb716e5a28cfe396415b36b47648265daa4b705 100644 (file)
@@ -43,7 +43,7 @@
     <parameter name="SettingsGeomStep"    value="10" />
     <parameter name="display_mode"        value="0"  />
     <parameter name="shading_color"       value="255, 255, 0" />
-    <parameter name="edges_in_shading_color" value="255, 255, 255" />
+    <parameter name="edges_in_shading_color" value="180, 180, 180" />
     <parameter name="wireframe_color"     value="255, 255, 0" />
     <parameter name="free_bound_color"    value="0, 255, 0" />
     <parameter name="line_color"          value="255, 0, 0" />
diff --git a/resources/get_non_blocks.png b/resources/get_non_blocks.png
new file mode 100644 (file)
index 0000000..b13b294
Binary files /dev/null and b/resources/get_non_blocks.png differ
index a72aba04a71614261cb2ec0d3055371b3f7a0705..94143574ec3a98d03c0bc90892dc68faab32d458 100644 (file)
 #include <SalomeApp_Application.h>
 #include <LightApp_SelectionMgr.h>
 
+// VSR 22/08/2012: issue 0021787: remove "Preview" button from BOP and Partition operations
+// Comment next line to enable preview in BOP dialog box
+#define NO_PREVIEW
+
 //=================================================================================
 // class    : BooleanGUI_Dialog()
 // purpose  : Constructs a BooleanGUI_Dialog which is a child of 'parent', with the
@@ -110,6 +114,10 @@ BooleanGUI_Dialog::BooleanGUI_Dialog (const int theOperation, GeometryGUI* theGe
   layout->addWidget(myGroup);
   /***************************************************************/
 
+#ifdef NO_PREVIEW
+  mainFrame()->CheckBoxPreview->setChecked( false );
+  mainFrame()->CheckBoxPreview->hide();
+#endif
   // Initialisation
   Init();
 }
@@ -224,6 +232,7 @@ void BooleanGUI_Dialog::SelectionIntoArgument()
     if      (myEditCurrentArgument == myGroup->LineEdit1) myObject1.nullify();
     else if (myEditCurrentArgument == myGroup->LineEdit2) myObject2.nullify();
   }
+  processPreview();
 }
 
 //=================================================================================
index 07613982f27b95ffc9662834ffee52091a40e45c..67665f66e955fdf6141b9baedbc8fb7e66640277 100644 (file)
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 // GEOM GEOMGUI : GUI for Geometry component
 // File   : DisplayGUI.cxx
 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
-//
+
 #include "DisplayGUI.h"
 #include <GeometryGUI.h>
 #include "GeometryGUI_Operations.h"
@@ -110,6 +109,10 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
     getGeometryGUI()->EmitSignalDeactivateDialog();
     DisplayOnly();
     break;
+  case GEOMOp::OpShowOnlyChildren: // POPUP MENU - SHOW ONLY CHILDREN
+    getGeometryGUI()->EmitSignalDeactivateDialog();
+    DisplayOnlyChildren();
+    break;
   case GEOMOp::OpHideAll:        // MENU VIEW - HIDE ALL
     EraseAll();
     break;
@@ -217,6 +220,62 @@ void DisplayGUI::DisplayOnly()
   Display();
 }
 
+//=====================================================================================
+// function : DisplayGUI::DisplayOnlyChildren()
+// purpose  : Display only children of selected GEOM objects and erase other
+//=====================================================================================
+void DisplayGUI::DisplayOnlyChildren()
+{
+  EraseAll();
+
+  SALOME_ListIO listIO;
+
+  SalomeApp_Application* app = getGeometryGUI()->getApp();
+  if (!app) return;
+
+  SalomeApp_Study* anActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
+  if (!anActiveStudy) return;
+
+  LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+  if (!aSelMgr) return;
+
+  // get selection
+  SALOME_ListIO aList;
+  //aSelMgr->selectedObjects(aList);
+  aSelMgr->selectedObjects(aList, "ObjectBrowser", false);
+  SALOME_ListIteratorOfListIO It (aList);
+
+  SUIT_OverrideCursor();
+
+  for (; It.More(); It.Next()) {
+    Handle(SALOME_InteractiveObject) anIObject = It.Value();
+    if (anIObject->hasEntry()) {
+      _PTR(SObject) SO (anActiveStudy->studyDS()->FindObjectID(anIObject->getEntry()));
+      if (SO) {
+        _PTR(SComponent) SC (SO->GetFatherComponent());
+        if (QString(SO->GetID().c_str()) == QString(SO->GetFatherComponent()->GetID().c_str())) {
+          // if component is selected, pass it
+        }
+        else {
+          _PTR(ChildIterator) anIter (anActiveStudy->studyDS()->NewChildIterator(SO));
+          anIter->InitEx(true);
+          while (anIter->More()) {
+            _PTR(SObject) valSO (anIter->Value());
+            _PTR(SObject) refSO;
+            if (!valSO->ReferencedObject(refSO)) {
+              listIO.Append(new SALOME_InteractiveObject(valSO->GetID().c_str(),
+                                                         SC->ComponentDataType().c_str(),
+                                                         valSO->GetName().c_str()));
+            }
+            anIter->Next();
+          }
+        }
+      }
+    }
+  }
+  GEOM_Displayer(anActiveStudy).Display(listIO, true);
+}
+
 //=====================================================================================
 // function : DisplayGUI::Display()
 // purpose  : Display selected GEOM objects
index a52fe0352947c196689d17c2648c686501f86dc5..74de0e22f2e3f16b59bf92e1ea0badc610237dd2 100644 (file)
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 // GEOM GEOMGUI : GUI for Geometry component
 // File   : DisplayGUI.h
 // Author : Damien COQUERET, Open CASCADE S.A.S.
-//
+
 #ifndef DISPLAYGUI_H
 #define DISPLAYGUI_H
 
@@ -53,6 +52,8 @@ public:
   void Display();
   // Display selected GEOM objects and erase other
   void DisplayOnly();
+  // Display only children of selected GEOM objects and erase other
+  void DisplayOnlyChildren();
   // Erase selected GEOM objects
   void Erase();
 
index 53b0694e953c0bd1586b34a8d9377529d7a52c5d..b44cbd49c29b922feacb9001585578f23a9adfbc 100755 (executable)
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 // GEOM GEOMGUI : GUI for Geometry component
 // File   : EntityGUI_3DSketcherDlg.cxx
 // Author : DMV, OCN
-//
+
 #include <cmath>
 #include <string>
 #include <boost/lexical_cast.hpp>
@@ -31,7 +30,7 @@
 
 #include <GEOMBase.h>
 #include <GeometryGUI.h>
-#include <Precision.hxx> 
+#include <Precision.hxx>
 
 #include <DlgRef.h>
 #include <SUIT_Session.h>
 #include <SalomeApp_Tools.h>
 
 //OCCT includes
-//#include <BRep_Tool.hxx>
-//#include <TopExp.hxx>
-//#include <TopExp_Explorer.hxx>
-//#include <TopoDS_Vertex.hxx>
 #include <TopoDS.hxx>
 #include <TColStd_IndexedMapOfInteger.hxx>
-//#include <BRepBuilderAPI_Transform.hxx>
-//#include <BRepBuilderAPI_MakeWire.hxx>
 #include <BRepBuilderAPI_MakeVertex.hxx>
 #include <BRepBuilderAPI_MakePolygon.hxx>
 #include <BRepBuilderAPI_MakeEdge.hxx>
@@ -86,11 +79,18 @@ enum
   TYPE_TWO_ANGLES
 };
 
+enum
+{
+  OXY,
+  OYZ,
+  OXZ
+};
+
 class Locker
 {
 public:
-  Locker( bool& l ) : myLock( l ) { myLock = true;  }
-  ~Locker()                       { myLock = false; }
+  Locker(bool& l) : myLock(l) { myLock = true;  }
+  ~Locker()                   { myLock = false; }
 private:
   bool& myLock;
 };
@@ -102,27 +102,28 @@ private:
 //            The dialog will by default be modeless, unless you set 'modal' to
 //            TRUE to construct a modal dialog.
 //=================================================================================
-EntityGUI_3DSketcherDlg::EntityGUI_3DSketcherDlgGeometryGUI* theGeometryGUI, QWidget* parent,
+EntityGUI_3DSketcherDlg::EntityGUI_3DSketcherDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
                                                   bool modal, Qt::WindowFlags fl,
-                                                  const double lineWidth )
-  : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ),
-    myMode( -1 ),
-    myOK( false ),
-    myLineWidth( lineWidth ),
-    myGeometryGUI( theGeometryGUI ),
+                                                  const double lineWidth)
+  : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
+    myMode(-1),
+    myOK(false),
+    myLineWidth(lineWidth),
+    myGeometryGUI(theGeometryGUI),
     myLengthIORedoList()
+//     myLastAngleNormal()
 {
-  QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
-  QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_UNDO" ) ) );
-  QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_REDO" ) ) );
-  QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICO_3DSKETCH" ) ) );
+  QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
+  QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_UNDO")));
+  QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_REDO")));
+  QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICO_3DSKETCH")));
 
-  setWindowTitle( tr( "GEOM_3DSKETCHER_TITLE" ) );
+  setWindowTitle(tr("GEOM_3DSKETCHER_TITLE"));
 
   /***************************************************************/
 
-  mainFrame()->GroupConstructors->setTitle( tr( "GEOM_3DSKETCHER" ) );
-  mainFrame()->RadioButton1->setIcon( image3 );;
+  mainFrame()->GroupConstructors->setTitle(tr("GEOM_3DSKETCHER"));
+  mainFrame()->RadioButton1->setIcon(image3);;
   mainFrame()->RadioButton2->close();
   mainFrame()->RadioButton3->close();
 
@@ -132,48 +133,59 @@ EntityGUI_3DSketcherDlg::EntityGUI_3DSketcherDlg( GeometryGUI* theGeometryGUI, Q
   GroupType->RadioButton2->setText(tr("GEOM_SKETCHER_REL"));
   GroupType->RadioButton3->setText(tr("Angles")); //TODO translation
 //   GroupType->RadioButton3->close();
-  myTypeGroup = new QButtonGroup( this );
-  myTypeGroup->addButton( GroupType->RadioButton1, 0 );
-  myTypeGroup->addButton( GroupType->RadioButton2, 1 );
-  myTypeGroup->addButton( GroupType->RadioButton3, 2 );
-
-  Group3Spin = new EntityGUI_3Spin( centralWidget() );
-  Group3Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) );
-  Group3Spin->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) );
-  Group3Spin->buttonUndo->setIcon( image1 );
-  Group3Spin->buttonRedo->setIcon( image2 );
-  Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) );
-  Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) );
-  Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Z2" ) );
-  
-  GroupAngles = new EntityGUI_Angles( centralWidget() );
-  GroupAngles->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) );
-  GroupAngles->buttonUndo->setIcon( image1 );
-  GroupAngles->buttonRedo->setIcon( image2 );
-  GroupAngles->checkBox->setText( tr( "Angle 2" ) ); //TODO translation
-  
-  GroupControls = new EntityGUI_Controls( centralWidget() );
+  myTypeGroup = new QButtonGroup(this);
+  myTypeGroup->addButton(GroupType->RadioButton1, 0);
+  myTypeGroup->addButton(GroupType->RadioButton2, 1);
+  myTypeGroup->addButton(GroupType->RadioButton3, 2);
+
+  Group3Spin = new EntityGUI_3Spin(centralWidget());
+  Group3Spin->GroupBox1->setTitle(tr("GEOM_SKETCHER_VALUES"));
+  Group3Spin->buttonApply->setText(tr("GEOM_SKETCHER_APPLY"));
+  Group3Spin->buttonUndo->setIcon(image1);
+  Group3Spin->buttonRedo->setIcon(image2);
+  Group3Spin->TextLabel1->setText(tr("GEOM_SKETCHER_X2"));
+  Group3Spin->TextLabel2->setText(tr("GEOM_SKETCHER_Y2"));
+  Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_Z2"));
+
+  GroupAngles = new EntityGUI_Angles(centralWidget());
+  GroupAngles->buttonApply->setText(tr("GEOM_SKETCHER_APPLY"));
+  GroupAngles->buttonUndo->setIcon(image1);
+  GroupAngles->buttonRedo->setIcon(image2);
+  GroupAngles->checkBox->setText(tr("Angle 2")); //TODO translation
+
+  GroupControls = new EntityGUI_Controls(centralWidget());
   GroupControls->GroupBox1->setTitle(tr("GEOM_CONTROLS"));
-  GroupControls->CheckBox1->setText( tr( "Show length dimensions" ) ); //TODO translation
-  GroupControls->CheckBox2->setText( tr( "Show angle dimensions" ) );  //TODO translation
-
-  buttonOk()->setText( tr( "GEOM_BUT_END_SKETCH" ) );
-  buttonApply()->setText( tr( "GEOM_BUT_CLOSE_SKETCH" ) );
-  
-  QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
-  layout->setMargin( 0 ); layout->setSpacing( 6 );
-  layout->addWidget( GroupType );
-  layout->addWidget( Group3Spin );
-  layout->addWidget( GroupAngles );
-  layout->addWidget( GroupControls );
-
-  setHelpFileName( "create_3dsketcher_page.html" );
+  GroupControls->CheckBox1->setText(tr("Show length dimensions")); //TODO translation
+  GroupControls->CheckBox2->setText(tr("Show angle dimensions"));  //TODO translation
+  GroupControls->CheckBox3->setText(tr("Show start/end point coordinates"));  //TODO translation
+  GroupControls->lineEdit_1->setReadOnly(true);
+  GroupControls->lineEdit_2->setReadOnly(true);
+  GroupControls->lineEdit_3->setReadOnly(true);
+  GroupControls->lineEdit_4->setReadOnly(true);
+  GroupControls->lineEdit_5->setReadOnly(true);
+  GroupControls->lineEdit_6->setReadOnly(true);
+  GroupControls->label_1->setText(tr("X:"));
+  GroupControls->label_2->setText(tr("Y:"));
+  GroupControls->label_3->setText(tr("Z:"));
+  GroupControls->label_4->setText(tr("X:"));
+  GroupControls->label_5->setText(tr("Y:"));
+  GroupControls->label_6->setText(tr("Z:"));
+
+  buttonOk()->setText(tr("GEOM_BUT_END_SKETCH"));
+  buttonApply()->setText(tr("GEOM_BUT_CLOSE_SKETCH"));
+
+  QVBoxLayout* layout = new QVBoxLayout(centralWidget());
+  layout->setMargin(0); layout->setSpacing(6);
+  layout->addWidget(GroupType);
+  layout->addWidget(Group3Spin);
+  layout->addWidget(GroupAngles);
+  layout->addWidget(GroupControls);
+
+  setHelpFileName("create_3dsketcher_page.html");
 
   resize(100,100);
   Init();
-}  
-
-
+}
 
 //=================================================================================
 // function : ~EntityGUI_3DSketcherDlg()
@@ -181,7 +193,7 @@ EntityGUI_3DSketcherDlg::EntityGUI_3DSketcherDlg( GeometryGUI* theGeometryGUI, Q
 //=================================================================================
 EntityGUI_3DSketcherDlg::~EntityGUI_3DSketcherDlg()
 {
-  myGeomGUI->SetActiveDialogBox( 0 );
+  myGeomGUI->SetActiveDialogBox(0);
 }
 
 //=================================================================================
@@ -191,152 +203,160 @@ EntityGUI_3DSketcherDlg::~EntityGUI_3DSketcherDlg()
 void EntityGUI_3DSketcherDlg::Init()
 {
   myOK = false;
-  myOrientation = 1;
+  myOrientation = OXY;
   myPrsType = NONE;
-  
+
   SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
   myAnglePrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
   myLengthPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
-  
+
   //TEST
-  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+  localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
 //   globalSelection(GEOM_PREVIEW);
+//   setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 
 
   /* Get setting of step value from file configuration */
-  double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 );
+  double step = SUIT_Session::session()->resourceMgr()->doubleValue("Geometry", "SettingsGeomStep", 100.0);
 
   /* min, max, step and decimals for spin boxes */
-  initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
-  initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
-  initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
-  
-  initSpinBox( GroupAngles->SpinBox_DA , -180.0, 180.0, step, "angular_precision" );
-  initSpinBox( GroupAngles->SpinBox_DA2,  -90.0,  90.0, step, "angular_precision" );
-  initSpinBox( GroupAngles->SpinBox_DL , COORD_MIN, COORD_MAX, step, "length_precision" );
+  initSpinBox(Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision");
+  initSpinBox(Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision");
+  initSpinBox(Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision");
+
+  initSpinBox(GroupAngles->SpinBox_DA , -180.0, 180.0, step, "angular_precision");
+  initSpinBox(GroupAngles->SpinBox_DA2,  -90.0,  90.0, step, "angular_precision");
+  initSpinBox(GroupAngles->SpinBox_DL , COORD_MIN, COORD_MAX, step, "length_precision");
 
   Group3Spin->SpinBox_DX->setValue(0.0);
   Group3Spin->SpinBox_DY->setValue(0.0);
   Group3Spin->SpinBox_DZ->setValue(0.0);
-  
+
   GroupAngles->SpinBox_DA->setValue(0.0);
   GroupAngles->SpinBox_DA2->setValue(0.0);
   GroupAngles->SpinBox_DL->setValue(0.0);
-  
+
   GroupAngles->radioButton_1->setChecked(true);
   GroupAngles->checkBox->setChecked(false);
-  GroupAngles->SpinBox_DA2->setEnabled(false); 
+  GroupAngles->SpinBox_DA2->setEnabled(false);
+
+  GroupControls->CheckBox1->setChecked(true);
+  GroupControls->CheckBox2->setChecked(true);
+  GroupControls->CheckBox3->setChecked(true);
   
-  GroupControls->CheckBox1->setChecked( true );
-  GroupControls->CheckBox2->setChecked( true );
   isLengthVisible = true;
   isAngleVisible = true;
-   
+
   GroupAngles->hide();
 
   /* signals and slots connections */
-  connect( buttonOk(),     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
-  connect( buttonApply(),  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
+  connect(buttonOk(),     SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+  connect(buttonApply(),  SIGNAL(clicked()), this, SLOT(ClickOnApply()));
 
-  connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+  connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 
-  connect( Group3Spin->buttonApply,  SIGNAL( clicked() ), this, SLOT( ClickOnAddPoint() ) );
-  connect( Group3Spin->buttonUndo,   SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
-  connect( Group3Spin->buttonRedo,   SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ) ;
-  
-  connect( GroupAngles->buttonApply,  SIGNAL( clicked() ), this, SLOT( ClickOnAddPoint() ) );
-  connect( GroupAngles->buttonUndo,   SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
-  connect( GroupAngles->buttonRedo,   SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ) ;
+  connect(Group3Spin->buttonApply,  SIGNAL(clicked()), this, SLOT(ClickOnAddPoint()));
+  connect(Group3Spin->buttonUndo,   SIGNAL(clicked()), this, SLOT(ClickOnUndo()));
+  connect(Group3Spin->buttonRedo,   SIGNAL(clicked()), this, SLOT(ClickOnRedo())) ;
 
-  connect( myTypeGroup, SIGNAL( buttonClicked( int ) ),  this, SLOT( TypeClicked( int ) ) );
+  connect(GroupAngles->buttonApply,  SIGNAL(clicked()), this, SLOT(ClickOnAddPoint()));
+  connect(GroupAngles->buttonUndo,   SIGNAL(clicked()), this, SLOT(ClickOnUndo()));
+  connect(GroupAngles->buttonRedo,   SIGNAL(clicked()), this, SLOT(ClickOnRedo())) ;
 
-  connect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
-  connect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
-  connect( Group3Spin->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
-  
-  connect( GroupAngles->SpinBox_DA,  SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
-  connect( GroupAngles->SpinBox_DA2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
-  connect( GroupAngles->SpinBox_DL,  SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
-  
-  connect( GroupAngles->radioButton_1,   SIGNAL( clicked ( bool ) ), this, SLOT( ButtonClicked(bool) ) ) ;
-  connect( GroupAngles->radioButton_2,   SIGNAL( clicked ( bool ) ), this, SLOT( ButtonClicked(bool) ) ) ;
-  connect( GroupAngles->radioButton_3,   SIGNAL( clicked ( bool ) ), this, SLOT( ButtonClicked(bool) ) ) ;
-  
-  connect( GroupAngles->checkBox,        SIGNAL( clicked ( bool ) ), this, SLOT( BoxChecked (bool) ) ) ;
-  connect( GroupControls->CheckBox1,     SIGNAL( clicked ( bool ) ), this, SLOT( BoxChecked (bool) ) ) ;
-  connect( GroupControls->CheckBox2,     SIGNAL( clicked ( bool ) ), this, SLOT( BoxChecked (bool) ) ) ;
+  connect(myTypeGroup, SIGNAL(buttonClicked(int)),  this, SLOT(TypeClicked(int)));
+
+  connect(Group3Spin->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+  connect(Group3Spin->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+  connect(Group3Spin->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+
+  connect(GroupAngles->SpinBox_DA,  SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+  connect(GroupAngles->SpinBox_DA2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+  connect(GroupAngles->SpinBox_DL,  SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+
+  connect(GroupAngles->radioButton_1,   SIGNAL(clicked (bool)), this, SLOT(ButtonClicked(bool))) ;
+  connect(GroupAngles->radioButton_2,   SIGNAL(clicked (bool)), this, SLOT(ButtonClicked(bool))) ;
+  connect(GroupAngles->radioButton_3,   SIGNAL(clicked (bool)), this, SLOT(ButtonClicked(bool))) ;
+
+  connect(GroupAngles->checkBox,        SIGNAL(clicked (bool)), this, SLOT(BoxChecked (bool))) ;
+  connect(GroupControls->CheckBox1,     SIGNAL(clicked (bool)), this, SLOT(BoxChecked (bool))) ;
+  connect(GroupControls->CheckBox2,     SIGNAL(clicked (bool)), this, SLOT(BoxChecked (bool))) ;
+  connect(GroupControls->CheckBox3,     SIGNAL(clicked (bool)), this, SLOT(BoxChecked (bool))) ;
 
-  connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
+  connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
 
-  connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
-  connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( ClickOnCancel() ) );
+  connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()),        this, SLOT(ClickOnCancel()));
 
-  initName( tr( "GEOM_3DSKETCHER" ) );
+  initName(tr("GEOM_3DSKETCHER"));
+  
+  GroupControls->CheckBox3->click();
 
   UpdateButtonsState();
-  GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
+  GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth);
 }
 
 //=================================================================================
 // function : TypeClicked()
 // purpose  : Radio button management
 //=================================================================================
-void EntityGUI_3DSketcherDlg::TypeClicked( int mode )
+void EntityGUI_3DSketcherDlg::TypeClicked (int mode)
 {
-  if ( mode == myMode ) return;
+  if (mode == myMode) return;
 
   GroupAngles->hide();
   Group3Spin->show();
-  
+
   bool blocked = Group3Spin->SpinBox_DX->signalsBlocked();
   Group3Spin->SpinBox_DX->blockSignals(true);
   Group3Spin->SpinBox_DY->blockSignals(true);
   Group3Spin->SpinBox_DZ->blockSignals(true);
+
   // Get setting of step value from file configuration
   XYZ xyz = getLastPoint();
   bool okx, oky, okz;
-  Group3Spin->SpinBox_DX->text().toDouble( &okx );
-  Group3Spin->SpinBox_DY->text().toDouble( &oky );
-  Group3Spin->SpinBox_DZ->text().toDouble( &okz );
-  if ( mode == 0 ) {  // XY
-    Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) );
-    Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) );
-    Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Z2" ) );
+  Group3Spin->SpinBox_DX->text().toDouble(&okx);
+  Group3Spin->SpinBox_DY->text().toDouble(&oky);
+  Group3Spin->SpinBox_DZ->text().toDouble(&okz);
+
+  if (mode == 0) {  // XYZ
+    Group3Spin->TextLabel1->setText(tr("GEOM_SKETCHER_X2"));
+    Group3Spin->TextLabel2->setText(tr("GEOM_SKETCHER_Y2"));
+    Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_Z2"));
     if (myMode == 1)
     {
-      if ( okx ) Group3Spin->SpinBox_DX->setValue( xyz.x + Group3Spin->SpinBox_DX->value() );
-      if ( oky ) Group3Spin->SpinBox_DY->setValue( xyz.y + Group3Spin->SpinBox_DY->value() );
-      if ( okz ) Group3Spin->SpinBox_DZ->setValue( xyz.z + Group3Spin->SpinBox_DZ->value() );
+      if (okx) Group3Spin->SpinBox_DX->setValue(xyz.x + Group3Spin->SpinBox_DX->value());
+      if (oky) Group3Spin->SpinBox_DY->setValue(xyz.y + Group3Spin->SpinBox_DY->value());
+      if (okz) Group3Spin->SpinBox_DZ->setValue(xyz.z + Group3Spin->SpinBox_DZ->value());
     }
     Group3Spin->buttonApply->setFocus();
   }
-  else if ( mode == 1) { // DXDY
-    Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_DX2" ) );
-    Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_DY2" ) );
-    Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_DZ2" ) );
+  else if (mode == 1) { // DXDYDZ
+    Group3Spin->TextLabel1->setText(tr("GEOM_SKETCHER_DX2"));
+    Group3Spin->TextLabel2->setText(tr("GEOM_SKETCHER_DY2"));
+    Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_DZ2"));
     if (myMode == 0)
     {
-      if ( okx ) Group3Spin->SpinBox_DX->setValue( Group3Spin->SpinBox_DX->value() - xyz.x );
-      if ( oky ) Group3Spin->SpinBox_DY->setValue( Group3Spin->SpinBox_DY->value() - xyz.y );
-      if ( okz ) Group3Spin->SpinBox_DZ->setValue( Group3Spin->SpinBox_DZ->value() - xyz.z );
+      if (okx) Group3Spin->SpinBox_DX->setValue(Group3Spin->SpinBox_DX->value() - xyz.x);
+      if (oky) Group3Spin->SpinBox_DY->setValue(Group3Spin->SpinBox_DY->value() - xyz.y);
+      if (okz) Group3Spin->SpinBox_DZ->setValue(Group3Spin->SpinBox_DZ->value() - xyz.z);
     }
     Group3Spin->buttonApply->setFocus();
   }
-  else if (mode == 2){ // Angles
+  else if (mode == 2) { // Angles and Length
     Group3Spin->hide();
     GroupAngles->show();
     GroupAngles->buttonApply->setFocus();
   }
-  
+
   Group3Spin->SpinBox_DX->blockSignals(blocked);
   Group3Spin->SpinBox_DY->blockSignals(blocked);
   Group3Spin->SpinBox_DZ->blockSignals(blocked);
 
   myMode = mode;
-  
+
   updateGeometry();
   resize(minimumSizeHint());
-  
-  GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
+
+  GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth);
 }
 
 //=================================================================================
@@ -344,72 +364,113 @@ void EntityGUI_3DSketcherDlg::TypeClicked( int mode )
 // purpose  : called when the point coordinates is Applyed
 //=================================================================================
 void EntityGUI_3DSketcherDlg::ClickOnAddPoint()
-{
+{ 
   QString msg;
-  if ( !isValid( msg ) ) {
-    showError( msg );
+  if (!isValid(msg)) {
+    showError(msg);
     return;
   }
-  
+
   // Display and store angle dimensions interactive objects in Prs
-  if( GroupType->RadioButton3->isChecked() )
+  if (GroupType->RadioButton3->isChecked())    // ANGLES
   {
     double anAngle2 = 0.0;
     if (GroupAngles->checkBox->isChecked())
       anAngle2 = GroupAngles->SpinBox_DA2->value();
-    
-    // Store length dimensions
-    displayLength(GroupAngles->SpinBox_DL->value(), /*store =*/true);
+
     // Store angle dimensions
-    displayAngle(GroupAngles->SpinBox_DA->value(), anAngle2, 
-                 GroupAngles->SpinBox_DL->value(), myOrientation,  /*store =*/true);  
+    displayAngle(GroupAngles->SpinBox_DA->value(), anAngle2,
+                 GroupAngles->SpinBox_DL->value(), myOrientation,  /*store =*/true);
+    // Store length dimensions
+    displayLength(GroupAngles->SpinBox_DL->value(), /*store =*/true, /*type=*/myPrsType);
   }
-  
+
   // Display and store store length dimension interactive object in Prs
-  if (GroupType->RadioButton1->isChecked() ||
+  if (GroupType->RadioButton1->isChecked() ||   // ABSOLUTE or RELATIVE coordinates
       GroupType->RadioButton2->isChecked())
   {
     displayLength(-1, /*store=*/true);
   }
-  
-  myPointsList.append( getCurrentPoint() );
-  myPrsTypeList.push_back( myPrsType );
-  
+
+  myPointsList.append(getCurrentPoint());
+  myPrsTypeList.push_back(myPrsType);
+
   // Clean redo lists
   myRedoList.clear();
   myPrsTypeRedoList.clear();
   myLengthIORedoList.Clear();
   myAngleIORedoList.Clear();
-  
-  if ( myMode == 1 ) {
-    Group3Spin->SpinBox_DX->setValue( 0.0 );
-    Group3Spin->SpinBox_DY->setValue( 0.0 );
-    Group3Spin->SpinBox_DZ->setValue( 0.0 );
+
+  if (myMode == 1) 
+  {
+    Group3Spin->SpinBox_DX->setValue(0.0);
+    Group3Spin->SpinBox_DY->setValue(0.0);
+    Group3Spin->SpinBox_DZ->setValue(0.0);
   }
-  else if ( myMode == 2 )
+  else if (myMode == 2)
   {
-    GroupAngles->SpinBox_DA->setValue( 0.0 );
-    GroupAngles->SpinBox_DL->setValue( 0.0 );
-    GroupAngles->SpinBox_DA2->setValue( 0.0 );
+    GroupAngles->SpinBox_DA->setValue(0.0);
+    GroupAngles->SpinBox_DL->setValue(0.0);
+    GroupAngles->SpinBox_DA2->setValue(0.0);
   }
-  UpdateButtonsState();
-  GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
   
+  UpdatePointCoordinates();
+    
+  UpdateButtonsState();
+  GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth);
 }
 
 //=================================================================================
 // function : UpdateButtonsState()
-// purpose  : 
+// purpose  :
 //=================================================================================
 void EntityGUI_3DSketcherDlg::UpdateButtonsState()
 {
-  if ( myPointsList.count() == 0 ) GroupType->RadioButton1->click();
-  GroupType->RadioButton2->setEnabled( myPointsList.count() > 0 );
-  GroupType->RadioButton3->setEnabled( myPointsList.count() > 0 );
-  Group3Spin->buttonUndo->setEnabled( myPointsList.count() > 0 );
-  Group3Spin->buttonRedo->setEnabled( myRedoList.count() > 0 );
-  GroupAngles->buttonUndo->setEnabled( myPointsList.count() > 0 );
-  GroupAngles->buttonRedo->setEnabled( myRedoList.count() > 0 );
+  if (myPointsList.count() == 0) GroupType->RadioButton1->click();
+  GroupType->RadioButton2->setEnabled(myPointsList.count() > 0);
+  GroupType->RadioButton3->setEnabled(myPointsList.count() > 0);
+  Group3Spin->buttonUndo->setEnabled(myPointsList.count() > 0);
+  Group3Spin->buttonRedo->setEnabled(myRedoList.count() > 0);
+  GroupAngles->buttonUndo->setEnabled(myPointsList.count() > 0);
+  GroupAngles->buttonRedo->setEnabled(myRedoList.count() > 0);
+}
+
+//=================================================================================
+// function : UpdatePointCoordinates()
+// purpose  :Update point coordinates in the control groupbox
+//=================================================================================
+void EntityGUI_3DSketcherDlg::UpdatePointCoordinates()
+{
+  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+  int aPrecision = resMgr->integerValue("Geometry", "length_precision", 6);
+  
+  if (myPointsList.count() == 0)
+  {
+    GroupControls->lineEdit_1->setText("");
+    GroupControls->lineEdit_2->setText("");
+    GroupControls->lineEdit_3->setText("");
+    
+    GroupControls->lineEdit_4->setText("");
+    GroupControls->lineEdit_5->setText("");
+    GroupControls->lineEdit_6->setText("");
+  }
+  else if (myPointsList.count() == 1)
+  {
+    GroupControls->lineEdit_1->setText(DlgRef::PrintDoubleValue(getLastPoint().x, aPrecision));
+    GroupControls->lineEdit_2->setText(DlgRef::PrintDoubleValue(getLastPoint().y, aPrecision));
+    GroupControls->lineEdit_3->setText(DlgRef::PrintDoubleValue(getLastPoint().z, aPrecision));
+    
+    GroupControls->lineEdit_4->setText("");
+    GroupControls->lineEdit_5->setText("");
+    GroupControls->lineEdit_6->setText("");
+  }
+  else
+  {
+    GroupControls->lineEdit_4->setText(DlgRef::PrintDoubleValue(getLastPoint().x, aPrecision));
+    GroupControls->lineEdit_5->setText(DlgRef::PrintDoubleValue(getLastPoint().y, aPrecision));
+    GroupControls->lineEdit_6->setText(DlgRef::PrintDoubleValue(getLastPoint().z, aPrecision));
+  }
+  
 }
 
 //=================================================================================
@@ -419,42 +480,45 @@ void EntityGUI_3DSketcherDlg::UpdateButtonsState()
 void EntityGUI_3DSketcherDlg::ClickOnUndo()
 {
   if (myPointsList.count() > 0) {
-    myRedoList.append( myPointsList.takeLast() );
+    myRedoList.append(myPointsList.takeLast());
     UpdateButtonsState();
-    GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
-    
+    GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth);
+
     // Erase dimensions presentations
     SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
-    ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myLengthPrs, true); 
+    ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myLengthPrs, true);
     ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myAnglePrs, true);
-    
+
     if (myPrsTypeList.back() != NONE)
     {
       // Remove last prepended IO
-      removeLastIOFromPrs( TYPE_LENGTH );     
-    }   
-    if ( myPrsTypeList.back() == TYPE_ANGLE ||
-         myPrsTypeList.back() == TYPE_TWO_ANGLES )
+      removeLastIOFromPrs(TYPE_LENGTH);
+    }
+    if (myPrsTypeList.back() == TYPE_ANGLE ||
+         myPrsTypeList.back() == TYPE_TWO_ANGLES)
     {
       // Remove first Angle IO from presentation
-      removeLastIOFromPrs( TYPE_ANGLE );   
-      if ( myPrsTypeList.back() == TYPE_TWO_ANGLES )
+      removeLastIOFromPrs(TYPE_ANGLE);
+      if (myPrsTypeList.back() == TYPE_TWO_ANGLES)
       {
         // Remove second  Angle IO
-        removeLastIOFromPrs( TYPE_ANGLE );   
+        removeLastIOFromPrs(TYPE_ANGLE);
       }
     }
-       
+
     // Erase last action type and store it in redo list
     myPrsTypeRedoList.push_back(myPrsTypeList.back());
     myPrsTypeList.pop_back();
-    
+
     // Display modified presentation
     if (isLengthVisible)
       ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myLengthPrs);
     if (isAngleVisible)
       ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs);
     
+    // Update of point coordinates in the control groupbox
+    UpdatePointCoordinates();
+
     updateViewer();
   }
 }
@@ -465,41 +529,44 @@ void EntityGUI_3DSketcherDlg::ClickOnUndo()
 //=================================================================================
 void EntityGUI_3DSketcherDlg::ClickOnRedo()
 {
-  if ( myRedoList.count() > 0) {
-    myPointsList.append( myRedoList.takeLast() );
+  if (myRedoList.count() > 0) {
+    myPointsList.append(myRedoList.takeLast());
     UpdateButtonsState();
-    GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
-      
+    GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth);
+
     // Erase dimensions presentations
     SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
     ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myLengthPrs, true);
     ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myAnglePrs, true);
-    
-    if ( myPrsTypeRedoList.back() != NONE )
-      restoreLastIOToPrs( TYPE_LENGTH ); 
-    
-    if ( myPrsTypeRedoList.back() == TYPE_ANGLE || 
-         myPrsTypeRedoList.back() == TYPE_TWO_ANGLES )
+
+    if (myPrsTypeRedoList.back() != NONE)
+      restoreLastIOToPrs(TYPE_LENGTH);
+
+    if (myPrsTypeRedoList.back() == TYPE_ANGLE ||
+         myPrsTypeRedoList.back() == TYPE_TWO_ANGLES)
     {
       // Add a first IO from the Redo list
-      restoreLastIOToPrs( TYPE_ANGLE ); 
-      if ( myPrsTypeRedoList.back() == TYPE_TWO_ANGLES )
+      restoreLastIOToPrs(TYPE_ANGLE);
+      if (myPrsTypeRedoList.back() == TYPE_TWO_ANGLES)
       {
         // Add a second IO from the Redo list
-        restoreLastIOToPrs( TYPE_ANGLE ); 
+        restoreLastIOToPrs(TYPE_ANGLE);
       }
     }
-    
+
     // Record last prs type
     myPrsTypeList.push_back(myPrsTypeRedoList.back());
     myPrsTypeRedoList.pop_back();
-    
+
     // Display modified presentation
     if (isLengthVisible)
       ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myLengthPrs);
     if (isAngleVisible)
       ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs);
     
+    // Update of point coordinates in the control groupbox
+    UpdatePointCoordinates();
+
     updateViewer();
   }
 }
@@ -508,40 +575,40 @@ void EntityGUI_3DSketcherDlg::ClickOnRedo()
 // function : removeLastIO()
 // purpose  :
 //=================================================================================
-void EntityGUI_3DSketcherDlg::removeLastIOFromPrs(int type)
+void EntityGUI_3DSketcherDlg::removeLastIOFromPrs (int type)
 {
   AIS_ListOfInteractive anIOList;
-  
+
   if (type == TYPE_LENGTH)
   {
     myLengthPrs->GetObjects(anIOList);
     myLengthIORedoList.Prepend(anIOList.First());  // Store last prepended Length IO in redo list
     myLengthPrs->RemoveFirst();                    // Remove it from myLengthPrs
-  }   
+  }
   if (type == TYPE_ANGLE)
   {
     myAnglePrs->GetObjects(anIOList);
     myAngleIORedoList.Prepend(anIOList.First());  // Store last prepended Angle IO in redo list
     myAnglePrs->RemoveFirst();                    // Remove it from myAnglePrs
-  }   
+  }
 }
 
 //=================================================================================
 // function : restoreLastIO()
 // purpose  :
 //=================================================================================
-void EntityGUI_3DSketcherDlg::restoreLastIOToPrs(int type)
+void EntityGUI_3DSketcherDlg::restoreLastIOToPrs (int type)
 {
   if (type == TYPE_LENGTH)
   {
     myLengthPrs->PrependObject(myLengthIORedoList.First()); // Restore last removed IO
     myLengthIORedoList.RemoveFirst();                       // Remove it from redo list
-  }   
+  }
   if (type == TYPE_ANGLE)
   {
     myAnglePrs->PrependObject(myAngleIORedoList.First());  // Restore last removed IO
     myAngleIORedoList.RemoveFirst();                       // Remove it from redo list
-  }   
+  }
 }
 
 //=================================================================================
@@ -555,26 +622,26 @@ void EntityGUI_3DSketcherDlg::SelectionIntoArgument()
   aSelMgr->selectedObjects(aSelList);
 
   int nbSel = aSelList.Extent();
-  if ( nbSel == 1 ) {
-    GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-    if ( !CORBA::is_nil(aSelectedObject) ) {
+  if (nbSel == 1) {
+    GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First());
+    if (!CORBA::is_nil(aSelectedObject)) {
       TopoDS_Shape aShape;
-      if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE)) { // Explore the shape if its a local selection
+      if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE)) {
+        // Explore the shape if its a local selection
         TColStd_IndexedMapOfInteger aMap;
         aSelMgr->GetIndexes(aSelList.First(), aMap);
-        if (aMap.Extent() == 1)
-          {
-            int anIndex = aMap(1);
-            GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
-            aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-          }
+        if (aMap.Extent() == 1) {
+          int anIndex = aMap(1);
+          GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
+          aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+        }
       }
       bool isOk = true;
-      if ( aShape.ShapeType() != TopAbs_VERTEX )
+      if (aShape.ShapeType() != TopAbs_VERTEX)
         isOk = GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX);
       if (isOk) {
         gp_Pnt aPnt;
-        if ( GEOMBase::VertexToPoint( aShape, aPnt ) ) {
+        if (GEOMBase::VertexToPoint(aShape, aPnt)) {
           // set coordinates to the Spin Boxes
           double aX, aY, aZ;
           aX = aPnt.X();
@@ -584,15 +651,16 @@ void EntityGUI_3DSketcherDlg::SelectionIntoArgument()
           Group3Spin->SpinBox_DX->blockSignals(true);
           Group3Spin->SpinBox_DY->blockSignals(true);
           Group3Spin->SpinBox_DZ->blockSignals(true);
-          if ( GroupType->RadioButton1->isChecked() ) {
-            Group3Spin->SpinBox_DX->setValue( aX );
-            Group3Spin->SpinBox_DY->setValue( aY );
-            Group3Spin->SpinBox_DZ->setValue( aZ );
-          } else if ( GroupType->RadioButton2->isChecked() ) {
+          if (GroupType->RadioButton1->isChecked()) {
+            Group3Spin->SpinBox_DX->setValue(aX);
+            Group3Spin->SpinBox_DY->setValue(aY);
+            Group3Spin->SpinBox_DZ->setValue(aZ);
+          }
+          else if (GroupType->RadioButton2->isChecked()) {
             XYZ xyz = getLastPoint();
-            Group3Spin->SpinBox_DX->setValue( aX - xyz.x );
-            Group3Spin->SpinBox_DY->setValue( aY - xyz.y );
-            Group3Spin->SpinBox_DZ->setValue( aZ - xyz.z );
+            Group3Spin->SpinBox_DX->setValue(aX - xyz.x);
+            Group3Spin->SpinBox_DY->setValue(aY - xyz.y);
+            Group3Spin->SpinBox_DZ->setValue(aZ - xyz.z);
           }
           Group3Spin->SpinBox_DX->blockSignals(blocked);
           Group3Spin->SpinBox_DY->blockSignals(blocked);
@@ -601,7 +669,7 @@ void EntityGUI_3DSketcherDlg::SelectionIntoArgument()
       }
     }
   }
-  GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
+  GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth);
 }
 
 //=================================================================================
@@ -610,13 +678,12 @@ void EntityGUI_3DSketcherDlg::SelectionIntoArgument()
 //=================================================================================
 void EntityGUI_3DSketcherDlg::DeactivateActiveDialog()
 {
-  setEnabled( false );
+  setEnabled(false);
   globalSelection();
-  disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
-  myGeomGUI->SetActiveDialogBox( 0 );
+  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+  myGeomGUI->SetActiveDialogBox(0);
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -624,43 +691,41 @@ void EntityGUI_3DSketcherDlg::DeactivateActiveDialog()
 void EntityGUI_3DSketcherDlg::ActivateThisDialog()
 {
   myGeomGUI->EmitSignalDeactivateDialog();
-  setEnabled( true );
-  myGeomGUI->SetActiveDialogBox( this );
+  setEnabled(true);
+  myGeomGUI->SetActiveDialogBox(this);
 
-  connect( myGeomGUI->getApp()->selectionMgr(),
-          SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+  connect(myGeomGUI->getApp()->selectionMgr(),
+          SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 
-  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
-  GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
+  localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+  GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth);
 }
 
-
 //=================================================================================
 // function : ValueChangedInSpinBox()
 // purpose  :
 //=================================================================================
-void EntityGUI_3DSketcherDlg::ValueChangedInSpinBox( double newValue )
+void EntityGUI_3DSketcherDlg::ValueChangedInSpinBox (double newValue)
 {
-  GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
+  GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth);
 }
 
-
 //=================================================================================
 // function : BoxChecked()
 // purpose  : ChecBoxes management
 //=================================================================================
-void EntityGUI_3DSketcherDlg::BoxChecked( bool checked )
+void EntityGUI_3DSketcherDlg::BoxChecked (bool checked)
 {
   QCheckBox* send = (QCheckBox*) sender();
   SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
-  
+
   if (send == GroupAngles->checkBox)
-    GroupAngles->SpinBox_DA2->setEnabled(checked); 
-  
+    GroupAngles->SpinBox_DA2->setEnabled(checked);
+
   else if (send == GroupControls->CheckBox1)
   {
     ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myLengthPrs, true);
-    if(checked){
+    if (checked){
       ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myLengthPrs);
       isLengthVisible=true;
     }
@@ -669,8 +734,8 @@ void EntityGUI_3DSketcherDlg::BoxChecked( bool checked )
   }
   else if (send == GroupControls->CheckBox2)
   {
-    ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myAnglePrs, true); 
-    if(checked)
+    ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myAnglePrs, true);
+    if (checked)
     {
       ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs);
       isAngleVisible=true;
@@ -678,33 +743,57 @@ void EntityGUI_3DSketcherDlg::BoxChecked( bool checked )
     else
       isAngleVisible=false;
   }
+  else if (send == GroupControls->CheckBox3)
+  {
+    GroupControls->lineEdit_1->setVisible(checked);
+    GroupControls->lineEdit_2->setVisible(checked);
+    GroupControls->lineEdit_3->setVisible(checked);
+    GroupControls->lineEdit_4->setVisible(checked);
+    GroupControls->lineEdit_5->setVisible(checked);
+    GroupControls->lineEdit_6->setVisible(checked);
+    
+    GroupControls->label_1->setVisible(checked);
+    GroupControls->label_2->setVisible(checked);
+    GroupControls->label_3->setVisible(checked);
+    GroupControls->label_4->setVisible(checked);
+    GroupControls->label_5->setVisible(checked);
+    GroupControls->label_6->setVisible(checked);
+    GroupControls->label_7->setVisible(checked);
+    GroupControls->label_8->setVisible(checked);
+    
+    GroupControls->updateGeometry();
+    GroupControls->resize(minimumSizeHint());
+  } 
 
-  GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
+  updateGeometry();
+  resize(minimumSizeHint());
+  
+  GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth);
 }
 
 //=================================================================================
 // function : ButtonClicked()
 // purpose  :
 //=================================================================================
-void EntityGUI_3DSketcherDlg::ButtonClicked( bool checked )
+void EntityGUI_3DSketcherDlg::ButtonClicked (bool checked)
 {
   if (GroupAngles->radioButton_1->isChecked())
-    myOrientation = 1;
+    myOrientation = OXY;
   else if (GroupAngles->radioButton_2->isChecked())
-    myOrientation = 2;
+    myOrientation = OYZ;
   else
-    myOrientation = 3; 
-  
-  GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
+    myOrientation = OXZ;
+
+  GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth);
 }
 
 //=================================================================================
 // function : enterEvent()
 // purpose  :
 //=================================================================================
-void EntityGUI_3DSketcherDlg::enterEvent( QEvent* )
+void EntityGUI_3DSketcherDlg::enterEvent (QEvent*)
 {
-  if ( !mainFrame()->GroupConstructors->isEnabled() )
+  if (!mainFrame()->GroupConstructors->isEnabled())
     ActivateThisDialog();
 }
 
@@ -714,19 +803,19 @@ void EntityGUI_3DSketcherDlg::enterEvent( QEvent* )
 //=================================================================================
 GEOM::GEOM_IOperations_ptr EntityGUI_3DSketcherDlg::createOperation()
 {
-  return getGeomEngine()->GetICurvesOperations( getStudyId() );
+  return getGeomEngine()->GetICurvesOperations(getStudyId());
 }
 
 //=================================================================================
 // function : isValid
 // purpose  :
 //=================================================================================
-bool EntityGUI_3DSketcherDlg::isValid( QString& msg )
+bool EntityGUI_3DSketcherDlg::isValid (QString& msg)
 {
   bool ok = true;
-  ok = Group3Spin->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-  ok = Group3Spin->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
-  ok = Group3Spin->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
+  ok = Group3Spin->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
+  ok = Group3Spin->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
+  ok = Group3Spin->SpinBox_DZ->isValid(msg, !IsPreview()) && ok;
   return ok;
 }
 
@@ -734,43 +823,44 @@ bool EntityGUI_3DSketcherDlg::isValid( QString& msg )
 // function : execute
 // purpose  :
 //=================================================================================
-bool EntityGUI_3DSketcherDlg::execute( ObjectList& objects )
+bool EntityGUI_3DSketcherDlg::execute (ObjectList& objects)
 {
-  GEOM::ListOfDouble_var aCoordsArray = new GEOM::ListOfDouble;
-  if (!myOK || myPointsList.size() == 0)
-    aCoordsArray->length((myPointsList.size()+1)*3);
-  else
-    aCoordsArray->length(myPointsList.size()*3);
-
+  //GEOM::ListOfDouble_var aCoordsArray = new GEOM::ListOfDouble;
+  //if (!myOK || myPointsList.size() == 0)
+  //  aCoordsArray->length((myPointsList.size()+1)*3);
+  //else
+  //  aCoordsArray->length(myPointsList.size()*3);
+
+  QStringList aCommands;
+  aCommands << "3DSketcher";
   QStringList aParameters;
 
-  int i = 0;
+  //int i = 0;
   QList<XYZ>::const_iterator it;
-  for(it = myPointsList.begin(); it != myPointsList.end(); ++it ) {
-    aCoordsArray[i++] = (*it).x;
-    aCoordsArray[i++] = (*it).y;
-    aCoordsArray[i++] = (*it).z;
-    aParameters << (*it).xt;
-    aParameters << (*it).yt;
-    aParameters << (*it).zt;
+  for (it = myPointsList.begin(); it != myPointsList.end(); ++it) {
+    //aCoordsArray[i++] = (*it).x;
+    //aCoordsArray[i++] = (*it).y;
+    //aCoordsArray[i++] = (*it).z;
+    aCommands << (*it).command;
+    aParameters << (*it).params;
   }
 
   if (!myOK || myPointsList.size() == 0) {
     XYZ xyz = getCurrentPoint();
-    aCoordsArray[i++] = xyz.x;
-    aCoordsArray[i++] = xyz.y;
-    aCoordsArray[i++] = xyz.z;
-    aParameters << xyz.xt;
-    aParameters << xyz.yt;
-    aParameters << xyz.zt;
-  } 
+    //aCoordsArray[i++] = xyz.x;
+    //aCoordsArray[i++] = xyz.y;
+    //aCoordsArray[i++] = xyz.z;
+    aCommands << xyz.command;
+    aParameters << xyz.params;
+  }
 
   GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow(getOperation());
-  GEOM::GEOM_Object_var anObj = anOper->Make3DSketcher( aCoordsArray );
+  //GEOM::GEOM_Object_var anObj = anOper->Make3DSketcher(aCoordsArray);
+  GEOM::GEOM_Object_var anObj = anOper->Make3DSketcherCommand(aCommands.join(":").toLatin1().constData());
 
-  if ( !anObj->_is_nil() ) {
-    if ( !IsPreview() ) anObj->SetParameters(aParameters.join(":").toLatin1().constData());
-    objects.push_back( anObj._retn() );
+  if (!anObj->_is_nil()) {
+    if (!IsPreview()) anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+    objects.push_back(anObj._retn());
   }
 
   return true;
@@ -780,7 +870,7 @@ bool EntityGUI_3DSketcherDlg::execute( ObjectList& objects )
 // function : SetDoubleSpinBoxStep()
 // purpose  : Double spin box management
 //=================================================================================
-void EntityGUI_3DSketcherDlg::SetDoubleSpinBoxStep( double step )
+void EntityGUI_3DSketcherDlg::SetDoubleSpinBoxStep (double step)
 {
   Group3Spin->SpinBox_DX->setSingleStep(step);
   Group3Spin->SpinBox_DY->setSingleStep(step);
@@ -796,9 +886,9 @@ void EntityGUI_3DSketcherDlg::SetDoubleSpinBoxStep( double step )
 //=================================================================================
 void EntityGUI_3DSketcherDlg::ClickOnOk()
 {
-  Locker lock( myOK );
+  Locker lock(myOK);
 
-  if ( !onAccept() )
+  if (!onAccept())
     return;
 
   ClickOnCancel();
@@ -811,19 +901,19 @@ void EntityGUI_3DSketcherDlg::ClickOnOk()
 bool EntityGUI_3DSketcherDlg::ClickOnApply()
 {
   QString msg;
-  if ( !isValid( msg ) ) {
-    showError( msg );
+  if (!isValid(msg)) {
+    showError(msg);
     return false;
   }
 
   if (myPointsList.count() > 0)
     myPointsList.append(myPointsList[0]);
 
-  Locker lock( myOK );
+  Locker lock(myOK);
 
-  if ( !onAccept() )
+  if (!onAccept())
     return false;
-  
+
   ClickOnCancel();
   return true;
 }
@@ -849,59 +939,94 @@ EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getPenultimatePoint() cons
 
 //=================================================================================
 // function : getCurrentPoint()
-// purpose  : returns current points
+// purpose  : returns current point
 //=================================================================================
 EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getCurrentPoint() const
 {
-  XYZ xyz; 
-  // Temporary way of doing this. To be changed with ordered improvement of the sketcher
-  if ( myMode == 2 )
-  {
-    double anAngle  = GroupAngles->SpinBox_DA->value() * M_PI/180.0;
-    double anAngle2 = 0.0;
+  XYZ xyz;
+
+  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+  int aPrecision = resMgr->integerValue("Geometry", "length_precision", 7);
+
+  if (myMode == 2) {
+    if (GroupAngles->radioButton_1->isChecked())
+      xyz.command = "OXY ";
+    else if (GroupAngles->radioButton_2->isChecked())
+      xyz.command = "OYZ ";
+    else
+      xyz.command = "OXZ ";
+
+    double anAngle  = GroupAngles->SpinBox_DA->value();
     double aLength  = GroupAngles->SpinBox_DL->value();
-    
-    if (GroupAngles->checkBox->isChecked())
-      anAngle2 = GroupAngles->SpinBox_DA2->value() * M_PI/180.0;
-    
+
+    double anAngle2 = 0.0;
+    QString da2 = "0";
+    if (GroupAngles->checkBox->isChecked()) {
+      anAngle2 = GroupAngles->SpinBox_DA2->value();
+      da2 = GroupAngles->SpinBox_DA2->text();
+    }
+
+    xyz.command +=
+      QString::number(anAngle, 'g', aPrecision) + " " +
+      QString::number(anAngle2, 'g', aPrecision) + " " +
+      QString::number(aLength, 'g', aPrecision);
+    xyz.params =
+      GroupAngles->SpinBox_DA->text() + ":" +
+      da2 + ":" +
+      GroupAngles->SpinBox_DL->text();
+
+    // Calculate point coordinates for preview
+    anAngle  = anAngle * M_PI/180.0;
+    anAngle2 = anAngle2 * M_PI/180.0;
     double aProjectedLength = aLength * cos(anAngle2);
-    
-    xyz = getLastPoint();
-    if (GroupAngles->radioButton_1->isChecked())
+
+    XYZ xyzP = getLastPoint();
+    if (GroupAngles->radioButton_1->isChecked()) // OXY
     {
-      xyz.x += aProjectedLength * cos(anAngle);
-      xyz.y += aProjectedLength * sin(anAngle);
-      xyz.z += aLength * sin(anAngle2);
+      xyz.x = xyzP.x + aProjectedLength * cos(anAngle);
+      xyz.y = xyzP.y + aProjectedLength * sin(anAngle);
+      xyz.z = xyzP.z + aLength * sin(anAngle2);
     }
-    else if (GroupAngles->radioButton_2->isChecked())
+    else if (GroupAngles->radioButton_2->isChecked()) // OYZ
     {
-      xyz.y += aProjectedLength * cos(anAngle);
-      xyz.z += aProjectedLength * sin(anAngle);
-      xyz.x += aLength * sin(anAngle2);
+      xyz.y = xyzP.y + aProjectedLength * cos(anAngle);
+      xyz.z = xyzP.z + aProjectedLength * sin(anAngle);
+      xyz.x = xyzP.x + aLength * sin(anAngle2);
     }
-    else
+    else // OXZ
     {
-      xyz.z += aProjectedLength * sin(anAngle);
-      xyz.x += aProjectedLength * cos(anAngle);
-      xyz.y += aLength * sin(anAngle2);
+      xyz.z = xyzP.z + aProjectedLength * sin(anAngle);
+      xyz.x = xyzP.x + aProjectedLength * cos(anAngle);
+      xyz.y = xyzP.y + aLength * sin(anAngle2);
     }
   }
-  else
-  {
-    if ( myMode == 0 ) {
+  else {
+    if (myMode == 0) { // XYZ
       xyz.x = Group3Spin->SpinBox_DX->value();
       xyz.y = Group3Spin->SpinBox_DY->value();
       xyz.z = Group3Spin->SpinBox_DZ->value();
-    } 
-    else{
+      xyz.command = "TT ";
+    }
+    else { // DXDYDZ
       xyz = getLastPoint();
       xyz.x += Group3Spin->SpinBox_DX->value();
       xyz.y += Group3Spin->SpinBox_DY->value();
       xyz.z += Group3Spin->SpinBox_DZ->value();
+      xyz.command = "T ";
     }
-    xyz.xt = Group3Spin->SpinBox_DX->text();
-    xyz.yt = Group3Spin->SpinBox_DY->text();
-    xyz.zt = Group3Spin->SpinBox_DZ->text();
+
+    double aX  = Group3Spin->SpinBox_DX->value();
+    double aY  = Group3Spin->SpinBox_DY->value();
+    double aZ  = Group3Spin->SpinBox_DZ->value();
+
+    xyz.command +=
+      QString::number(aX, 'g', aPrecision) + " " +
+      QString::number(aY, 'g', aPrecision) + " " +
+      QString::number(aZ, 'g', aPrecision);
+    xyz.params =
+      Group3Spin->SpinBox_DX->text() + ":" +
+      Group3Spin->SpinBox_DY->text() + ":" +
+      Group3Spin->SpinBox_DZ->text();
   }
   return xyz;
 }
@@ -911,97 +1036,97 @@ EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getCurrentPoint() const
 // Purpose  : Method for displaying preview of resulting shape
 //            Redefined from GEOMBase_Helper.
 //================================================================
-void EntityGUI_3DSketcherDlg::displayPreviewGEOM::GEOM_Object_ptr object,
+void EntityGUI_3DSketcherDlg::displayPreview (GEOM::GEOM_Object_ptr object,
                                               const bool            append,
                                               const bool            activate,
                                               const bool            update,
                                               const double          lineWidth,
                                               const int             displayMode,
-                                              const int             color )
-{ 
-  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); 
-  
+                                              const int             color)
+{
+  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+
   QColor aColor = resMgr->colorValue("Geometry","line_color",QColor(255,0,0));
-  Quantity_NameOfColor line_color = SalomeApp_Tools::color( aColor ).Name();
-  
+  Quantity_NameOfColor line_color = SalomeApp_Tools::color(aColor).Name();
+
   // set width of displayed shape
   int lw = lineWidth;
-  if(lw == -1) { 
+  if (lw == -1) {
     lw = resMgr->integerValue("Geometry", "preview_edge_width", -1);
   }
-  getDisplayer()->SetWidth( lw );
+  getDisplayer()->SetWidth(lw);
 
   // Disable activation of selection
-  getDisplayer()->SetToActivate( activate );
+  getDisplayer()->SetToActivate(activate);
 
   // Make a reference to GEOM_Object
-  CORBA::String_var objStr = myGeometryGUI->getApp()->orb()->object_to_string( object );
-  getDisplayer()->SetName( objStr.in() );
+  CORBA::String_var objStr = myGeometryGUI->getApp()->orb()->object_to_string(object);
+  getDisplayer()->SetName(objStr.in());
 
   // Create wire from applied object
   TopoDS_Shape anApplyedWire, aLastSegment;
-  if ( !createShapes( object, anApplyedWire, aLastSegment ) )
+  if (!createShapes(object, anApplyedWire, aLastSegment))
     return;
 
   // Set color for preview shape
-  getDisplayer()->SetColor( line_color );
-  
+  getDisplayer()->SetColor(line_color);
+
   // Build prs
-  SALOME_Prs* aPrs = getDisplayer()->BuildPrs( anApplyedWire );
-  if ( aPrs != 0 && !aPrs->IsNull() )
-    GEOMBase_Helper::displayPreview( aPrs, append, update );
+  SALOME_Prs* aPrs = getDisplayer()->BuildPrs(anApplyedWire);
+  if (aPrs != 0 && !aPrs->IsNull())
+    GEOMBase_Helper::displayPreview(aPrs, append, update);
+
+  getDisplayer()->SetColor(Quantity_NOC_VIOLET);
+  aPrs = getDisplayer()->BuildPrs(aLastSegment);
+
+  if (aPrs != 0 && !aPrs->IsNull())
+    GEOMBase_Helper::displayPreview(aPrs, append, update);
+
+  getDisplayer()->SetColor(line_color);
 
-  getDisplayer()->SetColor( Quantity_NOC_VIOLET );
-  aPrs = getDisplayer()->BuildPrs( aLastSegment );
-    
-  if ( aPrs != 0 && !aPrs->IsNull() )
-    GEOMBase_Helper::displayPreview( aPrs, append, update );
-  
-  getDisplayer()->SetColor( line_color );
-  
   // Display local trihedron if the mode is relatives coordinates or angles
   if (myMode == 1 || myMode == 2)
     displayTrihedron(2);
-  
+
   // Display preview of suitable dimension presentations
-  if(myMode == 2)  // ANGLES
+  if (myMode == 2)                 // ANGLES
   {
     double anAngle2 = 0.0;
     if (GroupAngles->checkBox->isChecked())
       anAngle2 = GroupAngles->SpinBox_DA2->value();
-    
+
     displayAngle(GroupAngles->SpinBox_DA->value(), anAngle2, GroupAngles->SpinBox_DL->value(), myOrientation);
-    displayLength(GroupAngles->SpinBox_DL->value());  
+    displayLength(GroupAngles->SpinBox_DL->value(), /*store=*/false, /*type=*/myPrsType);
   }
-  if( myMode == 0 || myMode == 1 )  // COORDINATES
-    displayLength(); 
-  
+  if (myMode == 0 || myMode == 1)  // COORDINATES
+    displayLength();
+
   getDisplayer()->UnsetName();
 
   // Enable activation of displayed objects
-  getDisplayer()->SetToActivate( true );
+  getDisplayer()->SetToActivate(true);
 }
 
 //================================================================
 // Function : displayTrihedron()
 // Purpose  : Method for displaying trihedron
 //================================================================
-void EntityGUI_3DSketcherDlg::displayTrihedron(int selMode)
+void EntityGUI_3DSketcherDlg::displayTrihedron (int selMode)
 {
   // Add trihedron to preview
   SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
-  
+
   gp_Pnt P(getLastPoint().x,getLastPoint().y,getLastPoint().z);
   Handle(Geom_Axis2Placement) anAxis = new Geom_Axis2Placement(P,gp::DZ(),gp::DX());
   Handle(AIS_Trihedron) anIO = new AIS_Trihedron(anAxis);
   anIO->SetSelectionMode(selMode);
-  
-  SOCC_Prs* aSPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
-  
-  if (aSPrs)
-  {
+
+  SOCC_Prs* aSPrs = dynamic_cast<SOCC_Prs*>
+    (((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
+
+  if (aSPrs) {
     aSPrs->PrependObject(anIO);
-    GEOMBase_Helper::displayPreview( aSPrs, true, true );
+    GEOMBase_Helper::displayPreview(aSPrs, true, true);
   }
 }
 
@@ -1009,51 +1134,52 @@ void EntityGUI_3DSketcherDlg::displayTrihedron(int selMode)
 // Function : displayAngle()
 // Purpose  : Method for displaying angle dimensions
 //================================================================
-void EntityGUI_3DSketcherDlg::displayAngle(double theAngle1, double theAngle2, double theLength, int theOrientation, bool store)
+void EntityGUI_3DSketcherDlg::displayAngle (double theAngle1, double theAngle2,
+                                            double theLength, int theOrientation, bool store)
 {
-  if( Abs(theAngle2 - 90.0) < Precision::Angular() || 
-      theLength < Precision::Confusion() )
+  if (Abs(theAngle2 - 90.0) < Precision::Angular() ||
+      theLength < Precision::Confusion())
     return;
 
-  SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); 
-  
+  SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
+
   XYZ Last    = getLastPoint();
   XYZ Current = getCurrentPoint();
-    
+
   gp_Pnt Last_Pnt(Last.x,Last.y,Last.z);
   gp_Pnt Current_Pnt(Current.x,Current.y,Current.z);
   gp_Pnt P1, P2;
-  
+
   bool twoAngles = GroupAngles->checkBox->isChecked();
-  
+
   switch(theOrientation)
   {
-    case 1: //OXY
-    {   
+    case OXY:
+    {
       P1 = gp_Pnt(Last.x + theLength,Last.y,Last.z);    // X direction
       P2 = gp_Pnt(Last.x + theLength * cos(theAngle1 * M_PI / 180.),
                   Last.y + theLength * sin(theAngle1 * M_PI / 180.),
-                  Last.z); 
+                  Last.z);
       break;
     }
-    case 2: //OYZ
+    case OYZ:
     {
       P1 = gp_Pnt(Last.x, Last.y + theLength,Last.z);     // Y direction
-      P2 = gp_Pnt(Last.x, 
+      P2 = gp_Pnt(Last.x,
                   Last.y + theLength * cos(theAngle1 * M_PI / 180.),
-                  Last.z + theLength * sin(theAngle1 * M_PI / 180.)); 
+                  Last.z + theLength * sin(theAngle1 * M_PI / 180.));
       break;
     }
-    case 3: //OXZ
+    case OXZ:
     {
-      P1 = gp_Pnt( Last.x + theLength,Last.y,Last.z);     // X direction
-      P2 = gp_Pnt( Last.x + theLength * cos(theAngle1 * M_PI / 180.) ,
-                   Last.y,
-                   Last.z + theLength * sin(theAngle1 * M_PI / 180.)); 
+      P1 = gp_Pnt(Last.x + theLength,Last.y,Last.z);     // X direction
+      P2 = gp_Pnt(Last.x + theLength * cos(theAngle1 * M_PI / 180.) ,
+                  Last.y,
+                  Last.z + theLength * sin(theAngle1 * M_PI / 180.));
       break;
     }
   }
-  
+
   TopoDS_Vertex V1    = BRepBuilderAPI_MakeVertex(P1);
   TopoDS_Vertex V2    = BRepBuilderAPI_MakeVertex(P2);
   TopoDS_Vertex LastV = BRepBuilderAPI_MakeVertex(Last_Pnt);
@@ -1061,77 +1187,79 @@ void EntityGUI_3DSketcherDlg::displayAngle(double theAngle1, double theAngle2, d
   TopoDS_Edge anEdge1 = BRepBuilderAPI_MakeEdge(LastV, V1);
   TopoDS_Edge anEdge2 = BRepBuilderAPI_MakeEdge(LastV, V2);
   TopoDS_Edge anEdge3 = BRepBuilderAPI_MakeEdge(LastV, CurV);
-  
-  gce_MakePln gce_MP(Last_Pnt, P1, P2);
-        Handle(Geom_Plane) aPlane = new Geom_Plane(gce_MP.Value());
-      
-  // Covert angles to string
+
+  gce_MakePln gce_MP (Last_Pnt, P1, P2);
+  Handle(Geom_Plane) aPlane = new Geom_Plane(gce_MP.Value());
+
+  // Convert angles to string
   std::string Angle1_str = doubleToString(theAngle1);
   std::string Angle2_str = doubleToString(theAngle2);
-  
+
   // Create interactive object
-  Handle(AIS_AngleDimension) anAngleIO  = new AIS_AngleDimension(anEdge1, anEdge2, aPlane, theAngle1 * M_PI / 180.,
-           TCollection_ExtendedString(Angle1_str.c_str()));
-  anAngleIO->SetArrowSize( (theAngle1 * M_PI / 180) * (theLength/20) );
-  
+  Handle(AIS_AngleDimension) anAngleIO = new AIS_AngleDimension
+    (anEdge1, anEdge2, aPlane, theAngle1 * M_PI / 180.,
+     TCollection_ExtendedString(Angle1_str.c_str()));
+  anAngleIO->SetArrowSize((theAngle1 * M_PI / 180) * (theLength/20));
+
   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
   int w = resMgr->integerValue("Geometry", "measures_line_width", 1);
-  
+
   Handle(Prs3d_AngleAspect) asp = new Prs3d_AngleAspect();
   asp->LineAspect()->SetWidth(w);
   anAngleIO->Attributes()->SetAngleAspect(asp);
-  
-  SOCC_Prs* aSPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
-  
+
+  SOCC_Prs* aSPrs = dynamic_cast<SOCC_Prs*>
+    (((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
+
   if (store)
   {
     // Erase dimensions presentations
     ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myAnglePrs, true);
-    
     myAnglePrs->PrependObject(anAngleIO);
-    myPrsType = TYPE_ANGLE;  // Overwrite type with ANGLE
-    
+
     // Display modified presentation
     if (isAngleVisible)
       ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs);
   }
-  else if(aSPrs)
+  else if (aSPrs)
   {
     aSPrs->AddObject(anAngleIO);
   }
+  myPrsType = TYPE_ANGLE;  // Overwrite type with ANGLE
   
   if (twoAngles)
   {
     gce_MakePln gce_MP2(Last_Pnt, P2, Current_Pnt);
     Handle(Geom_Plane) aPlane2 = new Geom_Plane(gce_MP2.Value());
-          
-    Handle(AIS_AngleDimension) anAngle2IO = new AIS_AngleDimension(anEdge2, anEdge3, aPlane2, theAngle2 * M_PI / 180.,
-            TCollection_ExtendedString(Angle2_str.c_str()));
-    anAngle2IO->SetArrowSize( (theAngle2 * M_PI / 180) * (theLength/20) );
-    
+
+    Handle(AIS_AngleDimension) anAngle2IO =
+      new AIS_AngleDimension(anEdge2, anEdge3, aPlane2, theAngle2 * M_PI / 180.,
+                             TCollection_ExtendedString(Angle2_str.c_str()));
+    anAngle2IO->SetArrowSize((theAngle2 * M_PI / 180) * (theLength/20));
+
     anAngle2IO->Attributes()->SetAngleAspect(asp);
-    
+
     if (store)
     {
       // Erase dimensions presentations
       ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myAnglePrs, true);
-      
       myAnglePrs->PrependObject(anAngle2IO);
-      myPrsType = TYPE_TWO_ANGLES;   // Overwrite type with TWO_ANGLES
-      
+
       // Display modified presentation
       if (isAngleVisible)
         ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs);
     }
     else if (aSPrs)
     {
-      aSPrs->AddObject(anAngle2IO);   
+      aSPrs->AddObject(anAngle2IO);
     }
+    
+    myPrsType = TYPE_TWO_ANGLES;   // Overwrite type with TWO_ANGLES
   }
-  
-  if(!store && isAngleVisible)
-  {       
-    GEOMBase_Helper::displayPreview( aSPrs, true, true ); 
+
+  if (!store && isAngleVisible)
+  {
+    GEOMBase_Helper::displayPreview(aSPrs, true, true);
   }
 }
 
@@ -1139,152 +1267,178 @@ void EntityGUI_3DSketcherDlg::displayAngle(double theAngle1, double theAngle2, d
 // Function : displayLength()
 // Purpose  : Method for displaying length dimensions
 //================================================================
-void EntityGUI_3DSketcherDlg::displayLength(double theLength, bool store)
+void EntityGUI_3DSketcherDlg::displayLength (double theLength, bool store, int type)
 {
   SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
-  
+
   XYZ Last    = getLastPoint();
   XYZ Current = getCurrentPoint();
   XYZ Penultimate = getPenultimatePoint();
   
-  double aLength = 0.0;
+  bool withAngle = (type == TYPE_ANGLE || type == TYPE_TWO_ANGLES);
+  bool twoAngles = (type == TYPE_TWO_ANGLES);
   
-  if( theLength < 0)  // Calculate length if not given
+  double aLength = 0.0;
+
+  if (theLength < 0)  // Calculate length if not given
   {
     aLength = sqrt((Last.x - Current.x)*(Last.x - Current.x) +
-                   (Last.y - Current.y)*(Last.y - Current.y) +  
+                   (Last.y - Current.y)*(Last.y - Current.y) +
                    (Last.z - Current.z)*(Last.z - Current.z));
   }
   else
     aLength = theLength;
-  
+
   if (aLength<Precision::Confusion())
     return;
-  
+
   gp_Pnt P1 = gp_Pnt(Last.x,Last.y,Last.z);
   gp_Pnt P2 = gp_Pnt(Current.x,Current.y,Current.z);
   gp_Pnt P3 = gp_Pnt(Penultimate.x,Penultimate.y,Penultimate.z);
-  
+
   gp_Vec Vec1(P1,P2);
   gp_Vec Vec2(P1,P3);
-  
+  gp_Vec Vec3 = Vec1;
+
   TopoDS_Vertex aVert1 = BRepBuilderAPI_MakeVertex(P1);
   TopoDS_Vertex aVert2 = BRepBuilderAPI_MakeVertex(P2);
-  
+
   // Convert length to string
   std::string aLength_str = doubleToString(aLength);
   
-  // Plane for the presentation
-  if ( Abs(Vec1.CrossMagnitude(Vec2)) < Precision::Confusion() ) // Check colinearity
+  // Define the suitable plane for right relative positioning of dimension presentations
+  
+  gp_Dir aNormal;                  // Normal defining the plane of the presentation 
+  if (withAngle)                   // If one angle
   {
-    Vec2 = gp_Vec(gp::DX());
-    if ( Abs(Vec1.CrossMagnitude(Vec2)) < Precision::Confusion())
+    switch(myOrientation)
     {
-      Vec2 = gp_Vec(gp::DY());
+      case OXY:
+      {
+        aNormal = gp::DZ().Crossed(gp_Dir(Vec1));//--> the plane is orthogonal to the angle presentation   
+                                                 //    plane and contains the current edge
+        if (twoAngles)            // If two angles 
+        { 
+          gp_XYZ Vec1_XY(Vec1.X(),Vec1.Y(),0.0);// --> define Vec3 as the projection of the current 
+          Vec3 = gp_Vec(Vec1_XY);               //     edge on the plane chosen for the first angle
+        }
+        break;
+      }
+      case OYZ:
+      {
+        aNormal = gp::DX().Crossed(gp_Dir(Vec1));
+        if (twoAngles)
+        {
+          gp_XYZ Vec1_YZ(0.0,Vec1.Y(),Vec1.Z());
+          Vec3 = gp_Vec(Vec1_YZ);
+        }
+        break;
+      }
+      case OXZ:
+      {
+        aNormal = gp::DY().Crossed(gp_Dir(Vec1));
+        if (twoAngles)
+        {
+          gp_XYZ Vec1_XZ(Vec1.X(),0.0,Vec1.Z());
+          Vec3 = gp_Vec(Vec1_XZ);
+        }
+        break;
+      }
     }
-  }
-  
-  // Normal to the representation plane
-  gp_Dir Normal(Vec2.Crossed(Vec1));
-  
-//   // Check orientation of plane in order to avoid it to change during an Angle preview
-//   MESSAGE("repere0  abs = "<< Abs(Normal.Dot(gp::DZ()) ))
-//   if ( Abs(Normal.Dot(gp::DZ())) > Precision::Confusion() )
-//   {
-//     MESSAGE("repere1")
-//     if ( Normal.Dot(gp::DZ()) < 0.0 ){
-//       MESSAGE("REVERSE on OZ basis")
-//       Normal.Reverse();
-//     }
-//   }
-//   else if ( Abs(Normal.Dot(gp::DX())) > Precision::Confusion() )
-//   {
-//     MESSAGE("repere2")
-//     if ( Normal.Dot(gp::DX()) < 0.0 ){
-//       MESSAGE("REVERSE on OX basis")
-//       Normal.Reverse();
-//     }
-//   }
-//   else if ( Abs(Normal.Dot(gp::DY())) > Precision::Confusion() )
-//   {
-//     MESSAGE("repere3")
-//     if ( Normal.Dot(gp::DY()) < 0.0 ){
-//       MESSAGE("REVERSE on OY basis")
-//       Normal.Reverse();
-//     }
-//   }
+    if(twoAngles                  // If two angles 
+      && Abs(Vec1.CrossMagnitude(Vec3)) > Precision::Confusion())                                  
+    {                                                                    
+      aNormal = gp_Dir(Vec1.Crossed(Vec3));//       --> set the normal as the cross product of
+    }                                      //           the current edge with its projection           
+  }                                        //           it ensures that the dimension changes     
+  else
+  {
+    // Check colinearity
+    if (Abs(Vec1.CrossMagnitude(Vec2)) < Precision::Confusion())
+    {
+      Vec2 = gp_Vec(gp::DX());
+      if (Abs(Vec1.CrossMagnitude(Vec2)) < Precision::Confusion())
+      {
+        Vec2 = gp_Vec(gp::DY());
+      }
+    }
+    aNormal = gp_Dir(Vec1.Crossed(Vec2)); // If no angles --> the plane is the one formed by
+  }                                       //                  the last edge and the current one
   
-  gce_MakePln gce_MP(P1, Normal);
+  // Plane construction
+  gce_MakePln gce_MP(P1, aNormal);
   Handle(Geom_Plane) aPlane = new Geom_Plane(gce_MP.Value());
-  
-  Handle(AIS_LengthDimension) anIO = new AIS_LengthDimension(aVert1, 
-                                                             aVert2, 
-                                                             aPlane, 
-                                                             aLength, 
-                                                             TCollection_ExtendedString(aLength_str.c_str()));
+
+  Handle(AIS_LengthDimension) anIO =
+    new AIS_LengthDimension(aVert1,
+                            aVert2,
+                            aPlane,
+                            aLength,
+                            TCollection_ExtendedString(aLength_str.c_str()));
   anIO->SetArrowSize(aLength/20);
-      
+
   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
   int w = resMgr->integerValue("Geometry", "measures_line_width", 1);
   Handle(Prs3d_LengthAspect) asp = new Prs3d_LengthAspect();
   asp->LineAspect()->SetWidth(w);
   anIO->Attributes()->SetLengthAspect(asp);
-   
+
   if (store)
   {
     // Erase length dimensions presentation
     ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myLengthPrs, true);
-    
     myLengthPrs->PrependObject(anIO);
-    myPrsType = TYPE_LENGTH;
-    
+
     // Display modified presentation
     if (isLengthVisible)
       ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myLengthPrs);
   }
-  else if( isLengthVisible )
+  else if (isLengthVisible)
   {
-    SOCC_Prs* aSPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
+    SOCC_Prs* aSPrs = dynamic_cast<SOCC_Prs*>
+      (((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
     if (aSPrs)
     {
       aSPrs->PrependObject(anIO);
-      GEOMBase_Helper::displayPreview( aSPrs, true, true );
+      GEOMBase_Helper::displayPreview(aSPrs, true, true);
     }
   }
+  
+  myPrsType = TYPE_LENGTH;
 }
 
 //================================================================
 // Function : createShapes
 // Purpose  : Create applyed wire, and last segment from entry object
 //================================================================
-bool EntityGUI_3DSketcherDlg::createShapesGEOM::GEOM_Object_ptr /*theObject*/,
+bool EntityGUI_3DSketcherDlg::createShapes (GEOM::GEOM_Object_ptr /*theObject*/,
                                             TopoDS_Shape&         theApplyedWire,
-                                            TopoDS_Shape&         theLastSegment )
+                                            TopoDS_Shape&         theLastSegment)
 {
   QList<gp_Pnt> points;
-  foreachXYZ xyz, myPointsList) {
+  foreach (XYZ xyz, myPointsList) {
     gp_Pnt p(xyz.x, xyz.y, xyz.z);
-    if ( points.isEmpty() || points.last().Distance(p) > gp::Resolution())
+    if (points.isEmpty() || points.last().Distance(p) > gp::Resolution())
       points << p;
-  } 
-  
-  if ( points.count() == 1 ) {
+  }
+
+  if (points.count() == 1) {
     // only one point is created
     BRepBuilderAPI_MakeVertex mkVertex (points.last());
     theApplyedWire = mkVertex.Shape();
   }
-  else if ( points.count() > 1 ) {
+  else if (points.count() > 1) {
     // wire is created
     BRepBuilderAPI_MakePolygon mkWire;
-    foreach( gp_Pnt p, points )
+    foreach(gp_Pnt p, points)
       mkWire.Add(p);
     theApplyedWire = mkWire.Shape();
   }
 
   XYZ curxyz = getCurrentPoint();
   gp_Pnt curpnt(curxyz.x, curxyz.y, curxyz.z);
-  
-  if ( points.isEmpty() || points.last().Distance(curpnt) <= gp::Resolution() ) {
+
+  if (points.isEmpty() || points.last().Distance(curpnt) <= gp::Resolution()) {
     BRepBuilderAPI_MakeVertex mkVertex (curpnt);
     theLastSegment = mkVertex.Shape();
   }
@@ -1295,34 +1449,34 @@ bool EntityGUI_3DSketcherDlg::createShapes( GEOM::GEOM_Object_ptr /*theObject*/,
 
   /* VSR: old algorithm does not work properly, see bug 0020899
   TopoDS_Shape aShape;
-  if ( !GEOMBase::GetShape( theObject, aShape ) )
+  if (!GEOMBase::GetShape(theObject, aShape))
     return false;
 
-  if( aShape.ShapeType() != TopAbs_WIRE && aShape.ShapeType() != TopAbs_VERTEX )
+  if (aShape.ShapeType() != TopAbs_WIRE && aShape.ShapeType() != TopAbs_VERTEX)
     return false;
 
   theApplyedWire = aShape;
-  if ( myOK  )
+  if (myOK)
      return true;
 
   BRepBuilderAPI_MakeWire aBuilder;
-  TopExp_Explorer edgeExp( aShape, TopAbs_EDGE );
-  while ( 1 ) {
+  TopExp_Explorer edgeExp(aShape, TopAbs_EDGE);
+  while (1) {
     TopoDS_Shape anEdge = edgeExp.Current();
     edgeExp.Next();
-    if ( edgeExp.More() ) // i.e. non-last edge
-      aBuilder.Add( TopoDS::Edge( anEdge ) );
+    if (edgeExp.More()) // i.e. non-last edge
+      aBuilder.Add(TopoDS::Edge(anEdge));
     else {
       theLastSegment = anEdge;
       break;
     }
   }
 
-  if ( aBuilder.IsDone() ) {
+  if (aBuilder.IsDone()) {
     theApplyedWire = aBuilder.Shape();
   }
-  else if ( !theLastSegment.IsNull() ) {
-    TopExp_Explorer vertexExp( theLastSegment, TopAbs_VERTEX );
+  else if (!theLastSegment.IsNull()) {
+    TopExp_Explorer vertexExp(theLastSegment, TopAbs_VERTEX);
     theApplyedWire = vertexExp.Current();
     }
   */
@@ -1334,11 +1488,11 @@ bool EntityGUI_3DSketcherDlg::createShapes( GEOM::GEOM_Object_ptr /*theObject*/,
 // Function : doubleToString
 // Purpose  : converts double to string
 //================================================================
-std::string EntityGUI_3DSketcherDlg::doubleToString(double num)
+std::string EntityGUI_3DSketcherDlg::doubleToString (double num)
 {
   // truncate num
   int digNum = 5;
   char format = 'g'; // truncated to a number of significant digits
-  
-  return QString::number( num, format, digNum).toStdString();
+
+  return QString::number(num, format, digNum).toStdString();
 }
index af81a199d13259968db0b15291c38b5670ee635c..8888cf0655a7d8ab5a2aa2ccd604ed45aeca8239 100755 (executable)
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 // GEOM GEOMGUI : GUI for Geometry component
 // File   : EntityGUI_3DSketcherDlg.h
 // Author : DMV, OCN
-//
+
 #ifndef ENTITYGUI_3DSKETCHERDLG_H
 #define ENTITYGUI_3DSKETCHERDLG_H
 
@@ -53,14 +52,15 @@ class EntityGUI_3DSketcherDlg : public GEOMBase_Skeleton
 
   struct XYZ
   {
-    XYZ() { x = y = z = 0.0; xt = yt = zt = "0.0"; }
-    double  x,  y,  z;
-    QString xt, yt, zt;
+    XYZ() { x = y = z = 0.0; command = params = ""; }
+    double  x,  y,  z; // for preview only
+    QString command;
+    QString params;
   };
   typedef QList<XYZ> XYZList;
 
 public:
-  EntityGUI_3DSketcherDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, const double = 2. );
+  EntityGUI_3DSketcherDlg (GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, const double = 2.);
   ~EntityGUI_3DSketcherDlg();
 
 protected:
@@ -85,7 +85,7 @@ private:
   void                               displayTrihedron( int );
   
   void                               displayAngle( double, double, double, int, bool store = false );
-  void                               displayLength( double theLength = -1.0, bool store = false );
+  void                               displayLength( double theLength = -1.0, bool store = false, int type = 1);
 
   bool                               createShapes( GEOM::GEOM_Object_ptr,
                                                    TopoDS_Shape&,
@@ -132,6 +132,7 @@ private slots:
   bool                               ClickOnApply();
   //  bool                               isSameAsPrevious();
   void                               UpdateButtonsState();
+  void                               UpdatePointCoordinates();
 
   void                               ClickOnUndo();
   void                               ClickOnRedo();
index 0c3222beac442d721bf86fa4a3db5c5b82db38a9..b58621ea55905f475691b717cfd62cd73431378a 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>327</width>
-    <height>50</height>
+    <width>278</width>
+    <height>181</height>
    </rect>
   </property>
   <property name="windowTitle">
    </property>
    <item row="0" column="0">
     <widget class="QGroupBox" name="GroupBox1">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
      <property name="title">
       <string/>
      </property>
-     <layout class="QGridLayout" name="gridLayout">
-      <item row="0" column="0">
-       <widget class="QCheckBox" name="CheckBox2">
-        <property name="text">
-         <string/>
-        </property>
-       </widget>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <layout class="QGridLayout" name="gridLayout">
+        <item row="0" column="0">
+         <widget class="QCheckBox" name="CheckBox2">
+          <property name="text">
+           <string/>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1">
+         <widget class="QCheckBox" name="CheckBox1">
+          <property name="text">
+           <string/>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="0">
+         <widget class="QCheckBox" name="CheckBox3">
+          <property name="text">
+           <string/>
+          </property>
+         </widget>
+        </item>
+       </layout>
       </item>
-      <item row="1" column="0">
-       <widget class="QCheckBox" name="CheckBox1">
-        <property name="text">
-         <string/>
-        </property>
-       </widget>
+      <item>
+       <layout class="QGridLayout" name="gridLayout_2">
+        <item row="0" column="0" colspan="2">
+         <widget class="QLabel" name="label_8">
+          <property name="text">
+           <string>Start:</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="0">
+         <widget class="QLabel" name="label_1">
+          <property name="text">
+           <string>X</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="1">
+         <widget class="QLineEdit" name="lineEdit_1"/>
+        </item>
+        <item row="2" column="0">
+         <widget class="QLabel" name="label_2">
+          <property name="text">
+           <string>Y</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="1">
+         <widget class="QLineEdit" name="lineEdit_2"/>
+        </item>
+        <item row="3" column="0">
+         <widget class="QLabel" name="label_3">
+          <property name="text">
+           <string>Z</string>
+          </property>
+         </widget>
+        </item>
+        <item row="3" column="1">
+         <widget class="QLineEdit" name="lineEdit_3"/>
+        </item>
+        <item row="0" column="3">
+         <widget class="QLabel" name="label_7">
+          <property name="text">
+           <string>End:</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="2">
+         <widget class="QLabel" name="label_4">
+          <property name="text">
+           <string>X</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="3">
+         <widget class="QLineEdit" name="lineEdit_4"/>
+        </item>
+        <item row="2" column="2">
+         <widget class="QLabel" name="label_5">
+          <property name="text">
+           <string>Y</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="3">
+         <widget class="QLineEdit" name="lineEdit_5"/>
+        </item>
+        <item row="3" column="2">
+         <widget class="QLabel" name="label_6">
+          <property name="text">
+           <string>Z</string>
+          </property>
+         </widget>
+        </item>
+        <item row="3" column="3">
+         <widget class="QLineEdit" name="lineEdit_6"/>
+        </item>
+       </layout>
       </item>
      </layout>
     </widget>
index d0333cd593b4048c7124b467e42ed2a997de0f3a..b884d9067442bd0a8f13b39aed913d9cecd34246 100644 (file)
@@ -674,6 +674,13 @@ void EntityGUI_SketcherDlg::DestClicked( int constructorId )
     GroupD2->show();
     Group3Spin->checkBox->hide();
     Group4Spin->checkBox->hide();
+    if (myConstructorId == 1) {
+      myRadius = 100.0;
+      myLength = 30.0;
+      myAngle = 0.0;
+      myDX = 0.0;
+      myDY = 0.0;
+    }
     Dir1Clicked( 2 );  // Angle
   }
   resize( minimumSizeHint() );
@@ -899,8 +906,18 @@ void EntityGUI_SketcherDlg::Dir1Clicked( int constructorId )
 void EntityGUI_SketcherDlg::Dir2Clicked( int constructorId )
 {
   InitClick();
-  myAngle = 0.0;
-
+  Group3Spin->SpinBox_DX->blockSignals(true); // Block signals in order not to modify
+  Group3Spin->SpinBox_DY->blockSignals(true); // defaut values
+  Group3Spin->SpinBox_DZ->blockSignals(true);
+  
+  Group2Spin->SpinBox_DX->blockSignals(true);
+  Group2Spin->SpinBox_DY->blockSignals(true);
+  
+  Group4Spin->SpinBox_DX->blockSignals(true); 
+  Group4Spin->SpinBox_DY->blockSignals(true);
+  Group4Spin->SpinBox_DZ->blockSignals(true);
+  Group4Spin->SpinBox_DS->blockSignals(true); 
+  
   // Get setting of step value from file configuration
   double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 );
 
@@ -980,9 +997,7 @@ void EntityGUI_SketcherDlg::Dir2Clicked( int constructorId )
       initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
       Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_VX2" ) );
       Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_VY2" ) );
-      myDX = 0.0;
       Group3Spin->SpinBox_DX->setValue( myDX );
-      myDY = 0.0;
       Group3Spin->SpinBox_DY->setValue( myDY );
       Group3Spin->show();
       Group3Spin->buttonApply->setFocus();
@@ -1015,9 +1030,7 @@ void EntityGUI_SketcherDlg::Dir2Clicked( int constructorId )
         Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_RADIUS2" ) );
         Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_ANGLE2" ));
         Group3Spin->SpinBox_DX->setValue( myAngle );
-        myRadius = 100.0;
         Group3Spin->SpinBox_DY->setValue( myRadius );
-        myLength = 30.0;
         Group3Spin->SpinBox_DZ->setValue( myLength );
         Group3Spin->show();
         Group3Spin->buttonApply->setFocus();
@@ -1030,9 +1043,9 @@ void EntityGUI_SketcherDlg::Dir2Clicked( int constructorId )
         initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 5., "angle_precision" );
         Group2Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_RADIUS2" ) );
         Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_ANGLE2" ) );
-        myRadius = 100.0;
+//         myRadius = 100.0;
         Group2Spin->SpinBox_DX->setValue( myRadius );
-        myLength = 30.0;
+//         myLength = 30.0;
         Group2Spin->SpinBox_DY->setValue( myLength );
         Group2Spin->show();
         Group2Spin->buttonApply->setFocus();
@@ -1045,9 +1058,9 @@ void EntityGUI_SketcherDlg::Dir2Clicked( int constructorId )
         initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 5., "angle_precision" );
         Group2Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_RADIUS2" ) );
         Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_ANGLE2" ) );
-        myRadius = 100.0;
+//         myRadius = 100.0;
         Group2Spin->SpinBox_DX->setValue( myRadius );
-        myLength = 30.0;
+//         myLength = 30.0;
         Group2Spin->SpinBox_DY->setValue( myLength );
         Group2Spin->show();
         Group2Spin->buttonApply->setFocus();
@@ -1064,19 +1077,29 @@ void EntityGUI_SketcherDlg::Dir2Clicked( int constructorId )
        initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 0.1, "length_precision" );
        initSpinBox( Group4Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 0.1, "length_precision" );
        initSpinBox( Group4Spin->SpinBox_DS, COORD_MIN, COORD_MAX, 5., "length_precision" );
-        myDX = 0.0;
         Group4Spin->SpinBox_DX->setValue( myDX );
-        myDY = 0.0;
         Group4Spin->SpinBox_DY->setValue( myDY );
-        myRadius = 100.0;
+//         myRadius = 100.0;
         Group4Spin->SpinBox_DZ->setValue( myRadius );
-        myLength = 30.0;
+//         myLength = 30.0;
         Group4Spin->SpinBox_DS->setValue( myLength );
         Group4Spin->show();
         Group4Spin->buttonApply->setFocus();
       }
     }
   }
+  Group3Spin->SpinBox_DX->blockSignals(false); // Restore signals
+  Group3Spin->SpinBox_DY->blockSignals(false); 
+  Group3Spin->SpinBox_DZ->blockSignals(false);
+  
+  Group2Spin->SpinBox_DX->blockSignals(false);
+  Group2Spin->SpinBox_DY->blockSignals(false);
+  
+  Group4Spin->SpinBox_DX->blockSignals(false); 
+  Group4Spin->SpinBox_DY->blockSignals(false);
+  Group4Spin->SpinBox_DZ->blockSignals(false);
+  Group4Spin->SpinBox_DS->blockSignals(false); 
+  
   resize( minimumSizeHint() );
   GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
 }
index 6efcaf7e0bfc958888502b5ec90cba9beaf9fa50..32d3e97c284ab764724d4ac44f6fb2496ef9e01c 100644 (file)
@@ -674,12 +674,13 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
       // add function description before dump
       if (!aCurScript.IsEmpty())
       {
-        if ( aFunction->GetDriverGUID() == GEOM_Object::GetSubShapeID() )
+        if ( aFunction->GetDriverGUID() == GEOM_Object::GetSubShapeID() &&
+             aFuncScript.Length() > aCurScript.Length() )
           // avoid repeated SubShape...() command at the end
           if (aFuncScript.Location( aCurScript,
                                     aFuncScript.Length() - aCurScript.Length(),
                                     aFuncScript.Length()))
-              continue;
+            continue; // aCurScript is already at the end of aFuncScript
         aFuncScript += aCurScript;
       }
       if (isDumpCollected ) {
@@ -960,7 +961,7 @@ std::list<int> GEOM_Engine::getAllTextures(int theDocID)
 
 //=============================================================================
 /*!
- *  ProcessFunction: Dump fucntion description into script
+ *  ProcessFunction: Dump function description into script
  */
 //=============================================================================
 bool ProcessFunction(Handle(GEOM_Function)&             theFunction,
@@ -1022,6 +1023,16 @@ bool ProcessFunction(Handle(GEOM_Function)&             theFunction,
   //Check if its internal function which doesn't requires dumping
   if(aDescr == "None") return false;
 
+  //Check the very specific case of RestoreShape function,
+  //which is not dumped, but the result can be published by the user.
+  //We do not publish such objects to decrease danger of dumped script failure.
+  if(aDescr.Value(1) == '#') {
+    TCollection_AsciiString anObjEntry;
+    TDF_Tool::Entry(theFunction->GetOwnerEntry(), anObjEntry);
+    theIgnoreObjs.insert(anObjEntry);
+    return false;
+  }
+
   // 0020001 PTv, check for critical functions, which require dump of objects
   if (theIsPublished)
   {
@@ -1035,6 +1046,95 @@ bool ProcessFunction(Handle(GEOM_Function)&             theFunction,
 
   //Replace parameter by notebook variables
   ReplaceVariables(aDescr,theVariables);
+
+  //Process sketcher functions, replacing string command by calls to Sketcher interface
+  if (aDescr.Search( "Make3DSketcher" ) != -1) {
+    TCollection_AsciiString aNewDescr;
+    int i = 1;
+    TCollection_AsciiString aSubStr = aDescr.Token("\n\t", i);
+    for (; !aSubStr.IsEmpty(); aSubStr = aDescr.Token("\n\t", i)) {
+      if (aSubStr.Search( "Make3DSketcherCommand" ) != -1) {
+        TCollection_AsciiString aResult = aSubStr.Token(" ", 1);
+        // "3DSketcher:CMD[:CMD[:CMD...]]"
+        TCollection_AsciiString aCommand = aSubStr.Token("\"", 2);
+
+        // Split the command string to separate CMDs
+        int icmd = 2;
+        TColStd_SequenceOfAsciiString aSequence;
+        if (aCommand.Length()) {
+          TCollection_AsciiString aToken = aCommand.Token(":", icmd);
+          while (aToken.Length() > 0) {
+            aSequence.Append(aToken);
+            aToken = aCommand.Token(":", ++icmd);
+          }
+        }
+
+        if (aSequence.Length() > 0) {
+          if (i > 1)
+            aNewDescr += "\n\t";
+
+          aNewDescr += "sk = geompy.Sketcher3D()";
+          int nbCMDs = aSequence.Length();
+          for (icmd = 1; icmd <= nbCMDs; icmd++) {
+            aNewDescr += "\n\t";
+
+            TCollection_AsciiString aCMD = aSequence.Value(icmd);
+
+            // Split the CMD into string values
+            TColStd_SequenceOfAsciiString aStrVals;
+            int ival = 1;
+            TCollection_AsciiString aToken = aCMD.Token(" ", ival);
+            while (aToken.Length() > 0) {
+              aStrVals.Append(aToken);
+              aToken = aCMD.Token(" ", ++ival);
+            }
+
+            TCollection_AsciiString aCMDpref = aStrVals.Value(1);
+            if (aCMDpref == "TT") {
+              aNewDescr += "sk.addPointsAbsolute(";
+              aNewDescr += aStrVals.Value(2) + ", " + aStrVals.Value(3) + ", " + aStrVals.Value(4) + ")";
+            }
+            else if (aCMDpref == "T") {
+              aNewDescr += "sk.addPointsRelative(";
+              aNewDescr += aStrVals.Value(2) + ", " + aStrVals.Value(3) + ", " + aStrVals.Value(4) + ")";
+            }
+            else if (aCMDpref == "WW") {
+              aNewDescr += "sk.close()";
+            }
+            else {
+              aNewDescr += "sk.addPointAnglesLength(\"";
+              aNewDescr += aCMDpref + "\", " +
+                aStrVals.Value(2) + ", " + aStrVals.Value(3) + ", " + aStrVals.Value(4) + ")";
+            }
+          }
+          aNewDescr += "\n\t";
+          aNewDescr += aResult + " = sk.wire()";
+        }
+      } // Make3DSketcherCommand
+      else if (aSubStr.Search( "Make3DSketcher" ) != -1) {
+        TCollection_AsciiString aResult = aSubStr.Token(" ", 1);
+        TCollection_AsciiString aCommand = aSubStr.Token("[", 2);
+        aCommand = aCommand.Token("]", 1);
+        if (i > 1)
+          aNewDescr += "\n\t";
+        aNewDescr += "sk = geompy.Sketcher3D()";
+        aNewDescr += "\n\t";
+        aNewDescr += "sk.addPointsAbsolute(";
+        aNewDescr += aCommand + ")";
+        aNewDescr += "\n\t";
+        aNewDescr += aResult + " = sk.wire()";
+      }
+      else {
+        if (i > 1)
+          aNewDescr += "\n\t";
+        aNewDescr += aSubStr;
+      }
+
+      i++;
+    }
+    aDescr = aNewDescr;
+  }
+
   if ( theIsDumpCollected ) {
     int i = 1;
     bool isBefore = true;
index a599ca89e864feb4378383859ca32c5eb1487344..5bfdb55cbda954aa0e711854c13c89008e7d1e77 100644 (file)
@@ -570,9 +570,11 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS)
     aPc.SetXYZ(aXYZc);
     aInfo.SetLocation(aPc);
     //
-    gp_Vec aVec(aPc, aP2);
-    gp_Dir aDir(aVec);
-    aInfo.SetDirection(aDir);
+    if ( aLength >= gp::Resolution() ) {
+      gp_Vec aVec(aPc, aP2);
+      gp_Dir aDir(aVec);
+      aInfo.SetDirection(aDir);
+    }
   }
   //modified by NIZNHY-PKV Tue Jul 03 10:19:06 2012t
   // Line
index 73423426981974a01dcf79fef35cc8fd86196a54..0aa1da20ae232d6838bdd125d459acbe79f4c308 100644 (file)
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 // File   : GEOMGUI_Selection.cxx
 // Author : Alexander SOLOVYOV, Open CASCADE S.A.S. (alexander.solovyov@opencascade.com)
-//
+
 #include "GEOMGUI_Selection.h"
 
 #include "GeometryGUI.h"
@@ -159,10 +158,12 @@ QVariant GEOMGUI_Selection::parameter( const int idx, const QString& p ) const
     v = isVectorsMode( idx );
   else if ( p == "topLevel" )
     v = topLevel( idx );
-  else if ( p == "hasHiddenChildren" )
-    v = hasHiddenChildren( idx );
-  else if ( p == "hasShownChildren" )
-    v = hasShownChildren( idx );
+  else if ( p == "hasChildren" )
+    v = hasChildren( idx );
+  else if ( p == "hasConcealedChildren" )
+    v = hasConcealedChildren( idx );
+  else if ( p == "hasDisclosedChildren" )
+    v = hasDisclosedChildren( idx );
   else if ( p == "compoundOfVertices" )
     v = compoundOfVertices( idx );
   else if ( p == "imported" )
@@ -446,7 +447,23 @@ bool GEOMGUI_Selection::isCompoundOfVertices( GEOM::GEOM_Object_ptr obj )
   return ret;
 }
 
-bool GEOMGUI_Selection::hasHiddenChildren( const int index ) const
+bool GEOMGUI_Selection::hasChildren( const int index ) const
+{
+  bool ok = false;
+  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
+
+  if ( appStudy ) {
+    QString anEntry = entry( index );
+    _PTR(Study) study = appStudy->studyDS();
+    if ( study && !anEntry.isEmpty() ) {
+      _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
+      ok = hasChildren( aSO );
+    }
+  }
+  return ok;
+}
+
+bool GEOMGUI_Selection::hasConcealedChildren( const int index ) const
 {
   bool OK = false;
   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
@@ -462,7 +479,7 @@ bool GEOMGUI_Selection::hasHiddenChildren( const int index ) const
   return OK;
 }
 
-bool GEOMGUI_Selection::hasShownChildren( const int index ) const
+bool GEOMGUI_Selection::hasDisclosedChildren( const int index ) const
 {
   bool OK = false;
   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
index c6e9b59da7a627913f14ce5178a725e347c67c95..acef7e196656a41c5fdfe1333f2dfebe58e0ff76 100644 (file)
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 // File   : GEOMGUI_Selection.h
 // Author : Alexander SOLOVYOV, Open CASCADE S.A.S. (alexander.solovyov@opencascade.com)
-//
+
 #ifndef GEOMGUI_SELECTION_H
 #define GEOMGUI_SELECTION_H
 
@@ -66,8 +65,9 @@ private:
   QString               displayMode( const int ) const;
   QString               selectionMode() const;
   bool                  isVectorsMode( const int ) const;
-  bool                  hasHiddenChildren( const int ) const;
-  bool                  hasShownChildren( const int ) const;
+  bool                  hasChildren( const int ) const;
+  bool                  hasConcealedChildren( const int ) const;
+  bool                  hasDisclosedChildren( const int ) const;
   bool                  compoundOfVertices( const int ) const;
   bool                  topLevel( const int ) const;
   bool                  isPhysicalMaterial( const int ) const;
index 15f36281d67895429c2b57ed8cf5df29377ad803..7edbae5b250419101084af6f93bee54c5481c7d6 100644 (file)
 #include <Graphic3d_HArray1OfBytes.hxx>
 #endif
 
+// If the next macro is defined, autocolor feature works for all sub-shapes;
+// if it is undefined, autocolor feature works for groups only
+//#define GENERAL_AUTOCOLOR
+// Below macro, when uncommented, switches on simplified (more performant) algorithm
+// of auto-color picking up
+//#define SIMPLE_AUTOCOLOR
+
 //================================================================
 // Function : getActiveStudy
 // Purpose  : Get active study, returns 0 if no open study frame
@@ -1823,6 +1830,40 @@ int GEOM_Displayer::UnsetDisplayMode()
   return aPrevMode;
 }
 
+SALOMEDS::Color GEOM_Displayer::getPredefinedUniqueColor()
+{
+  static QList<QColor> colors;
+
+  if ( colors.isEmpty() ) {
+    const int rfactor = 4; // red   color component split factor, must be > 0
+    const int gfactor = 4; // green color component split factor, must be > 0
+    const int bfactor = 3; // blue  color component split factor, must be > 0
+                           // -
+                           // total number of pre-defined colors is defined as
+                           // nbcolors = rfactor * gfactor * bfactor
+                           // NB: all three factors should not have same values
+                           // otherwise all colors will be greyish
+    
+    for ( int g = 0; g < gfactor; g++ ) {
+      for ( int r = 0; r < rfactor; r++ ) {
+       for ( int b = 0; b < bfactor; b++ )
+         colors.append( QColor( qRgb( r * 255 / (rfactor-1), g * 255 / (gfactor-1), b * 255 / (bfactor-1) ) ) );
+      }
+    }
+  }
+
+  static int currentColor = 0;
+
+  SALOMEDS::Color color;
+  color.R = (double)colors[currentColor].red()   / 255.0;
+  color.G = (double)colors[currentColor].green() / 255.0;
+  color.B = (double)colors[currentColor].blue()  / 255.0;
+
+  currentColor = (currentColor+1) % colors.count();
+
+  return color;
+}
+
 SALOMEDS::Color GEOM_Displayer::getUniqueColor( const QList<SALOMEDS::Color>& theReservedColors )
 {
   int aHue = -1;
@@ -2003,48 +2044,50 @@ SALOMEDS::Color GEOM_Displayer::getColor(GEOM::GEOM_Object_var theGeomObject, bo
   hasColor = false;
 
   SUIT_Session* session = SUIT_Session::session();
-  SUIT_Application* app = session->activeApplication();
+  SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
 
   if ( app && !theGeomObject->_is_nil()) {
     SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
 
     if ( study ) {
+      _PTR(Study) aStudy = study->studyDS();
       aSColor = theGeomObject->GetColor();
       hasColor = aSColor.R >= 0 && aSColor.G >= 0 && aSColor.B >= 0;
-      if( !hasColor && theGeomObject->GetType() == GEOM_GROUP ) { // auto color for group
-        GEOM::GEOM_Gen_var theGeomGen = GeometryGUI::GetGeomGen();
-        GEOM::GEOM_IGroupOperations_var anOperations = theGeomGen->GetIGroupOperations( study->id() );
-        GEOM::GEOM_Object_var aMainObject = anOperations->GetMainShape( theGeomObject );
-        if ( !aMainObject->_is_nil() && aMainObject->GetAutoColor() )
-          {
-            QList<SALOMEDS::Color> aReservedColors;
-
-            SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( app );
-            CORBA::String_var IOR = app->orb()->object_to_string( aMainObject );
-            if ( strcmp(IOR.in(), "") != 0 )
-              {
-                _PTR(Study) aStudy = study->studyDS();
-                _PTR(SObject) aMainSObject( aStudy->FindObjectIOR( std::string(IOR) ) );
-                _PTR(ChildIterator) it( aStudy->NewChildIterator( aMainSObject ) );
-                for( ; it->More(); it->Next() )
-                  {
-                    _PTR(SObject) aChildSObject( it->Value() );
-                    GEOM::GEOM_Object_var aChildObject =
-                      GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aChildSObject));
-                    if( CORBA::is_nil( aChildObject ) )
-                      continue;
-
-                    if( aChildObject->GetType() != GEOM_GROUP )
-                      continue;
-
-                    SALOMEDS::Color aReservedColor = aChildObject->GetColor();
-                    aReservedColors.append( aReservedColor );
-                  }
-              }
-
-            aSColor = getUniqueColor( aReservedColors );
-            hasColor = true;
-          }
+      if ( !hasColor ) {
+#ifdef GENERAL_AUTOCOLOR // auto-color for all sub-shapes
+       bool general_autocolor = true;
+#else                    // auto-color for groups only
+       bool general_autocolor = false;
+#endif                   // GENERAL_AUTOCOLOR
+       if ( general_autocolor || theGeomObject->GetType() == GEOM_GROUP ) {
+         GEOM::GEOM_Object_var aMainObject = theGeomObject->GetMainShape();
+         if ( !CORBA::is_nil( aMainObject ) && aMainObject->GetAutoColor() ) {
+#ifdef SIMPLE_AUTOCOLOR  // simplified algorithm for auto-colors
+           aSColor = getPredefinedUniqueColor();
+           hasColor = true;
+#else                    // old algorithm  for auto-colors
+           QList<SALOMEDS::Color> aReservedColors;
+           CORBA::String_var IOR = app->orb()->object_to_string( aMainObject );
+           _PTR(SObject) aMainSObject( aStudy->FindObjectIOR( IOR.in() ) );
+           if ( aMainSObject ) {
+             _PTR(ChildIterator) it( aStudy->NewChildIterator( aMainSObject ) );
+             for ( ; it->More(); it->Next() ) {
+               _PTR(SObject) aChildSObject( it->Value() );
+               GEOM::GEOM_Object_var aChildObject =
+                 GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aChildSObject));
+               if ( CORBA::is_nil( aChildObject ) )
+                 continue;
+               
+               SALOMEDS::Color aReservedColor = aChildObject->GetColor();
+               if ( aReservedColor.R >= 0 && aReservedColor.G >= 0 && aReservedColor.B >= 0 )
+                 aReservedColors.append( aReservedColor );
+             }
+           }
+           aSColor = getUniqueColor( aReservedColors );
+           hasColor = true;
+#endif                   // SIMPLE_AUTOCOLOR
+         }
+       }
       }
     }
   }
index 07305f66b15d2c4fc349c5633c82e06e6899602a..656612776a1bcc603f549c2173d0a38b4516f5e6 100644 (file)
@@ -169,6 +169,7 @@ public:
   SalomeApp_Study* getStudy() const;
 
   static SALOMEDS::Color getUniqueColor( const QList<SALOMEDS::Color>& );
+  static SALOMEDS::Color getPredefinedUniqueColor();
 
   static PropMap getDefaultPropertyMap(const QString& viewer_type);
   
index d15ade1d2a0f2f27da6c6e53b85f481c6f963f8d..96b164f7bc053034eb16a836c70689ee635b104e 100644 (file)
             <source>ICON_DLG_CHECK_COMPOUND_OF_BLOCKS</source>
             <translation>check_blocks_compound.png</translation>
         </message>
+        <message>
+            <source>ICON_DLG_GETNONBLOCKS</source>
+            <translation>get_non_blocks.png</translation>
+        </message>
         <message>
             <source>ICON_DLG_CHECK_SELF_INTERSECTIONS</source>
             <translation>check_self_intersections.png</translation>
             <source>ICO_CHECK_COMPOUND</source>
             <translation>check_blocks_compound.png</translation>
         </message>
+        <message>
+            <source>ICO_GET_NON_BLOCKS</source>
+            <translation>get_non_blocks.png</translation>
+        </message>
         <message>
             <source>ICO_CHECK_SELF_INTERSECTIONS</source>
             <translation>check_self_intersections.png</translation>
             <source>ICO_COMMON</source>
             <translation>common.png</translation>
         </message>
+        <message>
+            <source>ICO_GROUP_INTERSECT</source>
+            <translation>common.png</translation>
+        </message>
         <message>
             <source>ICO_COMPOUND</source>
             <translation>build_compound.png</translation>
             <source>ICO_CUT</source>
             <translation>cut.png</translation>
         </message>
+        <message>
+            <source>ICO_GROUP_CUT</source>
+            <translation>cut.png</translation>
+        </message>
         <message>
             <source>ICO_CYLINDER</source>
             <translation>cylinder.png</translation>
             <source>ICO_FUSE</source>
             <translation>fuse.png</translation>
         </message>
+        <message>
+            <source>ICO_GROUP_UNION</source>
+            <translation>fuse.png</translation>
+        </message>
         <message>
             <source>ICO_GLUE_FACES</source>
             <translation>glue.png</translation>
index cf4c13db2a3231ba6550aabf8e9230c43fea9928..d0ec111bb5d14b1ef5d8963755bfb3d60f229193 100644 (file)
@@ -7,6 +7,10 @@
         <source>BRep_API: command not done</source>
         <translation>Error: can&apos;t build object</translation>
     </message>
+    <message>
+        <source>PAL_NOT_DONE_ERROR</source>
+        <translation>Operation aborted</translation>
+    </message>
     <message>
         <source>CHANGE_ORIENTATION_NEW_OBJ_NAME</source>
         <translation>Invert</translation>
@@ -357,6 +361,18 @@ Please, select face, shell or solid and try again</translation>
         <source>GEOM_CHECK_BLOCKS_COMPOUND_SUBSHAPES</source>
         <translation>Incriminated Sub-shapes</translation>
     </message>
+    <message>
+        <source>GEOM_GETNONBLOCKS_TITLE</source>
+        <translation>Get non-hexahedral solids and non-quadrangular faces</translation>
+    </message>
+    <message>
+        <source>GEOM_GETNONBLOCKS</source>
+        <translation>Get non blocks</translation>
+    </message>
+    <message>
+        <source>GEOM_NONBLOCKS</source>
+        <translation>NonBlocksGroup</translation>
+    </message>
     <message>
         <source>GEOM_CHECK_INFOS</source>
         <translation>Object And Its Topological Information</translation>
@@ -1830,6 +1846,10 @@ Please, select face, shell or solid and try again</translation>
         <source>GEOM_COORDINATES_TYPE</source>
         <translation>Coordinates Type</translation>
     </message>
+    <message>
+        <source>GEOM_CONTROLS</source>
+        <translation>Dimensions</translation>
+    </message>
     <message>
         <source>GEOM_SOLID</source>
         <translation>Solid</translation>
@@ -2310,6 +2330,10 @@ Please, select face, shell or solid and try again</translation>
         <source>MEN_CHECK_COMPOUND</source>
         <translation>Check Compound of Blocks</translation>
     </message>
+    <message>
+        <source>MEN_GET_NON_BLOCKS</source>
+        <translation>Get Non Blocks</translation>
+    </message>
     <message>
         <source>MEN_CHECK_SELF_INTERSECTIONS</source>
         <translation>Detect Self-intersections</translation>
@@ -2422,6 +2446,10 @@ Please, select face, shell or solid and try again</translation>
         <source>MEN_DISPLAY_ONLY</source>
         <translation>Show Only</translation>
     </message>
+    <message>
+        <source>MEN_SHOW_ONLY_CHILDREN</source>
+        <translation>Show Only Children</translation>
+    </message>
     <message>
         <source>MEN_BRING_TO_FRONT</source>
         <translation>Bring To Front</translation>
@@ -2550,6 +2578,18 @@ Please, select face, shell or solid and try again</translation>
         <source>MEN_GROUP_EDIT</source>
         <translation>Edit</translation>
     </message>
+    <message>
+        <source>MEN_GROUP_UNION</source>
+        <translation>Union Groups</translation>
+    </message>
+    <message>
+        <source>MEN_GROUP_INTERSECT</source>
+        <translation>Intersect Groups</translation>
+    </message>
+    <message>
+        <source>MEN_GROUP_CUT</source>
+        <translation>Cut Groups</translation>
+    </message>
     <message>
         <source>MEN_RELOAD_IMPORTED</source>
         <translation>Reload From Disk</translation>
@@ -2667,12 +2707,12 @@ Please, select face, shell or solid and try again</translation>
         <translation>Create Group</translation>
     </message>
     <message>
-        <source>MEN_POP_SHOW_CHILDREN</source>
-        <translation>Show Children</translation>
+        <source>MEN_POP_DISCLOSE_CHILDREN</source>
+        <translation>Disclose child items</translation>
     </message>
     <message>
-        <source>MEN_POP_HIDE_CHILDREN</source>
-        <translation>Hide Children</translation>
+        <source>MEN_POP_CONCEAL_CHILDREN</source>
+        <translation>Conceal child items</translation>
     </message>
     <message>
         <source>MEN_POP_UNPUBLISH_OBJ</source>
@@ -3154,6 +3194,10 @@ Please, select face, shell or solid and try again</translation>
         <source>STB_CHECK_COMPOUND</source>
         <translation>Check compound of blocks</translation>
     </message>
+    <message>
+        <source>STB_GET_NON_BLOCKS</source>
+        <translation>Get non blocks</translation>
+    </message>
     <message>
         <source>STB_CHECK_SELF_INTERSECTIONS</source>
         <translation>Detect Self-intersections</translation>
@@ -3234,6 +3278,10 @@ Please, select face, shell or solid and try again</translation>
         <source>STB_DISPLAY_ONLY</source>
         <translation>Show only</translation>
     </message>
+    <message>
+        <source>STB_SHOW_ONLY_CHILDREN</source>
+        <translation>Show Only Children</translation>
+    </message>
     <message>
         <source>STB_EDGE</source>
         <translation>Build an edge</translation>
@@ -3322,6 +3370,18 @@ Please, select face, shell or solid and try again</translation>
         <source>STB_GROUP_EDIT</source>
         <translation>Edit a group</translation>
     </message>
+    <message>
+        <source>STB_GROUP_UNION</source>
+        <translation>Union Groups</translation>
+    </message>
+    <message>
+        <source>STB_GROUP_INTERSECT</source>
+        <translation>Intersect Groups</translation>
+    </message>
+    <message>
+        <source>STB_GROUP_CUT</source>
+        <translation>Cut Groups</translation>
+    </message>
     <message>
         <source>STB_RELOAD_IMPORTED</source>
         <translation>Reload imported shape from its original place on disk</translation>
@@ -3426,10 +3486,6 @@ Please, select face, shell or solid and try again</translation>
         <source>STB_POP_CREATE_GROUP</source>
         <translation>Create Group</translation>
     </message>
-    <message>
-        <source>STB_POP_SHOW_CHILDREN</source>
-        <translation>Show child objects</translation>
-    </message>
     <message>
         <source>STB_POP_UNPUBLISH_OBJ</source>
         <translation>Unpublish object</translation>
@@ -3439,8 +3495,12 @@ Please, select face, shell or solid and try again</translation>
         <translation>Publish object</translation>
     </message>
     <message>
-        <source>STB_POP_HIDE_CHILDREN</source>
-        <translation>Hide child objects</translation>
+        <source>STB_POP_DISCLOSE_CHILDREN</source>
+        <translation>Disclose child items</translation>
+    </message>
+    <message>
+        <source>STB_POP_CONCEAL_CHILDREN</source>
+        <translation>Conceal child items</translation>
     </message>
     <message>
         <source>STB_POP_ISOS</source>
@@ -3762,6 +3822,10 @@ Please, select face, shell or solid and try again</translation>
         <source>TOP_CHECK_COMPOUND</source>
         <translation>Check compound of blocks</translation>
     </message>
+    <message>
+        <source>TOP_GET_NON_BLOCKS</source>
+        <translation>Get non blocks</translation>
+    </message>
     <message>
         <source>TOP_CHECK_SELF_INTERSECTIONS</source>
         <translation>Detect Self-intersections</translation>
@@ -3838,6 +3902,10 @@ Please, select face, shell or solid and try again</translation>
         <source>TOP_DISPLAY_ONLY</source>
         <translation>Show only</translation>
     </message>
+    <message>
+        <source>TOP_SHOW_ONLY_CHILDREN</source>
+        <translation>Show Only Children</translation>
+    </message>
     <message>
         <source>TOP_EDGE</source>
         <translation>Build edge</translation>
@@ -3918,6 +3986,18 @@ Please, select face, shell or solid and try again</translation>
         <source>TOP_GROUP_EDIT</source>
         <translation>Edit a group</translation>
     </message>
+    <message>
+        <source>TOP_GROUP_UNION</source>
+        <translation>Union Groups</translation>
+    </message>
+    <message>
+        <source>TOP_GROUP_INTERSECT</source>
+        <translation>Intersect Groups</translation>
+    </message>
+    <message>
+        <source>TOP_GROUP_CUT</source>
+        <translation>Cut Groups</translation>
+    </message>
     <message>
         <source>TOP_HEX_SOLID</source>
         <translation>Hexahedral Solid</translation>
@@ -4026,10 +4106,6 @@ Please, select face, shell or solid and try again</translation>
         <source>TOP_POP_CREATE_GROUP</source>
         <translation>Create Group</translation>
     </message>
-    <message>
-        <source>TOP_POP_SHOW_CHILDREN</source>
-        <translation>Show Children</translation>
-    </message>
     <message>
         <source>TOP_POP_UNPUBLISH_OBJ</source>
         <translation>Unpublish object</translation>
@@ -4039,8 +4115,12 @@ Please, select face, shell or solid and try again</translation>
         <translation>Publish object</translation>
     </message>
     <message>
-        <source>TOP_POP_HIDE_CHILDREN</source>
-        <translation>Hide Children</translation>
+        <source>TOP_POP_DISCLOSE_CHILDREN</source>
+        <translation>Disclose child items</translation>
+    </message>
+    <message>
+        <source>TOP_POP_CONCEAL_CHILDREN</source>
+        <translation>Conceal child items</translation>
     </message>
     <message>
         <source>TOP_POP_ISOS</source>
@@ -5037,6 +5117,45 @@ Number of sketch points too small</translation>
         <translation>Please, select a group to edit</translation>
     </message>
 </context>
+<context>
+    <name>GroupGUI_BooleanDlg</name>
+    <message>
+        <source>GEOM_UNION</source>
+        <translation>Union</translation>
+    </message>
+    <message>
+        <source>GEOM_UNION_TITLE</source>
+        <translation>Union Groups</translation>
+    </message>
+    <message>
+        <source>GEOM_INTERSECT</source>
+        <translation>Intersect</translation>
+    </message>
+    <message>
+        <source>GEOM_INTERSECT_TITLE</source>
+        <translation>Intersect Groups</translation>
+    </message>
+    <message>
+        <source>GEOM_CUT</source>
+        <translation>Cut</translation>
+    </message>
+    <message>
+        <source>GEOM_CUT_TITLE</source>
+        <translation>Cut Groups</translation>
+    </message>
+    <message>
+        <source>GEOM_GROUPS</source>
+        <translation>Groups</translation>
+    </message>
+    <message>
+        <source>GEOM_MAIN_GROUPS</source>
+        <translation>Main Groups</translation>
+    </message>
+    <message>
+        <source>GEOM_TOOL_GROUPS</source>
+        <translation>Tool Groups</translation>
+    </message>
+</context>
 <context>
     <name>GroupGUI_GroupDlg</name>
     <message>
index 23694246d53be3d77688dcfaaf77fb1f6f29c10f..cfb646debbcc1af0ea482144e18e75bb04f426ad 100644 (file)
@@ -376,8 +376,9 @@ void GeometryGUI::OnGUIEvent( int id )
   NotViewerDependentCommands << GEOMOp::OpDelete
                              << GEOMOp::OpShow
                              << GEOMOp::OpShowOnly
-                             << GEOMOp::OpShowChildren
-                             << GEOMOp::OpHideChildren
+                             << GEOMOp::OpShowOnlyChildren
+                             << GEOMOp::OpDiscloseChildren
+                             << GEOMOp::OpConcealChildren
                              << GEOMOp::OpUnpublishObject
                              << GEOMOp::OpPublishObject
                              << GEOMOp::OpPointMarker;
@@ -419,8 +420,8 @@ void GeometryGUI::OnGUIEvent( int id )
   case GEOMOp::OpDecrNbIsos:         // SHORTCUT   - DECREASE NB ISOS
   case GEOMOp::OpAutoColor:          // POPUP MENU - AUTO COLOR
   case GEOMOp::OpNoAutoColor:        // POPUP MENU - DISABLE AUTO COLOR
-  case GEOMOp::OpShowChildren:       // POPUP MENU - SHOW CHILDREN
-  case GEOMOp::OpHideChildren:       // POPUP MENU - HIDE CHILDREN
+  case GEOMOp::OpDiscloseChildren:   // POPUP MENU - DISCLOSE CHILD ITEMS
+  case GEOMOp::OpConcealChildren:    // POPUP MENU - CONCEAL CHILD ITEMS
   case GEOMOp::OpUnpublishObject:    // POPUP MENU - UNPUBLISH
   case GEOMOp::OpPublishObject:      // ROOT GEOM OBJECT - POPUP MENU - PUBLISH
   case GEOMOp::OpPointMarker:        // POPUP MENU - POINT MARKER
@@ -436,6 +437,7 @@ void GeometryGUI::OnGUIEvent( int id )
   case GEOMOp::OpDMShadingWithEdges: // MENU VIEW - SHADING
   case GEOMOp::OpShowAll:            // MENU VIEW - SHOW ALL
   case GEOMOp::OpShowOnly:           // MENU VIEW - DISPLAY ONLY
+  case GEOMOp::OpShowOnlyChildren:   // MENU VIEW - SHOW ONLY CHILDREN
   case GEOMOp::OpHideAll:            // MENU VIEW - ERASE ALL
   case GEOMOp::OpHide:               // MENU VIEW - ERASE
   case GEOMOp::OpShow:               // MENU VIEW - DISPLAY
@@ -549,6 +551,7 @@ void GeometryGUI::OnGUIEvent( int id )
   case GEOMOp::OpWhatIs:             // MENU MEASURE - WHATIS
   case GEOMOp::OpCheckShape:         // MENU MEASURE - CHECK
   case GEOMOp::OpCheckCompound:      // MENU MEASURE - CHECK COMPOUND OF BLOCKS
+  case GEOMOp::OpGetNonBlocks:       // MENU MEASURE - Get NON BLOCKS
   case GEOMOp::OpPointCoordinates:   // MENU MEASURE - POINT COORDINATES
   case GEOMOp::OpCheckSelfInters:    // MENU MEASURE - CHECK SELF INTERSECTIONS
     libName = "MeasureGUI";
@@ -556,6 +559,9 @@ void GeometryGUI::OnGUIEvent( int id )
   case GEOMOp::OpGroupCreate:        // MENU GROUP - CREATE
   case GEOMOp::OpGroupCreatePopup:   // POPUP MENU - CREATE GROUP
   case GEOMOp::OpGroupEdit:          // MENU GROUP - EDIT
+  case GEOMOp::OpGroupUnion:         // MENU GROUP - UNION
+  case GEOMOp::OpGroupIntersect:     // MENU GROUP - INTERSECT
+  case GEOMOp::OpGroupCut:           // MENU GROUP - CUT
     libName = "GroupGUI";
     break;
   case GEOMOp::OpHexaSolid:          // MENU BLOCKS - HEXAHEDRAL SOLID
@@ -748,6 +754,9 @@ void GeometryGUI::initialize( CAM_Application* app )
 
   createGeomAction( GEOMOp::OpGroupCreate, "GROUP_CREATE" );
   createGeomAction( GEOMOp::OpGroupEdit,   "GROUP_EDIT" );
+  createGeomAction( GEOMOp::OpGroupUnion,  "GROUP_UNION" );
+  createGeomAction( GEOMOp::OpGroupIntersect, "GROUP_INTERSECT" );
+  createGeomAction( GEOMOp::OpGroupCut,    "GROUP_CUT" );
 
   createGeomAction( GEOMOp::OpReimport,    "RELOAD_IMPORTED" );
 
@@ -829,6 +838,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createGeomAction( GEOMOp::OpWhatIs,           "WHAT_IS" );
   createGeomAction( GEOMOp::OpCheckShape,       "CHECK" );
   createGeomAction( GEOMOp::OpCheckCompound,    "CHECK_COMPOUND" );
+  createGeomAction( GEOMOp::OpGetNonBlocks,     "GET_NON_BLOCKS" );
   createGeomAction( GEOMOp::OpCheckSelfInters,  "CHECK_SELF_INTERSECTIONS" );
 
 #ifdef _DEBUG_ // PAL16821
@@ -851,6 +861,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createGeomAction( GEOMOp::OpSelectCompound,   "COMPOUND_SEL_ONLY", "",  0, true );
   createGeomAction( GEOMOp::OpSelectAll,        "ALL_SEL_ONLY", "",  0, true );
   createGeomAction( GEOMOp::OpShowOnly,         "DISPLAY_ONLY" );
+  createGeomAction( GEOMOp::OpShowOnlyChildren, "SHOW_ONLY_CHILDREN" );
   createGeomAction( GEOMOp::OpBringToFront,     "BRING_TO_FRONT", "", 0, true );
   createGeomAction( GEOMOp::OpClsBringToFront,  "CLS_BRING_TO_FRONT" );
   createGeomAction( GEOMOp::OpHide,             "ERASE" );
@@ -870,8 +881,8 @@ void GeometryGUI::initialize( CAM_Application* app )
   createGeomAction( GEOMOp::OpAutoColor,        "POP_AUTO_COLOR" );
   createGeomAction( GEOMOp::OpNoAutoColor,      "POP_DISABLE_AUTO_COLOR" );
   createGeomAction( GEOMOp::OpGroupCreatePopup, "POP_CREATE_GROUP" );
-  createGeomAction( GEOMOp::OpShowChildren,     "POP_SHOW_CHILDREN" );
-  createGeomAction( GEOMOp::OpHideChildren,     "POP_HIDE_CHILDREN" );
+  createGeomAction( GEOMOp::OpDiscloseChildren, "POP_DISCLOSE_CHILDREN" );
+  createGeomAction( GEOMOp::OpConcealChildren,  "POP_CONCEAL_CHILDREN" );
   createGeomAction( GEOMOp::OpUnpublishObject,  "POP_UNPUBLISH_OBJ" );
   createGeomAction( GEOMOp::OpPublishObject,    "POP_PUBLISH_OBJ" );
   createGeomAction( GEOMOp::OpPointMarker,      "POP_POINT_MARKER" );
@@ -947,8 +958,11 @@ void GeometryGUI::initialize( CAM_Application* app )
   createMenu( separator(), newEntId, -1 );
 
   int groupId = createMenu( tr( "MEN_GROUP" ), newEntId, -1 );
-  createMenu( GEOMOp::OpGroupCreate, groupId, -1 );
-  createMenu( GEOMOp::OpGroupEdit,   groupId, -1 );
+  createMenu( GEOMOp::OpGroupCreate,    groupId, -1 );
+  createMenu( GEOMOp::OpGroupEdit,      groupId, -1 );
+  createMenu( GEOMOp::OpGroupUnion,     groupId, -1 );
+  createMenu( GEOMOp::OpGroupIntersect, groupId, -1 );
+  createMenu( GEOMOp::OpGroupCut,       groupId, -1 );
 
   createMenu( separator(), newEntId, -1 );
 
@@ -1059,6 +1073,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createMenu( GEOMOp::OpWhatIs,          measurId, -1 );
   createMenu( GEOMOp::OpCheckShape,      measurId, -1 );
   createMenu( GEOMOp::OpCheckCompound,   measurId, -1 );
+  createMenu( GEOMOp::OpGetNonBlocks,    measurId, -1 );
   createMenu( GEOMOp::OpCheckSelfInters, measurId, -1 );
 
 #ifdef _DEBUG_ // PAL16821
@@ -1196,8 +1211,9 @@ void GeometryGUI::initialize( CAM_Application* app )
   createTool( GEOMOp::OpWhatIs,           measureTbId );
   createTool( GEOMOp::OpCheckShape,       measureTbId );
   createTool( GEOMOp::OpCheckCompound,    measureTbId );
+  createTool( GEOMOp::OpGetNonBlocks,     measureTbId );
   createTool( GEOMOp::OpCheckSelfInters,  measureTbId );
-  
+
   int picturesTbId = createTool( tr( "TOOL_PICTURES" ) );
   createTool( GEOMOp::OpPictureImport,    picturesTbId );
   #ifdef WITH_OPENCV
@@ -1229,11 +1245,11 @@ void GeometryGUI::initialize( CAM_Application* app )
   mgr->setRule( action( GEOMOp::OpDelete ), QString("$type in {'Shape' 'Group'} and selcount>0"), QtxPopupMgr::VisibleRule );
   mgr->insert( action(  GEOMOp::OpGroupCreatePopup ), -1, -1 ); // create group
   mgr->setRule( action( GEOMOp::OpGroupCreatePopup ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule );
-  mgr->insert( action(  GEOMOp::OpShowChildren ), -1, -1 ); // show children
-  mgr->setRule( action( GEOMOp::OpShowChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasHiddenChildren=true"), QtxPopupMgr::VisibleRule );
+  mgr->insert( action(  GEOMOp::OpDiscloseChildren ), -1, -1 ); // disclose child items
+  mgr->setRule( action( GEOMOp::OpDiscloseChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasConcealedChildren=true"), QtxPopupMgr::VisibleRule );
 
-  mgr->insert( action(  GEOMOp::OpHideChildren ), -1, -1 ); // hide children
-  mgr->setRule( action( GEOMOp::OpHideChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasShownChildren=true"), QtxPopupMgr::VisibleRule );
+  mgr->insert( action(  GEOMOp::OpConcealChildren ), -1, -1 ); // conceal shild items
+  mgr->setRule( action( GEOMOp::OpConcealChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasDisclosedChildren=true"), QtxPopupMgr::VisibleRule );
   mgr->insert( action(  GEOMOp::OpGroupEdit ), -1, -1 );  // edit group
   mgr->setRule( action( GEOMOp::OpGroupEdit ),  QString("client='ObjectBrowser' and type='Group' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule );
   mgr->insert( separator(), -1, -1 );     // -----------
@@ -1340,6 +1356,8 @@ void GeometryGUI::initialize( CAM_Application* app )
   mgr->setRule(action(GEOMOp::OpSelectAll),      selectOnly + " and selectionmode='ALL'", QtxPopupMgr::ToggleRule);
   mgr->insert( action(GEOMOp::OpShowOnly ), -1, -1 ); // display only
   mgr->setRule(action(GEOMOp::OpShowOnly ), rule.arg( types ).arg( "true" ), QtxPopupMgr::VisibleRule );
+  mgr->insert( action(GEOMOp::OpShowOnlyChildren ), -1, -1 ); // display only children
+  mgr->setRule(action(GEOMOp::OpShowOnlyChildren ), (canDisplay + "and ($type in {%1}) and client='ObjectBrowser' and hasChildren=true").arg( types ), QtxPopupMgr::VisibleRule );
 
   mgr->insert( separator(), -1, -1 );     // -----------
   mgr->insert( action(  GEOMOp::OpUnpublishObject ), -1, -1 ); // Unpublish object
@@ -1663,41 +1681,19 @@ LightApp_Selection* GeometryGUI::createSelection() const
 void GeometryGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& title )
 {
   SalomeApp_Module::contextMenuPopup( client, menu, title );
-
-  /*
   SALOME_ListIO lst;
-  getApp()->selectionMgr()->selectedObjects(lst);
-  if (lst.Extent() < 1)
-    return;
-
-  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
-  _PTR(Study) study = appStudy->studyDS();
-
-  bool isImported = true;
-  SALOME_ListIteratorOfListIO anIt (lst);
-  for (; anIt.More() && isImported; anIt.Next()) {
-    Handle(SALOME_InteractiveObject) io = anIt.Value();
-    _PTR(SObject) aSObj = study->FindObjectID(io->getEntry());
-    if (aSObj) {
-      if (lst.Extent() == 1) {
-        // Set context menu title
-        if (client == "OCCViewer" || client == "VTKViewer")
-          title = QString(aSObj->GetName().c_str());
-      }
-
-      CORBA::Object_var anObj = GeometryGUI::ClientSObjectToObject(aSObj);
-      GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(anObj);
-      if (CORBA::is_nil(aGeomObj) || aGeomObj->GetType() != GEOM_IMPORT)
-        isImported = false;
-    } else {
-      isImported = false;
+  getApp()->selectionMgr()->selectedObjects( lst );
+  if ( ( client == "OCCViewer" || client == "VTKViewer" ) && lst.Extent() == 1 ) {
+    Handle(SALOME_InteractiveObject) io = lst.First();
+    SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
+    _PTR(Study) study = appStudy->studyDS();
+    _PTR(SObject) obj = study->FindObjectID( io->getEntry() );
+    if ( obj ) {
+      QString aName = QString( obj->GetName().c_str() );
+      aName.remove( QRegExp("\\s+$") );
+      title = aName;
     }
   }
-
-  if (isImported) {
-    menu->addAction(action(GEOMOp::OpReimport)); // Reload imported shape
-  }
-  */
 }
 
 void GeometryGUI::createPreferences()
index 3d8a41d4e9efd8941c2f60807e759ce0e9fd8dda..75e45e43f0614b06e3b3cc2b403fda987bd9171e 100644 (file)
@@ -24,7 +24,7 @@
 
 namespace GEOMOp {
   enum {
-    // ToolsGUI ------------------//--------------------------------
+    // ToolsGUI --------------------//--------------------------------
     OpImport              = 1000,   // MENU FILE  - IMPORT
     OpExport              = 1001,   // MENU FILE  - EXPORT
     OpDelete              = 1020,   // MENU EDIT  - DELETE
@@ -50,14 +50,13 @@ namespace GEOMOp {
     OpPointMarker         = 1210,   // POPUP MENU - POINT MARKER
     OpSetTexture          = 1211,   // POPUP MENU - SETTEXTURE
     OpMaterialProperties  = 1212,   // POPUP MENU - MATERIAL PROPERTIES
-    OpShowChildren        = 1250,   // POPUP MENU - SHOW CHILDREN
-    OpHideChildren        = 1251,   // POPUP MENU - HIDE CHILDREN
+    OpDiscloseChildren    = 1250,   // POPUP MENU - DISCLOSE CHILD ITEMS
+    OpConcealChildren     = 1251,   // POPUP MENU - CONCEAL CHILD ITEMS
     OpUnpublishObject     = 1253,   // POPUP MENU - UNPUBLISH
     OpPublishObject       = 1254,   // GEOM ROOT OBJECT - POPUP MENU - PUBLISH
     OpEdgeWidth           = 1260,   // POPUP MENU - LINE WIDTH - EDGE WIDTH
     OpIsosWidth           = 1261,   // POPUP MENU - LINE WIDTH - ISOS WIDTH
-
-    // DisplayGUI ----------------//--------------------------------
+    // DisplayGUI ------------------//--------------------------------
     OpSwitchVectors       = 2001,   // MENU VIEW  - DISPLAY MODE - SHOW/HIDE EDGE DIRECTION
     OpShowAll             = 2002,   // MENU VIEW  - SHOW ALL
     OpHideAll             = 2003,   // MENU VIEW  - HIDE ALL
@@ -67,6 +66,7 @@ namespace GEOMOp {
     OpShow                = 2100,   // POPUP MENU - SHOW
     OpShowOnly            = 2101,   // POPUP MENU - SHOW ONLY
     OpHide                = 2102,   // POPUP MENU - HIDE
+    OpShowOnlyChildren    = 2103,   // POPUP MENU - SHOW ONLY CHILDREN
     OpWireframe           = 2200,   // POPUP MENU - DISPLAY MODE - WIREFRAME
     OpShading             = 2201,   // POPUP MENU - DISPLAY MODE - SHADING
     OpShadingWithEdges    = 2202,   // POPUP MENU - DISPLAY MODE - SHADING WITH EDGES
@@ -74,7 +74,7 @@ namespace GEOMOp {
     OpTexture             = 2204,   // POPUP MENU - DISPLAY MODE - TEXTURE
     OpBringToFront        = 2205,   // POPUP MENU - BRING TO FRONT
     OpClsBringToFront     = 2206,
-    // BasicGUI ------------------//--------------------------------
+    // BasicGUI --------------------//--------------------------------
     OpPoint               = 3000,   // MENU NEW ENTITY - BASIC - POINT
     OpLine                = 3001,   // MENU NEW ENTITY - BASIC - LINE
     OpCircle              = 3002,   // MENU NEW ENTITY - BASIC - CIRCLE
@@ -85,7 +85,7 @@ namespace GEOMOp {
     OpCurve               = 3007,   // MENU NEW ENTITY - BASIC - CURVE
     OpLCS                 = 3008,   // MENU NEW ENTITY - BASIC - LOCAL COORDINATE SYSTEM
     OpOriginAndVectors    = 3009,   // MENU NEW ENTITY - BASIC - ORIGIN AND BASE VECTORS
-    // PrimitiveGUI --------------//--------------------------------
+    // PrimitiveGUI ----------------//--------------------------------
     OpBox                 = 3100,   // MENU NEW ENTITY - PRIMITIVES - BOX
     OpCylinder            = 3101,   // MENU NEW ENTITY - PRIMITIVES - CYLINDER
     OpSphere              = 3102,   // MENU NEW ENTITY - PRIMITIVES - SPHERE
@@ -93,12 +93,12 @@ namespace GEOMOp {
     OpCone                = 3104,   // MENU NEW ENTITY - PRIMITIVES - CONE
     OpRectangle           = 3105,   // MENU NEW ENTITY - PRIMITIVES - FACE
     OpDisk                = 3106,   // MENU NEW ENTITY - PRIMITIVES - DISK
-    // GenerationGUI -------------//--------------------------------
+    // GenerationGUI ---------------//--------------------------------
     OpPrism               = 3200,   // MENU NEW ENTITY - GENERATION - EXTRUSION
     OpRevolution          = 3201,   // MENU NEW ENTITY - GENERATION - REVOLUTION
     OpFilling             = 3202,   // MENU NEW ENTITY - GENERATION - FILLING
     OpPipe                = 3203,   // MENU NEW ENTITY - GENERATION - EXTRUSION ALONG PATH
-    // EntityGUI -----------------//--------------------------------
+    // EntityGUI -------------------//--------------------------------
     Op2dSketcher          = 3300,   // MENU NEW ENTITY - SKETCHER
     Op3dSketcher          = 3301,   // MENU NEW ENTITY - 3D SKETCHER
     OpExplode             = 3302,   // MENU NEW ENTITY - EXPLODE
@@ -106,20 +106,19 @@ namespace GEOMOp {
     OpFeatureDetect       = 3303,   // MENU NEW ENTITY - FEATURE DETECTION
 #endif
     OpPictureImport       = 3304,   // MENU NEW ENTITY - IMPORT PICTURE IN VIEWER
-
-    // BuildGUI ------------------//--------------------------------
+    // BuildGUI --------------------//--------------------------------
     OpEdge                = 3400,   // MENU NEW ENTITY - BUILD - EDGE
     OpWire                = 3401,   // MENU NEW ENTITY - BUILD - WIRE
     OpFace                = 3402,   // MENU NEW ENTITY - BUILD - FACE
     OpShell               = 3403,   // MENU NEW ENTITY - BUILD - SHELL
     OpSolid               = 3404,   // MENU NEW ENTITY - BUILD - SOLID
     OpCompound            = 3405,   // MENU NEW ENTITY - BUILD - COMPOUND
-    // BooleanGUI ----------------//--------------------------------
+    // BooleanGUI ------------------//--------------------------------
     OpFuse                = 3500,   // MENU OPERATIONS - BOOLEAN - FUSE
     OpCommon              = 3501,   // MENU OPERATIONS - BOOLEAN - COMMON
     OpCut                 = 3502,   // MENU OPERATIONS - BOOLEAN - CUT
     OpSection             = 3503,   // MENU OPERATIONS - BOOLEAN - SECTION
-    // TransformationGUI ---------//--------------------------------
+    // TransformationGUI -----------//--------------------------------
     OpTranslate           = 3600,   // MENU OPERATIONS - TRANSFORMATION - TRANSLATION
     OpRotate              = 3601,   // MENU OPERATIONS - TRANSFORMATION - ROTATION
     OpChangeLoc           = 3602,   // MENU OPERATIONS - TRANSFORMATION - LOCATION
@@ -130,7 +129,7 @@ namespace GEOMOp {
     OpMultiRotate         = 3607,   // MENU OPERATIONS - TRANSFORMATION - MULTI-ROTATION
     OpReimport            = 3608,   // POPUP MENU - RELOAD IMPORTED
     OpProjection          = 3609,   // MENU OPERATIONS - TRANSFORMATION - PROJECTION
-    // OperationGUI
+    // OperationGUI ----------------//--------------------------------
     OpPartition           = 3700,   // MENU OPERATION - PARTITION
     OpArchimede           = 3701,   // MENU OPERATION - ARCHIMEDE
     OpFillet3d            = 3702,   // MENU OPERATION - FILLET
@@ -142,7 +141,7 @@ namespace GEOMOp {
     OpSharedShapes        = 3708,   // MENU OPERATION - GET SHARED SHAPES
     OpExtrudedBoss        = 3709,   // MENU OPERATION - ETRUDED BOSS
     OpExtrudedCut         = 3710,   // MENU OPERATION - ETRUDED CUT
-    // RepairGUI -----------------//--------------------------------
+    // RepairGUI -------------------//--------------------------------
     OpSewing              = 4000,   // MENU REPAIR - SEWING
     OpSuppressFaces       = 4001,   // MENU REPAIR - SUPPRESS FACES
     OpSuppressHoles       = 4002,   // MENU REPAIR - SUPPRESS HOLES
@@ -158,7 +157,7 @@ namespace GEOMOp {
     OpLimitTolerance      = 4012,   // MENU REPAIR - LIMIT TOLERANCE
     OpGlueEdges           = 4013,   // MENU REPAIR - GLUE EDGES
     OpFuseEdges           = 4014,   // MENU REPAIR - FUSE COLLINEAR EDGES
-    // MeasureGUI ----------------//--------------------------------
+    // MeasureGUI ------------------//--------------------------------
     OpProperties          = 5000,   // MENU MEASURES - PROPERTIES
     OpCenterMass          = 5001,   // MENU MEASURES - CENTRE OF MASS
     OpInertia             = 5002,   // MENU MEASURES - INERTIA
@@ -172,22 +171,26 @@ namespace GEOMOp {
     OpCheckCompound       = 5010,   // MENU MEASURES - CHECK COMPOUND OF BLOCKS
     OpPointCoordinates    = 5011,   // MENU MEASURES - POINT COORDINATES
     OpCheckSelfInters     = 5012,   // MENU MEASURES - CHECK SELF INTERSECTIONS
-    // GroupGUI ------------------//--------------------------------
+    OpGetNonBlocks        = 5013,   // MENU MEASURES - GET NON BLOCKS
+    // GroupGUI --------------------//--------------------------------
     OpGroupCreate         = 6000,   // MENU GROUP - CREATE
     OpGroupEdit           = 6001,   // MENU GROUP - EDIT
     OpGroupCreatePopup    = 6002,   // POPUP MENU - CREATE GROUP
-    // BlocksGUI -----------------//--------------------------------
+    OpGroupUnion          = 6003,   // POPUP MENU - UNION GROUPS
+    OpGroupIntersect      = 6004,   // POPUP MENU - INTERSECT GROUPS
+    OpGroupCut            = 6005,   // POPUP MENU - CUT GROUPS
+    // BlocksGUI -------------------//--------------------------------
     OpHexaSolid           = 6100,   // MENU BLOCKS - HEXAHEDRAL SOLID
     OpMultiTransform      = 6101,   // MENU BLOCKS - MULTI-TRANSFORMATION
     OpQuadFace            = 6102,   // MENU BLOCKS - QUADRANGLE FACE
     OpPropagate           = 6103,   // MENU BLOCKS - PROPAGATE
     OpExplodeBlock        = 6104,   // MENU BLOCKS - EXPLODE ON BLOCKS
-    // AdvancedGUI ---------------//--------------------------------
+    // AdvancedGUI -----------------//--------------------------------
     OpAdvancedNoOp        = 10000,  // NO OPERATION (advanced operations base)
     OpPipeTShape          = 10001,  // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE
-//     OpPipeTShapeGroups  = 10002,  // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
-    OpDividedDisk            = 10003,  // MENU NEW ENTITY - ADVANCED - DIVIDEDDISK
-    OpDividedCylinder            = 10004,  // MENU NEW ENTITY - ADVANCED - DIVIDEDCYLINDER
+    //OpPipeTShapeGroups  = 10002,  // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
+    OpDividedDisk         = 10003,  // MENU NEW ENTITY - ADVANCED - DIVIDEDDISK
+    OpDividedCylinder     = 10004,  // MENU NEW ENTITY - ADVANCED - DIVIDEDCYLINDER
     //@@ insert new functions before this line @@ do not remove this line @@//
   };
 }
diff --git a/src/GEOMGUI/GeometryGUI_Swig.cxx b/src/GEOMGUI/GeometryGUI_Swig.cxx
deleted file mode 100644 (file)
index 5941021..0000000
+++ /dev/null
@@ -1,682 +0,0 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// GEOM GEOMGUI : GUI for Geometry component
-// File   : GeometryGUI_Swig.cxx
-// Author : Nicolas REJNERI, Paul RASCLE
-//
-#include "GeometryGUI_Swig.hxx"
-
-#include "GeometryGUI.h"
-
-#include "SUIT_Desktop.h"
-#include "SUIT_Session.h"
-#include "SalomeApp_Application.h"
-#include "SalomeApp_Study.h"
-
-#include "OB_Browser.h"
-
-#include "OCCViewer_ViewWindow.h"
-#include "OCCViewer_ViewManager.h"
-#include "SOCC_ViewModel.h"
-#include <SOCC_Prs.h>
-
-#include "SVTK_ViewModel.h"
-#include "SVTK_ViewWindow.h"
-#include "SVTK_View.h"
-#include "SVTK_Renderer.h"
-#include <SVTK_Prs.h>
-
-#include "GEOM_Actor.h"
-#include "GEOM_Client.hxx"
-#include "GEOM_AISShape.hxx"
-#include "GEOM_InteractiveObject.hxx"
-#include "GEOM_Displayer.h"
-
-#include "SALOME_Event.h"
-
-// OCCT Includes
-#include <TopAbs.hxx>
-#include <TopoDS_Shape.hxx>
-#include <AIS_ListOfInteractive.hxx>
-#include <AIS_ListIteratorOfListOfInteractive.hxx>
-#include <AIS_Drawer.hxx>
-#include <BRepTools.hxx>
-
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(GEOM_Gen)
-
-#include <vtkRenderer.h>
-
-static SHAPE_READER(ShapeReader);
-
-inline OCCViewer_Viewer* GetOCCViewer(SUIT_Application* theApp){
-  SUIT_ViewWindow* window = theApp->desktop()->activeWindow();
-  if(window && window->getViewManager()->getType() == OCCViewer_Viewer::Type()){
-    OCCViewer_ViewWindow* vw = dynamic_cast<OCCViewer_ViewWindow*>( window );
-    if ( vw ) {
-      OCCViewer_ViewManager* vm = dynamic_cast<OCCViewer_ViewManager*>( vw->getViewManager() );
-      if ( vm )
-        return vm->getOCCViewer();
-    }
-  }
-
-  return 0;
-}
-
-inline SVTK_ViewWindow* GetSVTKViewWindow(SUIT_Application* theApp){
-  SUIT_ViewWindow* window = theApp->desktop()->activeWindow();
-  if(window && window->getViewManager()->getType() == SVTK_Viewer::Type())
-    return dynamic_cast<SVTK_ViewWindow*>( window );
-
-  return 0;
-}
-
-GEOM_Swig::GEOM_Swig()
-{
-  // MESSAGE("Constructeur");
-}
-
-GEOM_Swig::~GEOM_Swig()
-{
-  // MESSAGE("Destructeur");
-}
-
-void GEOM_Swig::createAndDisplayGO (const char* Entry, bool isUpdated)
-{
-  class TEvent: public SALOME_Event
-  {
-    std::string myEntry;
-    bool        myUpdateViewer;
-  public:
-    TEvent(const char* theEntry, bool toUpdateViewer):
-      myEntry(theEntry),
-      myUpdateViewer(toUpdateViewer)
-    {}
-    virtual void Execute()
-    {
-      SUIT_Application* app = SUIT_Session::session()->activeApplication();
-      if (!app) return;
-
-      SalomeApp_Study* ActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
-      if (!ActiveStudy) return;
-
-      _PTR(Study) aStudy(ActiveStudy->studyDS());
-      _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder();
-
-      GEOM::GEOM_Gen_var Geom = GeometryGUI::GetGeomGen();
-      if (CORBA::is_nil(Geom)) {
-        GeometryGUI::InitGeomGen();
-        Geom = GeometryGUI::GetGeomGen();
-      }
-      if (CORBA::is_nil(Geom))
-        return;
-
-      std::string aFatherIOR;
-      _PTR(SComponent) father = aStudy->FindComponent("GEOM");
-      if (!father)
-        return;
-      if (!father->ComponentIOR(aFatherIOR)) {
-        CORBA::String_var objStr = SalomeApp_Application::orb()->object_to_string(Geom);
-        aStudyBuilder->LoadWith(father, objStr.in());
-        father->ComponentIOR(aFatherIOR);
-      }
-
-      _PTR(SObject) obj = aStudy->FindObjectID(myEntry);
-      if (!obj)
-        return;
-
-      // Create new actor
-      _PTR(GenericAttribute) anAttr;
-      if (!obj->FindAttribute(anAttr, "AttributeIOR"))
-        return;
-      _PTR(AttributeIOR) anIOR(anAttr);
-      std::string anIORValue = anIOR->Value();
-
-      GEOM::GEOM_Object_var aShape = Geom->GetIORFromString(anIORValue.c_str());
-      TopoDS_Shape Shape = ShapeReader.GetShape(Geom,aShape);
-      if (!Shape.IsNull()) {
-        if (obj->FindAttribute(anAttr, "AttributeName")) {
-          _PTR(AttributeName) aName (anAttr);
-          std::string aNameValue = aName->Value();
-          // open transaction
-          /*SUIT_Operation* op = new SalomeApp_ImportOperation (app);
-          op->start();
-
-          _PTR(SObject) newObj1 = aStudyBuilder->NewObject(father);
-          aStudyBuilder->Addreference(newObj1, obj);
-          // commit transaction
-          op->commit();*/
-          Handle(GEOM_InteractiveObject) anIO =
-            new GEOM_InteractiveObject (const_cast<char*>(anIORValue.c_str()),
-                                        const_cast<char*>(aFatherIOR.c_str()),
-                                        "GEOM",
-                                        const_cast<char*>( obj->GetID().c_str()));
-
-          GEOM_Displayer(ActiveStudy).Display(anIO, myUpdateViewer);
-          /*if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app)) {
-            SVTK_View* aView = aViewWindow->getView();
-            int aMode = aView->GetDisplayMode();
-
-            vtkActorCollection* theActors =
-              GEOM_AssemblyBuilder::BuildActors(Shape,0,aMode,true);
-            theActors->InitTraversal();
-            while (vtkActor* anActor = theActors->GetNextActor()) {
-              GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor);
-              GActor->setName(const_cast<char*>(aNameValue.c_str()));
-              GActor->setIO(anIO);
-              aView->Display(GActor);
-            }
-            aView->Repaint();
-          } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(app)) {
-            Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
-            Handle(GEOM_AISShape) aSh =
-              new GEOM_AISShape (Shape,const_cast<char*>(aNameValue.c_str()));
-            aSh->setName(const_cast<char*>(aNameValue.c_str()));
-            aSh->setIO(anIO);
-            ic->Display(aSh);
-            ic->AddOrRemoveCurrentObject(aSh,true);
-            }*/
-          // update object browser
-          SalomeApp_Application* app = NULL; //dynamic_cast<SalomeApp_Application*>(app);
-          if (app) {
-            CAM_Module* module = app->module("Geometry");
-            SalomeApp_Module* appMod = dynamic_cast<SalomeApp_Module*>(module);
-            if (appMod)
-              appMod->updateObjBrowser(true);
-          }
-        }
-      }
-    }
-  };
-
-  // MESSAGE("createAndDisplayGO");
-  ProcessVoidEvent(new TEvent (Entry, isUpdated));
-
-  class TEventUpdateBrowser: public SALOME_Event
-    {
-      public:
-        TEventUpdateBrowser() {}
-        virtual void Execute() {
-          SalomeApp_Application* app =
-            dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
-          if (app) {
-            CAM_Module* module = app->module("Geometry");
-            SalomeApp_Module* appMod = dynamic_cast<SalomeApp_Module*>(module);
-            if (appMod) appMod->updateObjBrowser(true);
-          }
-        }
-    };
-
-  if (isUpdated)
-    ProcessVoidEvent(new TEventUpdateBrowser ());
-}
-
-void GEOM_Swig::createAndDisplayFitAllGO (const char* Entry)
-{
-  class TEventFitAll: public SALOME_Event
-  {
-    public:
-      TEventFitAll() {}
-      virtual void Execute() {
-        SUIT_Application* app = SUIT_Session::session()->activeApplication();
-        if (!app) return;
-        
-        if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app))
-          {
-            SVTK_View* aView = aViewWindow->getView();
-            aView->GetRenderer()->OnFitAll();
-          }
-        else if (OCCViewer_Viewer* occViewer = GetOCCViewer(app))
-          {  
-            Handle(V3d_Viewer) aViewer3d = occViewer->getViewer3d();
-            aViewer3d->InitActiveViews();
-            
-            if (aViewer3d->MoreActiveViews())
-              aViewer3d->ActiveView()->FitAll();
-          }
-      }
-  };
-
-  createAndDisplayGO(Entry);
-  ProcessVoidEvent(new TEventFitAll());
-}
-
-void GEOM_Swig::UpdateViewer()
-{
-  class TEventUpdateViewer: public SALOME_Event
-  {
-    public:
-      TEventUpdateViewer() {}
-      virtual void Execute() {
-        SUIT_Application* app = SUIT_Session::session()->activeApplication();
-        if (!app) return;
-        SalomeApp_Study* ActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
-        if (!ActiveStudy) return;
-        
-        GEOM_Displayer(ActiveStudy).UpdateViewer();
-      }
-  };
-  
-  ProcessVoidEvent(new TEventUpdateViewer());
-}
-
-int GEOM_Swig::getIndexTopology(const char* SubIOR, const char* IOR)
-{
-  GEOM::GEOM_Gen_var aGeomGen = GeometryGUI::GetGeomGen();
-  if (CORBA::is_nil(aGeomGen))
-    return -1;
-
-  GEOM::GEOM_Object_var aMainShape = aGeomGen->GetIORFromString(IOR);
-  GEOM::GEOM_Object_var aSubShape  = aGeomGen->GetIORFromString(SubIOR);
-  if (CORBA::is_nil(aMainShape) || CORBA::is_nil(aSubShape))
-    return -1;
-
-  GEOM::GEOM_IShapesOperations_var anIShapesOperations =
-    aGeomGen->GetIShapesOperations(aMainShape->GetStudyID());
-  if (CORBA::is_nil(anIShapesOperations))
-    return -1;
-
-  return anIShapesOperations->GetTopologyIndex(aMainShape, aSubShape);
-}
-
-const char* GEOM_Swig::getShapeTypeString(const char* IOR)
-{
-  TCollection_AsciiString aTypeName ("Shape of unknown type");
-
-  GEOM::GEOM_Gen_var aGeomGen = GeometryGUI::GetGeomGen();
-  if (!CORBA::is_nil(aGeomGen))
-  {
-    GEOM::GEOM_Object_var aShape = aGeomGen->GetIORFromString(IOR);
-    if (!CORBA::is_nil(aShape))
-    {
-      GEOM::GEOM_IShapesOperations_var anIShapesOperations =
-        aGeomGen->GetIShapesOperations(aShape->GetStudyID());
-      if (!CORBA::is_nil(anIShapesOperations))
-      {
-        aTypeName = anIShapesOperations->GetShapeTypeString(aShape);
-      }
-    }
-  }
-
-  return CORBA::string_dup(aTypeName.ToCString());
-}
-
-
-const char* GEOM_Swig::getShapeTypeIcon(const char* IOR)
-{
-  GEOM::GEOM_Gen_var Geom = GeometryGUI::GetGeomGen();
-  if ( CORBA::is_nil( Geom ) )
-    return "None";
-
-  GEOM::GEOM_Object_var aShape = Geom->GetIORFromString(IOR);
-  TopoDS_Shape shape = ShapeReader.GetShape(Geom, aShape);
-
-  if( shape.IsNull() ) {
-    return "None" ;
-  }
-
-  switch (shape.ShapeType() )
-    {
-    case TopAbs_COMPOUND:
-      { return "ICON_OBJBROWSER_COMPOUND" ;}
-    case  TopAbs_COMPSOLID:
-      { return "ICON_OBJBROWSER_COMPSOLID" ;}
-    case TopAbs_SOLID:
-      { return "ICON_OBJBROWSER_SOLID" ;}
-    case TopAbs_SHELL:
-      { return "ICON_OBJBROWSER_SHELL" ;}
-    case TopAbs_FACE:
-      { return "ICON_OBJBROWSER_FACE" ;}
-    case TopAbs_WIRE:
-      { return "ICON_OBJBROWSER_WIRE" ;}
-    case TopAbs_EDGE:
-      { return "ICON_OBJBROWSER_EDGE" ;}
-    case TopAbs_VERTEX:
-      { return "ICON_OBJBROWSER_VERTEX" ;}
-    }
-
-  return "None";
-}
-
-void GEOM_Swig::setDisplayMode(const char* theEntry, int theMode, bool isUpdated)
-{
-  class TEvent: public SALOME_Event {
-    std::string myEntry;
-    int myMode;
-    bool myUpdateViewer;
-  public:
-    TEvent(const char* theEntryArg, int theModeArg, bool theUpdated):
-      myEntry(theEntryArg), myMode(theModeArg), myUpdateViewer(theUpdated)
-    {}
-    virtual void Execute() {
-      SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
-      if (!anApp) return;
-
-      Handle(SALOME_InteractiveObject) anIO =
-        new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
-
-      if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
-        SVTK_View* aView = aViewWindow->getView();
-        aView->SetDisplayMode(anIO, myMode);
-        if (myUpdateViewer)
-          aView->Repaint();
-      }
-      else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
-        SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
-        if (soccViewer)
-          soccViewer->switchRepresentation(anIO, myMode, myUpdateViewer);
-      }
-    }
-  };
-
-  ProcessVoidEvent(new TEvent (theEntry, theMode, isUpdated));
-}
-
-void GEOM_Swig::setVectorsMode(const char* theEntry, bool isOn, bool isUpdated)
-{
-  class TEvent: public SALOME_Event {
-    std::string myEntry;
-    bool myOn;
-    bool myUpdateViewer;
-  public:
-    TEvent(const char* theEntryArg, bool theOn, bool theUpdated):
-      myEntry(theEntryArg), myOn(theOn), myUpdateViewer(theUpdated)
-    {}
-    virtual void Execute() {
-      SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
-      if (!anApp) return;
-
-      Handle(SALOME_InteractiveObject) anIO =
-        new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
-
-      if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
-        SVTK_View* aView = aViewWindow->getView();
-        SVTK_Viewer* stvkViewer = dynamic_cast<SVTK_Viewer*>(aViewWindow->getViewManager()->getViewModel());
-        SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( stvkViewer->CreatePrs( myEntry.c_str()  ) );
-        vtkActorCollection* anActors = vtkPrs->GetObjects();
-        anActors->InitTraversal();
-        while (vtkActor* anAct = anActors->GetNextActor()) {
-          GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(anAct);
-          aGeomActor->SetVectorMode(!aGeomActor->GetVectorMode());
-        }
-        if (myUpdateViewer)
-          aView->Repaint();
-      }
-      else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
-        Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
-        SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
-        if (soccViewer) {
-          SOCC_Prs* occPrs = dynamic_cast<SOCC_Prs*>( soccViewer->CreatePrs( myEntry.c_str() ) );
-          if ( occPrs && !occPrs->IsNull() ) {
-            AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes );
-            AIS_ListIteratorOfListOfInteractive interIter( shapes );
-            for ( ; interIter.More(); interIter.Next() ) {
-              Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() );
-              aSh->SetDisplayVectors(myOn);
-              ic->RecomputePrsOnly(interIter.Value());
-            }
-          }
-        }
-      }
-    }
-  };
-
-  ProcessVoidEvent(new TEvent (theEntry, isOn, isUpdated));
-}
-
-void GEOM_Swig::setColor(const char* theEntry, int red, int green, int blue, bool isUpdated)
-{
-  class TEvent: public SALOME_Event {
-    std::string myEntry;
-    int myRed;
-    int myGreen;
-    int myBlue;
-    bool myUpdateViewer;
-  public:
-    TEvent(const char* theEntryArg, int theR, int theG, int theB, bool theUpdated):
-      myEntry(theEntryArg), myRed(theR), myGreen(theG), myBlue(theB), myUpdateViewer(theUpdated)
-    {}
-    virtual void Execute() {
-      SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
-      if (!anApp) return;
-
-      Handle(SALOME_InteractiveObject) anIO =
-        new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
-
-      if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)){
-        SVTK_View* aView = aViewWindow->getView();
-        QColor aColor (myRed, myGreen, myBlue);
-        aView->SetColor(anIO, aColor);
-        if (myUpdateViewer)
-          aView->Repaint();
-      } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
-        Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
-        SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
-        if (soccViewer)
-          {
-            SALOME_Prs*   prs=      soccViewer->CreatePrs( myEntry.c_str() );
-            const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( prs );
-            if ( !anOCCPrs || anOCCPrs->IsNull() )
-              return;
-
-            // get objects to be displayed
-            AIS_ListOfInteractive anAISObjects;
-            anOCCPrs->GetObjects( anAISObjects );
-            AIS_ListIteratorOfListOfInteractive ite( anAISObjects );
-            Quantity_Color CSFColor = Quantity_Color(myRed/255., myGreen/255., myBlue/255., Quantity_TOC_RGB);
-            for ( ; ite.More(); ite.Next() )
-              {
-                if(!ic->IsDisplayed(ite.Value()))continue;  //only displayed ais 
-                ite.Value()->SetColor(CSFColor);
-                if (ite.Value()->IsKind(STANDARD_TYPE(GEOM_AISShape))) Handle(GEOM_AISShape)::DownCast(ite.Value())->SetShadingColor(CSFColor);
-                ite.Value()->Redisplay(Standard_True); // as in OnColor
-              }
-            if (myUpdateViewer) occViewer->update();
-          }
-      }
-    }
-  };
-  ProcessVoidEvent(new TEvent(theEntry, red, green, blue, isUpdated));
-}
-
-void GEOM_Swig::setTransparency(const char* theEntry, float transp, bool isUpdated)
-{
-  class TEvent: public SALOME_Event {
-    std::string myEntry;
-    float myParam;
-    bool myUpdateViewer;
-  public:
-    TEvent(const char* theEntryArg, float theParam, bool theUpdated):
-      myEntry(theEntryArg), myParam(theParam), myUpdateViewer(theUpdated)
-    {}
-    virtual void Execute() {
-      SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
-      if (!anApp) return;
-
-      Handle(SALOME_InteractiveObject) anIO =
-        new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
-
-      if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
-        SVTK_View* aView = aViewWindow->getView();
-        aView->SetTransparency(anIO, myParam);
-        if (myUpdateViewer)
-          aView->Repaint();
-      } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
-        SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
-        if (soccViewer)
-          soccViewer->setTransparency(anIO, myParam, myUpdateViewer);
-      }
-    }
-  };
-
-  ProcessVoidEvent(new TEvent (theEntry, transp, isUpdated));
-}
-
-
-class TInitGeomGenEvent: public SALOME_Event {
-public:
-  typedef bool TResult;
-  TResult myResult;
-  TInitGeomGenEvent() : myResult(false) {}
-  virtual void Execute() {
-    myResult = GeometryGUI::InitGeomGen();
-  }
-};
-bool GEOM_Swig::initGeomGen()
-{
-  return ProcessEvent(new TInitGeomGenEvent());
-}
-
-
-
-void GEOM_Swig::eraseGO (const char* Entry, bool allWindows)
-{
-  class TEvent: public SALOME_Event
-  {
-    std::string myEntry;
-    bool myFromAllWindows;
-  public:
-    TEvent(const char* theEntry, bool fromAllWindows):
-      myEntry(theEntry), myFromAllWindows(fromAllWindows)
-    {}
-    virtual void Execute()
-    {
-      SUIT_Application* app = SUIT_Session::session()->activeApplication();
-      if (!app) return;
-      SalomeApp_Study* ActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
-      if (!ActiveStudy) return;
-
-      Handle (SALOME_InteractiveObject) aIO = new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
-
-      GEOM_Displayer(ActiveStudy).Erase(aIO, true);
-      /*      if (myFromAllWindows) {
-        QPtrList<SUIT_ViewWindow> aWindows = app->desktop()->windows();
-        SUIT_ViewWindow* aWin = 0;
-        for (aWin = aWindows.first(); aWin; aWin = aWindows.next()) {
-          EraseObject(aWin, aIO);
-        }
-      } else {
-        SUIT_ViewWindow* aWin = app->desktop()->activeWindow();
-        if (aWin)
-          EraseObject(aWin, aIO);
-          }*/
-    }
-
-    /*  private:
-    void EraseObject(SUIT_ViewWindow* theWin, Handle (SALOME_InteractiveObject) theIO)
-    {
-      if (theWin->getViewManager()->getType() == OCCViewer_Viewer::Type()){
-        OCCViewer_ViewWindow* vw = dynamic_cast<OCCViewer_ViewWindow*>( theWin );
-        if ( vw ) {
-          OCCViewer_ViewManager* vm = dynamic_cast<OCCViewer_ViewManager*>( vw->getViewManager() );
-          if ( vm ) {
-            SOCC_Viewer* aViewer = dynamic_cast<SOCC_Viewer*>(vm->getOCCViewer());
-            if (aViewer) {
-              SALOME_Prs* aPrs = aViewer->CreatePrs(myEntry.c_str());
-              if (aPrs) {
-                SALOME_OCCPrs* aOccPrs =  dynamic_cast<SALOME_OCCPrs*>(aPrs);
-                if (aOccPrs) {
-                  aViewer->Erase(aOccPrs);
-                  aViewer->Repaint();
-                }
-              }
-            }
-          }
-        }
-      } else if (theWin->getViewManager()->getType() == SVTK_Viewer::Type()){
-        SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>( theWin );
-        if (aViewWindow) {
-          aViewWindow->Erase(theIO);
-        }
-      }
-      }*/
-
-  };
-  ProcessVoidEvent(new TEvent(Entry, allWindows));
-}
-
-
-
-void GEOM_Swig::setDeflection(const char* theEntry, float theDeflect)
-{
-  class TEvent: public SALOME_Event {
-    std::string myEntry;
-    float myParam;
-  public:
-    TEvent(const char* theEntryArg, float theParam):
-      myEntry(theEntryArg), myParam(theParam)
-    {}
-    virtual void Execute() {
-      SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
-      if (!anApp) return;
-
-      Handle(SALOME_InteractiveObject) anIO =
-        new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
-
-      if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
-        vtkActorCollection* aActors = aViewWindow->getRenderer()->GetActors();
-        aActors->InitTraversal();
-        while (vtkActor* aAct = aActors->GetNextActor()) {
-          if (GEOM_Actor* aGeomActor = dynamic_cast<GEOM_Actor*>(aAct)) {
-            if (aGeomActor->hasIO()) {
-              Handle(SALOME_InteractiveObject) aNextIO = aGeomActor->getIO();
-              if (aNextIO->isSame(anIO)) {
-                aGeomActor->setDeflection(myParam);
-                aViewWindow->Repaint();
-                return;
-              }
-            }
-          }
-        }
-        //      aView->SetTransparency(anIO, myParam);
-        //aView->Repaint();
-      } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
-        Handle(AIS_InteractiveContext) aContext = occViewer->getAISContext();
-        AIS_ListOfInteractive aAISList;
-        aContext->DisplayedObjects(aAISList);
-        AIS_ListIteratorOfListOfInteractive it(aAISList);
-        for (; it.More(); it.Next()) {
-          Handle(SALOME_InteractiveObject) aObj = 
-            Handle(SALOME_InteractiveObject)::DownCast(it.Value()->GetOwner());
-          if ((!aObj.IsNull()) && aObj->hasEntry() && aObj->isSame(anIO)) {
-            Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(it.Value());
-            if (!aShape.IsNull()) {
-              TopoDS_Shape aSh = aShape->Shape();
-              if (!aSh.IsNull())
-                BRepTools::Clean(aSh);
-
-              aShape->SetOwnDeviationCoefficient( myParam );
-              aShape->SetOwnHLRDeviationAngle( 1.57 );
-              aContext->Redisplay(aShape);
-              return;
-            }
-          }
-        }
-      }
-    }
-  };
-
-  ProcessVoidEvent(new TEvent (theEntry, theDeflect));
-}
-
diff --git a/src/GEOMGUI/GeometryGUI_Swig.hxx b/src/GEOMGUI/GeometryGUI_Swig.hxx
deleted file mode 100644 (file)
index 0f93ab7..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// GEOM GEOMGUI : GUI for Geometry component
-// File   : GeometryGUI_Swig.hxx
-// Author : Nicolas REJNERI, Paul RASCLE
-//
-#ifndef GEOMETRYGUI_SWIG_HXX
-#define GEOMETRYGUI_SWIG_HXX
-
-#include "GEOM_GEOMGUI.hxx"
-
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(GEOM_Gen)
-#include CORBA_SERVER_HEADER(SALOMEDS)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-
-class GEOMGUI_EXPORT GEOM_Swig
-{
-public:
-  GEOM_Swig();
-  ~GEOM_Swig();
-
-  void createAndDisplayGO(const char* Entry, bool isUpdated = true);
-  void eraseGO(const char* Entry, bool allWindows);
-  void createAndDisplayFitAllGO(const char* Entry);
-  void UpdateViewer();
-  void setDisplayMode(const char* Entry, int mode, bool isUpdated = true);
-  void setVectorsMode(const char* Entry, bool isSet, bool isUpdated = true);
-  void setColor(const char* Entry, int red, int green, int blue, bool isUpdated = true);
-  void setTransparency(const char* Entry, float transp, bool isUpdated = true);
-  void setDeflection(const char* Entry, float deflect);
-
-  int  getIndexTopology(const char *SubEntry, const char *Entry);
-  const char* getShapeTypeString(const char *Entry);
-  const char* getShapeTypeIcon(const char *Ior);
-
-  bool initGeomGen();
-};
-
-#endif // GEOMETRYGUI_SWIG_HXX
diff --git a/src/GEOMGUI/GeometryGUI_Swig.i b/src/GEOMGUI/GeometryGUI_Swig.i
deleted file mode 100644 (file)
index d5bdfdf..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// GEOM GEOMGUI : GUI for Geometry component
-// File   : GeometryGUI_Swig.i
-// Author : Nicolas REJNERI, Paul RASCLE
-//
-%{
-#include "GeometryGUI_Swig.hxx"
-%}
-
-/*
-  managing C++ exception in the Python API
-*/
-%exception
-{
-  class PyAllowThreadsGuard {
-   public:
-    // Py_BEGIN_ALLOW_THREADS
-    PyAllowThreadsGuard() { _save = PyEval_SaveThread(); }
-    // Py_END_ALLOW_THREADS
-    ~PyAllowThreadsGuard() { PyEval_RestoreThread(_save); }
-   private:
-    PyThreadState *_save;
-  };
-
-  PyAllowThreadsGuard guard;
-
-  $action
-}
-
-class GEOM_Swig
-{
- public:
-  GEOM_Swig();
-  ~GEOM_Swig();
-
-  void createAndDisplayGO(const char* Entry, bool isUpdated =true);
-  void eraseGO(const char* Entry, bool allWindows);
-  void createAndDisplayFitAllGO(const char* Entry);
-  void UpdateViewer();
-  int  getIndexTopology(const char *SubEntry, const char *Entry);
-  const char* getShapeTypeString(const char *Entry);
-
-  void setDisplayMode(const char* Entry, int mode, bool isUpdated =true);
-  void setVectorsMode(const char* Entry, bool isSet, bool isUpdated =true);
-  void setColor(const char* Entry, int red, int green, int blue, bool isUpdated =true);
-  void setTransparency(const char* Entry, float transp, bool isUpdated =true);
-  void setDeflection(const char* Entry, float deflect);
-  const char* getShapeTypeIcon(const char *Ior);
-
-  bool initGeomGen();
-};
index 2ac3a347bbe19be826a3d42ebac69ed17f4ea1c4..71f187ae0f73b93681ea62cf0850f0faf4f58060 100644 (file)
@@ -35,8 +35,6 @@ salomeinclude_HEADERS =       \
        GEOM_Displayer.h        \
        GEOMGUI_OCCSelector.h   \
        GEOMGUI_Selection.h     \
-       GeometryGUI_Swig.hxx    \
-       GeometryGUI_Swig.i      \
        GEOM_GEOMGUI.hxx
 
 dist_libGEOM_la_SOURCES =      \
@@ -44,8 +42,7 @@ dist_libGEOM_la_SOURCES =     \
        GEOMGUI.cxx             \
        GEOM_Displayer.cxx      \
         GEOMGUI_OCCSelector.cxx        \
-       GEOMGUI_Selection.cxx   \
-       GeometryGUI_Swig.cxx
+       GEOMGUI_Selection.cxx
 
 MOC_FILES =                    \
        GeometryGUI_moc.cxx
index 5c00c46554ba581e25ad920d51ac54e6c1edccf8..d50aec7917e77e64442d5bd45e972970bdb86718 100755 (executable)
@@ -15,7 +15,6 @@
 // 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_IMeasureOperations.hxx>
 
+#include <Basics_Utils.hxx>
+
 // OCCT Includes
 #include <BRepBuilderAPI_MakePolygon.hxx>
 #include <BRepBuilderAPI_MakeVertex.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Shape.hxx>
 #include <TopoDS_Wire.hxx>
@@ -63,41 +66,234 @@ Standard_Integer GEOMImpl_3DSketcherDriver::Execute(TFunction_Logbook& log) cons
 {
   if (Label().IsNull()) return 0;
   Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
-  
+
   GEOMImpl_I3DSketcher aCI (aFunction);
 
   TopoDS_Shape aShape;
 
-  Handle(TColStd_HArray1OfReal) aCoordsArray = aCI.GetCoordinates();
-  int anArrayLength = aCoordsArray->Length();
+  if (aFunction->GetType() == SKETCHER3D_COORDS) {
+    Handle(TColStd_HArray1OfReal) aCoordsArray = aCI.GetCoordinates();
+    int anArrayLength = aCoordsArray->Length();
 
-  std::list<gp_Pnt> points;
-  
-  for (int i = 0; i <= (anArrayLength-3); i += 3) {
-    gp_Pnt aPnt = gp_Pnt(aCoordsArray->Value(i+1), aCoordsArray->Value(i+2), aCoordsArray->Value(i+3));
-    if (points.empty() || aPnt.Distance(points.back()) > gp::Resolution())
-      points.push_back(aPnt);
-  }
+    std::list<gp_Pnt> points;
+
+    for (int i = 0; i <= (anArrayLength-3); i += 3) {
+      gp_Pnt aPnt = gp_Pnt(aCoordsArray->Value(i+1), aCoordsArray->Value(i+2), aCoordsArray->Value(i+3));
+      if (points.empty() || aPnt.Distance(points.back()) > gp::Resolution())
+        points.push_back(aPnt);
+    }
+
+    if ( points.size() == 1) { // Only Start Point
+      BRepBuilderAPI_MakeVertex mkVertex (points.back());
+      aShape = mkVertex.Shape();
+    }
+    else if ( points.size() > 1) { // Make Wire
+      BRepBuilderAPI_MakePolygon aMakePoly;
+      std::list<gp_Pnt>::iterator it;
+      for (it = points.begin(); it != points.end(); ++it) {
+        aMakePoly.Add(*it);
+      }
 
-  if ( points.size() == 1) { // Only Start Point
-    BRepBuilderAPI_MakeVertex mkVertex (points.back());
-    aShape = mkVertex.Shape();
+      if (points.size() > 2 && 
+          points.back().X() == points.front().X() && 
+          points.back().Y() == points.front().Y() && 
+          points.back().Z() == points.front().Z())
+        aMakePoly.Close();
+
+      if (aMakePoly.IsDone())
+        aShape = aMakePoly.Wire();
+    }
   }
-  else if ( points.size() > 1) { // Make Wire
-    BRepBuilderAPI_MakePolygon aMakePoly;
-    std::list<gp_Pnt>::iterator it;
-    for (it = points.begin(); it != points.end(); ++it) {
-      aMakePoly.Add(*it);
+  else if (aFunction->GetType() == SKETCHER3D_COMMAND) {
+    Kernel_Utils::Localizer loc;
+
+    TCollection_AsciiString aCommand = aCI.GetCommand();
+    // "3DSketcher:CMD[:CMD[:CMD...]]"
+
+    // Split the command string to separate CMDs
+    int icmd = 2;
+    TColStd_SequenceOfAsciiString aSequence;
+    if (aCommand.Length()) {
+      TCollection_AsciiString aToken = aCommand.Token(":", icmd);
+      while (aToken.Length() > 0) {
+        aSequence.Append(aToken);
+        aToken = aCommand.Token(":", ++icmd);
+      }
     }
 
-    if (points.size() > 2 && 
-       points.back().X() == points.front().X() && 
-       points.back().Y() == points.front().Y() && 
-       points.back().Z() == points.front().Z())
-      aMakePoly.Close();
-    
-    if (aMakePoly.IsDone())
-      aShape = aMakePoly.Wire();
+    int nbEdges = 0;
+    bool isFirstPointSet = false;
+    gp_XYZ p = gp::Origin().XYZ();
+    BRepBuilderAPI_MakeVertex MV0 (p);
+    TopoDS_Vertex V = TopoDS::Vertex(MV0.Shape());
+
+    gp_XYZ p0 = p;
+    TopoDS_Vertex V0 = V;
+
+    bool doClose = false;
+    BRepBuilderAPI_MakeWire MW;
+
+    int nbCMDs = aSequence.Length();
+    for (icmd = 1; icmd <= nbCMDs; icmd++) {
+      TCollection_AsciiString aCMD = aSequence.Value(icmd);
+
+      // Split the CMD into string values
+      TColStd_SequenceOfAsciiString aStrVals;
+      int ival = 1;
+      TCollection_AsciiString aToken = aCMD.Token(" ", ival);
+      while (aToken.Length() > 0) {
+        aStrVals.Append(aToken);
+        aToken = aCMD.Token(" ", ++ival);
+      }
+
+      // "TT x y z" : Create segment by point at X & Y or set the first point
+      // "T dx dy dz" : Create segment by point with DX & DY
+      //
+      // "OXY angleX angle2 length" : Create segment by two angles and length
+      // "OYZ angleY angle2 length" : Create segment by two angles and length
+      // "OXZ angleX angle2 length" : Create segment by two angles and length
+      //
+      // "WW" : Close Wire (to finish)
+
+      switch (aStrVals.Value(1).Value(1))
+      {
+      case 'T':
+        {
+          if (aStrVals.Length() != 4)
+            Standard_ConstructionError::Raise("3D Sketcher error: Bad format of command.");
+
+          gp_XYZ vp;
+          vp.SetX(aStrVals.Value(2).RealValue());
+          vp.SetY(aStrVals.Value(3).RealValue());
+          vp.SetZ(aStrVals.Value(4).RealValue());
+
+          if (aStrVals.Value(1) == "TT") { // absolute coordinates
+            if (!isFirstPointSet) {
+              p = vp;
+              BRepBuilderAPI_MakeVertex MV (p);
+              V = TopoDS::Vertex(MV.Shape());
+
+              p0 = p;
+              V0 = V;
+
+              isFirstPointSet = true;
+            }
+            else {
+              if ((vp - p).SquareModulus() > Precision::Confusion()) {
+                BRepBuilderAPI_MakeVertex MV (vp);
+                TopoDS_Vertex VV = TopoDS::Vertex(MV.Shape());
+                BRepBuilderAPI_MakeEdge ME (V, VV);
+                MW.Add(ME);
+                nbEdges++;
+
+                p = vp;
+                V = VV;
+              }
+            }
+          }
+          else if (aStrVals.Value(1) == "T") { // relative coordinates
+            if (vp.SquareModulus() > Precision::Confusion()) {
+              vp = p + vp;
+
+              BRepBuilderAPI_MakeVertex MV (vp);
+              TopoDS_Vertex VV = TopoDS::Vertex(MV.Shape());
+              BRepBuilderAPI_MakeEdge ME (V, VV);
+              MW.Add(ME);
+              nbEdges++;
+
+              p = vp;
+              V = VV;
+            }
+          }
+          else
+            Standard_ConstructionError::Raise("3D Sketcher error: Bad format of command.");
+        }
+        break;
+      case 'O':
+        {
+          if (aStrVals.Length() != 4)
+            Standard_ConstructionError::Raise("3D Sketcher error: Bad format of command.");
+
+          double anAngle  = aStrVals.Value(2).RealValue() * M_PI/180.0;
+          double anAngle2 = aStrVals.Value(3).RealValue() * M_PI/180.0;
+          double aLength  = aStrVals.Value(4).RealValue();
+
+          double aProjectedLength = aLength * cos(anAngle2);
+
+          gp_XYZ vp;
+          vp.SetX(aStrVals.Value(2).RealValue());
+          vp.SetY(aStrVals.Value(3).RealValue());
+          vp.SetZ(aStrVals.Value(4).RealValue());
+
+          if (aStrVals.Value(1) == "OXY") {
+            vp.SetX(p.X() + aProjectedLength * cos(anAngle));
+            vp.SetY(p.Y() + aProjectedLength * sin(anAngle));
+            vp.SetZ(p.Z() + aLength * sin(anAngle2));
+          }
+          else if (aStrVals.Value(1) == "OYZ") {
+            vp.SetX(p.X() + aLength * sin(anAngle2));
+            vp.SetY(p.Y() + aProjectedLength * cos(anAngle));
+            vp.SetZ(p.Z() + aProjectedLength * sin(anAngle));
+          }
+          else if (aStrVals.Value(1) == "OXZ") {
+            vp.SetX(p.X() + aProjectedLength * cos(anAngle));
+            vp.SetY(p.Y() + aLength * sin(anAngle2));
+            vp.SetZ(p.Z() + aProjectedLength * sin(anAngle));
+          }
+          else
+            Standard_ConstructionError::Raise("3D Sketcher error: Bad format of command.");
+          
+          if ((vp - p).SquareModulus() > Precision::Confusion()) {
+            BRepBuilderAPI_MakeVertex MV (vp);
+            TopoDS_Vertex VV = TopoDS::Vertex(MV.Shape());
+            BRepBuilderAPI_MakeEdge ME (V, VV);
+            MW.Add(ME);
+            nbEdges++;
+
+            p = vp;
+            V = VV;
+          }
+        }
+        break;
+      case 'W':
+        {
+          if (aStrVals.Length() != 1)
+            Standard_ConstructionError::Raise("3D Sketcher error: Bad format of command.");
+
+          if (aStrVals.Value(1) == "WW")
+            doClose = true;
+          else
+            Standard_ConstructionError::Raise("3D Sketcher error: Bad format of command.");
+        }
+        break;
+      default:
+        {
+          Standard_ConstructionError::Raise("3D Sketcher error: Bad format of command.");
+        }
+      }
+    }
+
+    if (doClose &&
+        nbEdges > 1 && // as 3D sketcher has only straight edges
+        (p - p0).SquareModulus() > Precision::Confusion()) {
+      BRepBuilderAPI_MakeEdge ME (V, V0);
+      MW.Add(ME);
+      nbEdges++;
+    }
+
+    if (nbEdges > 0) {
+      if (!MW.IsDone())
+        Standard_ConstructionError::Raise("3D Sketcher error: Wire construction failed.");
+
+      aShape = MW;
+    }
+    else {
+      if (isFirstPointSet) {
+        aShape = V0;
+      }
+    }
+  }
+  else {
   }
 
   if (aShape.IsNull()) return 0;
index 95c2dbf08b9d9212c6a194b3ec1e535ecef7dba3..d50d24858461d5e98483ab6415b9fa1c91d9beda 100644 (file)
@@ -600,7 +600,8 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const
         TopTools_ListOfShape BLO; // All blocks from the given compound
         TopTools_ListOfShape NOT; // Not blocks
         TopTools_ListOfShape EXT; // Hexahedral solids, having degenerated and/or seam edges
-        GEOMImpl_IBlocksOperations::AddBlocksFrom(aFixedExtra, BLO, NOT, EXT);
+        TopTools_ListOfShape NOQ; // All non-quadrangular faces
+        GEOMImpl_IBlocksOperations::AddBlocksFrom(aFixedExtra, BLO, NOT, EXT, NOQ);
 
         if (NOT.Extent() > 0) {
           MESSAGE("Some non-blocks have been removed");
index 12d2e4df2fd86486aad5a7471a93db6933c09381..dc2ab3599da8ef0093c69ea791e77131b087d851 100644 (file)
@@ -1611,14 +1611,17 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling
 
   //Make a Python command
   GEOM::TPythonDump pd (aFunction);
-  pd << aFilling << " = geompy.MakeFilling("
-     << theShape << ", " << theMinDeg << ", " << theMaxDeg << ", "
-     << theTol2D << ", " << theTol3D << ", " << theNbIter  << ", ";
-  if( theMethod==1 ) pd << "GEOM.FOM_UseOri";
-  else if( theMethod==2 ) pd << "GEOM.FOM_AutoCorrect";
-  else pd << "GEOM.FOM_Default";
-  if(isApprox)
-    pd << ", " << isApprox ;
+  pd << aFilling << " = geompy.MakeFilling(" << theShape ;
+  if ( theMinDeg != 2 )   pd << ", theMinDeg=" << theMinDeg ;
+  if ( theMaxDeg != 5 )   pd << ", theMaxDeg=" << theMaxDeg ;
+  if ( fabs(theTol2D-0.0001) > Precision::Confusion() )
+                          pd << ", theTol2D=" << theTol2D ;
+  if ( fabs(theTol3D-0.0001) > Precision::Confusion() )
+                          pd << ", theTol3D=" << theTol3D ;
+  if ( theNbIter != 0 )   pd << ", theNbIter=" << theNbIter ;
+  if ( theMethod==1 )     pd << ", theMethod=GEOM.FOM_UseOri";
+  else if( theMethod==2 ) pd << ", theMethod=GEOM.FOM_AutoCorrect";
+  if(isApprox)            pd << ", isApprox=" << isApprox ;
   pd << ")";
 
   SetErrorCode(OK);
index fa6e046396d3f7e22a7b7c8fbd661cb6e15c9e04..4f4c9664d31a9717b17ec05e012771793548ab63 100755 (executable)
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 //NOTE: This is an interface to a function for the Sketcher creation.
-//
+
 #include "GEOM_Function.hxx"
 
 #include <TColStd_HArray1OfReal.hxx>
 
-#define SKETCH_ARG_COORDS  1
-
 class GEOMImpl_I3DSketcher
 {
- public:
+public:
 
-  GEOMImpl_I3DSketcher(Handle(GEOM_Function) theFunction): _func(theFunction) {}
+  GEOMImpl_I3DSketcher (Handle(GEOM_Function) theFunction): _func(theFunction) {}
 
-  void SetCoordinates(const Handle(TColStd_HArray1OfReal)& theValue)
-              { _func->SetRealArray(SKETCH_ARG_COORDS, theValue); }
+  void SetCoordinates (const Handle(TColStd_HArray1OfReal)& theValue)
+  { _func->SetRealArray(SKETCH_ARG_COORDS, theValue); }
 
   Handle(TColStd_HArray1OfReal) GetCoordinates() { return _func->GetRealArray(SKETCH_ARG_COORDS); }
 
- private:
+  void SetCommand (const TCollection_AsciiString& theCommand)
+  { _func->SetString(SKETCH_ARG_COMMAND, theCommand); }
+
+  TCollection_AsciiString GetCommand() { return _func->GetString(SKETCH_ARG_COMMAND); }
+
+private:
+
+  enum {
+    SKETCH_ARG_COORDS = 1,
+    SKETCH_ARG_COMMAND = 2
+  };
 
   Handle(GEOM_Function) _func;
 };
index e29905bd358e9baf5628c271f3781eda35c999ed..ae1d5959f3312bbd390fd1dd1efdb24963b1f9bb 100644 (file)
@@ -18,7 +18,6 @@
 // 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>
 
@@ -212,6 +211,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
     case PointOn_CurveByCoord:   fType = POINT_CURVE_COORD; break;
     case PointOn_SurfaceByParam: fType = POINT_SURFACE_PAR; break;
     case PointOn_SurfaceByCoord: fType = POINT_SURFACE_COORD; break;
+    case PointOn_Face:           fType = POINT_FACE_ANY; break;
     default: break;
     }
   Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), fType);
@@ -254,6 +254,10 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
       aPI.SetX(theParam1);
       aPI.SetY(theParam2);
       aPI.SetZ(theParam3);
+      break;
+    case PointOn_Face:
+      aPI.SetSurface(aRefFunction);
+      break;
     default: break;
     }
   
@@ -285,19 +289,24 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
                                    << theGeomObj << ", " << theParam1 << ", " << theRefPoint <<  ")";
       break;
     case PointOn_CurveByCoord:
-  GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByCoord("
-                               << theGeomObj << ", " << theParam1 
-                               << ", " << theParam2 << ", " << theParam3 << ")";
+      GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByCoord("
+                                   << theGeomObj << ", " << theParam1 
+                                   << ", " << theParam2 << ", " << theParam3 << ")";
       break;
     case PointOn_SurfaceByParam:
-  GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurface("
-                               << theGeomObj << ", " << theParam1 
-                               << ", " << theParam2 << ")";
+      GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurface("
+                                   << theGeomObj << ", " << theParam1 
+                                   << ", " << theParam2 << ")";
       break;
     case PointOn_SurfaceByCoord:
-  GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurfaceByCoord("
-                               << theGeomObj << ", " << theParam1 
-                               << ", " << theParam2 << ", " << theParam3 << ")";
+      GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurfaceByCoord("
+                                   << theGeomObj << ", " << theParam1 
+                                   << ", " << theParam2 << ", " << theParam3 << ")";
+      break;
+    case PointOn_Face:
+      GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexInsideFace("
+                                   << theGeomObj << ")";
+      break;
     default: break;
     }
 
@@ -370,6 +379,15 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnSurfaceByCoord
   return makePointOnGeom(theSurface, theXParam, theYParam, theZParam, PointOn_SurfaceByCoord);
 }
 
+//=============================================================================
+/*!
+ *  MakePointOnFace
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnFace (Handle(GEOM_Object) theFace)
+{
+  return makePointOnGeom(theFace, 0., 0., 0., PointOn_Face);
+}
 
 //=============================================================================
 /*!
index 1e743415f96661a22a2bcb7e6b22a4b2bdbfec4d..736e8afc060591f41458c41dab0e041ee4612192 100644 (file)
@@ -18,7 +18,6 @@
 // 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_IBasicOperations_HXX_
 #define _GEOMImpl_IBasicOperations_HXX_
@@ -64,6 +63,8 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations {
                                                                  double theYParam,
                                                                  double theZParam);
 
+  Standard_EXPORT Handle(GEOM_Object) MakePointOnFace (Handle(GEOM_Object) theFace);
+
   // Vector
   Standard_EXPORT Handle(GEOM_Object) MakeVectorDXDYDZ (double theDX, double theDY, double theDZ);
 
@@ -128,7 +129,8 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations {
     PointOn_CurveByCoord,
     PointOn_CurveByLength,   
     PointOn_SurfaceByParam,
-    PointOn_SurfaceByCoord
+    PointOn_SurfaceByCoord,
+    PointOn_Face
   };
 
   Handle(GEOM_Object) makePointOnGeom (Handle(GEOM_Object) theGeomObj,
index 42aaa42607c172af81b2161367ab7e8ba6de2e53..efb69f42c5f3759a527bf95614a1e9f98dd0f68c 100644 (file)
@@ -18,7 +18,6 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 #ifdef WNT
 #pragma warning( disable:4786 )
@@ -1735,7 +1734,8 @@ Standard_Boolean GEOMImpl_IBlocksOperations::IsCompoundOfBlocks
 void GEOMImpl_IBlocksOperations::AddBlocksFrom (const TopoDS_Shape&   theShape,
                                                 TopTools_ListOfShape& BLO,
                                                 TopTools_ListOfShape& NOT,
-                                                TopTools_ListOfShape& EXT)
+                                                TopTools_ListOfShape& EXT,
+                                                TopTools_ListOfShape& NOQ)
 {
   TopAbs_ShapeEnum aType = theShape.ShapeType();
   switch (aType) {
@@ -1744,7 +1744,7 @@ void GEOMImpl_IBlocksOperations::AddBlocksFrom (const TopoDS_Shape&   theShape,
     {
       TopoDS_Iterator It (theShape);
       for (; It.More(); It.Next()) {
-        AddBlocksFrom(It.Value(), BLO, NOT, EXT);
+        AddBlocksFrom(It.Value(), BLO, NOT, EXT, NOQ);
       }
     }
     break;
@@ -1766,7 +1766,7 @@ void GEOMImpl_IBlocksOperations::AddBlocksFrom (const TopoDS_Shape&   theShape,
         for (; expF.More(); expF.Next()) {
           if (mapFaces.Add(expF.Current())) {
             nbFaces++;
-            if (nbFaces > 6) break;
+            //0021483//if (nbFaces > 6) break;
 
             // get wire
             TopoDS_Shape aF = expF.Current();
@@ -1774,14 +1774,18 @@ void GEOMImpl_IBlocksOperations::AddBlocksFrom (const TopoDS_Shape&   theShape,
             if (!wires.More()) {
               // no wire in the face
               hasNonQuadr = Standard_True;
-              break;
+              NOQ.Append(aF);//0021483
+              //0021483//break;
+              continue;
             }
             TopoDS_Shape aWire = wires.Current();
             wires.Next();
             if (wires.More()) {
               // multiple wires in the face
               hasNonQuadr = Standard_True;
-              break;
+              NOQ.Append(aF);//0021483
+              //0021483//break;
+              continue;
             }
 
             // Check number of edges in the face
@@ -1796,6 +1800,7 @@ void GEOMImpl_IBlocksOperations::AddBlocksFrom (const TopoDS_Shape&   theShape,
             }
             if (nbEdges != 4) {
               hasNonQuadr = Standard_True;
+              NOQ.Append(aF);//0021483
             }
           }
         }
@@ -1808,6 +1813,47 @@ void GEOMImpl_IBlocksOperations::AddBlocksFrom (const TopoDS_Shape&   theShape,
       }
     }
     break;
+  case TopAbs_SHELL: //0021483
+  case TopAbs_FACE: //0021483
+    {
+      // Count edges in each face
+      TopTools_MapOfShape mapFaces;
+      TopExp_Explorer expF (theShape, TopAbs_FACE);
+      for (; expF.More(); expF.Next()) {
+        if (mapFaces.Add(expF.Current())) {
+          // get wire
+          TopoDS_Shape aF = expF.Current();
+          TopExp_Explorer wires (aF, TopAbs_WIRE);
+          if (!wires.More()) {
+            // no wire in the face
+            NOQ.Append(aF);//0021483
+            continue;
+          }
+          TopoDS_Shape aWire = wires.Current();
+          wires.Next();
+          if (wires.More()) {
+            // multiple wires in the face
+            NOQ.Append(aF);//0021483
+            continue;
+          }
+
+          // Check number of edges in the face
+          Standard_Integer nbEdges = 0;
+          TopTools_MapOfShape mapEdges;
+          TopExp_Explorer expW (aWire, TopAbs_EDGE);
+          for (; expW.More(); expW.Next()) {
+            if (mapEdges.Add(expW.Current())) {
+              nbEdges++;
+              if (nbEdges > 4) break;
+            }
+          }
+          if (nbEdges != 4) {
+            NOQ.Append(aF);//0021483
+          }
+        }
+      }
+    }
+    break;
   default:
     NOT.Append(theShape);
   }
@@ -2353,7 +2399,8 @@ Standard_Boolean GEOMImpl_IBlocksOperations::CheckCompoundOfBlocks
   TopTools_ListOfShape NOT; // Not blocks
   TopTools_ListOfShape EXT; // Hexahedral solids, having degenerated and/or seam edges
   TopTools_ListOfShape BLO; // All blocks from the given compound
-  AddBlocksFrom(aBlockOrComp, BLO, NOT, EXT);
+  TopTools_ListOfShape NOQ; // All non-quadrangular faces
+  AddBlocksFrom(aBlockOrComp, BLO, NOT, EXT, NOQ);
 
   // Report non-blocks
   if (NOT.Extent() > 0) {
@@ -2513,6 +2560,100 @@ Standard_Boolean GEOMImpl_IBlocksOperations::CheckCompoundOfBlocks
   return isCompOfBlocks;
 }
 
+//=============================================================================
+/*!
+ *  GetNonBlocks
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetNonBlocks
+                                     (Handle(GEOM_Object) theShape,
+                                      Handle(GEOM_Object)& theNonQuads)
+{
+  SetErrorCode(KO);
+
+  if (theShape.IsNull()) return NULL;
+  TopoDS_Shape aShape = theShape->GetValue();
+
+  // Separate blocks from non-blocks
+  TopTools_ListOfShape BLO; // All blocks from the given compound
+  TopTools_ListOfShape NOT; // Not blocks
+  TopTools_ListOfShape EXT; // Hexahedral solids, having degenerated and/or seam edges
+  TopTools_ListOfShape NOQ; // All non-quadrangular faces
+  AddBlocksFrom(aShape, BLO, NOT, EXT, NOQ);
+
+  if (NOT.IsEmpty() && EXT.IsEmpty() && NOQ.IsEmpty()) {
+    SetErrorCode("NOT_FOUND_ANY");
+    return NULL;
+  }
+
+  // Map sub-shapes and their indices
+  TopTools_IndexedMapOfShape anIndices;
+  TopExp::MapShapes(aShape, anIndices);
+
+  // Non-blocks
+  Handle(GEOM_Object) aNonBlocks;
+  if (NOT.Extent() > 0 || EXT.Extent() > 0) {
+    Handle(TColStd_HArray1OfInteger) anArray =
+      new TColStd_HArray1OfInteger (1, NOT.Extent() + EXT.Extent());
+    Standard_Integer ii = 1;
+    TopTools_ListIteratorOfListOfShape it1 (NOT);
+    for (; it1.More(); it1.Next(), ii++) {
+      anArray->SetValue(ii, anIndices.FindIndex(it1.Value()));
+    }
+    TopTools_ListIteratorOfListOfShape it2 (EXT);
+    for (; it2.More(); it2.Next(), ii++) {
+      anArray->SetValue(ii, anIndices.FindIndex(it2.Value()));
+    }
+
+    aNonBlocks = GetEngine()->AddSubShape(theShape, anArray);
+    if (aNonBlocks.IsNull()) {
+      SetErrorCode("Error in algorithm: result found, but cannot be returned.");
+      return NULL;
+    }
+    aNonBlocks->SetType(GEOM_GROUP);
+    TDF_Label aFreeLabel = aNonBlocks->GetFreeLabel();
+    TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)TopAbs_SOLID);
+  }
+
+  // Non-quadrangles
+  if (NOQ.Extent() > 0) {
+    Handle(TColStd_HArray1OfInteger) anArray =
+      new TColStd_HArray1OfInteger (1, NOQ.Extent());
+    Standard_Integer ii = 1;
+    TopTools_ListIteratorOfListOfShape it1 (NOQ);
+    for (; it1.More(); it1.Next(), ii++) {
+      anArray->SetValue(ii, anIndices.FindIndex(it1.Value()));
+    }
+
+    theNonQuads = GetEngine()->AddSubShape(theShape, anArray);
+    if (theNonQuads.IsNull()) {
+      SetErrorCode("Error in algorithm: result found, but cannot be returned.");
+      return NULL;
+    }
+    theNonQuads->SetType(GEOM_GROUP);
+    TDF_Label aFreeLabel = theNonQuads->GetFreeLabel();
+    TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)TopAbs_FACE);
+  }
+
+  //Make a Python command
+  Handle(GEOM_Function) aMainShape = theShape->GetLastFunction();
+  GEOM::TPythonDump pd (aMainShape, /*append=*/true);
+  pd << "(";
+  if (aNonBlocks.IsNull())
+    pd << "no_bad_solids";
+  else
+    pd << aNonBlocks;
+  pd << ", ";
+  if (theNonQuads.IsNull())
+    pd << "no_bad_faces";
+  else
+    pd << theNonQuads;
+  pd << ") = geompy.GetNonBlocks(" << theShape << ")";
+
+  SetErrorCode(OK);
+  return aNonBlocks;
+}
+
 //=============================================================================
 /*!
  *  RemoveExtraEdges
index f702da4026c65867143d1261df1b3890b5062aaf..8a34d5510afe2669f36259785434e604e6319316 100644 (file)
@@ -18,7 +18,6 @@
 // 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_IBlocksOperations_HXX_
 #define _GEOMImpl_IBlocksOperations_HXX_
@@ -126,14 +125,17 @@ class GEOMImpl_IBlocksOperations : public GEOM_IOperations {
   };
 
   Standard_EXPORT Standard_Boolean CheckCompoundOfBlocksOld (Handle(GEOM_Object) theCompound,
-                                                             std::list<BCError>&      theErrors);
+                                                             std::list<BCError>& theErrors);
 
   Standard_EXPORT Standard_Boolean CheckCompoundOfBlocks (Handle(GEOM_Object) theCompound,
-                                                          std::list<BCError>&      theErrors);
+                                                          std::list<BCError>& theErrors);
 
-  Standard_EXPORT TCollection_AsciiString PrintBCErrors (Handle(GEOM_Object)  theCompound,
+  Standard_EXPORT TCollection_AsciiString PrintBCErrors (Handle(GEOM_Object)       theCompound,
                                                          const std::list<BCError>& theErrors);
 
+  Standard_EXPORT Handle(GEOM_Object) GetNonBlocks (Handle(GEOM_Object) theShape,
+                                                    Handle(GEOM_Object)& theNonQuads);
+
   Standard_EXPORT Handle(GEOM_Object) RemoveExtraEdges (Handle(GEOM_Object) theShape,
                                                         const Standard_Integer theOptimumNbFaces = 6);
 
@@ -142,7 +144,8 @@ class GEOMImpl_IBlocksOperations : public GEOM_IOperations {
   Standard_EXPORT static void AddBlocksFrom (const TopoDS_Shape&   theShape,
                                              TopTools_ListOfShape& BLO,
                                              TopTools_ListOfShape& NOT,
-                                             TopTools_ListOfShape& EXT);
+                                             TopTools_ListOfShape& EXT,
+                                             TopTools_ListOfShape& NOQ);
 
   // Extract blocks from blocks compounds
   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) ExplodeCompoundOfBlocks
index ca1ac5db0be258c1e2515282f1cc11a7c712f6d2..f4508d35b089d5c9028a7db2c698e1747438dc29 100644 (file)
@@ -18,7 +18,6 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 #ifdef WNT
 // E.A. : On windows with python 2.6, there is a conflict
@@ -1168,39 +1167,36 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCom
 
 //=============================================================================
 /*!
- *  Make3DSketcher
+ *  MakeSketcherOnPlane
  */
 //=============================================================================
-Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcher (std::list<double> theCoordinates)
+Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane
+                               (const char* theCommand,
+                                Handle(GEOM_Object)            theWorkingPlane)
 {
   SetErrorCode(KO);
 
+  if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
+
   //Add a new Sketcher object
-  Handle(GEOM_Object) a3DSketcher = GetEngine()->AddObject(GetDocID(), GEOM_3DSKETCHER);
+  Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GetDocID(), GEOM_SKETCHER);
 
   //Add a new Sketcher function
   Handle(GEOM_Function) aFunction =
-    a3DSketcher->AddFunction(GEOMImpl_3DSketcherDriver::GetID(), GEOM_3DSKETCHER);
+    aSketcher->AddFunction(GEOMImpl_SketcherDriver::GetID(), SKETCHER_PLANE);
   if (aFunction.IsNull()) return NULL;
 
   //Check if the function is set correctly
-  if (aFunction->GetDriverGUID() != GEOMImpl_3DSketcherDriver::GetID()) return NULL;
-
-  GEOMImpl_I3DSketcher aCI (aFunction);
-
-  int nbOfCoords = 0;
-  std::list<double>::iterator it = theCoordinates.begin();
-  for (; it != theCoordinates.end(); it++)
-    nbOfCoords++;
+  if (aFunction->GetDriverGUID() != GEOMImpl_SketcherDriver::GetID()) return NULL;
 
-  Handle(TColStd_HArray1OfReal) aCoordsArray = new TColStd_HArray1OfReal (1, nbOfCoords);
+  GEOMImpl_ISketcher aCI (aFunction);
 
-  it = theCoordinates.begin();
-  int ind = 1;
-  for (; it != theCoordinates.end(); it++, ind++)
-    aCoordsArray->SetValue(ind, *it);
+  TCollection_AsciiString aCommand((char*) theCommand);
+  aCI.SetCommand(aCommand);
 
-  aCI.SetCoordinates(aCoordsArray);
+  Handle(GEOM_Function) aRefPlane = theWorkingPlane->GetLastFunction();
+  if (aRefPlane.IsNull()) return NULL;
+  aCI.SetWorkingPlane( aRefPlane );
 
   //Compute the Sketcher value
   try {
@@ -1208,7 +1204,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcher (std::list<double
     OCC_CATCH_SIGNALS;
 #endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
-      SetErrorCode("3D Sketcher driver failed");
+      SetErrorCode("Sketcher driver failed");
       return NULL;
     }
   }
@@ -1219,52 +1215,99 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcher (std::list<double
   }
 
   //Make a Python command
-  GEOM::TPythonDump pd (aFunction);
-  pd << a3DSketcher << " = geompy.Make3DSketcher([";
-
-  it = theCoordinates.begin();
-  pd << (*it++);
-  while (it != theCoordinates.end()) {
-    pd << ", " << (*it++);
-  }
-  pd << "])";
+  GEOM::TPythonDump (aFunction) << aSketcher << " = geompy.MakeSketcherOnPlane(\""
+    << aCommand.ToCString() << "\", " << theWorkingPlane << " )";
 
   SetErrorCode(OK);
-  return a3DSketcher;
+  return aSketcher;
 }
 
 //=============================================================================
 /*!
- *  MakeSketcherOnPlane
+ *  Make3DSketcherCommand
  */
 //=============================================================================
-Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane
-                               (const char* theCommand,
-                                Handle(GEOM_Object)            theWorkingPlane)
+Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcherCommand (const char* theCommand)
 {
   SetErrorCode(KO);
 
   if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
 
   //Add a new Sketcher object
-  Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GetDocID(), GEOM_SKETCHER);
+  Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GetDocID(), GEOM_3DSKETCHER);
 
   //Add a new Sketcher function
   Handle(GEOM_Function) aFunction =
-    aSketcher->AddFunction(GEOMImpl_SketcherDriver::GetID(), SKETCHER_PLANE);
+    aSketcher->AddFunction(GEOMImpl_3DSketcherDriver::GetID(), SKETCHER3D_COMMAND);
   if (aFunction.IsNull()) return NULL;
 
   //Check if the function is set correctly
-  if (aFunction->GetDriverGUID() != GEOMImpl_SketcherDriver::GetID()) return NULL;
+  if (aFunction->GetDriverGUID() != GEOMImpl_3DSketcherDriver::GetID()) return NULL;
 
-  GEOMImpl_ISketcher aCI (aFunction);
+  GEOMImpl_I3DSketcher aCI (aFunction);
 
-  TCollection_AsciiString aCommand((char*) theCommand);
+  TCollection_AsciiString aCommand ((char*) theCommand);
   aCI.SetCommand(aCommand);
 
-  Handle(GEOM_Function) aRefPlane = theWorkingPlane->GetLastFunction();
-  if (aRefPlane.IsNull()) return NULL;
-  aCI.SetWorkingPlane( aRefPlane );
+  //Compute the 3D Sketcher value
+  try {
+#if OCC_VERSION_LARGE > 0x06010000
+    OCC_CATCH_SIGNALS;
+#endif
+    if (!GetSolver()->ComputeFunction(aFunction)) {
+      SetErrorCode("3D Sketcher 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 << aSketcher << " = geompy.Make3DSketcherCommand(\"" << aCommand.ToCString() << "\")";
+
+  SetErrorCode(OK);
+  return aSketcher;
+}
+
+//=============================================================================
+/*!
+ *  Make3DSketcher
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcher (std::list<double> theCoordinates)
+{
+  SetErrorCode(KO);
+
+  //Add a new Sketcher object
+  Handle(GEOM_Object) a3DSketcher = GetEngine()->AddObject(GetDocID(), GEOM_3DSKETCHER);
+
+  //Add a new Sketcher function
+  Handle(GEOM_Function) aFunction =
+    a3DSketcher->AddFunction(GEOMImpl_3DSketcherDriver::GetID(), SKETCHER3D_COORDS);
+  if (aFunction.IsNull()) return NULL;
+
+  //Check if the function is set correctly
+  if (aFunction->GetDriverGUID() != GEOMImpl_3DSketcherDriver::GetID()) return NULL;
+
+  GEOMImpl_I3DSketcher aCI (aFunction);
+
+  int nbOfCoords = 0;
+  std::list<double>::iterator it = theCoordinates.begin();
+  for (; it != theCoordinates.end(); it++)
+    nbOfCoords++;
+
+  Handle(TColStd_HArray1OfReal) aCoordsArray = new TColStd_HArray1OfReal (1, nbOfCoords);
+
+  it = theCoordinates.begin();
+  int ind = 1;
+  for (; it != theCoordinates.end(); it++, ind++)
+    aCoordsArray->SetValue(ind, *it);
+
+  aCI.SetCoordinates(aCoordsArray);
 
   //Compute the Sketcher value
   try {
@@ -1272,7 +1315,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane
     OCC_CATCH_SIGNALS;
 #endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
-      SetErrorCode("Sketcher driver failed");
+      SetErrorCode("3D Sketcher driver failed");
       return NULL;
     }
   }
@@ -1283,9 +1326,16 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane
   }
 
   //Make a Python command
-  GEOM::TPythonDump (aFunction) << aSketcher << " = geompy.MakeSketcherOnPlane(\""
-    << aCommand.ToCString() << "\", " << theWorkingPlane << " )";
+  GEOM::TPythonDump pd (aFunction);
+  pd << a3DSketcher << " = geompy.Make3DSketcher([";
+
+  it = theCoordinates.begin();
+  pd << (*it++);
+  while (it != theCoordinates.end()) {
+    pd << ", " << (*it++);
+  }
+  pd << "])";
 
   SetErrorCode(OK);
-  return aSketcher;
+  return a3DSketcher;
 }
index 2e71bbd38512e04f546cb46e2bd9cb07ea427dba..829f9cc5dda20f119be6d80a066c17df00a933a2 100644 (file)
@@ -18,7 +18,6 @@
 // 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_ICurvesOperations_HXX_
 #define _GEOMImpl_ICurvesOperations_HXX_
@@ -78,16 +77,17 @@ class GEOMImpl_ICurvesOperations : public GEOM_IOperations {
                                                                bool theIsClosed = false,
                                                                bool theDoReordering = false);
 
-  Standard_EXPORT Handle(GEOM_Object) MakeCurveParametric(const char* thexExpr, const char* theyExpr, const char* thezExpr, 
-                                                         double theParamMin, double theParamMax, double theParamStep
-                                                         CurveType theCurveType,
-                              int theParamNbStep=0, bool theNewMethod=false);
+  Standard_EXPORT Handle(GEOM_Object) MakeCurveParametric
+    (const char* thexExpr, const char* theyExpr, const char* thezExpr
+     double theParamMin, double theParamMax, double theParamStep, 
+     CurveType theCurveType, int theParamNbStep=0, bool theNewMethod=false);
 
   Standard_EXPORT Handle(GEOM_Object) MakeSketcher (const char* theCommand,
                                                     std::list<double> theWorkingPlane);
-  Standard_EXPORT Handle(GEOM_Object) Make3DSketcher (std::list<double> theCoordinates);
   Standard_EXPORT Handle(GEOM_Object) MakeSketcherOnPlane (const char* theCommand,
                                                            Handle(GEOM_Object) theWorkingPlane);
+  Standard_EXPORT Handle(GEOM_Object) Make3DSketcherCommand (const char* theCommand);
+  Standard_EXPORT Handle(GEOM_Object) Make3DSketcher (std::list<double> theCoordinates);
 };
 
 #endif
index db55c72b69a00730bec477a132f0d097da5ff99f..dc47e1f0e5e0581cc7803a5ff45175fbeb2f23e6 100644 (file)
@@ -18,7 +18,6 @@
 // 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>
 
@@ -511,10 +510,10 @@ void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup,
     if ( aLength - aRemLength > 0 ) {
       aNewSeq = new TColStd_HArray1OfInteger(1, aLength - aRemLength);
       for (j = 1; j <= aLength; j++) {
-       if (!mapIDsToRemove.Contains(aSeq->Value(j))) {
-         aNewSeq->SetValue(k, aSeq->Value(j));
-         k++;
-       }
+        if (!mapIDsToRemove.Contains(aSeq->Value(j))) {
+          aNewSeq->SetValue(k, aSeq->Value(j));
+          k++;
+        }
       }
     }
     else {
@@ -716,10 +715,10 @@ void GEOMImpl_IGroupOperations::DifferenceIDs (Handle(GEOM_Object) theGroup,
     if ( aLength - aRemLength > 0 ) {
       aNewSeq = new TColStd_HArray1OfInteger(1, aLength - aRemLength);
       for (j = 1; j <= aLength; j++) {
-       if (!mapIDsToRemove.Contains(aSeq->Value(j))) {
-         aNewSeq->SetValue(k, aSeq->Value(j));
-         k++;
-       }
+        if (!mapIDsToRemove.Contains(aSeq->Value(j))) {
+          aNewSeq->SetValue(k, aSeq->Value(j));
+          k++;
+        }
       }
     }
     else {
@@ -750,6 +749,743 @@ void GEOMImpl_IGroupOperations::DifferenceIDs (Handle(GEOM_Object) theGroup,
   SetErrorCode(OK);
 }
 
+//=============================================================================
+/*!
+ *  UnionGroups
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IGroupOperations::UnionGroups (Handle(GEOM_Object) theGroup1,
+                                                            Handle(GEOM_Object) theGroup2)
+{
+  SetErrorCode(KO);
+  if (theGroup1.IsNull() || theGroup2.IsNull()) return NULL;
+
+  // Get group type
+  TopAbs_ShapeEnum aType1 = GetType(theGroup1);
+  TopAbs_ShapeEnum aType2 = GetType(theGroup2);
+  TopAbs_ShapeEnum aType = aType1;
+  if (aType1 != aType2) {
+    if (aType1 != TopAbs_SHAPE && aType1 != TopAbs_COMPOUND) {
+      if (aType2 == TopAbs_SHAPE || aType2 == TopAbs_COMPOUND)
+        aType = aType2;
+      else {
+        SetErrorCode("Error: UnionGroups cannot be performed on groups of different type");
+        return NULL;
+      }
+    }
+  }
+
+  // Get Main Shape
+  Handle(GEOM_Function) aFunction1 = theGroup1->GetLastFunction();
+  Handle(GEOM_Function) aFunction2 = theGroup2->GetLastFunction();
+  if (aFunction1.IsNull() || aFunction2.IsNull()) return NULL;
+
+  GEOM_ISubShape aSSI1 (aFunction1);
+  GEOM_ISubShape aSSI2 (aFunction2);
+
+  Handle(GEOM_Function) aMainShapeFunc1 = aSSI1.GetMainShape();
+  Handle(GEOM_Function) aMainShapeFunc2 = aSSI2.GetMainShape();
+  if (aMainShapeFunc1.IsNull() || aMainShapeFunc2.IsNull()) return NULL;
+
+  TDF_Label aLabel1 = aMainShapeFunc1->GetOwnerEntry();
+  TDF_Label aLabel2 = aMainShapeFunc2->GetOwnerEntry();
+  if (aLabel1.IsRoot() || aLabel2.IsRoot()) {
+    SetErrorCode("Error: UnionGroups can be performed only on groups");
+    return NULL;
+  }
+
+  if (aLabel1 != aLabel2) {
+    SetErrorCode("Error: UnionGroups cannot be performed on groups, built on different main shapes");
+    return NULL;
+  }
+
+  Handle(GEOM_Object) aMainObj = GEOM_Object::GetObject(aLabel1);
+  if (aMainObj.IsNull()) return NULL;
+
+  // New contents of the group
+  TColStd_ListOfInteger aNewIDs;
+  TColStd_MapOfInteger mapIDs;
+
+  Handle(TColStd_HArray1OfInteger) aSeq1 = aSSI1.GetIndices();
+  Handle(TColStd_HArray1OfInteger) aSeq2 = aSSI2.GetIndices();
+  if (aSeq1.IsNull() || aSeq2.IsNull()) return NULL;
+
+  Standard_Integer j, val_j;
+  Standard_Integer aLength1 = aSeq1->Length();
+  Standard_Integer aLength2 = aSeq2->Length();
+
+  for (j = 1; j <= aLength1; j++) {
+    val_j = aSeq1->Value(j);
+    if (val_j > 0 && mapIDs.Add(val_j)) {
+      aNewIDs.Append(val_j);
+    }
+  }
+  for (j = 1; j <= aLength2; j++) {
+    val_j = aSeq2->Value(j);
+    if (val_j > 0 && mapIDs.Add(val_j)) {
+      aNewIDs.Append(val_j);
+    }
+  }
+
+  if (aNewIDs.Extent() < 1) {
+    SetErrorCode("Error: UnionGroups cannot be performed on two empty groups");
+    return NULL;
+  }
+
+  // Put new indices from the list into an array
+  Standard_Integer k = 1;
+  TColStd_ListIteratorOfListOfInteger aNewIDsIter (aNewIDs);
+  Handle(TColStd_HArray1OfInteger) aNewArr = new TColStd_HArray1OfInteger (1, aNewIDs.Extent());
+  for (; aNewIDsIter.More(); aNewIDsIter.Next(), k++) {
+    aNewArr->SetValue(k, aNewIDsIter.Value());
+  }
+
+  // Create the Group
+  Handle(GEOM_Object) aGroup = GetEngine()->AddSubShape(aMainObj, aNewArr);
+  aGroup->SetType(GEOM_GROUP);
+  TDF_Label aFreeLabel = aGroup->GetFreeLabel();
+  TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)aType);
+
+  // Make a Python command
+  Handle(GEOM_Function) aFunction = aGroup->GetFunction(1);
+  GEOM::TPythonDump(aFunction) << aGroup << " = geompy.UnionGroups("
+                               << theGroup1 << ", " << theGroup2 << ")";
+
+  SetErrorCode(OK);
+  return aGroup;
+}
+
+//=============================================================================
+/*!
+ *  IntersectGroups
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IGroupOperations::IntersectGroups (Handle(GEOM_Object) theGroup1,
+                                                                Handle(GEOM_Object) theGroup2)
+{
+  SetErrorCode(KO);
+  if (theGroup1.IsNull() || theGroup2.IsNull()) return NULL;
+
+  // Get group type
+  TopAbs_ShapeEnum aType1 = GetType(theGroup1);
+  TopAbs_ShapeEnum aType2 = GetType(theGroup2);
+  TopAbs_ShapeEnum aType = aType1;
+  if (aType1 != aType2) {
+    if (aType1 != TopAbs_SHAPE && aType1 != TopAbs_COMPOUND) {
+      if (aType2 == TopAbs_SHAPE || aType2 == TopAbs_COMPOUND)
+        aType = aType2;
+      else {
+        SetErrorCode("Error: IntersectGroups cannot be performed on groups of different type");
+        return NULL;
+      }
+    }
+  }
+
+  // Get Main Shape
+  Handle(GEOM_Function) aFunction1 = theGroup1->GetLastFunction();
+  Handle(GEOM_Function) aFunction2 = theGroup2->GetLastFunction();
+  if (aFunction1.IsNull() || aFunction2.IsNull()) return NULL;
+
+  GEOM_ISubShape aSSI1 (aFunction1);
+  GEOM_ISubShape aSSI2 (aFunction2);
+
+  Handle(GEOM_Function) aMainShapeFunc1 = aSSI1.GetMainShape();
+  Handle(GEOM_Function) aMainShapeFunc2 = aSSI2.GetMainShape();
+  if (aMainShapeFunc1.IsNull() || aMainShapeFunc2.IsNull()) return NULL;
+
+  TDF_Label aLabel1 = aMainShapeFunc1->GetOwnerEntry();
+  TDF_Label aLabel2 = aMainShapeFunc2->GetOwnerEntry();
+  if (aLabel1.IsRoot() || aLabel2.IsRoot()) {
+    SetErrorCode("Error: UnionGroups can be performed only on groups");
+    return NULL;
+  }
+
+  if (aLabel1 != aLabel2) {
+    SetErrorCode("Error: IntersectGroups cannot be performed on groups, built on different main shapes");
+    return NULL;
+  }
+
+  Handle(GEOM_Object) aMainObj = GEOM_Object::GetObject(aLabel1);
+  if (aMainObj.IsNull()) return NULL;
+
+  // New contents of the group
+  TColStd_ListOfInteger aNewIDs;
+  TColStd_MapOfInteger mapIDs;
+
+  Handle(TColStd_HArray1OfInteger) aSeq1 = aSSI1.GetIndices();
+  Handle(TColStd_HArray1OfInteger) aSeq2 = aSSI2.GetIndices();
+  if (aSeq1.IsNull() || aSeq2.IsNull()) return NULL;
+
+  Standard_Integer j, val_j;
+  Standard_Integer aLength1 = aSeq1->Length();
+  Standard_Integer aLength2 = aSeq2->Length();
+
+  for (j = 1; j <= aLength1; j++) {
+    mapIDs.Add(aSeq1->Value(j));
+  }
+  for (j = 1; j <= aLength2; j++) {
+    val_j = aSeq2->Value(j);
+    if (val_j > 0 && !mapIDs.Add(val_j)) {
+      // add index, if it is in mapIDs (filled from Group_1)
+      aNewIDs.Append(val_j);
+    }
+  }
+
+  Handle(TColStd_HArray1OfInteger) aNewArr;
+  if (aNewIDs.Extent() < 1) {
+    aNewArr = new TColStd_HArray1OfInteger (1, 1);
+    aNewArr->SetValue(1, -1);
+  }
+  else {
+    // Put new indices from the list into an array
+    Standard_Integer k = 1;
+    TColStd_ListIteratorOfListOfInteger aNewIDsIter (aNewIDs);
+    aNewArr = new TColStd_HArray1OfInteger (1, aNewIDs.Extent());
+    for (; aNewIDsIter.More(); aNewIDsIter.Next(), k++) {
+      aNewArr->SetValue(k, aNewIDsIter.Value());
+    }
+  }
+
+  // Create the Group
+  Handle(GEOM_Object) aGroup = GetEngine()->AddSubShape(aMainObj, aNewArr);
+  aGroup->SetType(GEOM_GROUP);
+  TDF_Label aFreeLabel = aGroup->GetFreeLabel();
+  TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)aType);
+
+  // Make a Python command
+  Handle(GEOM_Function) aFunction = aGroup->GetFunction(1);
+  GEOM::TPythonDump(aFunction) << aGroup << " = geompy.IntersectGroups("
+                               << theGroup1 << ", " << theGroup2 << ")";
+
+  SetErrorCode(OK);
+  return aGroup;
+}
+
+//=============================================================================
+/*!
+ *  CutGroups
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IGroupOperations::CutGroups (Handle(GEOM_Object) theGroup1,
+                                                          Handle(GEOM_Object) theGroup2)
+{
+  SetErrorCode(KO);
+  if (theGroup1.IsNull() || theGroup2.IsNull()) return NULL;
+
+  // Get group type
+  TopAbs_ShapeEnum aType1 = GetType(theGroup1);
+  TopAbs_ShapeEnum aType2 = GetType(theGroup2);
+  TopAbs_ShapeEnum aType = aType1;
+  if (aType1 != aType2) {
+    if (aType1 != TopAbs_SHAPE && aType1 != TopAbs_COMPOUND) {
+      if (aType2 == TopAbs_SHAPE || aType2 == TopAbs_COMPOUND)
+        aType = aType2;
+      else {
+        SetErrorCode("Error: CutGroups cannot be performed on groups of different type");
+        return NULL;
+      }
+    }
+  }
+
+  // Get Main Shape
+  Handle(GEOM_Function) aFunction1 = theGroup1->GetLastFunction();
+  Handle(GEOM_Function) aFunction2 = theGroup2->GetLastFunction();
+  if (aFunction1.IsNull() || aFunction2.IsNull()) return NULL;
+
+  GEOM_ISubShape aSSI1 (aFunction1);
+  GEOM_ISubShape aSSI2 (aFunction2);
+
+  Handle(GEOM_Function) aMainShapeFunc1 = aSSI1.GetMainShape();
+  Handle(GEOM_Function) aMainShapeFunc2 = aSSI2.GetMainShape();
+  if (aMainShapeFunc1.IsNull() || aMainShapeFunc2.IsNull()) return NULL;
+
+  TDF_Label aLabel1 = aMainShapeFunc1->GetOwnerEntry();
+  TDF_Label aLabel2 = aMainShapeFunc2->GetOwnerEntry();
+  if (aLabel1.IsRoot() || aLabel2.IsRoot()) {
+    SetErrorCode("Error: UnionGroups can be performed only on groups");
+    return NULL;
+  }
+
+  if (aLabel1 != aLabel2) {
+    SetErrorCode("Error: CutGroups cannot be performed on groups, built on different main shapes");
+    return NULL;
+  }
+
+  Handle(GEOM_Object) aMainObj = GEOM_Object::GetObject(aLabel1);
+  if (aMainObj.IsNull()) return NULL;
+
+  // New contents of the group
+  TColStd_ListOfInteger aNewIDs;
+  TColStd_MapOfInteger mapIDs;
+
+  Handle(TColStd_HArray1OfInteger) aSeq1 = aSSI1.GetIndices();
+  Handle(TColStd_HArray1OfInteger) aSeq2 = aSSI2.GetIndices();
+  if (aSeq1.IsNull() || aSeq2.IsNull()) return NULL;
+
+  Standard_Integer j, val_j;
+  Standard_Integer aLength1 = aSeq1->Length();
+  Standard_Integer aLength2 = aSeq2->Length();
+
+  for (j = 1; j <= aLength2; j++) {
+    mapIDs.Add(aSeq2->Value(j));
+  }
+  for (j = 1; j <= aLength1; j++) {
+    val_j = aSeq1->Value(j);
+    if (val_j > 0 && mapIDs.Add(val_j)) {
+      // add index, if it is not in mapIDs (filled from Group_2)
+      aNewIDs.Append(val_j);
+    }
+  }
+
+  Handle(TColStd_HArray1OfInteger) aNewArr;
+  if (aNewIDs.Extent() < 1) {
+    aNewArr = new TColStd_HArray1OfInteger (1, 1);
+    aNewArr->SetValue(1, -1);
+  }
+  else {
+    // Put new indices from the list into an array
+    Standard_Integer k = 1;
+    TColStd_ListIteratorOfListOfInteger aNewIDsIter (aNewIDs);
+    aNewArr = new TColStd_HArray1OfInteger (1, aNewIDs.Extent());
+    for (; aNewIDsIter.More(); aNewIDsIter.Next(), k++) {
+      aNewArr->SetValue(k, aNewIDsIter.Value());
+    }
+  }
+
+  // Create the Group
+  Handle(GEOM_Object) aGroup = GetEngine()->AddSubShape(aMainObj, aNewArr);
+  aGroup->SetType(GEOM_GROUP);
+  TDF_Label aFreeLabel = aGroup->GetFreeLabel();
+  TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)aType);
+
+  // Make a Python command
+  Handle(GEOM_Function) aFunction = aGroup->GetFunction(1);
+  GEOM::TPythonDump(aFunction) << aGroup << " = geompy.CutGroups("
+                               << theGroup1 << ", " << theGroup2 << ")";
+
+  SetErrorCode(OK);
+  return aGroup;
+}
+
+//=============================================================================
+/*!
+ *  UnionListOfGroups
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IGroupOperations::UnionListOfGroups
+                         (const Handle(TColStd_HSequenceOfTransient)& theGList)
+{
+  SetErrorCode(KO);
+  if (theGList.IsNull()) return NULL;
+
+  Standard_Integer i, aLen = theGList->Length();
+  if (aLen < 1) {
+    SetErrorCode("UnionListOfGroups error: the list of groups is empty");
+    return NULL;
+  }
+
+  TopAbs_ShapeEnum aType, aType_i;
+  TDF_Label aLabel, aLabel_i;
+  TColStd_ListOfInteger aNewIDs;
+  TColStd_MapOfInteger mapIDs;
+
+  // Iterate on the initial groups
+  for (i = 1; i <= aLen; i++) {
+    Handle(GEOM_Object) aGr_i = Handle(GEOM_Object)::DownCast(theGList->Value(i));
+
+    // Get group type
+    aType_i = GetType(aGr_i);
+    if (i == 1)
+      aType = aType_i;
+    else {
+      if (aType_i != aType) {
+        if (aType != TopAbs_SHAPE && aType != TopAbs_COMPOUND) {
+          if (aType_i == TopAbs_SHAPE || aType_i == TopAbs_COMPOUND)
+            aType = aType_i;
+          else {
+            SetErrorCode("Error: UnionListOfGroups cannot be performed on groups of different type");
+            return NULL;
+          }
+        }
+      }
+    }
+
+    // Get Main Shape
+    Handle(GEOM_Function) aFunction_i = aGr_i->GetLastFunction();
+    if (aFunction_i.IsNull()) return NULL;
+    GEOM_ISubShape aSSI (aFunction_i);
+    Handle(GEOM_Function) aMainShapeFunc = aSSI.GetMainShape();
+    if (aMainShapeFunc.IsNull()) return NULL;
+    aLabel_i = aMainShapeFunc->GetOwnerEntry();
+    if (aLabel_i.IsRoot()) {
+      SetErrorCode("Error: UnionGroups can be performed only on groups");
+      return NULL;
+    }
+    if (i == 1)
+      aLabel = aLabel_i;
+    else {
+      if (aLabel_i != aLabel) {
+        SetErrorCode("Error: UnionListOfGroups cannot be performed on groups, built on different main shapes");
+        return NULL;
+      }
+    }
+
+    // New contents of the group
+    Handle(TColStd_HArray1OfInteger) aSeq = aSSI.GetIndices();
+    if (aSeq.IsNull()) return NULL;
+
+    Standard_Integer j, val_j, aLength = aSeq->Length();
+    for (j = 1; j <= aLength; j++) {
+      val_j = aSeq->Value(j);
+      if (val_j > 0 && mapIDs.Add(val_j)) {
+        aNewIDs.Append(val_j);
+      }
+    }
+  }
+
+  // Check the resulting list of indices
+  if (aNewIDs.Extent() < 1) {
+    SetErrorCode("Error: UnionListOfGroups cannot be performed on all empty groups");
+    return NULL;
+  }
+
+  Handle(GEOM_Object) aMainObj = GEOM_Object::GetObject(aLabel);
+  if (aMainObj.IsNull()) return NULL;
+
+  // Put new indices from the list into an array
+  Standard_Integer k = 1;
+  TColStd_ListIteratorOfListOfInteger aNewIDsIter (aNewIDs);
+  Handle(TColStd_HArray1OfInteger) aNewArr = new TColStd_HArray1OfInteger (1, aNewIDs.Extent());
+  for (; aNewIDsIter.More(); aNewIDsIter.Next(), k++) {
+    aNewArr->SetValue(k, aNewIDsIter.Value());
+  }
+
+  // Create the Group
+  Handle(GEOM_Object) aGroup = GetEngine()->AddSubShape(aMainObj, aNewArr);
+  aGroup->SetType(GEOM_GROUP);
+  TDF_Label aFreeLabel = aGroup->GetFreeLabel();
+  TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)aType);
+
+  //Make a Python command
+  Handle(GEOM_Function) aFunction = aGroup->GetFunction(1);
+  GEOM::TPythonDump pd (aFunction);
+  pd << aGroup << " = geompy.UnionListOfGroups([";
+  for (i = 1; i <= aLen; i++) {
+    Handle(GEOM_Object) aGr_i = Handle(GEOM_Object)::DownCast(theGList->Value(i));
+    pd << aGr_i << ((i < aLen) ? ", " : "])");
+  }
+
+  SetErrorCode(OK);
+  return aGroup;
+}
+
+//=============================================================================
+/*!
+ *  IntersectListOfGroups
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IGroupOperations::IntersectListOfGroups
+                         (const Handle(TColStd_HSequenceOfTransient)& theGList)
+{
+  SetErrorCode(KO);
+  if (theGList.IsNull()) return NULL;
+
+  Standard_Integer i, aLen = theGList->Length();
+  if (aLen < 1) {
+    SetErrorCode("IntersectListOfGroups error: the list of groups is empty");
+    return NULL;
+  }
+
+  TopAbs_ShapeEnum aType, aType_i;
+  TDF_Label aLabel, aLabel_i;
+  TColStd_ListOfInteger aNewIDs;
+  TColStd_MapOfInteger mapIDs;
+
+  // Iterate on the initial groups
+  for (i = 1; i <= aLen; i++) {
+    Handle(GEOM_Object) aGr_i = Handle(GEOM_Object)::DownCast(theGList->Value(i));
+
+    // Get group type
+    aType_i = GetType(aGr_i);
+    if (i == 1)
+      aType = aType_i;
+    else {
+      if (aType_i != aType) {
+        if (aType != TopAbs_SHAPE && aType != TopAbs_COMPOUND) {
+          if (aType_i == TopAbs_SHAPE || aType_i == TopAbs_COMPOUND)
+            aType = aType_i;
+          else {
+            SetErrorCode("Error: IntersectListOfGroups cannot be performed on groups of different type");
+            return NULL;
+          }
+        }
+      }
+    }
+
+    // Get Main Shape
+    Handle(GEOM_Function) aFunction_i = aGr_i->GetLastFunction();
+    if (aFunction_i.IsNull()) return NULL;
+    GEOM_ISubShape aSSI (aFunction_i);
+    Handle(GEOM_Function) aMainShapeFunc = aSSI.GetMainShape();
+    if (aMainShapeFunc.IsNull()) return NULL;
+    aLabel_i = aMainShapeFunc->GetOwnerEntry();
+    if (aLabel_i.IsRoot()) {
+     SetErrorCode("Error: UnionGroups can be performed only on groups");
+     return NULL;
+    }
+    if (i == 1)
+      aLabel = aLabel_i;
+    else {
+      if (aLabel_i != aLabel) {
+        SetErrorCode("Error: IntersectListOfGroups cannot be performed on groups, built on different main shapes");
+        return NULL;
+      }
+    }
+
+    // New contents of the group
+    Handle(TColStd_HArray1OfInteger) aSeq = aSSI.GetIndices();
+    if (aSeq.IsNull()) return NULL;
+
+    Standard_Integer j, val_j, aLength = aSeq->Length();
+    for (j = 1; j <= aLength; j++) {
+      val_j = aSeq->Value(j);
+      if (val_j > 0) {
+        if (i == 1) {
+          // get all elements of the first group
+          if (mapIDs.Add(val_j))
+            aNewIDs.Append(val_j);
+        }
+        else {
+          // get only elements, present in all previously processed groups
+          if (!mapIDs.Add(val_j))
+            aNewIDs.Append(val_j);
+        }
+      }
+    }
+
+    // refill the map with only validated elements
+    if (i > 1) {
+      mapIDs.Clear();
+      TColStd_ListIteratorOfListOfInteger aNewIDsIter (aNewIDs);
+      for (; aNewIDsIter.More(); aNewIDsIter.Next()) {
+        mapIDs.Add(aNewIDsIter.Value());
+      }
+    }
+    // clear the resulting list before starting the next sycle
+    if (i < aLen) {
+      aNewIDs.Clear();
+    }
+  }
+
+  Handle(GEOM_Object) aMainObj = GEOM_Object::GetObject(aLabel);
+  if (aMainObj.IsNull()) return NULL;
+
+  Handle(TColStd_HArray1OfInteger) aNewArr;
+  if (aNewIDs.Extent() < 1) {
+    aNewArr = new TColStd_HArray1OfInteger (1, 1);
+    aNewArr->SetValue(1, -1);
+  }
+  else {
+    // Put new indices from the list into an array
+    Standard_Integer k = 1;
+    TColStd_ListIteratorOfListOfInteger aNewIDsIter (aNewIDs);
+    aNewArr = new TColStd_HArray1OfInteger (1, aNewIDs.Extent());
+    for (; aNewIDsIter.More(); aNewIDsIter.Next(), k++) {
+      aNewArr->SetValue(k, aNewIDsIter.Value());
+    }
+  }
+
+  // Create the Group
+  Handle(GEOM_Object) aGroup = GetEngine()->AddSubShape(aMainObj, aNewArr);
+  aGroup->SetType(GEOM_GROUP);
+  TDF_Label aFreeLabel = aGroup->GetFreeLabel();
+  TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)aType);
+
+  //Make a Python command
+  Handle(GEOM_Function) aFunction = aGroup->GetFunction(1);
+  GEOM::TPythonDump pd (aFunction);
+  pd << aGroup << " = geompy.IntersectListOfGroups([";
+  for (i = 1; i <= aLen; i++) {
+    Handle(GEOM_Object) aGr_i = Handle(GEOM_Object)::DownCast(theGList->Value(i));
+    pd << aGr_i << ((i < aLen) ? ", " : "])");
+  }
+
+  SetErrorCode(OK);
+  return aGroup;
+}
+
+//=============================================================================
+/*!
+ *  CutListOfGroups
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IGroupOperations::CutListOfGroups
+                        (const Handle(TColStd_HSequenceOfTransient)& theGList1,
+                         const Handle(TColStd_HSequenceOfTransient)& theGList2)
+{
+  SetErrorCode(KO);
+  if (theGList1.IsNull() || theGList2.IsNull()) return NULL;
+
+  Standard_Integer i;
+  Standard_Integer aLen1 = theGList1->Length();
+  Standard_Integer aLen2 = theGList2->Length();
+  if (aLen1 < 1) {
+    SetErrorCode("CutListOfGroups error: the first list of groups is empty");
+    return NULL;
+  }
+
+  TopAbs_ShapeEnum aType, aType_i;
+  TDF_Label aLabel, aLabel_i;
+  TColStd_ListOfInteger aNewIDs;
+  TColStd_MapOfInteger mapIDs;
+
+  // 1. Collect indices to be excluded (from theGList2) into the mapIDs
+  for (i = 1; i <= aLen2; i++) {
+    Handle(GEOM_Object) aGr_i = Handle(GEOM_Object)::DownCast(theGList2->Value(i));
+
+    // Get group type
+    aType_i = GetType(aGr_i);
+    if (i == 1)
+      aType = aType_i;
+    else {
+      if (aType_i != aType) {
+        if (aType != TopAbs_SHAPE && aType != TopAbs_COMPOUND) {
+          if (aType_i == TopAbs_SHAPE || aType_i == TopAbs_COMPOUND)
+            aType = aType_i;
+          else {
+            SetErrorCode("Error: CutListOfGroups cannot be performed on groups of different type");
+            return NULL;
+          }
+        }
+      }
+    }
+
+    // Get Main Shape
+    Handle(GEOM_Function) aFunction_i = aGr_i->GetLastFunction();
+    if (aFunction_i.IsNull()) return NULL;
+    GEOM_ISubShape aSSI (aFunction_i);
+    Handle(GEOM_Function) aMainShapeFunc = aSSI.GetMainShape();
+    if (aMainShapeFunc.IsNull()) return NULL;
+    aLabel_i = aMainShapeFunc->GetOwnerEntry();
+    if (aLabel_i.IsRoot()) {
+      SetErrorCode("Error: UnionGroups can be performed only on groups");
+      return NULL;
+    }
+    if (i == 1)
+      aLabel = aLabel_i;
+    else {
+      if (aLabel_i != aLabel) {
+        SetErrorCode("Error: CutListOfGroups cannot be performed on groups, built on different main shapes");
+        return NULL;
+      }
+    }
+
+    // Indiced to exclude
+    Handle(TColStd_HArray1OfInteger) aSeq = aSSI.GetIndices();
+    if (aSeq.IsNull()) return NULL;
+
+    Standard_Integer j, aLength = aSeq->Length();
+    for (j = 1; j <= aLength; j++) {
+      mapIDs.Add(aSeq->Value(j));
+    }
+  }
+
+  // 2. Collect indices from theGList1, avoiding indices from theGList2 (mapIDs)
+  for (i = 1; i <= aLen1; i++) {
+    Handle(GEOM_Object) aGr_i = Handle(GEOM_Object)::DownCast(theGList1->Value(i));
+
+    // Get group type
+    aType_i = GetType(aGr_i);
+    if (i == 1 && aLen2 < 1)
+      aType = aType_i;
+    else {
+      if (aType_i != aType) {
+        if (aType != TopAbs_SHAPE && aType != TopAbs_COMPOUND) {
+          if (aType_i == TopAbs_SHAPE || aType_i == TopAbs_COMPOUND)
+            aType = aType_i;
+          else {
+            SetErrorCode("Error: CutListOfGroups cannot be performed on groups of different type");
+            return NULL;
+          }
+        }
+      }
+    }
+
+    // Get Main Shape
+    Handle(GEOM_Function) aFunction_i = aGr_i->GetLastFunction();
+    if (aFunction_i.IsNull()) return NULL;
+    GEOM_ISubShape aSSI (aFunction_i);
+    Handle(GEOM_Function) aMainShapeFunc = aSSI.GetMainShape();
+    if (aMainShapeFunc.IsNull()) return NULL;
+    aLabel_i = aMainShapeFunc->GetOwnerEntry();
+    if (aLabel_i.IsRoot()) {
+      SetErrorCode("Error: UnionGroups can be performed only on groups");
+      return NULL;
+    }
+    if (i == 1 && aLen2 < 1)
+      aLabel = aLabel_i;
+    else {
+      if (aLabel_i != aLabel) {
+        SetErrorCode("Error: CutListOfGroups cannot be performed on groups, built on different main shapes");
+        return NULL;
+      }
+    }
+
+    // New contents of the group
+    Handle(TColStd_HArray1OfInteger) aSeq = aSSI.GetIndices();
+    if (aSeq.IsNull()) return NULL;
+
+    Standard_Integer j, val_j, aLength = aSeq->Length();
+    for (j = 1; j <= aLength; j++) {
+      val_j = aSeq->Value(j);
+      if (val_j > 0 && mapIDs.Add(val_j)) {
+        // get only elements, not present in mapIDs (theGList2)
+        aNewIDs.Append(val_j);
+      }
+    }
+  }
+
+  Handle(GEOM_Object) aMainObj = GEOM_Object::GetObject(aLabel);
+  if (aMainObj.IsNull()) return NULL;
+
+  Handle(TColStd_HArray1OfInteger) aNewArr;
+  if (aNewIDs.Extent() < 1) {
+    aNewArr = new TColStd_HArray1OfInteger (1, 1);
+    aNewArr->SetValue(1, -1);
+  }
+  else {
+    // Put new indices from the list into an array
+    Standard_Integer k = 1;
+    TColStd_ListIteratorOfListOfInteger aNewIDsIter (aNewIDs);
+    aNewArr = new TColStd_HArray1OfInteger (1, aNewIDs.Extent());
+    for (; aNewIDsIter.More(); aNewIDsIter.Next(), k++) {
+      aNewArr->SetValue(k, aNewIDsIter.Value());
+    }
+  }
+
+  // Create the Group
+  Handle(GEOM_Object) aGroup = GetEngine()->AddSubShape(aMainObj, aNewArr);
+  aGroup->SetType(GEOM_GROUP);
+  TDF_Label aFreeLabel = aGroup->GetFreeLabel();
+  TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)aType);
+
+  //Make a Python command
+  Handle(GEOM_Function) aFunction = aGroup->GetFunction(1);
+  GEOM::TPythonDump pd (aFunction);
+  pd << aGroup << " = geompy.CutListOfGroups([";
+  for (i = 1; i <= aLen1; i++) {
+    Handle(GEOM_Object) aGr_i = Handle(GEOM_Object)::DownCast(theGList1->Value(i));
+    pd << aGr_i << ((i < aLen1) ? ", " : "], [");
+  }
+  for (i = 1; i <= aLen2; i++) {
+    Handle(GEOM_Object) aGr_i = Handle(GEOM_Object)::DownCast(theGList2->Value(i));
+    pd << aGr_i << ((i < aLen2) ? ", " : "])");
+  }
+
+  SetErrorCode(OK);
+  return aGroup;
+}
+
 //=============================================================================
 /*!
  *  GetType
index 0b6a89110704b208663d45c76af6518a9bb51c28..6b8d485eccc07b72a045173bf1ba0b618d4aec41 100644 (file)
@@ -18,7 +18,6 @@
 // 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_IGroupOperations_HXX_
 #define _GEOMImpl_IGroupOperations_HXX_
@@ -28,7 +27,7 @@
 #include "GEOM_Engine.hxx"
 #include "GEOM_Object.hxx"
 #include <TDocStd_Document.hxx>
-#include <TColStd_HArray1OfInteger.hxx> 
+#include <TColStd_HArray1OfInteger.hxx>
 #include <TColStd_HSequenceOfInteger.hxx>
 #include <TopAbs.hxx>
 
@@ -55,6 +54,20 @@ class GEOMImpl_IGroupOperations : public GEOM_IOperations {
   Standard_EXPORT void DifferenceIDs (Handle(GEOM_Object) theGroup,
                       const Handle(TColStd_HSequenceOfInteger)& theSubShapes);
 
+  Standard_EXPORT Handle(GEOM_Object) UnionGroups (Handle(GEOM_Object) theGroup1,
+                                                   Handle(GEOM_Object) theGroup2);
+  Standard_EXPORT Handle(GEOM_Object) IntersectGroups (Handle(GEOM_Object) theGroup1,
+                                                       Handle(GEOM_Object) theGroup2);
+  Standard_EXPORT Handle(GEOM_Object) CutGroups (Handle(GEOM_Object) theGroup1,
+                                                 Handle(GEOM_Object) theGroup2);
+
+  Standard_EXPORT Handle(GEOM_Object) UnionListOfGroups
+                                                      (const Handle(TColStd_HSequenceOfTransient)& theGList);
+  Standard_EXPORT Handle(GEOM_Object) IntersectListOfGroups
+                                                      (const Handle(TColStd_HSequenceOfTransient)& theGList);
+  Standard_EXPORT Handle(GEOM_Object) CutListOfGroups (const Handle(TColStd_HSequenceOfTransient)& theGList1,
+                                                       const Handle(TColStd_HSequenceOfTransient)& theGList2);
+
   Standard_EXPORT TopAbs_ShapeEnum GetType(Handle(GEOM_Object) theGroup);
 
   Standard_EXPORT Handle(GEOM_Object) GetMainShape(Handle(GEOM_Object) theGroup);
index 3bb7cec61dc5e56692cc7e122fdd179449a9da66..6aca179a16df948dceb84bef357fbb02f605fd3b 100644 (file)
@@ -18,7 +18,6 @@
 // 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>
 
@@ -47,7 +46,9 @@
 
 #include <TopoDS.hxx>
 #include <TopoDS_Vertex.hxx>
+#include <BRep_Builder.hxx>
 #include <BRep_Tool.hxx>
+#include <BRepTools.hxx>
 #include <gp_Pnt.hxx>
 
 #if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
 
 //=============================================================================
 /*!
- *   constructor:
+ *  constructor
  */
 //=============================================================================
-
 GEOMImpl_IInsertOperations::GEOMImpl_IInsertOperations(GEOM_Engine* theEngine, int theDocID)
 : GEOM_IOperations(theEngine, theDocID)
 {
@@ -76,20 +76,17 @@ GEOMImpl_IInsertOperations::GEOMImpl_IInsertOperations(GEOM_Engine* theEngine, i
  *  destructor
  */
 //=============================================================================
-
 GEOMImpl_IInsertOperations::~GEOMImpl_IInsertOperations()
 {
   MESSAGE("GEOMImpl_IInsertOperations::~GEOMImpl_IInsertOperations");
 }
 
-
-
 //=============================================================================
 /*!
  *  MakeCopy
  */
 //=============================================================================
-Handle(GEOM_Object) GEOMImpl_IInsertOperations::MakeCopy(Handle(GEOM_Object) theOriginal)
+Handle(GEOM_Object) GEOMImpl_IInsertOperations::MakeCopy (Handle(GEOM_Object) theOriginal)
 {
   SetErrorCode(KO);
 
@@ -231,7 +228,6 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::Import
   aCI.SetFileName(theFileName);
   aCI.SetFormatName(theFormatName);
   aCI.SetPluginName(aLibName);
-  //cout<<"IIO: theFormatName = "<<theFormatName.ToCString()<<endl;
 
   //Perform the Import
   try {
@@ -257,7 +253,8 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::Import
 
   SetErrorCode(OK);
 
-  if( theFormatName == "IGES_UNIT" ) {
+  // OLD CODE: begin
+  if (theFormatName == "IGES_UNIT") {
     TopoDS_Shape S = aFunction->GetValue();
     TopoDS_Vertex V = TopoDS::Vertex(S);
     gp_Pnt P = BRep_Tool::Pnt(V);
@@ -270,10 +267,42 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::Import
     //cout<<"IIO: aUnitName = "<<aUnitName.ToCString()<<endl;
     SetErrorCode(aUnitName);
   }
+  // OLD CODE: end
 
   return result;
 }
 
+//=============================================================================
+/*!
+ *  ReadValue
+ */
+//=============================================================================
+TCollection_AsciiString GEOMImpl_IInsertOperations::ReadValue
+                                 (const TCollection_AsciiString& theFileName,
+                                  const TCollection_AsciiString& theFormatName,
+                                  const TCollection_AsciiString& theParameterName)
+{
+  SetErrorCode(KO);
+
+  TCollection_AsciiString aValue, anError;
+
+  if (theFileName.IsEmpty() || theFormatName.IsEmpty() || theParameterName.IsEmpty()) return aValue;
+
+  Handle(TCollection_HAsciiString) aHLibName;
+  if (!IsSupported(Standard_True, theFormatName.SubString(1,4), aHLibName)) {
+    return aValue;
+  }
+  TCollection_AsciiString aLibName = aHLibName->String();
+
+  aValue = GEOMImpl_ImportDriver::ReadValue(theFileName, aLibName, theParameterName, anError);
+  if (anError.IsEmpty())
+    SetErrorCode(OK);
+  else
+    SetErrorCode(anError.ToCString());
+
+  return aValue;
+}
+
 //=============================================================================
 /*!
  *  ImportTranslators
@@ -554,6 +583,48 @@ Standard_Boolean GEOMImpl_IInsertOperations::InitResMgr()
            myResMgrUser->Find("Import") || myResMgrUser->Find("Export"));
 }
 
+//=============================================================================
+/*!
+ *  RestoreShape
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IInsertOperations::RestoreShape (std::istringstream& theStream)
+{
+  SetErrorCode(KO);
+
+  //Add a new result object
+  Handle(GEOM_Object) result = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
+
+  //Add a Copy function
+  Handle(GEOM_Function) aFunction = result->AddFunction(GEOMImpl_CopyDriver::GetID(), COPY_WITHOUT_REF);
+  if (aFunction.IsNull()) return NULL;
+
+  //Check if the function is set correctly
+  if (aFunction->GetDriverGUID() != GEOMImpl_CopyDriver::GetID()) return NULL;
+
+  //Read a shape from the stream
+  TopoDS_Shape aShape;
+  BRep_Builder B;
+  BRepTools::Read(aShape, theStream, B);
+  if (aShape.IsNull()) {
+    SetErrorCode("RestoreShape error: BREP reading failed");
+  }
+
+  //Set function value
+  aFunction->SetValue(aShape);
+
+  //Special dump to avoid restored shapes publication.
+  //See correcponding code in GEOM_Engine.cxx (method ProcessFunction)
+  //GEOM::TPythonDump(aFunction) << "#";
+
+  GEOM::TPythonDump(aFunction) << result
+    << " = geompy.RestoreShape(\"\") # the shape string has not been dump for performance reason";
+
+  SetErrorCode(OK);
+
+  return result;
+}
+
 int GEOMImpl_IInsertOperations::LoadTexture(const TCollection_AsciiString& theTextureFile)
 {
   SetErrorCode(KO);
index e60c22b32847068753773b50edabd11a5e42523c..56ea89d42f54188a841b4ed0c66ef722270103bd 100644 (file)
@@ -18,7 +18,6 @@
 // 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_IInsertOperations_HXX_
 #define _GEOMImpl_IInsertOperations_HXX_
@@ -55,6 +54,10 @@ class GEOMImpl_IInsertOperations : public GEOM_IOperations {
   Standard_EXPORT Handle(GEOM_Object) Import (const TCollection_AsciiString& theFileName,
                                               const TCollection_AsciiString& theFormatType);
 
+  Standard_EXPORT TCollection_AsciiString ReadValue (const TCollection_AsciiString& theFileName,
+                                                     const TCollection_AsciiString& theFormatType,
+                                                     const TCollection_AsciiString& theParameterName);
+
   Standard_EXPORT void Export (const Handle(GEOM_Object)      theOriginal,
                                const TCollection_AsciiString& theFileName,
                                const TCollection_AsciiString& theFormatType);
@@ -69,6 +72,8 @@ class GEOMImpl_IInsertOperations : public GEOM_IOperations {
                                                 const TCollection_AsciiString& theFormat,
                                                 Handle(TCollection_HAsciiString)& theLibName);
 
+  Standard_EXPORT Handle(GEOM_Object) RestoreShape (std::istringstream& theStream);
+
   Standard_EXPORT int LoadTexture(const TCollection_AsciiString& theTextureFile);
 
   Standard_EXPORT int AddTexture(int theWidth, int theHeight,
index 98abba29cb334a09d5a9ccd8300692767b77a087..df3a87a49963a3490934fa56f6eac236c9d82f20 100644 (file)
@@ -18,7 +18,6 @@
 // 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 <NMTDS_Tools.hxx>
 #include <NMTDS_InterfPool.hxx>
 #include <NMTDS_PInterfPool.hxx>
-//#include <NMTDS_PassKeyBoolean.hxx>
 #include <NMTDS_PairBoolean.hxx>
 #include <NMTDS_ShapesDataStructure.hxx>
-//#include <NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx>
 #include <NMTDS_ListIteratorOfListOfPairBoolean.hxx>
 
 #include <Basics_OCCTVersion.hxx>
 #include <TFunction_Logbook.hxx>
 #include <TDF_Tool.hxx>
 
+#include <BRep_Builder.hxx>
+#include <BRep_TFace.hxx>
 #include <BRep_Tool.hxx>
 #include <BRepAdaptor_Surface.hxx>
+#include <BRepBuilderAPI_Copy.hxx>
 #include <BRepBndLib.hxx>
 #include <BRepCheck.hxx>
 #include <BRepCheck_ListIteratorOfListOfStatus.hxx>
 #include <BRepCheck_Result.hxx>
 #include <BRepCheck_Shell.hxx>
+#include <BRepClass3d_SolidClassifier.hxx>
 #include <BRepExtrema_DistShapeShape.hxx>
 #include <BRepGProp.hxx>
 #include <BRepTools.hxx>
 
 #include <Bnd_Box.hxx>
 
-#include <GProp_GProps.hxx>
-#include <GProp_PrincipalProps.hxx>
-
 #include <TopAbs.hxx>
 #include <TopExp.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Face.hxx>
 #include <TopoDS_Shape.hxx>
 #include <TopoDS_Vertex.hxx>
+#include <TopoDS_Compound.hxx>
 #include <TopoDS_Iterator.hxx>
 #include <TopExp_Explorer.hxx>
 #include <TopTools_MapOfShape.hxx>
 #include <TopTools_ListOfShape.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 
+#include <ShapeAnalysis.hxx>
+#include <ShapeAnalysis_Surface.hxx>
+#include <ShapeFix_Shape.hxx>
+
+#include <GeomAPI_IntSS.hxx>
+#include <GeomAPI_ProjectPointOnCurve.hxx>
+
 #include <GeomAbs_SurfaceType.hxx>
-#include <Geom_Surface.hxx>
+
+#include <Geom_BezierSurface.hxx>
+#include <Geom_BSplineSurface.hxx>
+#include <Geom_Circle.hxx>
+#include <Geom_ConicalSurface.hxx>
+#include <Geom_CylindricalSurface.hxx>
+#include <Geom_Line.hxx>
+#include <Geom_OffsetSurface.hxx>
 #include <Geom_Plane.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
 #include <Geom_SphericalSurface.hxx>
-#include <Geom_CylindricalSurface.hxx>
-#include <Geom_ToroidalSurface.hxx>
-#include <Geom_ConicalSurface.hxx>
+#include <Geom_Surface.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 <Geom_Line.hxx>
-
-#include <gp_Pln.hxx>
-#include <gp_Lin.hxx>
+#include <Geom_ToroidalSurface.hxx>
 
-#include <GeomAPI_ProjectPointOnCurve.hxx>
 #include <GeomLProp_CLProps.hxx>
 #include <GeomLProp_SLProps.hxx>
-#include <ShapeAnalysis.hxx>
-#include <ShapeAnalysis_Surface.hxx>
 
-#include <Standard_Failure.hxx>
-#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
+#include <GProp_GProps.hxx>
+#include <GProp_PrincipalProps.hxx>
 
-#include <BRepClass3d_SolidClassifier.hxx>
-#include <BRep_Builder.hxx>
-#include <GeomAPI_IntSS.hxx>
-#include <Geom_Circle.hxx>
-#include <Geom_SphericalSurface.hxx>
-#include <Geom_ToroidalSurface.hxx>
-#include <ShapeFix_Shape.hxx>
-#include <TopoDS_Compound.hxx>
+#include <gp_Pln.hxx>
+#include <gp_Lin.hxx>
 
+#include <Standard_Failure.hxx>
+#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
 
 //=============================================================================
 /*!
@@ -794,10 +792,10 @@ gp_Ax3 GEOMImpl_IMeasureOperations::GetPosition (const TopoDS_Shape& theShape)
       if(theShape.Orientation() == TopAbs_REVERSED)
       {
         gp_Dir Vx =  aResult.XDirection();
-        gp_Dir N  =  aResult.Direction().Mirrored(Vx); 
+        gp_Dir N  =  aResult.Direction().Mirrored(Vx);
         gp_Pnt P  =  aResult.Location();
         aResult = gp_Ax3(P, N, Vx);
-      }       
+      }
     }
   }
 
@@ -1206,6 +1204,17 @@ void GEOMImpl_IMeasureOperations::GetBoundingBox
 #if OCC_VERSION_LARGE > 0x06010000
     OCC_CATCH_SIGNALS;
 #endif
+    BRepBuilderAPI_Copy aCopyTool (aShape);
+    if (!aCopyTool.IsDone()) {
+      SetErrorCode("GetBoundingBox Error: Bad shape detected");
+      return;
+    }
+
+    aShape = aCopyTool.Shape();
+
+    // remove triangulation to obtain more exact boundaries
+    BRepTools::Clean(aShape);
+
     BRepBndLib::Add(aShape, B);
     B.Get(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax);
   }
@@ -1386,7 +1395,7 @@ bool GEOMImpl_IMeasureOperations::CheckSelfIntersections
   const NMTDS_ShapesDataStructure& aDS = *(aCSI.DS());
   Standard_Integer aNbS = aDS.NumberOfShapesOfTheObject();
 
-  // 3. Get the pairs of interfered shapes 
+  // 3. Get the pairs of interfered shapes
   NMTDS_PInterfPool pIP = aCSI.IP();
   //const NMTDS_ListOfPassKeyBoolean& aLPKB = pIP->Get();
   const NMTDS_ListOfPairBoolean& aLPKB = pIP->Get();
index ee1495f0e0023c22a0425118868760dedab496f4..748a5a735993b0e7cb6c3204d0a023016353bfc1 100644 (file)
@@ -18,7 +18,6 @@
 // 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_Types.hxx>
 #include <GEOM_Function.hxx>
 
-#include "utilities.h"
-
 #include <TopoDS_Shape.hxx>
 
+#include <TCollection_HAsciiString.hxx>
+
+#include "utilities.h"
+
 #include <Standard_Failure.hxx>
 #include <StdFail_NotDone.hxx>
 
@@ -57,6 +58,10 @@ typedef TopoDS_Shape (*funcPoint)(const TCollection_AsciiString&,
                                   TCollection_AsciiString&,
                                   const TDF_Label&);
 
+typedef Handle(TCollection_HAsciiString) (*pGetValue)(const TCollection_AsciiString&,
+                                                      const TCollection_AsciiString&,
+                                                      TCollection_AsciiString&);
+
 //=======================================================================
 //function : GetID
 //purpose  :
@@ -67,7 +72,6 @@ const Standard_GUID& GEOMImpl_ImportDriver::GetID()
   return aImportDriver;
 }
 
-
 //=======================================================================
 //function : GEOMImpl_ImportDriver
 //purpose  :
@@ -97,6 +101,8 @@ Standard_Integer GEOMImpl_ImportDriver::Execute(TFunction_Logbook& log) const
 
   // load plugin library
   LibHandle anImportLib = LoadLib( aLibName.ToCString() ); //This is workaround of BUG OCC13051
+
+  // Get Import method
   funcPoint fp = 0;
   if ( anImportLib )
     fp = (funcPoint)GetProc( anImportLib, "Import" );
@@ -129,6 +135,53 @@ Standard_Integer GEOMImpl_ImportDriver::Execute(TFunction_Logbook& log) const
   return 1;
 }
 
+//=======================================================================
+//function : ReadValue
+//purpose  :
+//=======================================================================
+TCollection_AsciiString GEOMImpl_ImportDriver::ReadValue(const TCollection_AsciiString& theFileName,
+                                                         const TCollection_AsciiString& theLibName,
+                                                         const TCollection_AsciiString& theParameterName,
+                                                         TCollection_AsciiString& theError)
+{
+  TCollection_AsciiString aValue;
+
+  if (theFileName.IsEmpty() || theLibName.IsEmpty() || theParameterName.IsEmpty())
+    return aValue;
+
+  // load plugin library
+  LibHandle anImportLib = LoadLib(theLibName.ToCString()); //This is workaround of BUG OCC13051
+  if (!anImportLib) {
+    theError = theLibName + " library was not installed";
+    return aValue;
+  }
+
+  // Get GetValue method
+  pGetValue pGV = (pGetValue)GetProc(anImportLib, "GetValue");
+
+  if (!pGV) {
+    theError = theLibName + " library doesn't support GetValue method";
+    return aValue;
+  }
+
+  Handle(TCollection_HAsciiString) aHValue = pGV(theFileName, theParameterName, theError);
+
+  if (aHValue.IsNull()) {
+    if (theError.IsEmpty())
+      theError = theFileName + " doesn't contain requested parameter";
+    return aValue;
+  }
+
+  aValue = aHValue->String();
+
+  // unload plugin library
+  // commented by enk:
+  // the bug was occured: using ACIS Import/Export plugin
+  //UnLoadLib( anImportLib ); //This is workaround of BUG OCC13051
+
+  return aValue;
+}
+
 
 //=======================================================================
 //function :  GEOMImpl_ImportDriver_Type_
index 0c625e05c1354b9f1e98a2dfb6773874804785a6..265e5ac4c2bb7da1a20cd6a236f3d071114c7e63 100644 (file)
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 //  File   : GEOMImpl_ImportDriver.ixx
 //  Module : GEOMImpl
-//
+
 #ifndef _GEOMImpl_ImportDriver_HeaderFile
 #define _GEOMImpl_ImportDriver_HeaderFile
 
@@ -119,6 +118,8 @@ class Handle(GEOMImpl_ImportDriver) : public Handle(TFunction_Driver) {
 #include <Standard_CString.hxx>
 #endif
 
+#include <TCollection_AsciiString.hxx>
+
 class TColStd_SequenceOfExtendedString;
 
 
@@ -148,6 +149,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r
 Standard_EXPORT static const Standard_GUID& GetID();
 Standard_EXPORT ~GEOMImpl_ImportDriver() {};
 
+  // Static method
+  Standard_EXPORT static TCollection_AsciiString ReadValue (const TCollection_AsciiString& theFileName,
+                                                            const TCollection_AsciiString& theLibName,
+                                                            const TCollection_AsciiString& theParameterName,
+                                                            TCollection_AsciiString& theError);
 
  // Type management
  //
index e3c734a10a2b7da0c426bfa5781ea1da853b574a..21475ee427f61ef7124d705f724cfcb134cd73cd 100644 (file)
@@ -2222,6 +2222,11 @@ static TopoDS_Shape CreatePipeBiNormalAlongVector(const TopoDS_Wire& aWirePath,
     Standard_NullObject::Raise("MakePipe aborted : null base argument");
   }
 
+  // Make copy to prevent modifying of base object: 0021525
+  BRepBuilderAPI_Copy Copy (aShapeBase);
+  if (Copy.IsDone())
+    aShapeBase = Copy.Shape();
+
   TopoDS_Shape aProf;
   if (aShapeBase.ShapeType() == TopAbs_VERTEX) {
     aProf = aShapeBase;
@@ -2233,14 +2238,14 @@ static TopoDS_Shape CreatePipeBiNormalAlongVector(const TopoDS_Wire& aWirePath,
     aProf = aShapeBase;
   }
   else if (aShapeBase.ShapeType() == TopAbs_FACE) {
-    TopExp_Explorer wexp(aShapeBase,TopAbs_WIRE);
+    TopExp_Explorer wexp (aShapeBase,TopAbs_WIRE);
     aProf = wexp.Current();
   }
   else {
     Standard_TypeMismatch::Raise
       ("MakePipe aborted : invalid type of base");
   }
-  BRepOffsetAPI_MakePipeShell PipeBuilder(aWirePath);
+  BRepOffsetAPI_MakePipeShell PipeBuilder (aWirePath);
   PipeBuilder.Add(aProf);
 
   if (aShapeVec.IsNull()) {
index b25807bd095654ef98d3f6d74f84309f6d75548e..9fa9cf9c0d8aa1b2dc42e33b8fcef571a0ae5362 100644 (file)
@@ -18,7 +18,6 @@
 // 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>
 
@@ -26,6 +25,7 @@
 #include <GEOMImpl_IPoint.hxx>
 #include <GEOMImpl_Types.hxx>
 #include <GEOM_Function.hxx>
+#include <GEOMAlgo_Tools3D.hxx>
 
 #include <ShapeAnalysis.hxx>
 
@@ -124,8 +124,8 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
     aPnt = gp_Pnt(aPI.GetX(), aPI.GetY(), aPI.GetZ());
   }
   else if (aType == POINT_XYZ_REF) {
-    Handle(GEOM_Function) aRefPoint = aPI.GetRef();
-    TopoDS_Shape aRefShape = aRefPoint->GetValue();
+    Handle(GEOM_Function) aRefFunc = aPI.GetRef();
+    TopoDS_Shape aRefShape = aRefFunc->GetValue();
     if (aRefShape.ShapeType() != TopAbs_VERTEX) {
       Standard_TypeMismatch::Raise
         ("Point creation aborted : referenced shape is not a vertex");
@@ -134,8 +134,8 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
     aPnt = gp_Pnt(P.X() + aPI.GetX(), P.Y() + aPI.GetY(), P.Z() + aPI.GetZ());
   }
   else if (aType == POINT_CURVE_PAR) {
-    Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
-    TopoDS_Shape aRefShape = aRefCurve->GetValue();
+    Handle(GEOM_Function) aRefFunc = aPI.GetCurve();
+    TopoDS_Shape aRefShape = aRefFunc->GetValue();
     if (aRefShape.ShapeType() != TopAbs_EDGE) {
       Standard_TypeMismatch::Raise
         ("Point On Curve creation aborted : curve shape is not an edge");
@@ -146,8 +146,8 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
     aPnt = aCurve->Value(aP);
   }
   else if (aType == POINT_CURVE_COORD) {
-    Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
-    TopoDS_Shape aRefShape = aRefCurve->GetValue();
+    Handle(GEOM_Function) aRefFunc = aPI.GetCurve();
+    TopoDS_Shape aRefShape = aRefFunc->GetValue();
     if (aRefShape.ShapeType() != TopAbs_EDGE) {
       Standard_TypeMismatch::Raise
         ("Point On Curve creation aborted : curve shape is not an edge");
@@ -160,12 +160,12 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
   }
   else if (aType == POINT_CURVE_LENGTH) {
     // RefCurve
-    Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
-    if (aRefCurve.IsNull()) {
+    Handle(GEOM_Function) aRefFunc = aPI.GetCurve();
+    if (aRefFunc.IsNull()) {
       Standard_NullObject::Raise
         ("Point On Curve creation aborted : curve object is null");
     }
-    TopoDS_Shape aRefShape1 = aRefCurve->GetValue();
+    TopoDS_Shape aRefShape1 = aRefFunc->GetValue();
     if (aRefShape1.ShapeType() != TopAbs_EDGE) {
       Standard_TypeMismatch::Raise
         ("Point On Curve creation aborted : curve shape is not an edge");
@@ -222,8 +222,8 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
     aPnt = AdapCurve.Value(aParam);
   }
   else if (aType == POINT_SURFACE_PAR) {
-    Handle(GEOM_Function) aRefCurve = aPI.GetSurface();
-    TopoDS_Shape aRefShape = aRefCurve->GetValue();
+    Handle(GEOM_Function) aRefFunc = aPI.GetSurface();
+    TopoDS_Shape aRefShape = aRefFunc->GetValue();
     if (aRefShape.ShapeType() != TopAbs_FACE) {
       Standard_TypeMismatch::Raise
         ("Point On Surface creation aborted : surface shape is not a face");
@@ -238,8 +238,8 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
     aPnt = aSurf->Value(U,V);
   }
   else if (aType == POINT_SURFACE_COORD) {
-    Handle(GEOM_Function) aRefCurve = aPI.GetSurface();
-    TopoDS_Shape aRefShape = aRefCurve->GetValue();
+    Handle(GEOM_Function) aRefFunc = aPI.GetSurface();
+    TopoDS_Shape aRefShape = aRefFunc->GetValue();
     if (aRefShape.ShapeType() != TopAbs_FACE) {
       Standard_TypeMismatch::Raise
         ("Point On Surface creation aborted : surface shape is not a face");
@@ -250,6 +250,17 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
         ("Point On Surface creation aborted : cannot project point");
     }
   }
+  else if (aType == POINT_FACE_ANY) {
+    Handle(GEOM_Function) aRefFunc = aPI.GetSurface();
+    TopoDS_Shape aRefShape = aRefFunc->GetValue();
+    if (aRefShape.ShapeType() != TopAbs_FACE) {
+      Standard_TypeMismatch::Raise
+        ("Point On Surface creation aborted : surface shape is not a face");
+    }
+    TopoDS_Face F = TopoDS::Face(aRefShape);
+    gp_Pnt2d aP2d;
+    GEOMAlgo_Tools3D::PntInFace(F, aPnt, aP2d);
+  }
   else if (aType == POINT_LINES_INTERSECTION) {
     Handle(GEOM_Function) aRef1 = aPI.GetLine1();
     Handle(GEOM_Function) aRef2 = aPI.GetLine2();
index e1ef2802214944538c3c5d6409f788b89f764736..9f2ec8081ef91a66252bca747b44290ede986db2 100644 (file)
@@ -18,7 +18,6 @@
 // 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>
 
@@ -349,7 +348,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
     unsigned int ind, nbshapes = aShapes->Length();
 
     // add faces
-    BRepBuilderAPI_Sewing aSewing(Precision::Confusion()*10.0);
+    BRepBuilderAPI_Sewing aSewing (Precision::Confusion()*10.0);
     for (ind = 1; ind <= nbshapes; ind++) {
       Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
       TopoDS_Shape aShape_i = aRefShape->GetValue();
@@ -362,7 +361,8 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
     aSewing.Perform();
 
     TopoDS_Shape sh = aSewing.SewedShape();
-    if( sh.ShapeType()==TopAbs_FACE && nbshapes==1 ) {
+
+    if (sh.ShapeType()==TopAbs_FACE && nbshapes==1) {
       // case for creation of shell from one face - PAL12722 (skl 26.06.2006)
       TopoDS_Shell ss;
       B.MakeShell(ss);
@@ -378,8 +378,25 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
         ish++;
       }
 
-      if (ish != 1)
-        aShape = aSewing.SewedShape();
+      if (ish != 1) {
+        // try the case of one face (Mantis issue 0021809)
+        TopExp_Explorer expF (sh, TopAbs_FACE);
+        Standard_Integer ifa = 0;
+        for (; expF.More(); expF.Next()) {
+          aShape = expF.Current();
+          ifa++;
+        }
+
+        if (ifa == 1) {
+          TopoDS_Shell ss;
+          B.MakeShell(ss);
+          B.Add(ss,aShape);
+          aShape = ss;
+        }
+        else {
+          aShape = aSewing.SewedShape();
+        }
+      }
     }
 
   }
index 2e5f871b82c8d30c2b3f2225b8d6ce2e4b9e8fc9..5182f8cdc818a4410db7106122751a1ac34f20e3 100755 (executable)
@@ -18,7 +18,6 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 
 // GEOM_Object types
 #define POINT_SURFACE_PAR        5
 #define POINT_CURVE_COORD        6
 #define POINT_SURFACE_COORD      7
-#define POINT_CURVE_LENGTH       8 
+#define POINT_CURVE_LENGTH       8
+#define POINT_FACE_ANY           9
 
 // Vector
 #define VECTOR_TWO_PNT  1
 #define GLUE_EDGES_BY_LIST 4
 
 #define SKETCHER_NINE_DOUBLS 1
-#define SKETCHER_PLANE 2
+#define SKETCHER_PLANE       2
+
+#define SKETCHER3D_COORDS  1
+#define SKETCHER3D_COMMAND 2
 
 // Measures
 #define CDG_MEASURE 1
index f0acaa34f53c272a522b50c09d1671a7284964e9..e83523ea45ccb293a993aaefb74d1b14fdc07b74 100644 (file)
@@ -355,9 +355,9 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
   case GEOMOp::OpNoAutoColor:    // POPUP - DISABLE AUTO COLOR
     OnDisableAutoColor();
     break;
-  case GEOMOp::OpShowChildren:   // POPUP - SHOW CHILDREN
-  case GEOMOp::OpHideChildren:   // POPUP - HIDE CHILDREN
-    OnShowHideChildren( theCommandID == GEOMOp::OpShowChildren );
+  case GEOMOp::OpDiscloseChildren:   // POPUP - SHOW CHILDREN
+  case GEOMOp::OpConcealChildren:   // POPUP - HIDE CHILDREN
+    OnDiscloseConcealChildren( theCommandID == GEOMOp::OpDiscloseChildren );
     break;
   case GEOMOp::OpPointMarker:    // POPUP - POINT MARKER
     OnPointMarker();
@@ -647,6 +647,42 @@ bool GEOMToolsGUI::Import()
       CORBA::String_var fileN = fileName.toLatin1().constData();
       CORBA::String_var fileT = aCurrentType.toLatin1().constData();
 
+      // jfa 21.08.2012 for mantis issue 21511 (STEP file units)
+      CORBA::String_var aUnits = aInsOp->ReadValue(fileN, fileT, "LEN_UNITS");
+      TCollection_AsciiString aUnitsStr (aUnits.in());
+      bool needConvert = true;
+      if (aUnitsStr.IsEmpty() || aUnitsStr == "UNIT_M")
+        needConvert = false;
+
+      if (needConvert) {
+        if (igesAnswer == SUIT_MessageBox::NoToAll) {
+          // converting for all files is already approved
+          fileT = (aCurrentType + "_SCALE").toLatin1().constData();
+        }
+        else if (igesAnswer != SUIT_MessageBox::YesToAll) {
+          SUIT_MessageBox::StandardButtons btns = SUIT_MessageBox::Yes | SUIT_MessageBox::No;
+          if (i < fileNames.count() - 1) btns = btns | SUIT_MessageBox::YesToAll | SUIT_MessageBox::NoToAll;
+          igesAnswer = SUIT_MessageBox::question(app->desktop(),
+                                                 "Question",//tr("WRN_WARNING"),
+                                                 tr("GEOM_SCALE_DIMENSIONS"),
+                                                 btns | SUIT_MessageBox::Cancel,
+                                                 SUIT_MessageBox::No);
+          switch (igesAnswer) {
+          case SUIT_MessageBox::Cancel:
+            return false;                // cancel (break) import operation
+          case SUIT_MessageBox::Yes:
+          case SUIT_MessageBox::YesToAll:
+            break;                       // scaling is confirmed
+          case SUIT_MessageBox::No:
+          case SUIT_MessageBox::NoAll:
+            fileT = (aCurrentType + "_SCALE").toLatin1().constData();
+          default:
+            break;                       // scaling is rejected
+          } // switch ( igesAnswer )
+        } // if ( igeAnswer != NoToAll )
+      } // if ( needConvert )
+
+      /*
       // skl 29.05.2009
       if ( aCurrentType == "IGES" ) {
         GEOM::GEOM_Object_var anObj = aInsOp->ImportFile( fileN, "IGES_UNIT" );
@@ -684,6 +720,9 @@ bool GEOMToolsGUI::Import()
         } // if ( needConvert )
       } // if ( aCurrentType == "IGES" )
       else if ( aCurrentType == "ACIS" ) {
+      */
+
+      if ( aCurrentType == "ACIS" ) {
         if ( acisAnswer != SUIT_MessageBox::YesToAll && acisAnswer != SUIT_MessageBox::NoToAll ) {
           SUIT_MessageBox::StandardButtons btns = SUIT_MessageBox::Yes | SUIT_MessageBox::No;
           if ( i < fileNames.count()-1 ) btns = btns | SUIT_MessageBox::YesToAll | SUIT_MessageBox::NoToAll;
@@ -697,6 +736,7 @@ bool GEOMToolsGUI::Import()
         } // if ( acisAnswer != YesToAll && acisAnswer != NoToAll )
       } // else if ( aCurrentType == "ACIS" )
 
+      // IMPORT
       GEOM::GEOM_Object_var anObj = aInsOp->ImportFile( fileN, fileT );
 
       if ( !anObj->_is_nil() && aInsOp->IsDone() ) {
index 4241124f648abd30e3f49fff5f52faafd68123fc..8b6c32c78f1f8f3aa9e2270bf2675c1f3f6d4b89 100644 (file)
 #include "GEOM_ToolsGUI.hxx"
 
 #include <GEOMGUI.h>
-
 #include <SALOMEDSClient.hxx>
 
 class GEOM_Displayer;
 class SALOME_View;
 class SALOME_ListIO;
+class SalomeApp_Study;
+class SVTK_View;
+class QColor;
+class Handle_SALOME_InteractiveObject;
+class Handle_AIS_InteractiveContext;
 
 #include <QList>
 
@@ -54,6 +58,8 @@ public:
 
   enum ActionType { SHOWDLG, INCR, DECR };
 
+  static void  SetColor( const QString&, const QColor&, bool );
+
 private:
   // Import and export topology methods
   bool         Import();
@@ -71,7 +77,7 @@ private:
   void         OnNbIsos( ActionType actionType = SHOWDLG );
   void         OnDeflection();
   void         OnSelectOnly(int mode);
-  void         OnShowHideChildren( bool );
+  void         OnDiscloseConcealChildren( bool );
   void         OnUnpublishObject();
   void         OnPublishObject() ;
   void         OnPointMarker();
@@ -89,6 +95,18 @@ private:
                                          _PTR(Study),
                                          QList<SALOME_View*>,
                                          GEOM_Displayer* );
+
+  static void setVtkColor( SalomeApp_Study* study,
+                          int mgrId,
+                          SVTK_View* view,
+                          const Handle_SALOME_InteractiveObject& IO,
+                          const QColor& color );
+
+  static void setOccColor( SalomeApp_Study* study,
+                          int mgrId,
+                          const Handle_AIS_InteractiveContext& ic,
+                          const Handle_SALOME_InteractiveObject& IO,
+                          const QColor& color );
 };
 
 #endif // GEOMTOOLSGUI_H
index 64983d176e5ecc88111b8ae8dee4a52dcfadd430..c73767ca25426240a91503d6456983584dc0619c 100644 (file)
 // VTK includes
 #include <vtkRenderer.h>
 
+// If the next macro is defined, autocolor feature works for all sub-shapes;
+// if it is undefined, autocolor feature works for groups only
+//#define GENERAL_AUTOCOLOR
+// Below macro, when uncommented, switches on simplified (more performant) algorithm
+// of auto-color picking up
+//#define SIMPLE_AUTOCOLOR
+
 void GEOMToolsGUI::OnCheckGeometry()
 {
   SalomeApp_Application* app =
@@ -163,12 +170,18 @@ void GEOMToolsGUI::OnAutoColor()
     if( CORBA::is_nil( aChildObject ) )
       continue;
 
+#ifndef GENERAL_AUTOCOLOR // auto-color for groups only
     if( aChildObject->GetType() != GEOM_GROUP )
       continue;
+#endif                    // GENERAL_AUTOCOLOR
 
+#ifdef SIMPLE_AUTOCOLOR   // simplified algorithm for auto-colors
+    SALOMEDS::Color aColor = GEOM_Displayer::getPredefinedUniqueColor();
+#else                     // old algorithm  for auto-colors
     SALOMEDS::Color aColor = GEOM_Displayer::getUniqueColor( aReservedColors );
-    aChildObject->SetColor( aColor );
     aReservedColors.append( aColor );
+#endif                    // SIMPLE_AUTOCOLOR
+    aChildObject->SetColor( aColor );
 
     QColor c( (int)( aColor.R * 255.0 ), (int)( aColor.G * 255.0 ), (int)( aColor.B * 255.0 ) );
 
@@ -267,151 +280,246 @@ void GEOMToolsGUI::OnDisableAutoColor()
     return;
 
   aMainObject->SetAutoColor( false );
+}
+
+void GEOMToolsGUI::SetColor( const QString& entry, const QColor& color, bool updateViewer )
+{
+  if ( entry.isEmpty() || !color.isValid() ) return;
+
+  // get active application
+  SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+  if ( !app ) return;
+
+  // get current study
+  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+  if ( !appStudy ) return;
+
+  // get active view
+  SUIT_ViewWindow* window = app->desktop()->activeWindow();
+  if ( !window ) return;
+  
+  bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
+  bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
+
+  // get view id
+  int mgrId = window->getViewManager()->getGlobalId();
+
+  Handle(SALOME_InteractiveObject) IO =
+    new SALOME_InteractiveObject( entry.toLatin1().data(), "GEOM", "");
 
+  if ( isVTK ) {
+    SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
+    if ( !vtkVW ) return;
+    SVTK_View* aView = vtkVW->getView();
+
+    GEOMToolsGUI::setVtkColor( appStudy, mgrId, aView, IO, color );
+    if ( updateViewer ) aView->Repaint();
+  }
+  else if ( isOCC ) {
+    OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*> ( window->getViewManager()->getViewModel() );
+    Handle (AIS_InteractiveContext) ic = vm->getAISContext();
+    GEOMToolsGUI::setOccColor( appStudy, mgrId, ic, IO, color ); 
+    if ( updateViewer ) ic->UpdateCurrentViewer();
+  }
+
+  // mark study as modified
+  GeometryGUI::Modified();
+  
+  // update actions
+  app->updateActions(); //SRN: To update a Save button in the toolbar
 }
 
 void GEOMToolsGUI::OnColor()
 {
-  SALOME_ListIO selected;
+  // get active application
   SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+  if ( !app ) return;
+
+  // get current study
   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
-  if ( app && appStudy ) {
-    LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
-    if ( aSelMgr ) {
-      aSelMgr->selectedObjects( selected );
-      if ( !selected.IsEmpty() ) {
-        SUIT_ViewWindow* window = app->desktop()->activeWindow();
-        bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
-        bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
-        int mgrId = window->getViewManager()->getGlobalId();
-        if ( isVTK ) {
-          SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
-          if ( !vtkVW )
-            return;
-          SVTK_View* aView = vtkVW->getView();
-          QColor initcolor = aView->GetColor( selected.First()  );
-          QColor c = QColorDialog::getColor( initcolor, app->desktop() );
-          if ( c.isValid() ) {
-            SUIT_OverrideCursor();
-            for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
-              QString matProp;
-              matProp = appStudy->getObjectProperty(mgrId,It.Value()->getEntry(), MATERIAL_PROP, matProp).toString();
-              Material_Model material;
-              material.fromProperties( matProp );
-              if ( !material.isPhysical() ) {
-                aView->SetColor( It.Value(), c );
-                appStudy->setObjectProperty(mgrId,It.Value()->getEntry(),COLOR_PROP, c);
-              }
-              // store color to GEOM_Object
-              _PTR(Study) aStudy = appStudy->studyDS();
-              _PTR(SObject) aSObject( aStudy->FindObjectID( It.Value()->getEntry() ) );
-              GEOM::GEOM_Object_var anObject =
-              GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObject));
-              SALOMEDS::Color aSColor;
-              aSColor.R = (double)c.red() / 255.0;
-              aSColor.G = (double)c.green() / 255.0;
-              aSColor.B = (double)c.blue() / 255.0;
-              anObject->SetColor( aSColor );
-              anObject->SetAutoColor( false );          
-            }
-            GeometryGUI::Modified();
-          }
-        } // if ( isVTK )
-        else if ( isOCC ) {
-               Handle(AIS_InteractiveObject) io = GEOMBase::GetAIS( selected.First() );
-          if ( !io.IsNull() ) {
-            Quantity_Color aColor;
-            io->Color( aColor ); 
-            QColor ic = QColor((int )( aColor.Red() * 255.0 ),
-                             (int)( aColor.Green() * 255.0 ),
-                             (int)( aColor.Blue() * 255.0 ));      
-
-                             QVariant v = appStudy->getObjectProperty(mgrId,selected.First()->getEntry(), COLOR_PROP, ic);
-
-            QColor initcolor = v.value<QColor>();
-            QColor c =  QColorDialog::getColor( initcolor, app->desktop() );
-            if ( c.isValid() ) {
-              SUIT_OverrideCursor();
-              aColor = Quantity_Color( c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB );
-              OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*> ( window->getViewManager()->getViewModel() );
-              Handle (AIS_InteractiveContext) ic = vm->getAISContext();
-              for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
-                QString matProp;
-                matProp = appStudy->getObjectProperty(mgrId,It.Value()->getEntry(), MATERIAL_PROP, matProp).toString();
-               Material_Model material;
-               material.fromProperties( matProp );
-                io = GEOMBase::GetAIS( It.Value(), true );
-                if ( !io.IsNull()  && !material.isPhysical() ) { // change color only for shapes with not physical type of material
-                  
-                  if ( io->IsKind( STANDARD_TYPE(AIS_Shape) ) ) {
-                    TopoDS_Shape theShape = Handle(AIS_Shape)::DownCast( io )->Shape();
-                    bool onlyVertex = (theShape.ShapeType() == TopAbs_VERTEX || GEOM_Displayer::isCompoundOfVertices( theShape ));
-                    if (onlyVertex) {
-                      // Set color for a point
-
-                      Handle(AIS_Drawer) aCurDrawer = io->Attributes();
-                      Handle(Prs3d_PointAspect) aCurPointAspect =  aCurDrawer->PointAspect();
-                      Quantity_Color aCurColor;
-                      Standard_Real aCurScale;
-                      Aspect_TypeOfMarker aCurTypeOfMarker;
-                      aCurPointAspect->Aspect()->Values( aCurColor, aCurTypeOfMarker, aCurScale );
-                      if ( aCurTypeOfMarker != Aspect_TOM_USERDEFINED ) {
-                        aCurDrawer->SetPointAspect(new Prs3d_PointAspect(aCurTypeOfMarker, aColor, aCurScale));
-                      }
-                      else {
-                        Standard_Integer aWidth, aHeight;
-                        aCurPointAspect->GetTextureSize( aWidth, aHeight );
+  if ( !appStudy ) return;
 
-#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
-                        Handle(TColStd_HArray1OfByte) aTexture = aCurPointAspect->GetTexture();
-#else
-                        Handle(Graphic3d_HArray1OfBytes) aTexture = aCurPointAspect->GetTexture();
-#endif
+  // get selection manager
+  LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+  if ( !aSelMgr ) return;
 
-                        aCurDrawer->SetPointAspect(new Prs3d_PointAspect(aColor, 1, aWidth, aHeight, aTexture));
-                      }
-                      ic->SetLocalAttributes(io, aCurDrawer, Standard_False);
-                    }
-                  }
-
-                  io->SetColor( aColor );
-                  if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) ) {
-                    Handle(GEOM_AISShape) aGAISShape = Handle(GEOM_AISShape)::DownCast( io );
-                    aGAISShape->SetShadingColor( aColor );
-                    aGAISShape->storeBoundaryColors();
-                  }
-
-                  appStudy->setObjectProperty(mgrId,It.Value()->getEntry(), COLOR_PROP, c);
-                 
-                  io->Redisplay( Standard_True );
-
-                  // store color to GEOM_Object
-                  _PTR(Study) aStudy = appStudy->studyDS();
-                  _PTR(SObject) aSObject( aStudy->FindObjectID( It.Value()->getEntry() ) );
-                  GEOM::GEOM_Object_var anObject =
-                    GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObject));
-
-
-                  SALOMEDS::Color aSColor;
-                  aSColor.R = (double)c.red() / 255.0;
-                  aSColor.G = (double)c.green() / 255.0;
-                  aSColor.B = (double)c.blue() / 255.0;
-                  anObject->SetColor( aSColor );
-                  anObject->SetAutoColor( false );              
-                }
-              } // for
-              ic->UpdateCurrentViewer();
-              GeometryGUI::Modified();
-            } // if c.isValid()
-          } // first IO is not null
-        } // if ( isOCC )
-      } // if ( selection not empty )
+  // get selection
+  SALOME_ListIO selected;
+  aSelMgr->selectedObjects( selected );
+  if ( selected.IsEmpty() ) return;
+  
+  // get active view
+  SUIT_ViewWindow* window = app->desktop()->activeWindow();
+  bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
+  bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
+
+  // get view id
+  int mgrId = window->getViewManager()->getGlobalId();
+
+  if ( isVTK ) {
+    SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
+    if ( !vtkVW ) return;
+
+    // get initial color (use first object from selection)
+    SVTK_View* aView = vtkVW->getView();
+    QColor color = aView->GetColor( selected.First()  );
+    QVariant v = appStudy->getObjectProperty( mgrId, selected.First()->getEntry(), COLOR_PROP, color );
+
+    // show Choose Color dialog box
+    color = QColorDialog::getColor( v.value<QColor>(), app->desktop() );
+    if ( !color.isValid() ) return;
+
+    // iterate through list of objects and assign new color
+    SUIT_OverrideCursor();
+    for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
+      GEOMToolsGUI::setVtkColor( appStudy, mgrId, aView, It.Value(), color ); 
+    }
+    aView->Repaint();
+  }
+  else if ( isOCC ) {
+    // find AIS interactive object (for first item in selection)
+    Handle(AIS_InteractiveObject) io = GEOMBase::GetAIS( selected.First() );
+    if ( io.IsNull() ) return;
+
+    // get initial color (use first object from selection)
+    Quantity_Color aColor;
+    io->Color( aColor ); 
+    QColor color = QColor((int)( aColor.Red()   * 255.0 ),
+                         (int)( aColor.Green() * 255.0 ),
+                         (int)( aColor.Blue()  * 255.0 ));
+    QVariant v = appStudy->getObjectProperty( mgrId, selected.First()->getEntry(), COLOR_PROP, color );
+
+    // show Choose Color dialog box
+    color = QColorDialog::getColor( v.value<QColor>(), app->desktop() );
+    if ( !color.isValid() ) return;
+
+    // iterate through list of objects and assign new color
+    SUIT_OverrideCursor();
+    OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*> ( window->getViewManager()->getViewModel() );
+    Handle (AIS_InteractiveContext) ic = vm->getAISContext();
+    for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
+      GEOMToolsGUI::setOccColor( appStudy, mgrId, ic, It.Value(), color ); 
     }
+    ic->UpdateCurrentViewer();
   }
 
+  // mark study as modified
+  GeometryGUI::Modified();
+  
+  // update actions
   app->updateActions(); //SRN: To update a Save button in the toolbar
 }
 
+
+void GEOMToolsGUI::setVtkColor( SalomeApp_Study* study,                     // study
+                               int mgrId,                                  // view window id
+                               SVTK_View* view,                            // VTK view
+                               const Handle(SALOME_InteractiveObject)& IO, // interactive object
+                               const QColor& color )                       // color 
+{
+  // get material property
+  QString matProp;
+  matProp = study->getObjectProperty( mgrId, IO->getEntry(), MATERIAL_PROP, matProp ).toString();
+  Material_Model material;
+  material.fromProperties( matProp );
+
+  // change color only for shapes with not physical type of material
+  if ( !material.isPhysical() ) {
+    view->SetColor( IO, color );
+    study->setObjectProperty( mgrId, IO->getEntry(), COLOR_PROP, color );
+  }
+
+  // store color to GEOM_Object
+  _PTR(Study) aStudy = study->studyDS();
+  _PTR(SObject) aSObject( aStudy->FindObjectID( IO->getEntry() ) );
+  if ( !aSObject ) return;
+
+  GEOM::GEOM_Object_var anObject =
+    GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObject));
+
+  if ( CORBA::is_nil( anObject ) ) return;
+
+  SALOMEDS::Color aSColor;
+  aSColor.R = (double)color.red() / 255.0;
+  aSColor.G = (double)color.green() / 255.0;
+  aSColor.B = (double)color.blue() / 255.0;
+  anObject->SetColor( aSColor );
+  anObject->SetAutoColor( false );
+}
+
+void GEOMToolsGUI::setOccColor( SalomeApp_Study* study,                     // study
+                               int mgrId,                                  // view window id
+                               const Handle(AIS_InteractiveContext)& ic,   // OCC interactive context
+                               const Handle(SALOME_InteractiveObject)& IO, // interactive object
+                               const QColor& color )                       // color 
+{
+  // get AIS object
+  Handle(AIS_InteractiveObject) io = GEOMBase::GetAIS( IO, true );
+  if ( io.IsNull() ) return;
+
+  // get material property
+  QString matProp;
+  matProp = study->getObjectProperty( mgrId, IO->getEntry(), MATERIAL_PROP, matProp ).toString();
+  Material_Model material;
+  material.fromProperties( matProp );
+
+  Quantity_Color aColor = Quantity_Color( color.red() / 255., color.green() / 255., color.blue() / 255., Quantity_TOC_RGB );
+             
+  // change color only for shapes with not physical type of material
+  if ( !material.isPhysical() ) {
+    if ( io->IsKind( STANDARD_TYPE(AIS_Shape) ) ) {
+      TopoDS_Shape theShape = Handle(AIS_Shape)::DownCast( io )->Shape();
+      bool onlyVertex = (theShape.ShapeType() == TopAbs_VERTEX || GEOM_Displayer::isCompoundOfVertices( theShape ));
+      if ( onlyVertex ) {
+       // set color for a point
+       Handle(AIS_Drawer) aCurDrawer = io->Attributes();
+       Handle(Prs3d_PointAspect) aCurPointAspect =  aCurDrawer->PointAspect();
+       Quantity_Color aCurColor;
+       Standard_Real aCurScale;
+       Aspect_TypeOfMarker aCurTypeOfMarker;
+       aCurPointAspect->Aspect()->Values( aCurColor, aCurTypeOfMarker, aCurScale );
+       if ( aCurTypeOfMarker != Aspect_TOM_USERDEFINED ) {
+         aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aCurTypeOfMarker, aColor, aCurScale ) );
+       }
+       else {
+         Standard_Integer aWidth, aHeight;
+         aCurPointAspect->GetTextureSize( aWidth, aHeight );
+#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
+         Handle(TColStd_HArray1OfByte) aTexture = aCurPointAspect->GetTexture();
+#else
+         Handle(Graphic3d_HArray1OfBytes) aTexture = aCurPointAspect->GetTexture();
+#endif
+         aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aColor, 1, aWidth, aHeight, aTexture ) );
+       }
+       ic->SetLocalAttributes( io, aCurDrawer, Standard_False );
+      }
+    }
+    
+    io->SetColor( aColor );
+    if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) ) {
+      Handle(GEOM_AISShape) aGAISShape = Handle(GEOM_AISShape)::DownCast( io );
+      aGAISShape->SetShadingColor( aColor );
+      aGAISShape->storeBoundaryColors();
+    }
+
+    io->Redisplay( Standard_True );
+
+    study->setObjectProperty( mgrId, IO->getEntry(), COLOR_PROP, color );
+  }    
+
+  // store color to GEOM_Object
+  _PTR(Study) aStudy = study->studyDS();
+  _PTR(SObject) aSObject( aStudy->FindObjectID( IO->getEntry() ) );
+  GEOM::GEOM_Object_var anObject =
+    GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObject));
+  SALOMEDS::Color aSColor;
+  aSColor.R = (double)color.red() / 255.0;
+  aSColor.G = (double)color.green() / 255.0;
+  aSColor.B = (double)color.blue() / 255.0;
+  anObject->SetColor( aSColor );
+  anObject->SetAutoColor( false );              
+}
+
 void GEOMToolsGUI::OnTexture()
 {
   SALOME_ListIO selected;
@@ -844,7 +952,7 @@ void GEOMToolsGUI::OnSelectOnly(int mode)
   }
 }
 
-void GEOMToolsGUI::OnShowHideChildren( bool show )
+void GEOMToolsGUI::OnDiscloseConcealChildren( bool show )
 {
   SALOME_ListIO selected;
   SalomeApp_Application* app =
index 47979c7b00e753c8da8281c3e0540c60f52facc9..b5d674b7f212f3adb492a32c7b0940da3a6588af 100644 (file)
@@ -18,7 +18,6 @@
 // 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>
 
@@ -277,6 +276,29 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnSurfaceByCoord
   return GetObject(anObject);
 }
 
+//=============================================================================
+/*!
+ *  MakePointOnFace
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnFace (GEOM::GEOM_Object_ptr theFace)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Get the reference face
+  Handle(GEOM_Object) aReference = GetObjectImpl(theFace);
+  if (aReference.IsNull()) return aGEOMObject._retn();
+
+  //Create the point
+  Handle(GEOM_Object) anObject = GetOperations()->MakePointOnFace(aReference);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
 
 //=============================================================================
 /*!
index 841a0822154a505c09cf7e1f8f5b87b4fa3a04ea..7861a06bc5ff92165511f9fbe59e4874bc04e06a 100644 (file)
@@ -18,7 +18,6 @@
 // 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_IBasicOperations_i_HeaderFile
 #define _GEOM_IBasicOperations_i_HeaderFile
@@ -73,6 +72,8 @@ class GEOM_I_EXPORT GEOM_IBasicOperations_i :
                                                     CORBA::Double theYParameter,
                                                     CORBA::Double theZParameter);
 
+   GEOM::GEOM_Object_ptr MakePointOnFace (GEOM::GEOM_Object_ptr theFace);
+
    GEOM::GEOM_Object_ptr MakePointOnLinesIntersection (GEOM::GEOM_Object_ptr theLine1,
                                                       GEOM::GEOM_Object_ptr theLine2);
 
index 0c1917d46ca96d78e93a33c1903b99f6f922ade9..c71432528a43e0597f7e7fbc411e0332bab9365f 100644 (file)
@@ -18,7 +18,6 @@
 // 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>
 
@@ -742,6 +741,39 @@ char* GEOM_IBlocksOperations_i::PrintBCErrors
   return CORBA::string_dup(aDescr.ToCString());
 }
 
+//=============================================================================
+/*!
+ *  GetNonBlocks
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetNonBlocks
+                                      (GEOM::GEOM_Object_ptr theShape,
+                                       GEOM::GEOM_Object_out theNonQuads)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+  GEOM::GEOM_Object_var aNonQuads;
+
+  theNonQuads = aNonQuads._retn();
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Get the reference Objects
+  Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
+  if (aShape.IsNull()) return aGEOMObject._retn();
+
+  //Get the result
+  Handle(GEOM_Object) aFaces;
+  Handle(GEOM_Object) anObject = GetOperations()->GetNonBlocks(aShape, aFaces);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
+  if (!aFaces.IsNull())
+    theNonQuads = GetObject(aFaces);
+
+  return GetObject(anObject);
+}
+
 //=============================================================================
 /*!
  *  RemoveExtraEdges
index a801a1e7e5008d88a11b45a515a8b4192684c0e7..6f57650923bd58d990989574d4b7574260341b57 100644 (file)
@@ -18,7 +18,6 @@
 // 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_IBlocksOperations_i_HeaderFile
 #define _GEOM_IBlocksOperations_i_HeaderFile
@@ -121,6 +120,9 @@ class GEOM_I_EXPORT GEOM_IBlocksOperations_i :
   char* PrintBCErrors (GEOM::GEOM_Object_ptr theCompound,
                       const GEOM::GEOM_IBlocksOperations::BCErrors& theErrors);
 
+  GEOM::GEOM_Object_ptr GetNonBlocks (GEOM::GEOM_Object_ptr theShape,
+                                      GEOM::GEOM_Object_out theNonQuads);
+
   GEOM::GEOM_Object_ptr RemoveExtraEdges (GEOM::GEOM_Object_ptr theShape,
                                           CORBA::Long           theOptimumNbFaces);
 
index b5109c9bbe65300e268033e1532908662add8d10..3f1a678005b23b4fd114e9e0c80dff46f3d7497d 100644 (file)
@@ -18,7 +18,6 @@
 // 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>
 
@@ -433,13 +432,15 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolation
  *  MakeCurveParametric
  */
 //=============================================================================
-GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametric(const char* thexExpr, const char* theyExpr, const char* thezExpr, 
-                                                                   double theParamMin, double theParamMax, double theParamStep, 
-                                                                   GEOM::curve_type theCurveType) {
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametric
+             (const char* thexExpr, const char* theyExpr, const char* thezExpr,
+              double theParamMin, double theParamMax, double theParamStep,
+              GEOM::curve_type theCurveType)
+{
   GEOM::GEOM_Object_var aGEOMObject;
   //Set a not done flag
   GetOperations()->SetNotDone();
-  
+
   GEOMImpl_ICurvesOperations::CurveType aType;
   switch(theCurveType) {
   case GEOM::Polyline:
@@ -453,18 +454,17 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametric(const char*
     break;
   default:
     break;
-  }  
-  
+  }
 
   // Make Polyline
   Handle(GEOM_Object) anObject =
-    GetOperations()->MakeCurveParametric(thexExpr, theyExpr, thezExpr, 
-                                          theParamMin, theParamMax, 
-                                          theParamStep, aType);
-  
+    GetOperations()->MakeCurveParametric(thexExpr, theyExpr, thezExpr,
+                                         theParamMin, theParamMax,
+                                         theParamStep, aType);
+
   if (!GetOperations()->IsDone() || anObject.IsNull())
-    return aGEOMObject._retn();  
-  
+    return aGEOMObject._retn();
+
   return GetObject(anObject);
 }
 
@@ -473,13 +473,15 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametric(const char*
  *  MakeCurveParametricNew
  */
 //=============================================================================
-GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametricNew(const char* thexExpr, const char* theyExpr, const char* thezExpr, 
-                                    double theParamMin, double theParamMax, CORBA::Long theParamNbStep, 
-                                    GEOM::curve_type theCurveType) {
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametricNew
+             (const char* thexExpr, const char* theyExpr, const char* thezExpr,
+              double theParamMin, double theParamMax, CORBA::Long theParamNbStep,
+              GEOM::curve_type theCurveType)
+{
   GEOM::GEOM_Object_var aGEOMObject;
   //Set a not done flag
   GetOperations()->SetNotDone();
-  
+
   GEOMImpl_ICurvesOperations::CurveType aType;
   switch(theCurveType) {
   case GEOM::Polyline:
@@ -493,18 +495,17 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametricNew(const cha
     break;
   default:
     break;
-  }  
-  
+  }
 
   // Make Polyline
   Handle(GEOM_Object) anObject =
-    GetOperations()->MakeCurveParametric(thexExpr, theyExpr, thezExpr, 
-                       theParamMin, theParamMax, 
+    GetOperations()->MakeCurveParametric(thexExpr, theyExpr, thezExpr,
+                       theParamMin, theParamMax,
                        0.0, aType, theParamNbStep, true);
-  
+
   if (!GetOperations()->IsDone() || anObject.IsNull())
-    return aGEOMObject._retn();  
-  
+    return aGEOMObject._retn();
+
   return GetObject(anObject);
 }
 
@@ -536,24 +537,20 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher
 
 //=============================================================================
 /*!
- *  Make3DSketcher
+ *  MakeSketcherOnPlane
  */
 //=============================================================================
-GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::Make3DSketcher
-            (const GEOM::ListOfDouble& theCoordinates)
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane
+                (const char* theCommand, GEOM::GEOM_Object_ptr theWorkingPlane)
 {
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  int ind = 0;
-  int aLen = theCoordinates.length();
-  std::list<double> aCoords;
-  for (; ind < aLen; ind++)
-    aCoords.push_back(theCoordinates[ind]);
+  Handle(GEOM_Object) aWorkingPlane = GetObjectImpl(theWorkingPlane);
 
   // Make Sketcher
   Handle(GEOM_Object) anObject =
-    GetOperations()->Make3DSketcher(aCoords);
+      GetOperations()->MakeSketcherOnPlane(theCommand, aWorkingPlane);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return GEOM::GEOM_Object::_nil();
 
@@ -562,20 +559,42 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::Make3DSketcher
 
 //=============================================================================
 /*!
- *  MakeSketcherOnPlane
+ *  Make3DSketcherCommand
  */
 //=============================================================================
-GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane
-                (const char* theCommand, GEOM::GEOM_Object_ptr theWorkingPlane)
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::Make3DSketcherCommand (const char* theCommand)
 {
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  Handle(GEOM_Object) aWorkingPlane = GetObjectImpl(theWorkingPlane);
+  // Make 3D Sketcher
+  Handle(GEOM_Object) anObject = GetOperations()->Make3DSketcherCommand(theCommand);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return GEOM::GEOM_Object::_nil();
+
+  return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ *  Make3DSketcher
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::Make3DSketcher
+            (const GEOM::ListOfDouble& theCoordinates)
+{
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  int ind = 0;
+  int aLen = theCoordinates.length();
+  std::list<double> aCoords;
+  for (; ind < aLen; ind++)
+    aCoords.push_back(theCoordinates[ind]);
 
   // Make Sketcher
   Handle(GEOM_Object) anObject =
-      GetOperations()->MakeSketcherOnPlane(theCommand, aWorkingPlane);
+    GetOperations()->Make3DSketcher(aCoords);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return GEOM::GEOM_Object::_nil();
 
index 5fc09cc55f929cf553076441168b28faacf1a563..e50ab2111f0a92d59f7d45b5bdd9274785bf1c34 100644 (file)
@@ -18,7 +18,6 @@
 // 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_ICurvesOperations_i_HeaderFile
 #define _GEOM_ICurvesOperations_i_HeaderFile
 
 #include "GEOMImpl_ICurvesOperations.hxx"
 
-class GEOM_I_EXPORT GEOM_ICurvesOperations_i : 
+class GEOM_I_EXPORT GEOM_ICurvesOperations_i :
     public virtual POA_GEOM::GEOM_ICurvesOperations,
     public virtual GEOM_IOperations_i
 {
  public:
   GEOM_ICurvesOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine,
-                           ::GEOMImpl_ICurvesOperations* theImpl);
+                            ::GEOMImpl_ICurvesOperations* theImpl);
   ~GEOM_ICurvesOperations_i();
 
   GEOM::GEOM_Object_ptr MakeCirclePntVecR (GEOM::GEOM_Object_ptr theCenter,
-                                          GEOM::GEOM_Object_ptr theVector,
-                                          double theR);
+                                           GEOM::GEOM_Object_ptr theVector,
+                                           double theR);
 
   GEOM::GEOM_Object_ptr MakeCircleThreePnt (GEOM::GEOM_Object_ptr thePnt1,
-                                           GEOM::GEOM_Object_ptr thePnt2,
-                                           GEOM::GEOM_Object_ptr thePnt3);
+                                            GEOM::GEOM_Object_ptr thePnt2,
+                                            GEOM::GEOM_Object_ptr thePnt3);
 
   GEOM::GEOM_Object_ptr MakeCircleCenter2Pnt (GEOM::GEOM_Object_ptr thePnt1,
-                                             GEOM::GEOM_Object_ptr thePnt2,
-                                             GEOM::GEOM_Object_ptr thePnt3);
+                                              GEOM::GEOM_Object_ptr thePnt2,
+                                              GEOM::GEOM_Object_ptr thePnt3);
 
   GEOM::GEOM_Object_ptr MakeEllipse (GEOM::GEOM_Object_ptr theCenter,
-                                    GEOM::GEOM_Object_ptr theVector,
-                                    double theRMajor, double theRMinor);
+                                     GEOM::GEOM_Object_ptr theVector,
+                                     double theRMajor, double theRMinor);
 
   GEOM::GEOM_Object_ptr MakeEllipseVec (GEOM::GEOM_Object_ptr theCenter,
-                                       GEOM::GEOM_Object_ptr theVector,
-                                       double theRMajor, double theRMinor,
-                                       GEOM::GEOM_Object_ptr theVectorMajor);
+                                        GEOM::GEOM_Object_ptr theVector,
+                                        double theRMajor, double theRMinor,
+                                        GEOM::GEOM_Object_ptr theVectorMajor);
 
   GEOM::GEOM_Object_ptr MakeArc (GEOM::GEOM_Object_ptr thePnt1,
-                                GEOM::GEOM_Object_ptr thePnt2,
-                                GEOM::GEOM_Object_ptr thePnt3);
-  
+                                 GEOM::GEOM_Object_ptr thePnt2,
+                                 GEOM::GEOM_Object_ptr thePnt3);
+
   GEOM::GEOM_Object_ptr MakeArcCenter (GEOM::GEOM_Object_ptr thePnt1,
                                        GEOM::GEOM_Object_ptr thePnt2,
                                        GEOM::GEOM_Object_ptr thePnt3,
                                        bool theSense);
 
   GEOM::GEOM_Object_ptr MakeArcOfEllipse (GEOM::GEOM_Object_ptr thePnt1,
-                                         GEOM::GEOM_Object_ptr thePnt2,
-                                         GEOM::GEOM_Object_ptr thePnt3);
-  
+                                          GEOM::GEOM_Object_ptr thePnt2,
+                                          GEOM::GEOM_Object_ptr thePnt3);
+
   GEOM::GEOM_Object_ptr MakePolyline (const GEOM::ListOfGO& thePoints,
                                       CORBA::Boolean        theIsClosed);
 
@@ -86,20 +85,24 @@ class GEOM_I_EXPORT GEOM_ICurvesOperations_i :
                                                  CORBA::Boolean        theIsClosed,
                                                  CORBA::Boolean        theDoReordering);
 
-  GEOM::GEOM_Object_ptr MakeCurveParametric(const char* thexExpr, const char* theyExpr, const char* thezExpr, 
-                                           double theParamMin, double theParamMax, double theParamStep, 
-                                           GEOM::curve_type theCurveType);
-  
-  GEOM::GEOM_Object_ptr MakeCurveParametricNew(const char* thexExpr, const char* theyExpr, const char* thezExpr, 
-                        double theParamMin, double theParamMax, CORBA::Long theParamNbStep, 
-                        GEOM::curve_type theCurveType);
+  GEOM::GEOM_Object_ptr MakeCurveParametric
+    (const char* thexExpr, const char* theyExpr, const char* thezExpr,
+     double theParamMin, double theParamMax, double theParamStep,
+     GEOM::curve_type theCurveType);
+
+  GEOM::GEOM_Object_ptr MakeCurveParametricNew
+    (const char* thexExpr, const char* theyExpr, const char* thezExpr,
+     double theParamMin, double theParamMax, CORBA::Long theParamNbStep,
+     GEOM::curve_type theCurveType);
 
   GEOM::GEOM_Object_ptr MakeSketcher (const char* theCommand, const GEOM::ListOfDouble& theWorkingPlane);
-  
-  GEOM::GEOM_Object_ptr Make3DSketcher (const GEOM::ListOfDouble& theCoordinates);
 
   GEOM::GEOM_Object_ptr MakeSketcherOnPlane (const char* theCommand, GEOM::GEOM_Object_ptr theWorkingPlane);
 
+  GEOM::GEOM_Object_ptr Make3DSketcherCommand (const char* theCommand);
+
+  GEOM::GEOM_Object_ptr Make3DSketcher (const GEOM::ListOfDouble& theCoordinates);
+
   ::GEOMImpl_ICurvesOperations* GetOperations()
   { return (::GEOMImpl_ICurvesOperations*)GetImpl(); }
 };
index 3a8cef597d2d833c0ae93d92d2682e1c2c1cd1aa..60a26e129bece1f5fd8fdf3bfe7d60900f3aead4 100644 (file)
@@ -18,7 +18,6 @@
 // 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>
 
@@ -202,7 +201,6 @@ void GEOM_IGroupOperations_i::UnionIDs (GEOM::GEOM_Object_ptr   theGroup,
 
   //Perform the operation
   GetOperations()->UnionIDs(aGroupRef, aSubShapes);
-  return;
 }
 
 //=============================================================================
@@ -230,7 +228,176 @@ void GEOM_IGroupOperations_i::DifferenceIDs (GEOM::GEOM_Object_ptr   theGroup,
 
   //Perform the operation
   GetOperations()->DifferenceIDs(aGroupRef, aSubShapes);
-  return;
+}
+
+//=============================================================================
+/*!
+ *  UnionGroups
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::UnionGroups (GEOM::GEOM_Object_ptr theGroup1,
+                                                            GEOM::GEOM_Object_ptr theGroup2)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Get the reference groups
+  Handle(GEOM_Object) aGroupRef1 = GetObjectImpl(theGroup1);
+  Handle(GEOM_Object) aGroupRef2 = GetObjectImpl(theGroup2);
+  if (aGroupRef1.IsNull() || aGroupRef2.IsNull()) return aGEOMObject._retn();
+
+  //Perform the operation
+  Handle(GEOM_Object) anObject = GetOperations()->UnionGroups(aGroupRef1, aGroupRef2);
+  if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ *  IntersectGroups
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::IntersectGroups (GEOM::GEOM_Object_ptr theGroup1,
+                                                                GEOM::GEOM_Object_ptr theGroup2)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Get the reference groups
+  Handle(GEOM_Object) aGroupRef1 = GetObjectImpl(theGroup1);
+  Handle(GEOM_Object) aGroupRef2 = GetObjectImpl(theGroup2);
+  if (aGroupRef1.IsNull() || aGroupRef2.IsNull()) return aGEOMObject._retn();
+
+  //Perform the operation
+  Handle(GEOM_Object) anObject = GetOperations()->IntersectGroups(aGroupRef1, aGroupRef2);
+  if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ *  CutGroups
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::CutGroups (GEOM::GEOM_Object_ptr theGroup1,
+                                                          GEOM::GEOM_Object_ptr theGroup2)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Get the reference groups
+  Handle(GEOM_Object) aGroupRef1 = GetObjectImpl(theGroup1);
+  Handle(GEOM_Object) aGroupRef2 = GetObjectImpl(theGroup2);
+  if (aGroupRef1.IsNull() || aGroupRef2.IsNull()) return aGEOMObject._retn();
+
+  //Perform the operation
+  Handle(GEOM_Object) anObject = GetOperations()->CutGroups(aGroupRef1, aGroupRef2);
+  if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ *  UnionListOfGroups
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::UnionListOfGroups (const GEOM::ListOfGO& theGList)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Get the reference groups
+  Handle(TColStd_HSequenceOfTransient) aGroups = new TColStd_HSequenceOfTransient;
+
+  int ind, aLen = theGList.length();
+  for (ind = 0; ind < aLen; ind++) {
+    Handle(GEOM_Object) aGr = GetObjectImpl(theGList[ind]);
+    if (aGr.IsNull()) return aGEOMObject._retn();
+    aGroups->Append(aGr);
+  }
+
+  //Perform the operation
+  Handle(GEOM_Object) anObject = GetOperations()->UnionListOfGroups(aGroups);
+  if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ *  IntersectListOfGroups
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::IntersectListOfGroups (const GEOM::ListOfGO& theGList)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Get the reference groups
+  Handle(TColStd_HSequenceOfTransient) aGroups = new TColStd_HSequenceOfTransient;
+
+  int ind, aLen = theGList.length();
+  for (ind = 0; ind < aLen; ind++) {
+    Handle(GEOM_Object) aGr = GetObjectImpl(theGList[ind]);
+    if (aGr.IsNull()) return aGEOMObject._retn();
+    aGroups->Append(aGr);
+  }
+
+  //Perform the operation
+  Handle(GEOM_Object) anObject = GetOperations()->IntersectListOfGroups(aGroups);
+  if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ *  CutListOfGroups
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::CutListOfGroups (const GEOM::ListOfGO& theGList1,
+                                                                const GEOM::ListOfGO& theGList2)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Get the reference groups
+  Handle(TColStd_HSequenceOfTransient) aGroups1 = new TColStd_HSequenceOfTransient;
+  Handle(TColStd_HSequenceOfTransient) aGroups2 = new TColStd_HSequenceOfTransient;
+
+  int ind, aLen = theGList1.length();
+  for (ind = 0; ind < aLen; ind++) {
+    Handle(GEOM_Object) aGr = GetObjectImpl(theGList1[ind]);
+    if (aGr.IsNull()) return aGEOMObject._retn();
+    aGroups1->Append(aGr);
+  }
+  aLen = theGList2.length();
+  for (ind = 0; ind < aLen; ind++) {
+    Handle(GEOM_Object) aGr = GetObjectImpl(theGList2[ind]);
+    if (aGr.IsNull()) return aGEOMObject._retn();
+    aGroups2->Append(aGr);
+  }
+
+  //Perform the operation
+  Handle(GEOM_Object) anObject = GetOperations()->CutListOfGroups(aGroups1, aGroups2);
+  if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
+
+  return GetObject(anObject);
 }
 
 //=============================================================================
index b3871e0fe9122318c4b9c537918a6b626cfd0106..f213e8be2c4ff620999861da0523932bbad9dc61 100644 (file)
@@ -18,7 +18,6 @@
 // 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_IGroupOperations_i_HeaderFile
 #define _GEOM_IGroupOperations_i_HeaderFile
 
 #include "GEOMImpl_IGroupOperations.hxx"
 
-class GEOM_I_EXPORT GEOM_IGroupOperations_i : 
+class GEOM_I_EXPORT GEOM_IGroupOperations_i :
     public virtual POA_GEOM::GEOM_IGroupOperations,
     public virtual GEOM_IOperations_i
 {
  public:
   GEOM_IGroupOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine,
-                          ::GEOMImpl_IGroupOperations* theImpl);
+                           ::GEOMImpl_IGroupOperations* theImpl);
   ~GEOM_IGroupOperations_i();
 
-  GEOM::GEOM_Object_ptr CreateGroup  (GEOM::GEOM_Object_ptr theMainShape, CORBA::Long theShapeType);
+  GEOM::GEOM_Object_ptr CreateGroup (GEOM::GEOM_Object_ptr theMainShape, CORBA::Long theShapeType);
+
   void AddObject (GEOM::GEOM_Object_ptr theGroup, CORBA::Long theSubShapeId);
 
   void RemoveObject (GEOM::GEOM_Object_ptr theGroup, CORBA::Long theSubShapeId);
@@ -56,8 +55,16 @@ class GEOM_I_EXPORT GEOM_IGroupOperations_i :
 
   void DifferenceIDs (GEOM::GEOM_Object_ptr theGroup, const GEOM::ListOfLong& theSubShapes);
 
+  GEOM::GEOM_Object_ptr UnionGroups (GEOM::GEOM_Object_ptr theGroup1, GEOM::GEOM_Object_ptr theGroup2);
+  GEOM::GEOM_Object_ptr IntersectGroups (GEOM::GEOM_Object_ptr theGroup1, GEOM::GEOM_Object_ptr theGroup2);
+  GEOM::GEOM_Object_ptr CutGroups (GEOM::GEOM_Object_ptr theGroup1, GEOM::GEOM_Object_ptr theGroup2);
+
+  GEOM::GEOM_Object_ptr UnionListOfGroups (const GEOM::ListOfGO& theGList);
+  GEOM::GEOM_Object_ptr IntersectListOfGroups (const GEOM::ListOfGO& theGList);
+  GEOM::GEOM_Object_ptr CutListOfGroups (const GEOM::ListOfGO& theGList1, const GEOM::ListOfGO& theGList2);
+
   CORBA::Long GetType (GEOM::GEOM_Object_ptr theGroup);
-  
+
   GEOM::GEOM_Object_ptr GetMainShape (GEOM::GEOM_Object_ptr theGroup);
 
   GEOM::ListOfLong* GetObjects (GEOM::GEOM_Object_ptr theGroup);
index e27a6876b0fd5a114ef3f703d58c395d3c9303bb..57a20c3b39a223f22d52efcfaef25265dd8c11d6 100644 (file)
@@ -18,7 +18,6 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 #ifdef WNT
 #pragma warning( disable:4786 )
@@ -47,7 +46,7 @@
 
 //=============================================================================
 /*!
- *   constructor:
+ *  constructor
  */
 //=============================================================================
 GEOM_IInsertOperations_i::GEOM_IInsertOperations_i (PortableServer::POA_ptr thePOA,
@@ -155,6 +154,32 @@ GEOM::GEOM_Object_ptr GEOM_IInsertOperations_i::ImportFile
   return GetObject(anObject);
 }
 
+//=============================================================================
+/*!
+ *  ReadValue
+ */
+//=============================================================================
+char* GEOM_IInsertOperations_i::ReadValue(const char* theFileName,
+                                          const char* theFormatName,
+                                          const char* theParameterName)
+{
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  char* aFileName      = strdup(theFileName);
+  char* aFormatName    = strdup(theFormatName);
+  char* aParameterName = strdup(theParameterName);
+
+  TCollection_AsciiString aUnits = GetOperations()->ReadValue
+    (aFileName, aFormatName, aParameterName);
+
+  free(aFileName);
+  free(aFormatName);
+  free(aParameterName);
+
+  return CORBA::string_dup(aUnits.ToCString());
+}
+
 //=============================================================================
 /*!
  *  ImportTranslators
@@ -225,12 +250,47 @@ void GEOM_IInsertOperations_i::ExportTranslators
   thePatterns = aPatternsArray._retn();
 }
 
+//=============================================================================
+/*!
+ *  RestoreShape
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IInsertOperations_i::RestoreShape (const SALOMEDS::TMPFile& theStream)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  if (theStream.length() < 1)
+    return aGEOMObject._retn();
+
+  char* buf = (char*)theStream.NP_data();
+  std::istringstream aStream (buf);
+
+  Handle(GEOM_Object) anObject = GetOperations()->RestoreShape(aStream);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ *  LoadTexture
+ */
+//=============================================================================
 CORBA::Long GEOM_IInsertOperations_i::LoadTexture(const char* theTextureFile)
 {
   GetOperations()->SetNotDone();
   return GetOperations()->LoadTexture( theTextureFile );
 }
 
+//=============================================================================
+/*!
+ *  AddTexture
+ */
+//=============================================================================
 CORBA::Long GEOM_IInsertOperations_i::AddTexture(CORBA::Long theWidth, CORBA::Long theHeight,
                                                  const SALOMEDS::TMPFile& theTexture)
 {
@@ -255,6 +315,11 @@ CORBA::Long GEOM_IInsertOperations_i::AddTexture(CORBA::Long theWidth, CORBA::Lo
   return GetOperations()->AddTexture( theWidth, theHeight, aTexture );
 }
 
+//=============================================================================
+/*!
+ *  GetTexture
+ */
+//=============================================================================
 SALOMEDS::TMPFile* GEOM_IInsertOperations_i::GetTexture(CORBA::Long theID,
                                                         CORBA::Long& theWidth,
                                                         CORBA::Long& theHeight)
@@ -278,6 +343,11 @@ SALOMEDS::TMPFile* GEOM_IInsertOperations_i::GetTexture(CORBA::Long theID,
   return aTexture._retn();
 }
 
+//=============================================================================
+/*!
+ *  GetAllTextures
+ */
+//=============================================================================
 GEOM::ListOfLong* GEOM_IInsertOperations_i::GetAllTextures()
 {
   std::list<int> localIDs = GetOperations()->GetAllTextures();
index a7f8cf1dd7a41a916979660695d63e5f5859030b..97ca19c701bd49c905c7b6dfdf9e6d8c317267e3 100644 (file)
@@ -18,7 +18,6 @@
 // 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_IInsertOperations_i_HeaderFile
 #define _GEOM_IInsertOperations_i_HeaderFile
@@ -52,12 +51,18 @@ class GEOM_I_EXPORT GEOM_IInsertOperations_i :
   GEOM::GEOM_Object_ptr ImportFile (const char* theFileName,
                                     const char* theFormatName);
 
+  char* ReadValue (const char* theFileName,
+                   const char* theFormatName,
+                   const char* theParameterName);
+
   void ImportTranslators (GEOM::string_array_out theFormats,
                           GEOM::string_array_out thePatterns);
 
   void ExportTranslators (GEOM::string_array_out theFormats,
                           GEOM::string_array_out thePatterns);
 
+  GEOM::GEOM_Object_ptr RestoreShape (const SALOMEDS::TMPFile& theStream);
+
   CORBA::Long LoadTexture(const char* theTextureFile);
   CORBA::Long AddTexture(CORBA::Long theWidth, CORBA::Long theHeight,
                          const SALOMEDS::TMPFile& theTexture);
index 05c23aed66f4127f2bcf315e4822682a75ccf3bc..7c17db76a92cdcfc72a1e56604c9115d22585bff 100644 (file)
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-
 #  GEOM GEOM_SWIG : binding of C++ implementaion with Python
 #  File   : GEOM_Spanner.py
 #  Author : Julia DOROVSKIKH
 #  Module : GEOM
-#  $Header$
+#
 # ! Please, if you edit this example file, update also
 # ! GEOM_SRC/doc/salome/gui/GEOM/input/tui_test_spanner.doc
 # ! as some sequences of symbols from this example are used during
 # ! documentation generation to identify certain places of this file
-############# MakeSpanner #############
 #
+############# MakeSpanner #############
 def MakeSpanner (geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh = None):
 
   ### Variables ###
@@ -304,6 +303,11 @@ def MakeSpanner (geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh = None):
   isCompOfBlocks6 = BlocksOp.CheckCompoundOfBlocks(Spanner)
   if isCompOfBlocks6 == 0:
     print "Spanner is not a compound of hexahedral solids"
+    (NonBlocks, NonQuads) = geompy.GetNonBlocks(Spanner)
+    if NonBlocks is not None:
+      geompy.addToStudyInFather(Spanner, NonBlocks, "Group of non-hexahedral solids")
+    if NonQuads is not None:
+      geompy.addToStudyInFather(Spanner, NonQuads, "Group of non-quadrangular faces")
   else:
     print "Spanner is a compound of hexahedral solids"
 
index 3e7c14dc2c409c7b0ba9637b87c1d3c3390e90b4..b74b8081640f0cbe76a37327f41e8a3f9fb242bc 100644 (file)
@@ -19,7 +19,6 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
 
 #  GEOM GEOM_SWIG : binding of C++ omplementaion with Python
 #  File   : GEOM_usinggeom.py
@@ -105,8 +104,18 @@ def TestAll (geompy, math):
   Interpol = geompy.MakeInterpol([px, py, p200, pxyz], True) #(List of GEOM_Object,Boolean)->GEOM_Object
   Sketcher = geompy.MakeSketcher("Sketcher:F -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WW",
                                  [100,0,0, 1,1,1, -1,1,0]) #(String, List of Doubles)->GEOM_Object
-  Sketcher3d = geompy.Make3DSketcher([0,0,0, 50,50,50, 0,50,50, 10,0,0])
-  
+
+  #Create 3D wires with 3D Sketcher
+  sk = geompy.Sketcher3D()
+  sk.addPointsAbsolute(0,0,0, 70,0,0)
+  sk.addPointsRelative(0, 0, 130)
+  sk.addPointAnglesLength("OXY", 50, 0, 100)
+  sk.addPointAnglesLength("OXZ", 30, 80, 130)
+  sk.close()
+  Sketcher3d_1 = sk.wire()
+
+  Sketcher3d_2 = geompy.Make3DSketcher([0,0,0, 50,50,50, 0,50,50, 10,0,0])
+
   #Create local coordinate system from shape
   cs4 = geompy.MakeMarkerFromShape(Plane)
 
@@ -183,6 +192,7 @@ def TestAll (geompy, math):
   #Test point on surface creation
   p_on_face = geompy.MakeVertexOnSurface(Face, 0.1, 0.8) #(GEOM_Object, Double, Double)->GEOM_Object
   p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(Face, 0., 0., 0.) #(GEOM_Object, Double, Double, Double)->GEOM_Object
+  p_on_face3 = geompy.MakeVertexInsideFace(Face) #(GEOM_Object)->GEOM_Object
 
   # Test plane from existing face creation
   Plane2 = geompy.MakePlaneFace(Face, trimsize)      #(GEOM_Object, Double)->GEOM_Object
@@ -330,7 +340,9 @@ def TestAll (geompy, math):
   id_Bezier   = geompy.addToStudy(Bezier,   "Bezier")
   id_Interpol = geompy.addToStudy(Interpol, "Interpol")
   id_Sketcher = geompy.addToStudy(Sketcher, "Sketcher")
-  id_Sketcher3d = geompy.addToStudy(Sketcher3d, "Sketcher 3D")
+
+  id_Sketcher3d_1 = geompy.addToStudy(Sketcher3d_1, "Sketcher 3D by interface")
+  id_Sketcher3d_2 = geompy.addToStudy(Sketcher3d_2, "Sketcher 3D by list")
 
   id_p_on_arc  = geompy.addToStudy(p_on_arc,  "Vertex on Arc (0.25)")
   id_p_on_arc2 = geompy.addToStudy(p_on_arc2, "Vertex on Arc at(100, -10, 10)" )
@@ -374,6 +386,7 @@ def TestAll (geompy, math):
 
   id_p_on_face = geompy.addToStudy(p_on_face, "Vertex on Face (0.1, 0.8)")
   id_p_on_face2 = geompy.addToStudy(p_on_face2, "Vertex on Face at(0., 0., 0.)")
+  id_p_on_face3 = geompy.addToStudy(p_on_face3, "Vertex inside Face")
 
   id_Prism1   = geompy.addToStudy(Prism1,     "Prism by Two Pnt")
   id_Shell1   = geompy.addToStudy(Shell1,   "Shell from Prism1 faces")
index 8e65788e2b5d6dde49e5c1f91491114bbc6ef5fb..4db5841a03f34dd6952e6f494f8c20dd6bdad194 100644 (file)
@@ -95,6 +95,11 @@ def TestExportImport (geompy, shape):
   os.remove(fileExportImportIGES)
   os.remove(fileExportImportSTEP)
 
+  # Test RestoreShape from binary BRep stream
+  aStream = shape.GetShapeStream()
+  aNewShape = geompy.RestoreShape(aStream)
+  geompy.addToStudy(aNewShape, "aNewShape")
+
   print "OK"
 
 
@@ -144,6 +149,7 @@ def TestOtherOperations (geompy, math):
 
   # OrientationChange
   Box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+  geompy.addToStudy(Box, "Box")
   Orientation = geompy.OrientationChange(Box)
   id_Orientation = geompy.addToStudy(Orientation, "OrientationChange")
 
@@ -243,6 +249,11 @@ def TestOtherOperations (geompy, math):
   IsValid = geompy.CheckCompoundOfBlocks(Compound1)
   if IsValid == 0:
     print "The Blocks Compound is NOT VALID"
+    (NonBlocks, NonQuads) = geompy.GetNonBlocks(Compound1)
+    if NonBlocks is not None:
+      geompy.addToStudyInFather(Compound1, NonBlocks, "Group of non-hexahedral solids")
+    if NonQuads is not None:
+      geompy.addToStudyInFather(Compound1, NonQuads, "Group of non-quadrangular faces")
   else:
     print "The Blocks Compound is VALID"
 
@@ -311,6 +322,42 @@ def TestOtherOperations (geompy, math):
   for ObjectID in GetObjectIDs:
     print " ", ObjectID
 
+  # Boolean Operations on Groups (Union, Intersection, Cut)
+  Group_1 = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
+  geompy.UnionIDs(Group_1, [13, 23])
+  Group_2 = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
+  geompy.UnionIDs(Group_2, [3, 27])
+  Group_3 = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
+  geompy.UnionIDs(Group_3, [33, 23])
+  Group_4 = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
+  geompy.UnionIDs(Group_4, [31, 27])
+
+  geompy.addToStudyInFather(Box, Group_1, 'Group_1')
+  geompy.addToStudyInFather(Box, Group_2, 'Group_2')
+  geompy.addToStudyInFather(Box, Group_3, 'Group_3')
+  geompy.addToStudyInFather(Box, Group_4, 'Group_4')
+
+  # union groups
+  Group_U_1_2 = geompy.UnionGroups(Group_1, Group_2)
+  Group_UL_3_4 = geompy.UnionListOfGroups([Group_3, Group_4])
+
+  geompy.addToStudyInFather(Box, Group_U_1_2, 'Group_U_1_2')
+  geompy.addToStudyInFather(Box, Group_UL_3_4, 'Group_UL_3_4')
+
+  # intersect groups
+  Group_I_1_3 = geompy.IntersectGroups(Group_1, Group_3)
+  Group_IL_1_3 = geompy.IntersectListOfGroups([Group_1, Group_3])
+
+  geompy.addToStudyInFather(Box, Group_I_1_3, 'Group_I_1_3')
+  geompy.addToStudyInFather(Box, Group_IL_1_3, 'Group_IL_1_3')
+
+  # cut groups
+  Group_C_2_4 = geompy.CutGroups(Group_2, Group_4)
+  Group_CL_2_4 = geompy.CutListOfGroups([Group_2], [Group_4])
+
+  geompy.addToStudyInFather(Box, Group_C_2_4, 'Group_C_2_4')
+  geompy.addToStudyInFather(Box, Group_CL_2_4, 'Group_CL_2_4')
+
   # -----------------------------------------------------------------------------
   # enumeration ShapeTypeString as a dictionary
   # -----------------------------------------------------------------------------
index 3fe82e1a4d31be86adf99681b795f912daa1da01..c9742d23978bdaca653ff0efc9d217a919dc1762 100644 (file)
@@ -35,6 +35,7 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am
 dist_salomescript_DATA =               \
        geompy.py                       \
        geompyDC.py                     \
+       gsketcher.py                    \
        batchmode_geompy.py             \
        GEOM_Spanner.py                 \
        GEOM_blocks.py                  \
index 13df410632c98f07d198ffeff3cfc81531fd104a..f715dc8a469302d2c5fc85c894fbf202e7aa2c7b 100644 (file)
@@ -31,13 +31,22 @@ import salome
 import geompyDC
 from salome import *
 
-geom = lcc.FindOrLoadComponent("FactoryServer", "GEOM")
-geom.init_geom(salome.myStudy)
-
-# Export the methods of geompyDC
-for k in dir(geom):
-  if k[0] == '_':continue
-  globals()[k]=getattr(geom,k)
-del k
-from geompyDC import ShapeType, GEOM, kind, info, PackData, ReadTexture, EnumToLong
+# retrieve GEOM engine in try/except block
+# to avoid problems in some cases, e.g. when generating documentation
+try:
+    # get GEOM engine
+    geom = lcc.FindOrLoadComponent( "FactoryServer", "GEOM" )
+    # initialize GEOM with current study
+    geom.init_geom( salome.myStudy )
 
+    # export the methods of geompyDC
+    for k in dir( geom ):
+       if k[0] == '_': continue
+       globals()[k] = getattr( geom, k )
+        pass
+    del k
+    from geompyDC import ShapeType, GEOM, kind, info, PackData, ReadTexture, EnumToLong
+    pass
+except:
+    geom = None
+    pass
index ca34d88932208da5a4e5bdb4caa1e9203a724ba9..0dd628e5a1c91ceb683701e0bb0ed46bbb13ffdf 100644 (file)
 
 ## @}
 
-import salome
-salome.salome_init()
-from salome import *
+# initialize SALOME session in try/except block
+# to avoid problems in some cases, e.g. when generating documentation
+try:
+    import salome
+    salome.salome_init()
+    from salome import *
+except:
+    pass
 
 from salome_notebook import *
 
@@ -83,6 +88,8 @@ import GEOM
 import math
 import os
 
+from gsketcher import Sketcher3D
+
 ## Enumeration ShapeType as a dictionary. \n
 ## Topological types of shapes (like Open Cascade types). See GEOM::shape_type for details.
 #  @ingroup l1_geompy_auxiliary
@@ -481,6 +488,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
             # Example: see GEOM_TestAll.py
             try:
                 aSObject = self.AddInStudy(self.myStudy, aShape, aName, None)
+                if aSObject and aName: aSObject.SetAttrString("AttributeName", aName)
                 if doRestoreSubShapes:
                     self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs,
                                             theFindMethod, theInheritFirstArg, True )
@@ -511,6 +519,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
             # Example: see GEOM_TestAll.py
             try:
                 aSObject = self.AddInStudy(self.myStudy, aShape, aName, aFather)
+                if aSObject and aName: aSObject.SetAttrString("AttributeName", aName)
             except:
                 print "addToStudyInFather() failed"
                 return ""
@@ -813,7 +822,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
                 New GEOM.GEOM_Object, containing the created point.
 
             Example of usage:
-                p_on_face = geompy.MakeVertexOnSurface(Face, 0.1, 0.8) #(GEOM_Object, Double, Double)->GEOM_Object
+                p_on_face = geompy.MakeVertexOnSurface(Face, 0.1, 0.8)
             """
             theUParameter, theVParameter, Parameters = ParseParameters(theUParameter, theVParameter)
             # Example: see GEOM_TestAll.py
@@ -844,7 +853,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
                 New GEOM.GEOM_Object, containing the created point.
 
             Example of usage:
-                p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(Face, 0., 0., 0.) #(GEOM_Object, Double, Double, Double)->GEOM_Object
+                p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(Face, 0., 0., 0.)
             """
             theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
             # Example: see GEOM_TestAll.py
@@ -853,6 +862,37 @@ class geompyDC(GEOM._objref_GEOM_Gen):
             anObj.SetParameters(Parameters);
             return anObj
 
+        ## Create a point, which lays on the given face.
+        #  The point will lay in arbitrary place of the face.
+        #  The only condition on it is a non-zero distance to the face boundary.
+        #  Such point can be used to uniquely identify the face inside any
+        #  shape in case, when the shape does not contain overlapped faces.
+        #  @param theFace The referenced face.
+        #  @return New GEOM.GEOM_Object, containing the created point.
+        #
+        #  @ref swig_MakeVertexInsideFace "Example"
+        def MakeVertexInsideFace (self, theFace):
+            """
+            Create a point, which lays on the given face.
+            The point will lay in arbitrary place of the face.
+            The only condition on it is a non-zero distance to the face boundary.
+            Such point can be used to uniquely identify the face inside any
+            shape in case, when the shape does not contain overlapped faces.
+
+            Parameters:
+                theFace The referenced face.
+
+            Returns:
+                New GEOM.GEOM_Object, containing the created point.
+
+            Example of usage:
+                p_on_face = geompy.MakeVertexInsideFace(Face)
+            """
+            # Example: see GEOM_TestAll.py
+            anObj = self.BasicOp.MakePointOnFace(theFace)
+            RaiseIfFailed("MakeVertexInsideFace", self.BasicOp)
+            return anObj
+
         ## Create a point on intersection of two lines.
         #  @param theRefLine1, theRefLine2 The referenced lines.
         #  @return New GEOM.GEOM_Object, containing the created point.
@@ -891,7 +931,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
                 New GEOM.GEOM_Object, containing the created tangent.
 
             Example of usage:
-                tan_on_arc = geompy.MakeTangentOnCurve(Arc, 0.7) #(GEOM_Object, Double)->GEOM_Object
+                tan_on_arc = geompy.MakeTangentOnCurve(Arc, 0.7)
             """
             anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
             RaiseIfFailed("MakeTangentOnCurve", self.BasicOp)
@@ -1615,7 +1655,6 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #     - "C radius length" : Create arc by direction, radius and length(in degree)
         #     - "AA x y": Create arc by point at X & Y
         #     - "A dx dy" : Create arc by point with DX & DY
-        #     - "A dx dy" : Create arc by point with DX & DY
         #     - "UU x y radius flag1": Create arc by point at X & Y with given radiUs
         #     - "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs
         #     - "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates
@@ -1665,7 +1704,6 @@ class geompyDC(GEOM._objref_GEOM_Gen):
                - "C radius length" : Create arc by direction, radius and length(in degree)
                - "AA x y": Create arc by point at X & Y
                - "A dx dy" : Create arc by point with DX & DY
-               - "A dx dy" : Create arc by point with DX & DY
                - "UU x y radius flag1": Create arc by point at X & Y with given radiUs
                - "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs
                - "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates
@@ -1722,8 +1760,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
             Returns:
                 New GEOM.GEOM_Object, containing the created wire.
             """
+            theCommand,Parameters = ParseSketcherCommand(theCommand)
             anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
             RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
+            anObj.SetParameters(Parameters)
             return anObj
 
         ## Create a sketcher wire, following the numerical description,
@@ -1732,7 +1772,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #                                                      passing from it.
         #  @return New GEOM.GEOM_Object, containing the created wire.
         #
-        #  @ref tui_sketcher_page "Example"
+        #  @ref tui_3dsketcher_page "Example"
         def Make3DSketcher(self, theCoordinates):
             """
             Create a sketcher wire, following the numerical description,
@@ -1751,6 +1791,26 @@ class geompyDC(GEOM._objref_GEOM_Gen):
             anObj.SetParameters(Parameters)
             return anObj
 
+        ## Obtain a 3D sketcher interface
+        #  @return An instance of @ref gsketcher.Sketcher3D "Sketcher3D" interface
+        #
+        #  @ref tui_3dsketcher_page "Example"
+        def Sketcher3D (self):
+            """
+            Obtain a 3D sketcher interface.
+
+            Example of usage:
+                sk = geompy.Sketcher3D()
+                sk.addPointsAbsolute(0,0,0, 70,0,0)
+                sk.addPointsRelative(0, 0, 130)
+                sk.addPointAnglesLength("OXY", 50, 0, 100)
+                sk.addPointAnglesLength("OXZ", 30, 80, 130)
+                sk.close()
+                a3D_Sketcher_1 = sk.wire()
+            """
+            sk = Sketcher3D (self)
+            return sk
+
         # end of l3_sketcher
         ## @}
 
@@ -1764,7 +1824,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #
         #  @return New GEOM.GEOM_Object, containing the created box.
         #  @ref tui_creation_box "Example"
-        def MakeBox(self,x1,y1,z1,x2,y2,z2):
+        def MakeBox (self, x1,y1,z1, x2,y2,z2):
             """
             Create a box by coordinates of two opposite vertices.
             
@@ -1954,7 +2014,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
                 New GEOM.GEOM_Object, containing the created disk.
 
             Example of usage:
-                Disk3 = geompy.MakeDiskR(100., 1)   #(1 Doubles, 1 Int)->GEOM_Object
+                Disk3 = geompy.MakeDiskR(100., 1)
             """
             # Example: see GEOM_TestAll.py
             theR,Parameters = ParseParameters(theR)
@@ -2109,11 +2169,11 @@ class geompyDC(GEOM._objref_GEOM_Gen):
                 theR2 Radius of the second cone base.
                 theH Cone height.
 
-           Note:
+            Note:
                 If both radiuses are non-zero, the cone will be truncated.
                 If the radiuses are equal, a cylinder will be created instead.
 
-           Returns:
+            Returns:
                 New GEOM.GEOM_Object, containing the created cone.
             """
             # Example: see GEOM_TestAll.py
@@ -2149,7 +2209,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
                 If both radiuses are non-zero, the cone will be truncated.
                 If the radiuses are equal, a cylinder will be created instead.
 
-           Returns:
+            Returns:
                 New GEOM.GEOM_Object, containing the created cone.
             """
             # Example: see GEOM_TestAll.py
@@ -4063,7 +4123,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
                 List of sub-shapes of type theShapeType, contained in theShape.
             """
             # Example: see GEOM_TestAll.py
-            ListObj = self.ShapesOp.MakeAllSubShapes(aShape, aType, False)
+            ListObj = self.ShapesOp.MakeAllSubShapes(aShape, EnumToLong( aType ), False)
             RaiseIfFailed("SubShapeAll", self.ShapesOp)
             return ListObj
 
@@ -4084,7 +4144,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
             Returns:
                 List of IDs of sub-shapes.
             """
-            ListObj = self.ShapesOp.GetAllSubShapesIDs(aShape, aType, False)
+            ListObj = self.ShapesOp.GetAllSubShapesIDs(aShape, EnumToLong( aType ), False)
             RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
             return ListObj
 
@@ -4113,7 +4173,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
             """
             # Example: see GEOM_TestAll.py
             ListOfIDs = []
-            AllShapeIDsList = self.SubShapeAllIDs(aShape, aType)
+            AllShapeIDsList = self.SubShapeAllIDs(aShape, EnumToLong( aType ))
             for ind in ListOfInd:
                 ListOfIDs.append(AllShapeIDsList[ind - 1])
             anObj = self.GetSubShape(aShape, ListOfIDs)
@@ -4141,7 +4201,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
                 List of sub-shapes of type theShapeType, contained in theShape.
             """
             # Example: see GEOM_TestAll.py
-            ListObj = self.ShapesOp.MakeAllSubShapes(aShape, aType, True)
+            ListObj = self.ShapesOp.MakeAllSubShapes(aShape, EnumToLong( aType ), True)
             RaiseIfFailed("SubShapeAllSortedCentres", self.ShapesOp)
             return ListObj
 
@@ -4164,7 +4224,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
             Returns: 
                 List of IDs of sub-shapes.
             """
-            ListIDs = self.ShapesOp.GetAllSubShapesIDs(aShape, aType, True)
+            ListIDs = self.ShapesOp.GetAllSubShapesIDs(aShape, EnumToLong( aType ), True)
             RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
             return ListIDs
 
@@ -4193,7 +4253,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
             """
             # Example: see GEOM_TestAll.py
             ListOfIDs = []
-            AllShapeIDsList = self.SubShapeAllSortedCentresIDs(aShape, aType)
+            AllShapeIDsList = self.SubShapeAllSortedCentresIDs(aShape, EnumToLong( aType ))
             for ind in ListOfInd:
                 ListOfIDs.append(AllShapeIDsList[ind - 1])
             anObj = self.GetSubShape(aShape, ListOfIDs)
@@ -4219,7 +4279,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
                 List of sub-shapes of type aType, contained in aShape.
             """
             # Example: see GEOM_TestAll.py
-            ListObj = self.ShapesOp.ExtractSubShapes(aShape, aType, isSorted)
+            ListObj = self.ShapesOp.ExtractSubShapes(aShape, EnumToLong( aType ), isSorted)
             RaiseIfFailed("ExtractSubShapes", self.ShapesOp)
             return ListObj
 
@@ -4260,7 +4320,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
             It works like geompy.SubShapeAllSortedCentres, but wrongly
             defines centres of faces, shells and solids.
             """
-            ListObj = self.ShapesOp.MakeExplode(aShape, aType, True)
+            ListObj = self.ShapesOp.MakeExplode(aShape, EnumToLong( aType ), True)
             RaiseIfFailed("MakeExplode", self.ShapesOp)
             return ListObj
 
@@ -4273,7 +4333,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
             It works like geompy.SubShapeAllSortedCentresIDs, but wrongly
             defines centres of faces, shells and solids.
             """
-            ListIDs = self.ShapesOp.SubShapeAllIDs(aShape, aType, True)
+            ListIDs = self.ShapesOp.SubShapeAllIDs(aShape, EnumToLong( aType ), True)
             RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
             return ListIDs
 
@@ -4287,7 +4347,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
             (wrongly defines centres of faces, shells and solids).
             """
             ListOfIDs = []
-            AllShapeIDsList = self.SubShapeAllSortedIDs(aShape, aType)
+            AllShapeIDsList = self.SubShapeAllSortedIDs(aShape, EnumToLong( aType ))
             for ind in ListOfInd:
                 ListOfIDs.append(AllShapeIDsList[ind - 1])
             anObj = self.GetSubShape(aShape, ListOfIDs)
@@ -7280,6 +7340,31 @@ class geompyDC(GEOM._objref_GEOM_Gen):
             # Example: see GEOM_TestOthers.py
             return self.ImportFile(theFileName, "STEP")
 
+        ## Read a shape from the binary stream, containing its bounding representation (BRep).
+        #  @note This method will not be dumped to the python script by DumpStudy functionality.
+        #  @note GEOM.GEOM_Object.GetShapeStream() method can be used to obtain the shape's BRep stream.
+        #  @param theStream The BRep binary stream.
+        #  @return New GEOM_Object, containing the shape, read from theStream.
+        #
+        #  @ref swig_Import_Export "Example"
+        def RestoreShape (self, theStream):
+            """
+            Read a shape from the binary stream, containing its bounding representation (BRep).
+
+            Note:
+                shape.GetShapeStream() method can be used to obtain the shape's BRep stream.
+
+            Parameters: 
+                theStream The BRep binary stream.
+
+            Returns:
+                New GEOM_Object, containing the shape, read from theStream.
+            """
+            # Example: see GEOM_TestOthers.py
+            anObj = self.InsertOp.RestoreShape(theStream)
+            RaiseIfFailed("RestoreShape", self.InsertOp)
+            return anObj
+
         ## Export the given shape into a file with given name.
         #  @param theObject Shape to be stored in the file.
         #  @param theFileName Name of the file to store the given shape in.
@@ -7774,6 +7859,36 @@ class geompyDC(GEOM._objref_GEOM_Gen):
                 print Descr
             return IsValid
 
+        ## Retrieve all non blocks solids and faces from \a theShape.
+        #  @param theShape The shape to explore.
+        #  @return A tuple of two GEOM_Objects. The first object is a group of all
+        #          non block solids (= not 6 faces, or with 6 faces, but with the
+        #          presence of non-quadrangular faces). The second object is a
+        #          group of all non quadrangular faces.
+        #
+        #  @ref tui_measurement_tools_page "Example 1"
+        #  \n @ref swig_GetNonBlocks "Example 2"
+        def GetNonBlocks (self, theShape):
+            """
+            Retrieve all non blocks solids and faces from theShape.
+
+            Parameters:
+                theShape The shape to explore.
+
+            Returns:
+                A tuple of two GEOM_Objects. The first object is a group of all
+                non block solids (= not 6 faces, or with 6 faces, but with the
+                presence of non-quadrangular faces). The second object is a
+                group of all non quadrangular faces.
+
+            Usage:
+                (res_sols, res_faces) = geompy.GetNonBlocks(myShape1)
+            """
+            # Example: see GEOM_Spanner.py
+            aTuple = self.BlocksOp.GetNonBlocks(theShape)
+            RaiseIfFailed("GetNonBlocks", self.BlocksOp)
+            return aTuple
+
         ## Remove all seam and degenerated edges from \a theShape.
         #  Unite faces and edges, sharing one surface. It means that
         #  this faces must have references to one C++ surface object (handle).
@@ -8180,6 +8295,156 @@ class geompyDC(GEOM._objref_GEOM_Gen):
             RaiseIfFailed("DifferenceIDs", self.GroupOp)
             pass
 
+        ## Union of two groups.
+        #  New group is created. It will contain all entities
+        #  which are present in groups theGroup1 and theGroup2.
+        #  @param theGroup1, theGroup2 are the initial GEOM groups
+        #                              to create the united group from.
+        #  @return a newly created GEOM group.
+        #  @ref tui_union_groups_anchor "Example"
+        def UnionGroups (self, theGroup1, theGroup2):
+            """
+            Union of two groups.
+            New group is created. It will contain all entities
+            which are present in groups theGroup1 and theGroup2.
+
+            Parameters:
+                theGroup1, theGroup2 are the initial GEOM groups
+                                     to create the united group from.
+
+            Returns:
+                a newly created GEOM group.
+            """
+            # Example: see GEOM_TestOthers.py
+            aGroup = self.GroupOp.UnionGroups(theGroup1, theGroup2)
+            RaiseIfFailed("UnionGroups", self.GroupOp)
+            return aGroup
+
+        ## Intersection of two groups.
+        #  New group is created. It will contain only those entities
+        #  which are present in both groups theGroup1 and theGroup2.
+        #  @param theGroup1, theGroup2 are the initial GEOM groups to get common part of.
+        #  @return a newly created GEOM group.
+        #  @ref tui_intersect_groups_anchor "Example"
+        def IntersectGroups (self, theGroup1, theGroup2):
+            """
+            Intersection of two groups.
+            New group is created. It will contain only those entities
+            which are present in both groups theGroup1 and theGroup2.
+
+            Parameters:
+                theGroup1, theGroup2 are the initial GEOM groups to get common part of.
+
+            Returns:
+                a newly created GEOM group.
+            """
+            # Example: see GEOM_TestOthers.py
+            aGroup = self.GroupOp.IntersectGroups(theGroup1, theGroup2)
+            RaiseIfFailed("IntersectGroups", self.GroupOp)
+            return aGroup
+
+        ## Cut of two groups.
+        #  New group is created. It will contain entities which are
+        #  present in group theGroup1 but are not present in group theGroup2.
+        #  @param theGroup1 is a GEOM group to include elements of.
+        #  @param theGroup2 is a GEOM group to exclude elements of.
+        #  @return a newly created GEOM group.
+        #  @ref tui_cut_groups_anchor "Example"
+        def CutGroups (self, theGroup1, theGroup2):
+            """
+            Cut of two groups.
+            New group is created. It will contain entities which are
+            present in group theGroup1 but are not present in group theGroup2.
+
+            Parameters:
+                theGroup1 is a GEOM group to include elements of.
+                theGroup2 is a GEOM group to exclude elements of.
+
+            Returns:
+                a newly created GEOM group.
+            """
+            # Example: see GEOM_TestOthers.py
+            aGroup = self.GroupOp.CutGroups(theGroup1, theGroup2)
+            RaiseIfFailed("CutGroups", self.GroupOp)
+            return aGroup
+
+        ## Union of list of groups.
+        #  New group is created. It will contain all entities that are
+        #  present in groups listed in theGList.
+        #  @param theGList is a list of GEOM groups to create the united group from.
+        #  @return a newly created GEOM group.
+        #  @ref tui_union_groups_anchor "Example"
+        def UnionListOfGroups (self, theGList):
+            """
+            Union of list of groups.
+            New group is created. It will contain all entities that are
+            present in groups listed in theGList.
+
+            Parameters:
+                theGList is a list of GEOM groups to create the united group from.
+
+            Returns:
+                a newly created GEOM group.
+            """
+            # Example: see GEOM_TestOthers.py
+            aGroup = self.GroupOp.UnionListOfGroups(theGList)
+            RaiseIfFailed("UnionListOfGroups", self.GroupOp)
+            return aGroup
+
+        ## Cut of lists of groups.
+        #  New group is created. It will contain only entities
+        #  which are present in groups listed in theGList1 but 
+        #  are not present in groups from theGList2.
+        #  @param theGList1 is a list of GEOM groups to include elements of.
+        #  @param theGList2 is a list of GEOM groups to exclude elements of.
+        #  @return a newly created GEOM group.
+        #  @ref tui_intersect_groups_anchor "Example"
+        def IntersectListOfGroups (self, theGList):
+            """
+            Cut of lists of groups.
+            New group is created. It will contain only entities
+            which are present in groups listed in theGList1 but 
+            are not present in groups from theGList2.
+
+            Parameters:
+                theGList1 is a list of GEOM groups to include elements of.
+                theGList2 is a list of GEOM groups to exclude elements of.
+
+            Returns:
+                a newly created GEOM group.
+            """
+            # Example: see GEOM_TestOthers.py
+            aGroup = self.GroupOp.IntersectListOfGroups(theGList)
+            RaiseIfFailed("IntersectListOfGroups", self.GroupOp)
+            return aGroup
+
+        ## Cut of lists of groups.
+        #  New group is created. It will contain only entities
+        #  which are present in groups listed in theGList1 but 
+        #  are not present in groups from theGList2.
+        #  @param theGList1 is a list of GEOM groups to include elements of.
+        #  @param theGList2 is a list of GEOM groups to exclude elements of.
+        #  @return a newly created GEOM group.
+        #  @ref tui_cut_groups_anchor "Example"
+        def CutListOfGroups (self, theGList1, theGList2):
+            """
+            Cut of lists of groups.
+            New group is created. It will contain only entities
+            which are present in groups listed in theGList1 but 
+            are not present in groups from theGList2.
+
+            Parameters:
+                theGList1 is a list of GEOM groups to include elements of.
+                theGList2 is a list of GEOM groups to exclude elements of.
+
+            Returns:
+                a newly created GEOM group.
+            """
+            # Example: see GEOM_TestOthers.py
+            aGroup = self.GroupOp.CutListOfGroups(theGList1, theGList2)
+            RaiseIfFailed("CutListOfGroups", self.GroupOp)
+            return aGroup
+
         ## Returns a list of sub-objects ID stored in the group
         #  @param theGroup is a GEOM group for which a list of IDs is requested
         #
diff --git a/src/GEOM_SWIG/gsketcher.py b/src/GEOM_SWIG/gsketcher.py
new file mode 100644 (file)
index 0000000..11cb077
--- /dev/null
@@ -0,0 +1,182 @@
+#  -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+#  File   : gsketcher.py
+#  Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
+#  Module : GEOM_SWIG
+
+"""
+    \namespace geompy
+    \brief 3D Sketcher interface
+"""
+
+# This method is used by 3D Sketcher functionality
+def printVar (var):
+    if isinstance(var, str):
+        return "\'%s\'"%var
+    else:
+        return "%.7f"%var
+
+## An interface to build a 3D Sketcher step-by-step.
+#  Use geompy.Sketcher3D() method to obtain an instance of this class.
+#
+#  @ref tui_3dsketcher_page "Example"
+class Sketcher3D:
+    """
+    3D sketcher interface.
+
+    Example of usage:
+        sk = geompy.Sketcher3D()
+        sk.addPointsAbsolute(0,0,0, 70,0,0)
+        sk.addPointsRelative(0, 0, 130)
+        sk.addPointAnglesLength("OXY", 50, 0, 100)
+        sk.addPointAnglesLength("OXZ", 30, 80, 130)
+        sk.close()
+        a3D_Sketcher_1 = sk.wire()
+    """
+
+    def __init__(self, geompyD):
+        self.geompyD = geompyD
+        self.myCommand = "3DSketcher"
+        pass
+
+    ## Add one or more points, sequentially connected with straight segments.
+    #  Coordinates are considered as absolute.
+    #  If the first point of sketcher is not yet defined, the first point
+    #  from the listCoords will become the first sketcher point.
+    #  @param X1, Y1, Z1, X2, Y2, Z2, ... Coordinates of points
+    def addPointsAbsolute (self, *listCoords):
+        """
+        Add one or more points, sequentially connected with straight segments.
+        Coordinates are considered as absolute.
+        If the first point of sketcher is not yet defined, the first point
+        from the listCoords will become the first sketcher point.
+
+        Parameters:
+            X1, Y1, Z1, X2, Y2, Z2, ... Coordinates of points
+
+        Example of usage:
+            sk = geompy.Sketcher3D()
+            sk.addPointsAbsolute(0,0,0, 70,0,0)
+            a3D_Sketcher_1 = sk.wire()
+        """
+        ii = 1
+        for cc in listCoords:
+            if ii == 1:
+                self.myCommand = self.myCommand + ":TT"
+            self.myCommand = self.myCommand + " %s"%printVar(cc)
+            if ii == 3:
+                ii = 1
+            else:
+                ii = ii + 1
+        pass
+
+    ## Add one or more points, sequentially connected with straight segments.
+    #  Coordinates are considered relative to the previous point.
+    #  If the first point of sketcher is not yet defined, the
+    #  origin (0, 0, 0) will become the first sketcher point.
+    #  @param X1, Y1, Z1, X2, Y2, Z2, ... Coordinates of points
+    def addPointsRelative (self, *listCoords):
+        """
+        Add one or more points, sequentially connected with straight segments.
+        Coordinates are considered relative to the previous point.
+        If the first point of sketcher is not yet defined, the
+        origin (0, 0, 0) will become the first sketcher point.
+
+        Parameters:
+            X1, Y1, Z1, X2, Y2, Z2, ... Relative coordinates of points
+
+        Example of usage:
+            sk = geompy.Sketcher3D()
+            sk.addPointsRelative(0,0,130, 70,0,-130)
+            a3D_Sketcher_1 = sk.wire()
+        """
+        ii = 1
+        for cc in listCoords:
+            if ii == 1:
+                self.myCommand = self.myCommand + ":T"
+            self.myCommand = self.myCommand + " %s"%printVar(cc)
+            if ii == 3:
+                ii = 1
+            else:
+                ii = ii + 1
+        pass
+
+    ## Add one straight segment, defined by two angles and length.
+    #  If the first point of sketcher is not yet defined, the
+    #  origin (0, 0, 0) will become the first sketcher point.
+    #  @param axes can be: "OXY", "OYZ" or "OXZ"
+    #  @param angle1 angle in a plane, defined by the \a axes
+    #  @param angle2 angle from the plane, defined by the \a axes
+    #  @param length length of the segment
+    def addPointAnglesLength (self, axes, angle1, angle2, length):
+        """
+        Add one straight segment, defined by two angles and length.
+        If the first point of sketcher is not yet defined, the
+        origin (0, 0, 0) will become the first sketcher point.
+
+        Parameters:
+            axes can be: "OXY", "OYZ" or "OXZ"
+            angle1 angle in a plane, defined by the \a axes
+            angle2 angle from the plane, defined by the \a axes
+            length length of the segment
+
+        Example of usage:
+            sk = geompy.Sketcher3D()
+            sk.addPointAnglesLength("OXY", 50, 0, 100)
+            a3D_Sketcher_1 = sk.wire()
+        """
+        self.myCommand = self.myCommand + ":%s %s %s %s" % (axes, printVar(angle1), printVar(angle2), printVar(length))
+        pass
+
+    ## Set to close the wire
+    def close (self):
+        """
+        Set to close the wire
+
+        Example of usage:
+            sk = geompy.Sketcher3D()
+            sk.addPointsRelative(0,0,130, 70,0,-130)
+            sk.close()
+            a3D_Sketcher_1 = sk.wire()
+        """
+        self.myCommand = self.myCommand + ":WW"
+        pass
+
+    ## Obtain the sketcher result.
+    #  @return New GEOM_Object, containing the created wire
+    def wire (self):
+        """
+        Obtain the sketcher result.
+
+        Returns:
+            New GEOM_Object, containing the created wire.
+
+        Example of usage:
+            sk = geompy.Sketcher3D()
+            sk.addPointsRelative(0,0,130, 70,0,-130)
+            a3D_Sketcher_1 = sk.wire()
+        """
+        from geompyDC import ParseSketcherCommand, RaiseIfFailed
+        Command,Parameters = ParseSketcherCommand(self.myCommand)
+        wire = self.geompyD.CurvesOp.Make3DSketcherCommand(Command)
+        self.myCommand = "3DSketcher"
+        RaiseIfFailed("Sketcher3D", self.geompyD.CurvesOp)
+        wire.SetParameters(Parameters)
+        return wire
index e468bfb0d3a5f4bfccb6db16ed9a93737aef4270..59166af8166fe326892e11e3cf228fe1af65bc74 100644 (file)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-#  GEOM GEOM_SWIG : binding of C++ omplementaion with Python
-#  File   : Makefile.in
-#  Author : Nicolas REJNERI, Paul RASCLE
-#  Modified by : Alexander BORODIN (OCN) - autotools usage
-#  Module : GEOM
-#  $Header$
-# Libraries targets
-#
 include $(top_srcdir)/adm_local/unix/make_common_starter.am
 
 # ===============================================================
@@ -40,28 +32,24 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am
 # Step 2: build the dynamic library from cpp built source files and
 #         dependant libraries.
 #
-# swig_wrap.cpp -- gcc --> swig_wrap.o    |-- link --> _libSALOME_Swig.la
+# swig_wrap.cpp -- gcc --> swig_wrap.o    |-- link --> _libGEOM_Swig.la
 #                          +              |
 #                          dependant libs |
 #
-# The file libGEOM_Swig.py will be installed to the
-# <prefix>/bin/salome directory.
-# The library _libGEOM_Swig.so will be installed to the 
+# The files libGEOM_Swig.py and _libGEOM_Swig.so will be installed to the
 # <prefix>/lib/python<version>/site-package/salome directory.
 #
 
 SWIG_FLAGS    = @SWIG_FLAGS@ -I$(srcdir) -I$(srcdir)/../GEOMGUI
 SWIG_SOURCES  = libGEOM_Swig.i
 
+salomeinclude_HEADERS = $(SWIG_SOURCES) libGEOM_Swig.h
+
 salomepython_PYTHON = libGEOM_Swig.py
 salomepyexec_LTLIBRARIES = _libGEOM_Swig.la
 
-libGEOM_Swig.py: swig_wrap.cpp
-BUILT_SOURCES = swig_wrap.cpp
-_libGEOM_Swig_la_SOURCES        = $(SWIG_SOURCES)
-nodist__libGEOM_Swig_la_SOURCES = $(BUILT_SOURCES)
-
-salomeinclude_HEADERS           = $(SWIG_SOURCES)
+_libGEOM_Swig_la_SOURCES        = $(SWIG_SOURCES) libGEOM_Swig.h libGEOM_Swig.cxx
+nodist__libGEOM_Swig_la_SOURCES = swig_wrap.cpp
 
 _libGEOM_Swig_la_CPPFLAGS =            \
        $(QT_INCLUDES)                  \
@@ -73,16 +61,23 @@ _libGEOM_Swig_la_CPPFLAGS =         \
        $(GUI_CXXFLAGS)                 \
        $(CORBA_CXXFLAGS)               \
        $(CORBA_INCLUDES)               \
+       $(BOOST_CPPFLAGS)               \
+       -I$(srcdir)/../GEOMClient       \
+       -I$(srcdir)/../OBJECT           \
        -I$(srcdir)/../GEOMGUI          \
+       -I$(srcdir)/../GEOMToolsGUI     \
        -I$(top_builddir)/idl
 
 _libGEOM_Swig_la_LDFLAGS = -module
 _libGEOM_Swig_la_LIBADD  =             \
        ../GEOMGUI/libGEOM.la           \
+       ../GEOMToolsGUI/libGEOMToolsGUI.la      \
        $(PYTHON_LIBS)
 
 swig_wrap.cpp : $(SWIG_SOURCES)
        $(SWIG) $(SWIG_FLAGS) -o $@ $<
 
+libGEOM_Swig.py: swig_wrap.cpp
+
 CLEANFILES = swig_wrap.cpp libGEOM_Swig.py
 
diff --git a/src/GEOM_SWIG_WITHIHM/libGEOM_Swig.cxx b/src/GEOM_SWIG_WITHIHM/libGEOM_Swig.cxx
new file mode 100644 (file)
index 0000000..616fd50
--- /dev/null
@@ -0,0 +1,723 @@
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File   : libGEOM_Swig.cxx
+// Author : Nicolas REJNERI, Paul RASCLE
+//
+#include "libGEOM_Swig.h"
+
+#include "GeometryGUI.h"
+#include "GEOMToolsGUI.h"
+
+#include "SUIT_Desktop.h"
+#include "SUIT_Session.h"
+#include "SalomeApp_Application.h"
+#include "SalomeApp_Study.h"
+
+#include "OB_Browser.h"
+
+#include "OCCViewer_ViewWindow.h"
+#include "OCCViewer_ViewManager.h"
+#include "SOCC_ViewModel.h"
+#include <SOCC_Prs.h>
+
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_View.h"
+#include "SVTK_Renderer.h"
+#include <SVTK_Prs.h>
+
+#include "GEOM_Actor.h"
+#include "GEOM_Client.hxx"
+#include "GEOM_AISShape.hxx"
+#include "GEOM_InteractiveObject.hxx"
+#include "GEOM_Displayer.h"
+#include "GEOM_Constants.h"
+
+#include "SALOME_Event.h"
+
+// OCCT Includes
+#include <TopAbs.hxx>
+#include <TopoDS_Shape.hxx>
+#include <AIS_ListOfInteractive.hxx>
+#include <AIS_ListIteratorOfListOfInteractive.hxx>
+#include <AIS_Drawer.hxx>
+#include <Prs3d_IsoAspect.hxx>
+#include <BRepTools.hxx>
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(GEOM_Gen)
+
+#include <vtkRenderer.h>
+
+static SHAPE_READER(ShapeReader);
+
+inline OCCViewer_Viewer* GetOCCViewer(SUIT_Application* theApp){
+  SUIT_ViewWindow* window = theApp->desktop()->activeWindow();
+  if(window && window->getViewManager()->getType() == OCCViewer_Viewer::Type()){
+    OCCViewer_ViewWindow* vw = dynamic_cast<OCCViewer_ViewWindow*>( window );
+    if ( vw ) {
+      OCCViewer_ViewManager* vm = dynamic_cast<OCCViewer_ViewManager*>( vw->getViewManager() );
+      if ( vm )
+        return vm->getOCCViewer();
+    }
+  }
+
+  return 0;
+}
+
+inline SVTK_ViewWindow* GetSVTKViewWindow(SUIT_Application* theApp){
+  SUIT_ViewWindow* window = theApp->desktop()->activeWindow();
+  if(window && window->getViewManager()->getType() == SVTK_Viewer::Type())
+    return dynamic_cast<SVTK_ViewWindow*>( window );
+
+  return 0;
+}
+
+GEOM_Swig::GEOM_Swig()
+{
+  // MESSAGE("Constructeur");
+}
+
+GEOM_Swig::~GEOM_Swig()
+{
+  // MESSAGE("Destructeur");
+}
+
+void GEOM_Swig::createAndDisplayGO (const char* Entry, bool isUpdated)
+{
+  class TEvent: public SALOME_Event
+  {
+    std::string myEntry;
+    bool        myUpdateViewer;
+  public:
+    TEvent(const char* theEntry, bool toUpdateViewer):
+      myEntry(theEntry),
+      myUpdateViewer(toUpdateViewer)
+    {}
+    virtual void Execute()
+    {
+      SUIT_Application* app = SUIT_Session::session()->activeApplication();
+      if (!app) return;
+
+      SalomeApp_Study* ActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
+      if (!ActiveStudy) return;
+
+      _PTR(Study) aStudy(ActiveStudy->studyDS());
+      _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder();
+
+      GEOM::GEOM_Gen_var Geom = GeometryGUI::GetGeomGen();
+      if (CORBA::is_nil(Geom)) {
+        GeometryGUI::InitGeomGen();
+        Geom = GeometryGUI::GetGeomGen();
+      }
+      if (CORBA::is_nil(Geom))
+        return;
+
+      std::string aFatherIOR;
+      _PTR(SComponent) father = aStudy->FindComponent("GEOM");
+      if (!father)
+        return;
+      if (!father->ComponentIOR(aFatherIOR)) {
+        CORBA::String_var objStr = SalomeApp_Application::orb()->object_to_string(Geom);
+        aStudyBuilder->LoadWith(father, objStr.in());
+        father->ComponentIOR(aFatherIOR);
+      }
+
+      _PTR(SObject) obj = aStudy->FindObjectID(myEntry);
+      if (!obj)
+        return;
+
+      // Create new actor
+      _PTR(GenericAttribute) anAttr;
+      if (!obj->FindAttribute(anAttr, "AttributeIOR"))
+        return;
+      _PTR(AttributeIOR) anIOR(anAttr);
+      std::string anIORValue = anIOR->Value();
+
+      GEOM::GEOM_Object_var aShape = Geom->GetIORFromString(anIORValue.c_str());
+      TopoDS_Shape Shape = ShapeReader.GetShape(Geom,aShape);
+      if (!Shape.IsNull()) {
+        if (obj->FindAttribute(anAttr, "AttributeName")) {
+          _PTR(AttributeName) aName (anAttr);
+          std::string aNameValue = aName->Value();
+          // open transaction
+          /*SUIT_Operation* op = new SalomeApp_ImportOperation (app);
+          op->start();
+
+          _PTR(SObject) newObj1 = aStudyBuilder->NewObject(father);
+          aStudyBuilder->Addreference(newObj1, obj);
+          // commit transaction
+          op->commit();*/
+          Handle(GEOM_InteractiveObject) anIO =
+            new GEOM_InteractiveObject (const_cast<char*>(anIORValue.c_str()),
+                                        const_cast<char*>(aFatherIOR.c_str()),
+                                        "GEOM",
+                                        const_cast<char*>( obj->GetID().c_str()));
+
+          GEOM_Displayer(ActiveStudy).Display(anIO, myUpdateViewer);
+          /*if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app)) {
+            SVTK_View* aView = aViewWindow->getView();
+            int aMode = aView->GetDisplayMode();
+
+            vtkActorCollection* theActors =
+              GEOM_AssemblyBuilder::BuildActors(Shape,0,aMode,true);
+            theActors->InitTraversal();
+            while (vtkActor* anActor = theActors->GetNextActor()) {
+              GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor);
+              GActor->setName(const_cast<char*>(aNameValue.c_str()));
+              GActor->setIO(anIO);
+              aView->Display(GActor);
+            }
+            aView->Repaint();
+          } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(app)) {
+            Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
+            Handle(GEOM_AISShape) aSh =
+              new GEOM_AISShape (Shape,const_cast<char*>(aNameValue.c_str()));
+            aSh->setName(const_cast<char*>(aNameValue.c_str()));
+            aSh->setIO(anIO);
+            ic->Display(aSh);
+            ic->AddOrRemoveCurrentObject(aSh,true);
+            }*/
+          // update object browser
+          SalomeApp_Application* app = NULL; //dynamic_cast<SalomeApp_Application*>(app);
+          if (app) {
+            CAM_Module* module = app->module("Geometry");
+            SalomeApp_Module* appMod = dynamic_cast<SalomeApp_Module*>(module);
+            if (appMod)
+              appMod->updateObjBrowser(true);
+          }
+        }
+      }
+    }
+  };
+
+  // MESSAGE("createAndDisplayGO");
+  ProcessVoidEvent(new TEvent (Entry, isUpdated));
+
+  class TEventUpdateBrowser: public SALOME_Event
+    {
+      public:
+        TEventUpdateBrowser() {}
+        virtual void Execute() {
+          SalomeApp_Application* app =
+            dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
+          if (app) {
+            CAM_Module* module = app->module("Geometry");
+            SalomeApp_Module* appMod = dynamic_cast<SalomeApp_Module*>(module);
+            if (appMod) appMod->updateObjBrowser(true);
+          }
+        }
+    };
+
+  if (isUpdated)
+    ProcessVoidEvent(new TEventUpdateBrowser ());
+}
+
+void GEOM_Swig::createAndDisplayFitAllGO (const char* Entry)
+{
+  class TEventFitAll: public SALOME_Event
+  {
+    public:
+      TEventFitAll() {}
+      virtual void Execute() {
+        SUIT_Application* app = SUIT_Session::session()->activeApplication();
+        if (!app) return;
+        
+        if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app))
+          {
+            SVTK_View* aView = aViewWindow->getView();
+            aView->GetRenderer()->OnFitAll();
+          }
+        else if (OCCViewer_Viewer* occViewer = GetOCCViewer(app))
+          {  
+            Handle(V3d_Viewer) aViewer3d = occViewer->getViewer3d();
+            aViewer3d->InitActiveViews();
+            
+            if (aViewer3d->MoreActiveViews())
+              aViewer3d->ActiveView()->FitAll();
+          }
+      }
+  };
+
+  createAndDisplayGO(Entry);
+  ProcessVoidEvent(new TEventFitAll());
+}
+
+void GEOM_Swig::UpdateViewer()
+{
+  class TEventUpdateViewer: public SALOME_Event
+  {
+    public:
+      TEventUpdateViewer() {}
+      virtual void Execute() {
+        SUIT_Application* app = SUIT_Session::session()->activeApplication();
+        if (!app) return;
+        SalomeApp_Study* ActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
+        if (!ActiveStudy) return;
+        
+        GEOM_Displayer(ActiveStudy).UpdateViewer();
+      }
+  };
+  
+  ProcessVoidEvent(new TEventUpdateViewer());
+}
+
+int GEOM_Swig::getIndexTopology(const char* SubIOR, const char* IOR)
+{
+  GEOM::GEOM_Gen_var aGeomGen = GeometryGUI::GetGeomGen();
+  if (CORBA::is_nil(aGeomGen))
+    return -1;
+
+  GEOM::GEOM_Object_var aMainShape = aGeomGen->GetIORFromString(IOR);
+  GEOM::GEOM_Object_var aSubShape  = aGeomGen->GetIORFromString(SubIOR);
+  if (CORBA::is_nil(aMainShape) || CORBA::is_nil(aSubShape))
+    return -1;
+
+  GEOM::GEOM_IShapesOperations_var anIShapesOperations =
+    aGeomGen->GetIShapesOperations(aMainShape->GetStudyID());
+  if (CORBA::is_nil(anIShapesOperations))
+    return -1;
+
+  return anIShapesOperations->GetTopologyIndex(aMainShape, aSubShape);
+}
+
+const char* GEOM_Swig::getShapeTypeString(const char* IOR)
+{
+  TCollection_AsciiString aTypeName ("Shape of unknown type");
+
+  GEOM::GEOM_Gen_var aGeomGen = GeometryGUI::GetGeomGen();
+  if (!CORBA::is_nil(aGeomGen))
+  {
+    GEOM::GEOM_Object_var aShape = aGeomGen->GetIORFromString(IOR);
+    if (!CORBA::is_nil(aShape))
+    {
+      GEOM::GEOM_IShapesOperations_var anIShapesOperations =
+        aGeomGen->GetIShapesOperations(aShape->GetStudyID());
+      if (!CORBA::is_nil(anIShapesOperations))
+      {
+        aTypeName = anIShapesOperations->GetShapeTypeString(aShape);
+      }
+    }
+  }
+
+  return CORBA::string_dup(aTypeName.ToCString());
+}
+
+
+const char* GEOM_Swig::getShapeTypeIcon(const char* IOR)
+{
+  GEOM::GEOM_Gen_var Geom = GeometryGUI::GetGeomGen();
+  if ( CORBA::is_nil( Geom ) )
+    return "None";
+
+  GEOM::GEOM_Object_var aShape = Geom->GetIORFromString(IOR);
+  TopoDS_Shape shape = ShapeReader.GetShape(Geom, aShape);
+
+  if( shape.IsNull() ) {
+    return "None" ;
+  }
+
+  switch (shape.ShapeType() )
+    {
+    case TopAbs_COMPOUND:
+      { return "ICON_OBJBROWSER_COMPOUND" ;}
+    case  TopAbs_COMPSOLID:
+      { return "ICON_OBJBROWSER_COMPSOLID" ;}
+    case TopAbs_SOLID:
+      { return "ICON_OBJBROWSER_SOLID" ;}
+    case TopAbs_SHELL:
+      { return "ICON_OBJBROWSER_SHELL" ;}
+    case TopAbs_FACE:
+      { return "ICON_OBJBROWSER_FACE" ;}
+    case TopAbs_WIRE:
+      { return "ICON_OBJBROWSER_WIRE" ;}
+    case TopAbs_EDGE:
+      { return "ICON_OBJBROWSER_EDGE" ;}
+    case TopAbs_VERTEX:
+      { return "ICON_OBJBROWSER_VERTEX" ;}
+    }
+
+  return "None";
+}
+
+void GEOM_Swig::setDisplayMode(const char* theEntry, int theMode, bool isUpdated)
+{
+  class TEvent: public SALOME_Event {
+    std::string myEntry;
+    int myMode;
+    bool myUpdateViewer;
+  public:
+    TEvent(const char* theEntryArg, int theModeArg, bool theUpdated):
+      myEntry(theEntryArg), myMode(theModeArg), myUpdateViewer(theUpdated)
+    {}
+    virtual void Execute() {
+      SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
+      if (!anApp) return;
+
+      Handle(SALOME_InteractiveObject) anIO =
+        new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
+
+      if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
+        SVTK_View* aView = aViewWindow->getView();
+        aView->SetDisplayMode(anIO, myMode);
+        if (myUpdateViewer)
+          aView->Repaint();
+      }
+      else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
+        SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
+        if (soccViewer)
+          soccViewer->switchRepresentation(anIO, myMode, myUpdateViewer);
+      }
+    }
+  };
+
+  ProcessVoidEvent(new TEvent (theEntry, theMode, isUpdated));
+}
+
+void GEOM_Swig::setVectorsMode(const char* theEntry, bool isOn, bool isUpdated)
+{
+  class TEvent: public SALOME_Event {
+    std::string myEntry;
+    bool myOn;
+    bool myUpdateViewer;
+  public:
+    TEvent(const char* theEntryArg, bool theOn, bool theUpdated):
+      myEntry(theEntryArg), myOn(theOn), myUpdateViewer(theUpdated)
+    {}
+    virtual void Execute() {
+      SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
+      if (!anApp) return;
+
+      Handle(SALOME_InteractiveObject) anIO =
+        new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
+
+      if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
+        SVTK_View* aView = aViewWindow->getView();
+        SVTK_Viewer* stvkViewer = dynamic_cast<SVTK_Viewer*>(aViewWindow->getViewManager()->getViewModel());
+        SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( stvkViewer->CreatePrs( myEntry.c_str()  ) );
+        vtkActorCollection* anActors = vtkPrs->GetObjects();
+        anActors->InitTraversal();
+        while (vtkActor* anAct = anActors->GetNextActor()) {
+          GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(anAct);
+          aGeomActor->SetVectorMode(!aGeomActor->GetVectorMode());
+        }
+        if (myUpdateViewer)
+          aView->Repaint();
+      }
+      else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
+        Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
+        SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
+        if (soccViewer) {
+          SOCC_Prs* occPrs = dynamic_cast<SOCC_Prs*>( soccViewer->CreatePrs( myEntry.c_str() ) );
+          if ( occPrs && !occPrs->IsNull() ) {
+            AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes );
+            AIS_ListIteratorOfListOfInteractive interIter( shapes );
+            for ( ; interIter.More(); interIter.Next() ) {
+              Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() );
+              aSh->SetDisplayVectors(myOn);
+              ic->RecomputePrsOnly(interIter.Value());
+            }
+          }
+        }
+      }
+    }
+  };
+
+  ProcessVoidEvent(new TEvent (theEntry, isOn, isUpdated));
+}
+
+void GEOM_Swig::setColor(const char* theEntry, int red, int green, int blue, bool isUpdated)
+{
+  class TEvent: public SALOME_Event {
+    QString myEntry;
+    int myRed;
+    int myGreen;
+    int myBlue;
+    bool myUpdateViewer;
+  public:
+    TEvent(const char* theEntryArg, int theR, int theG, int theB, bool theUpdated):
+      myEntry(theEntryArg), myRed(theR), myGreen(theG), myBlue(theB), myUpdateViewer(theUpdated)
+    {}
+    virtual void Execute() {
+      SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
+      if (!anApp) return;
+      GEOMToolsGUI::SetColor( myEntry, QColor( myRed, myGreen, myBlue), myUpdateViewer );
+    }
+  };
+  ProcessVoidEvent(new TEvent(theEntry, red, green, blue, isUpdated));
+}
+
+void GEOM_Swig::setIsos(const char* Entry, int nbU, int nbV, bool isUpdated )
+{
+  class TEvent: public SALOME_Event {
+    std::string myEntry;
+    int myNbU, myNbV;
+    bool myUpdateViewer;
+  public:
+    TEvent(const char* theEntry, int theNbU, int theNbV, bool theUpdated):
+      myEntry(theEntry), myNbU(theNbU), myNbV(theNbV), myUpdateViewer(theUpdated)
+    {}
+    virtual void Execute() {
+      SUIT_Application* app = SUIT_Session::session()->activeApplication();
+      if (!app) return;
+      SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
+      if (!study) return;
+
+      Handle(SALOME_InteractiveObject) anIO =
+        new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
+
+      if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app)) {
+        SVTK_Viewer* aView = dynamic_cast<SVTK_Viewer*>(aViewWindow->getViewManager()->getViewModel());
+       SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( aView->CreatePrs( myEntry.c_str() ) );
+       if ( vtkPrs ) {
+         vtkActorCollection* anActors = vtkPrs->GetObjects();
+         anActors->InitTraversal();
+         GEOM_Actor* anActor = GEOM_Actor::SafeDownCast( anActors->GetNextActor() );
+         if ( anActor ) {
+           int aIsos[2]={myNbU,myNbV};
+           anActor->SetNbIsos(aIsos);
+           anActor->StoreIsoNumbers();
+           QString anIsos = QString("%1%2%3").arg(myNbU).arg(DIGIT_SEPARATOR).arg(myNbV);
+           int aMgrId = aView->getViewManager()->getGlobalId();
+           study->setObjectProperty(aMgrId, myEntry.c_str(), ISOS_PROP, anIsos);
+         }
+       }
+       
+       if (myUpdateViewer)
+          aView->Repaint();
+      }
+      else if (OCCViewer_Viewer* occViewer = GetOCCViewer(app)) {
+        Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
+        SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
+        if (soccViewer) {
+         int aMgrId = soccViewer->getViewManager()->getGlobalId();
+          SOCC_Prs* occPrs = dynamic_cast<SOCC_Prs*>( soccViewer->CreatePrs( myEntry.c_str() ) );
+          if ( occPrs && !occPrs->IsNull() ) {
+            AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes );
+            AIS_ListIteratorOfListOfInteractive interIter( shapes );
+            for ( ; interIter.More(); interIter.Next() ) {
+              Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() );
+             if ( !aSh.IsNull() ) {
+               Handle(AIS_Drawer) drawer = aSh->Attributes();
+               QVariant v = study->getObjectProperty( aMgrId, myEntry.c_str(), EDGE_WIDTH_PROP, QVariant() );
+               int width = v.isValid() ? v.toInt() : 1;
+               drawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, width, myNbU) );
+               drawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, width, myNbV) );
+               aSh->storeIsoNumbers();
+                ic->SetLocalAttributes(aSh, drawer);
+               ic->Redisplay(aSh);
+               QString anIsos = QString("%1%2%3").arg(myNbU).arg(DIGIT_SEPARATOR).arg(myNbV);
+               study->setObjectProperty(aMgrId, myEntry.c_str(), ISOS_PROP, anIsos);
+             }
+            }
+          }
+        }
+      }
+    }
+  };
+
+  ProcessVoidEvent(new TEvent (Entry, nbU, nbV, isUpdated));
+}
+
+void GEOM_Swig::setTransparency(const char* theEntry, float transp, bool isUpdated)
+{
+  class TEvent: public SALOME_Event {
+    std::string myEntry;
+    float myParam;
+    bool myUpdateViewer;
+  public:
+    TEvent(const char* theEntryArg, float theParam, bool theUpdated):
+      myEntry(theEntryArg), myParam(theParam), myUpdateViewer(theUpdated)
+    {}
+    virtual void Execute() {
+      SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
+      if (!anApp) return;
+
+      Handle(SALOME_InteractiveObject) anIO =
+        new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
+
+      if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
+        SVTK_View* aView = aViewWindow->getView();
+        aView->SetTransparency(anIO, myParam);
+        if (myUpdateViewer)
+          aView->Repaint();
+      } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
+        SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
+        if (soccViewer)
+          soccViewer->setTransparency(anIO, myParam, myUpdateViewer);
+      }
+    }
+  };
+
+  ProcessVoidEvent(new TEvent (theEntry, transp, isUpdated));
+}
+
+
+class TInitGeomGenEvent: public SALOME_Event {
+public:
+  typedef bool TResult;
+  TResult myResult;
+  TInitGeomGenEvent() : myResult(false) {}
+  virtual void Execute() {
+    myResult = GeometryGUI::InitGeomGen();
+  }
+};
+bool GEOM_Swig::initGeomGen()
+{
+  return ProcessEvent(new TInitGeomGenEvent());
+}
+
+
+
+void GEOM_Swig::eraseGO (const char* Entry, bool allWindows)
+{
+  class TEvent: public SALOME_Event
+  {
+    std::string myEntry;
+    bool myFromAllWindows;
+  public:
+    TEvent(const char* theEntry, bool fromAllWindows):
+      myEntry(theEntry), myFromAllWindows(fromAllWindows)
+    {}
+    virtual void Execute()
+    {
+      SUIT_Application* app = SUIT_Session::session()->activeApplication();
+      if (!app) return;
+      SalomeApp_Study* ActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
+      if (!ActiveStudy) return;
+
+      Handle (SALOME_InteractiveObject) aIO = new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
+
+      GEOM_Displayer(ActiveStudy).Erase(aIO, true);
+      /*      if (myFromAllWindows) {
+        QPtrList<SUIT_ViewWindow> aWindows = app->desktop()->windows();
+        SUIT_ViewWindow* aWin = 0;
+        for (aWin = aWindows.first(); aWin; aWin = aWindows.next()) {
+          EraseObject(aWin, aIO);
+        }
+      } else {
+        SUIT_ViewWindow* aWin = app->desktop()->activeWindow();
+        if (aWin)
+          EraseObject(aWin, aIO);
+          }*/
+    }
+
+    /*  private:
+    void EraseObject(SUIT_ViewWindow* theWin, Handle (SALOME_InteractiveObject) theIO)
+    {
+      if (theWin->getViewManager()->getType() == OCCViewer_Viewer::Type()){
+        OCCViewer_ViewWindow* vw = dynamic_cast<OCCViewer_ViewWindow*>( theWin );
+        if ( vw ) {
+          OCCViewer_ViewManager* vm = dynamic_cast<OCCViewer_ViewManager*>( vw->getViewManager() );
+          if ( vm ) {
+            SOCC_Viewer* aViewer = dynamic_cast<SOCC_Viewer*>(vm->getOCCViewer());
+            if (aViewer) {
+              SALOME_Prs* aPrs = aViewer->CreatePrs(myEntry.c_str());
+              if (aPrs) {
+                SALOME_OCCPrs* aOccPrs =  dynamic_cast<SALOME_OCCPrs*>(aPrs);
+                if (aOccPrs) {
+                  aViewer->Erase(aOccPrs);
+                  aViewer->Repaint();
+                }
+              }
+            }
+          }
+        }
+      } else if (theWin->getViewManager()->getType() == SVTK_Viewer::Type()){
+        SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>( theWin );
+        if (aViewWindow) {
+          aViewWindow->Erase(theIO);
+        }
+      }
+      }*/
+
+  };
+  ProcessVoidEvent(new TEvent(Entry, allWindows));
+}
+
+
+
+void GEOM_Swig::setDeflection(const char* theEntry, float theDeflect)
+{
+  class TEvent: public SALOME_Event {
+    std::string myEntry;
+    float myParam;
+  public:
+    TEvent(const char* theEntryArg, float theParam):
+      myEntry(theEntryArg), myParam(theParam)
+    {}
+    virtual void Execute() {
+      SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
+      if (!anApp) return;
+
+      Handle(SALOME_InteractiveObject) anIO =
+        new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
+
+      if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
+        vtkActorCollection* aActors = aViewWindow->getRenderer()->GetActors();
+        aActors->InitTraversal();
+        while (vtkActor* aAct = aActors->GetNextActor()) {
+          if (GEOM_Actor* aGeomActor = dynamic_cast<GEOM_Actor*>(aAct)) {
+            if (aGeomActor->hasIO()) {
+              Handle(SALOME_InteractiveObject) aNextIO = aGeomActor->getIO();
+              if (aNextIO->isSame(anIO)) {
+                aGeomActor->setDeflection(myParam);
+                aViewWindow->Repaint();
+                return;
+              }
+            }
+          }
+        }
+        //      aView->SetTransparency(anIO, myParam);
+        //aView->Repaint();
+      } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
+        Handle(AIS_InteractiveContext) aContext = occViewer->getAISContext();
+        AIS_ListOfInteractive aAISList;
+        aContext->DisplayedObjects(aAISList);
+        AIS_ListIteratorOfListOfInteractive it(aAISList);
+        for (; it.More(); it.Next()) {
+          Handle(SALOME_InteractiveObject) aObj = 
+            Handle(SALOME_InteractiveObject)::DownCast(it.Value()->GetOwner());
+          if ((!aObj.IsNull()) && aObj->hasEntry() && aObj->isSame(anIO)) {
+            Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(it.Value());
+            if (!aShape.IsNull()) {
+              TopoDS_Shape aSh = aShape->Shape();
+              if (!aSh.IsNull())
+                BRepTools::Clean(aSh);
+
+              aShape->SetOwnDeviationCoefficient( myParam );
+              aShape->SetOwnHLRDeviationAngle( 1.57 );
+              aContext->Redisplay(aShape);
+              return;
+            }
+          }
+        }
+      }
+    }
+  };
+
+  ProcessVoidEvent(new TEvent (theEntry, theDeflect));
+}
+
diff --git a/src/GEOM_SWIG_WITHIHM/libGEOM_Swig.h b/src/GEOM_SWIG_WITHIHM/libGEOM_Swig.h
new file mode 100644 (file)
index 0000000..5f85b56
--- /dev/null
@@ -0,0 +1,63 @@
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File   : libGEOM_Swig.h
+// Author : Nicolas REJNERI, Paul RASCLE
+//
+
+#ifndef GEOMETRYGUI_SWIG_HXX
+#define GEOMETRYGUI_SWIG_HXX
+
+#include "GEOM_GEOMGUI.hxx"
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(GEOM_Gen)
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class GEOMGUI_EXPORT GEOM_Swig
+{
+public:
+  GEOM_Swig();
+  ~GEOM_Swig();
+
+  void createAndDisplayGO(const char* Entry, bool isUpdated = true);
+  void eraseGO(const char* Entry, bool allWindows);
+  void createAndDisplayFitAllGO(const char* Entry);
+  void UpdateViewer();
+  void setDisplayMode(const char* Entry, int mode, bool isUpdated = true);
+  void setVectorsMode(const char* Entry, bool isSet, bool isUpdated = true);
+  void setColor(const char* Entry, int red, int green, int blue, bool isUpdated = true);
+  void setTransparency(const char* Entry, float transp, bool isUpdated = true);
+  void setIsos(const char* Entry, int nbU, int nbV, bool isUpdated =true);
+  void setDeflection(const char* Entry, float deflect);
+
+  int  getIndexTopology(const char *SubEntry, const char *Entry);
+  const char* getShapeTypeString(const char *Entry);
+  const char* getShapeTypeIcon(const char *Ior);
+
+  bool initGeomGen();
+};
+
+#endif // GEOMETRYGUI_SWIG_HXX
index fc1b8fea470c16bca415252410770836197d20cd..6bf220c2d4553eea783b191716153c0ff4146ac3 100644 (file)
 //
 %module libGEOM_Swig
 
-%include "GeometryGUI_Swig.i"
+%{
+#include "libGEOM_Swig.h"
+%}
+
+/*
+  managing C++ exception in the Python API
+*/
+%exception
+{
+  class PyAllowThreadsGuard {
+   public:
+    // Py_BEGIN_ALLOW_THREADS
+    PyAllowThreadsGuard() { _save = PyEval_SaveThread(); }
+    // Py_END_ALLOW_THREADS
+    ~PyAllowThreadsGuard() { PyEval_RestoreThread(_save); }
+   private:
+    PyThreadState *_save;
+  };
+
+  PyAllowThreadsGuard guard;
+
+  $action
+}
+
+class GEOM_Swig
+{
+ public:
+  GEOM_Swig();
+  ~GEOM_Swig();
+
+  void createAndDisplayGO(const char* Entry, bool isUpdated =true);
+  void eraseGO(const char* Entry, bool allWindows);
+  void createAndDisplayFitAllGO(const char* Entry);
+  void UpdateViewer();
+  int  getIndexTopology(const char *SubEntry, const char *Entry);
+  const char* getShapeTypeString(const char *Entry);
+
+  void setDisplayMode(const char* Entry, int mode, bool isUpdated =true);
+  void setVectorsMode(const char* Entry, bool isSet, bool isUpdated =true);
+  void setColor(const char* Entry, int red, int green, int blue, bool isUpdated =true);
+  void setTransparency(const char* Entry, float transp, bool isUpdated =true);
+  void setIsos(const char* Entry, int nbU, int nbV, bool isUpdated =true);
+  void setDeflection(const char* Entry, float deflect);
+  const char* getShapeTypeIcon(const char *Ior);
+
+  bool initGeomGen();
+};
 
index 990263407f6a530f2765c500c1490758a81923a0..d8f92294fd42526026ca063dd8a62a5b0d0049a2 100644 (file)
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 // GEOM GEOMGUI : GUI for Geometry component
 // File   : GroupGUI.cxx
 // Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
-//
+
 #include "GroupGUI.h"
 #include "GroupGUI_GroupDlg.h" 
+#include "GroupGUI_BooleanDlg.h" 
 
 #include <GeometryGUI.h>
 #include "GeometryGUI_Operations.h"
@@ -44,8 +44,8 @@
 // function : GroupGUI()
 // purpose  : Constructor
 //=======================================================================
-GroupGUI::GroupGUI( GeometryGUI* parent )
-  : GEOMGUI( parent )
+GroupGUI::GroupGUI (GeometryGUI* parent)
+  : GEOMGUI(parent)
 {
 }
 
@@ -62,60 +62,67 @@ GroupGUI::~GroupGUI()
 // function : OnGUIEvent()
 // purpose  : 
 //=======================================================================
-bool GroupGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
+bool GroupGUI::OnGUIEvent (int theCommandID, SUIT_Desktop* parent)
 {
   SalomeApp_Application* app = getGeometryGUI()->getApp();
-  if ( !app ) return false;
+  if (!app) return false;
 
   getGeometryGUI()->EmitSignalDeactivateDialog();
 
   QDialog* aDlg = 0;
 
-  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
-  if ( !appStudy ) return false;
+  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
+  if (!appStudy) return false;
   _PTR(Study) aStudy = appStudy->studyDS();
 
-  if ( aStudy->GetProperties()->IsLocked() ) {
-    SUIT_MessageBox::warning( parent,
-                              tr( "WRN_WARNING" ), 
-                              tr( "WRN_STUDY_LOCKED" ) );
+  if (aStudy->GetProperties()->IsLocked()) {
+    SUIT_MessageBox::warning(parent, tr("WRN_WARNING"), tr("WRN_STUDY_LOCKED"));
     return false;
   }
 
-  switch ( theCommandID ) {
+  switch (theCommandID) {
   case GEOMOp::OpGroupCreate: 
   case GEOMOp::OpGroupCreatePopup: // CREATE GROUP
-    aDlg = new GroupGUI_GroupDlg( GroupGUI_GroupDlg::CreateGroup, getGeometryGUI(), parent ); 
+    aDlg = new GroupGUI_GroupDlg (GroupGUI_GroupDlg::CreateGroup, getGeometryGUI(), parent); 
     break;
-  case GEOMOp::OpGroupEdit:  // EDIT GROUP
+  case GEOMOp::OpGroupEdit: // EDIT GROUP
     {
       SALOME_ListIO aList;
       aList.Clear();
 
       LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
-      if ( aSelMgr )
-        aSelMgr->selectedObjects( aList );
+      if (aSelMgr)
+        aSelMgr->selectedObjects(aList);
 
-      if ( aList.Extent() == 1 ) {
+      if (aList.Extent() == 1) {
         GEOM::GEOM_Object_var anObj =
-          GEOMBase::ConvertIOinGEOMObject( aList.First() );
+          GEOMBase::ConvertIOinGEOMObject(aList.First());
 
-        if ( !CORBA::is_nil( anObj ) && anObj->GetType() == GEOM_GROUP ) {
-          aDlg = new GroupGUI_GroupDlg( GroupGUI_GroupDlg::EditGroup, getGeometryGUI(), parent ); 
+        if (!CORBA::is_nil(anObj) && anObj->GetType() == GEOM_GROUP) {
+          aDlg = new GroupGUI_GroupDlg (GroupGUI_GroupDlg::EditGroup, getGeometryGUI(), parent); 
           break;
         }
       }
-      SUIT_MessageBox::warning( parent, tr( "WRN_WARNING" ), tr( "NO_GROUP" ) );
-      break;
+      SUIT_MessageBox::warning(parent, tr("WRN_WARNING"), tr("NO_GROUP"));
     }
+    break;
+  case GEOMOp::OpGroupUnion: // UNION GROUPS
+    aDlg = new GroupGUI_BooleanDlg (GroupGUI_BooleanDlg::UNION, getGeometryGUI(), parent); 
+    break;
+  case GEOMOp::OpGroupIntersect: // INTERSECT GROUPS
+    aDlg = new GroupGUI_BooleanDlg (GroupGUI_BooleanDlg::INTERSECT, getGeometryGUI(), parent); 
+    break;
+  case GEOMOp::OpGroupCut: // CUT GROUPS
+    aDlg = new GroupGUI_BooleanDlg (GroupGUI_BooleanDlg::CUT, getGeometryGUI(), parent); 
+    break;
   default: 
-    app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); 
+    app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); 
     break;
   }
 
-  if ( aDlg ) {
+  if (aDlg) {
     aDlg->updateGeometry();
-    aDlg->resize( aDlg->minimumSizeHint() );
+    aDlg->resize(aDlg->minimumSizeHint());
     aDlg->show();
   }
 
diff --git a/src/GroupGUI/GroupGUI_BooleanDlg.cxx b/src/GroupGUI/GroupGUI_BooleanDlg.cxx
new file mode 100644 (file)
index 0000000..3c227e0
--- /dev/null
@@ -0,0 +1,320 @@
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File   : GroupGUI_BooleanDlg.cxx
+// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
+
+#include "GroupGUI_BooleanDlg.h"
+
+#include <DlgRef.h>
+#include <GeometryGUI.h>
+#include <GEOMBase.h>
+
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+#include <SalomeApp_Application.h>
+#include <LightApp_SelectionMgr.h>
+
+#include <GEOMImpl_Types.hxx>
+
+//=================================================================================
+// class    : GroupGUI_BooleanDlg()
+// purpose  : Constructs a GroupGUI_BooleanDlg which is a child of 'parent', with the
+//            name 'name' and widget flags set to 'f'.
+//            The dialog will by default be modeless, unless you set 'modal' to
+//            TRUE to construct a modal dialog.
+//=================================================================================
+GroupGUI_BooleanDlg::GroupGUI_BooleanDlg (const int theOperation, GeometryGUI* theGeometryGUI,
+                                          QWidget* parent, bool modal, Qt::WindowFlags fl)
+  : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
+    myOperation(theOperation)
+{
+  QPixmap image0;
+  QString aTitle, aCaption;
+  switch (myOperation) {
+  case UNION:
+    image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_FUSE")));
+    aTitle = tr("GEOM_UNION");
+    aCaption = tr("GEOM_UNION_TITLE");
+    setHelpFileName("work_with_groups_page.html#union_groups_anchor");
+    break;
+  case INTERSECT:
+    image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_COMMON")));
+    aTitle = tr("GEOM_INTERSECT");
+    aCaption = tr("GEOM_INTERSECT_TITLE");
+    setHelpFileName("work_with_groups_page.html#intersect_groups_anchor");
+    break;
+  case CUT:
+    image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_CUT")));
+    aTitle = tr("GEOM_CUT");
+    aCaption = tr("GEOM_CUT_TITLE");
+    setHelpFileName("work_with_groups_page.html#cut_groups_anchor");
+    break;
+  }
+  QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
+
+  setWindowTitle(aCaption);
+
+  /***************************************************************/
+  mainFrame()->GroupConstructors->setTitle(aTitle);
+  mainFrame()->RadioButton1->setIcon(image0);
+  mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
+  mainFrame()->RadioButton2->close();
+  mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
+  mainFrame()->RadioButton3->close();
+
+  myGroup = new DlgRef_2Sel (centralWidget());
+
+  myGroup->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
+  if (myOperation == CUT) {
+    myGroup->TextLabel1->setText(tr("GEOM_MAIN_GROUPS"));
+    myGroup->TextLabel2->setText(tr("GEOM_TOOL_GROUPS"));
+  }
+  else {
+    myGroup->TextLabel1->setText(tr("GEOM_GROUPS").arg(1));
+    myGroup->TextLabel2->hide();
+    myGroup->PushButton2->hide();
+    myGroup->LineEdit2->hide();
+  }
+
+  myGroup->PushButton1->setIcon(image1);
+  myGroup->PushButton2->setIcon(image1);
+  myGroup->LineEdit1->setReadOnly(true);
+  myGroup->LineEdit2->setReadOnly(true);
+
+  QVBoxLayout* layout = new QVBoxLayout (centralWidget());
+  layout->setMargin(0); layout->setSpacing(6);
+  layout->addWidget(myGroup);
+  /***************************************************************/
+
+  // Initialisation
+  Init();
+}
+
+//=================================================================================
+// function : ~GroupGUI_BooleanDlg()
+// purpose  : Destroys the object and frees any allocated resources
+//=================================================================================
+GroupGUI_BooleanDlg::~GroupGUI_BooleanDlg()
+{
+}
+
+//=================================================================================
+// function : Init()
+// purpose  :
+//=================================================================================
+void GroupGUI_BooleanDlg::Init()
+{
+  // init variables
+  myEditCurrentArgument = myGroup->LineEdit1;
+
+  myGroup->LineEdit1->setText("");
+  myGroup->LineEdit2->setText("");
+  myListShapes.length( 0 );
+  myListTools.length( 0 );
+
+  // signals and slots connections
+  connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+  connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+
+  connect(myGroup->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(myGroup->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+
+  connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+           SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+
+  initName(mainFrame()->GroupConstructors->title());
+
+  setTabOrder(mainFrame()->GroupConstructors, mainFrame()->GroupBoxName);
+  setTabOrder(mainFrame()->GroupBoxName, mainFrame()->GroupMedium);
+  setTabOrder(mainFrame()->GroupMedium, mainFrame()->GroupButtons);
+
+  mainFrame()->RadioButton1->setFocus();
+
+  globalSelection(GEOM_GROUP);
+
+  myGroup->PushButton1->click();
+  SelectionIntoArgument();
+  resize(100,100);
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose  :
+//=================================================================================
+void GroupGUI_BooleanDlg::ClickOnOk()
+{
+  setIsApplyAndClose(true);
+  if (ClickOnApply())
+    ClickOnCancel();
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose  :
+//=================================================================================
+bool GroupGUI_BooleanDlg::ClickOnApply()
+{
+  if (!onAccept())
+    return false;
+
+  initName();
+  // activate selection and connect selection manager
+  myGroup->PushButton1->click();
+  return true;
+}
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose  : Called when selection is changed or on dialog initialization or activation
+//=================================================================================
+void GroupGUI_BooleanDlg::SelectionIntoArgument()
+{
+  myEditCurrentArgument->setText("");
+
+  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+  SALOME_ListIO aSelList;
+  aSelMgr->selectedObjects(aSelList);
+
+  QString aString = "";
+  GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true);
+
+  if (myEditCurrentArgument == myGroup->LineEdit1) {
+    GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListShapes, true);
+  }
+  else if ( myEditCurrentArgument == myGroup->LineEdit2 ) {
+    GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListTools, true);
+  }
+
+  myEditCurrentArgument->setText(aString);
+}
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose  :
+//=================================================================================
+void GroupGUI_BooleanDlg::SetEditCurrentArgument()
+{
+  QPushButton* send = (QPushButton*)sender();
+
+  if (send == myGroup->PushButton1) {
+    myEditCurrentArgument = myGroup->LineEdit1;
+
+    myGroup->PushButton2->setDown(false);
+    myGroup->LineEdit2->setEnabled(false);
+  }
+  else if (send == myGroup->PushButton2) {
+    myEditCurrentArgument = myGroup->LineEdit2;
+
+    myGroup->PushButton1->setDown(false);
+    myGroup->LineEdit1->setEnabled(false);
+  }
+
+  // enable line edit
+  myEditCurrentArgument->setEnabled(true);
+  myEditCurrentArgument->setFocus();
+  // after setFocus(), because it will be setDown(false) when loses focus
+  send->setDown(true);
+}
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose  :
+//=================================================================================
+void GroupGUI_BooleanDlg::ActivateThisDialog()
+{
+  GEOMBase_Skeleton::ActivateThisDialog();
+
+  connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+           this, SLOT(SelectionIntoArgument()));
+}
+
+//=================================================================================
+// function : enterEvent()
+// purpose  : when mouse enter onto the QWidget
+//=================================================================================
+void GroupGUI_BooleanDlg::enterEvent (QEvent*)
+{
+  if (!mainFrame()->GroupConstructors->isEnabled())
+    ActivateThisDialog();
+}
+
+//=================================================================================
+// function : createOperation
+// purpose  :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr GroupGUI_BooleanDlg::createOperation()
+{
+  return getGeomEngine()->GetIGroupOperations(getStudyId());
+}
+
+//=================================================================================
+// function : isValid
+// purpose  :
+//=================================================================================
+bool GroupGUI_BooleanDlg::isValid (QString&)
+{
+  return (myListShapes.length() > 0);
+}
+
+//=================================================================================
+// function : execute
+// purpose  :
+//=================================================================================
+bool GroupGUI_BooleanDlg::execute (ObjectList& objects)
+{
+  GEOM::GEOM_Object_var anObj;
+
+  GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation());
+  switch (myOperation) {
+  case UNION:
+    anObj = anOper->UnionListOfGroups(myListShapes);
+    break;
+  case INTERSECT:
+    anObj = anOper->IntersectListOfGroups(myListShapes);
+    break;
+  case CUT:
+    anObj = anOper->CutListOfGroups(myListShapes, myListTools);
+    break;
+  default:
+    ;
+  }
+  if (!anObj->_is_nil())
+    objects.push_back(anObj._retn());
+
+  return true;
+}
+
+//================================================================
+// Function : getFather
+// Purpose  : Get father object for object to be added in study
+//            (called with addInStudy method)
+//================================================================
+GEOM::GEOM_Object_ptr GroupGUI_BooleanDlg::getFather(GEOM::GEOM_Object_ptr theObj)
+{
+  GEOM::GEOM_Object_var aFatherObj;
+  if (theObj->GetType() == GEOM_GROUP) {
+    GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation());
+    aFatherObj = anOper->GetMainShape(theObj);
+  }
+  return aFatherObj._retn();
+}
diff --git a/src/GroupGUI/GroupGUI_BooleanDlg.h b/src/GroupGUI/GroupGUI_BooleanDlg.h
new file mode 100644 (file)
index 0000000..467130e
--- /dev/null
@@ -0,0 +1,76 @@
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File   : GroupGUI_BooleanDlg.h
+// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
+
+#ifndef GROUPGUI_BOOLEANDLG_H
+#define GROUPGUI_BOOLEANDLG_H
+
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
+
+class DlgRef_2Sel;
+
+//=================================================================================
+// class    : GroupGUI_BooleanDlg
+// purpose  :
+//=================================================================================
+class GroupGUI_BooleanDlg : public GEOMBase_Skeleton
+{
+  Q_OBJECT
+
+public:
+  enum Operation { UNION = 1, INTERSECT = 2, CUT = 3 };
+
+  GroupGUI_BooleanDlg (const int, GeometryGUI*, QWidget* = 0,
+                       bool = false, Qt::WindowFlags = 0);
+  ~GroupGUI_BooleanDlg();
+
+protected:
+  // redefined from GEOMBase_Helper
+  virtual GEOM::GEOM_IOperations_ptr createOperation();
+  virtual bool                       isValid (QString&);
+  virtual bool                       execute (ObjectList&);
+  virtual GEOM::GEOM_Object_ptr      getFather (GEOM::GEOM_Object_ptr);
+
+private:
+  void                               Init();
+  void                               enterEvent (QEvent*);
+
+private slots:
+  void                               ClickOnOk();
+  bool                               ClickOnApply();
+  void                               SetEditCurrentArgument();
+  void                               SelectionIntoArgument();
+  void                               ActivateThisDialog();
+  
+private:
+  int                                myOperation;
+  
+  GEOM::ListOfGO                     myListShapes;
+  GEOM::ListOfGO                     myListTools;
+  
+  DlgRef_2Sel*                       myGroup;
+};
+
+#endif // GROUPGUI_BOOLEANDLG_H
index 068c3587afde2c761dea5b5ca8e32c2858bb75d2..78e540589ff7105f5d3c606ccac23d088bf441cb 100755 (executable)
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
 
-# GEOM GROUPGUI : 
 # File    : Makefile.am
 # Author  : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com)
 # Package : GroupGUI
-#
+
 include $(top_srcdir)/adm_local/unix/make_common_starter.am
 
 # Libraries targets
@@ -30,16 +28,20 @@ lib_LTLIBRARIES = libGroupGUI.la
 # header files 
 salomeinclude_HEADERS =                \
        GroupGUI.h              \
+       GroupGUI_BooleanDlg.h   \
        GroupGUI_GroupDlg.h
 
 dist_libGroupGUI_la_SOURCES =  \
        GroupGUI.h              \
+       GroupGUI_BooleanDlg.h   \
        GroupGUI_GroupDlg.h     \
        GroupGUI.cxx            \
+       GroupGUI_BooleanDlg.cxx \
        GroupGUI_GroupDlg.cxx
 
-MOC_FILES =                    \
-       GroupGUI_moc.cxx        \
+MOC_FILES =                            \
+       GroupGUI_moc.cxx                \
+       GroupGUI_BooleanDlg_moc.cxx     \
        GroupGUI_GroupDlg_moc.cxx 
 
 nodist_libGroupGUI_la_SOURCES =        \
index cff70de1861e89bc3e0b2a54a8aef281a94fab2d..e9c73ac4a2569d319a6fc57b6c43ad6dca374c53 100644 (file)
@@ -51,6 +51,8 @@
 #include <BRep_Builder.hxx>
 #include <gp_Pnt.hxx>
 
+#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
+
 #ifdef WNT
  #if defined IGESIMPORT_EXPORTS || defined IGESImport_EXPORTS
   #if defined WIN32
 
 extern "C"
 {
+  IGESIMPORT_EXPORT
+  Handle(TCollection_HAsciiString) GetValue (const TCollection_AsciiString& theFileName,
+                                             const TCollection_AsciiString& theParameterName,
+                                             TCollection_AsciiString&       theError)
+  {
+    Handle(TCollection_HAsciiString) aValue;
+
+    if (theParameterName != "LEN_UNITS") {
+      theError = theParameterName + " parameter reading is not supported by IGES plugin";
+      return aValue;
+    }
+
+    // Set "C" numeric locale to save numbers correctly
+    Kernel_Utils::Localizer loc;
+
+    IGESControl_Reader aReader;
+
+    Interface_Static::SetCVal("xstep.cascade.unit","M");
+
+    try {
+      OCC_CATCH_SIGNALS;
+
+      IFSelect_ReturnStatus status = aReader.ReadFile(theFileName.ToCString());
+      if (status == IFSelect_RetDone) {
+        Handle(IGESData_IGESModel) aModel =
+          Handle(IGESData_IGESModel)::DownCast(aReader.Model());
+        if (!aModel.IsNull()) {
+          aValue = aModel->GlobalSection().UnitName();
+
+          if (!aValue.IsNull()) {
+            Handle(TCollection_HAsciiString) aPrefix = new TCollection_HAsciiString ("UNIT_");
+            aValue->Prepend(aPrefix);
+          }
+        }
+      }
+      else {
+        theError = theFileName + " reading failed";
+      }
+    }
+    catch (Standard_Failure) {
+      Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+      theError = aFail->GetMessageString();
+    }
+
+    return aValue;
+  }
+
 IGESIMPORT_EXPORT
   TopoDS_Shape Import (const TCollection_AsciiString& theFileName,
                        const TCollection_AsciiString& theFormatName,
                        TCollection_AsciiString&       theError,
                        const TDF_Label&               theShapeLabel)
   {
+    TopoDS_Shape aResShape;
+
     // Set "C" numeric locale to save numbers correctly
     Kernel_Utils::Localizer loc;
 
     IGESControl_Reader aReader;
-    TopoDS_Shape aResShape;
+
     Interface_Static::SetCVal("xstep.cascade.unit","M");
+
     try {
+      OCC_CATCH_SIGNALS;
+
       IFSelect_ReturnStatus status = aReader.ReadFile(theFileName.ToCString());
 
       if (status == IFSelect_RetDone) {
 
+        // BEGIN: old code
         if (theFormatName == "IGES_UNIT") {
           Handle(IGESData_IGESModel) aModel =
             Handle(IGESData_IGESModel)::DownCast(aReader.Model());
-          gp_Pnt P(1.0,0.0,0.0);
+          gp_Pnt P (1.0, 0.0, 0.0);
           if (!aModel.IsNull()) {
             Handle(TCollection_HAsciiString) aUnitName =
               aModel->GlobalSection().UnitName();
-            //cout<<"aUnitName = "<<aUnitName->ToCString()<<endl;
-            //cout<<"aUnitFlag = "<<aModel->GlobalSection().UnitFlag()<<endl;
-            if (aUnitName->String()=="MM") {
-              P = gp_Pnt(0.001,0.0,0.0);
-            }
-            else if (aUnitName->String()=="CM") {
-              P = gp_Pnt(0.01,0.0,0.0);
+            if (!aUnitName.IsNull()) {
+              if (aUnitName->String()=="MM") {
+                P = gp_Pnt(0.001,0.0,0.0);
+              }
+              else if (aUnitName->String()=="CM") {
+                P = gp_Pnt(0.01,0.0,0.0);
+              }
             }
           }
           BRep_Builder B;
@@ -116,6 +171,8 @@ IGESIMPORT_EXPORT
           aResShape = V;
           return aResShape;
         }
+        // END: old code
+
         if (theFormatName == "IGES_SCALE") {
           //cout<<"need re-scale a model"<<endl;
           // set UnitFlag to 'meter'
index 8b0541a9af480125dda4238be3b12be724cbfcac..55cfcf7a5a899aaeac31136f770d7f19a1ad4a23 100644 (file)
@@ -40,6 +40,7 @@ salomeinclude_HEADERS =                               \
        MeasureGUI_WhatisDlg.h                  \
        MeasureGUI_CheckShapeDlg.h              \
        MeasureGUI_CheckCompoundOfBlocksDlg.h   \
+       MeasureGUI_GetNonBlocksDlg.h            \
        MeasureGUI_CheckSelfIntersectionsDlg.h  \
        MeasureGUI_PointDlg.h
 
@@ -61,6 +62,7 @@ dist_libMeasureGUI_la_SOURCES =                       \
        MeasureGUI_WhatisDlg.cxx                \
        MeasureGUI_CheckShapeDlg.cxx            \
        MeasureGUI_CheckCompoundOfBlocksDlg.cxx \
+       MeasureGUI_GetNonBlocksDlg.cxx          \
        MeasureGUI_CheckSelfIntersectionsDlg.cxx \
        MeasureGUI_PointDlg.cxx
 
@@ -78,6 +80,7 @@ MOC_FILES =                                           \
        MeasureGUI_WhatisDlg_moc.cxx                    \
        MeasureGUI_CheckShapeDlg_moc.cxx                \
        MeasureGUI_CheckCompoundOfBlocksDlg_moc.cxx     \
+       MeasureGUI_GetNonBlocksDlg_moc.cxx              \
        MeasureGUI_CheckSelfIntersectionsDlg_moc.cxx    \
        MeasureGUI_PointDlg_moc.cxx
 
@@ -122,4 +125,3 @@ libMeasureGUI_la_CPPFLAGS =         \
 libMeasureGUI_la_LDFLAGS  =            \
        $(CAS_LDFLAGS) -lTKGeomBase \
        ../GEOMBase/libGEOMBase.la ../DlgRef/libDlgRef.la
-
index e1ddbfcfff31b4b53818b073223d32ec163657dc..f31cf71615de934031c272a523b2035aea60d32b 100644 (file)
@@ -18,7 +18,6 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 // GEOM GEOMGUI : GUI for Geometry component
 // File   : MeasureGUI.cxx
@@ -42,6 +41,7 @@
 #include "MeasureGUI_WhatisDlg.h"        // Method WHATIS
 #include "MeasureGUI_CheckShapeDlg.h"    // Method CHECKSHAPE
 #include "MeasureGUI_CheckCompoundOfBlocksDlg.h" // Method CHECKCOMPOUND
+#include "MeasureGUI_GetNonBlocksDlg.h"  // Method GET NON BLOCKS
 #include "MeasureGUI_CheckSelfIntersectionsDlg.h" // Method CHECK SELF INTERSCTIONS
 #include "MeasureGUI_PointDlg.h"         // Method POINTCOORDINATES
 
@@ -110,6 +110,9 @@ bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
   case GEOMOp::OpCheckCompound:
     dlg = new MeasureGUI_CheckCompoundOfBlocksDlg( getGeometryGUI(), parent );
     break; // CHECKCOMPOUND
+  case GEOMOp::OpGetNonBlocks:
+    dlg = new MeasureGUI_GetNonBlocksDlg(getGeometryGUI(), parent);
+    break; // GET NON BLOCKS
   case GEOMOp::OpCheckSelfInters:
     dlg = new MeasureGUI_CheckSelfIntersectionsDlg( getGeometryGUI(), parent );
     break; // CHECK SELF INTERSCTIONS
index 3544009ac56527bc54f90a29eaedc62a6d77b5e3..d3eb0603a053bb36b25c04010f31967e98a4ad65 100644 (file)
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 // GEOM GEOMGUI : GUI for Geometry component
 // File   : MeasureGUI_BndBoxDlg.cxx
 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
-//
+
 #include "MeasureGUI_BndBoxDlg.h"
 #include "MeasureGUI_Widgets.h"
 
 #include <GEOMBase.h>
 #include <DlgRef.h>
 
-#include <GEOM_Function.hxx>
-#include <GEOM_Object.hxx>
-
 #include <BRepPrimAPI_MakeBox.hxx>
-#include <BRepAdaptor_Surface.hxx>
-#include <BRep_Tool.hxx>
-#include <BRep_TFace.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopExp_Explorer.hxx>
 
 #include <SUIT_Session.h>
 #include <SUIT_ResourceMgr.h>
-#include <SalomeApp_Tools.h>
-
-// #include <qlineedit.h>
-// #include <qlabel.h>
-// #include <qlayout.h>
-// #include <qpushbutton.h>
-// #include <qradiobutton.h>
-// #include <qbuttongroup.h>
 
 //=================================================================================
 // class    : MeasureGUI_BndBoxDlg()
-// purpose  : Constructs a MeasureGUI_BndBoxDlg which is a child of 'parent', with the 
+// purpose  : Constructs a MeasureGUI_BndBoxDlg which is a child of 'parent', with the
 //            name 'name' and widget flags set to 'f'.
 //            The dialog will by default be modeless, unless you set 'modal' to
 //            true to construct a modal dialog.
 //=================================================================================
-MeasureGUI_BndBoxDlg::MeasureGUI_BndBoxDlg( GeometryGUI* GUI, QWidget* parent )
-  : MeasureGUI_Skeleton( GUI, parent )
+MeasureGUI_BndBoxDlg::MeasureGUI_BndBoxDlg (GeometryGUI* GUI, QWidget* parent)
+  : MeasureGUI_Skeleton(GUI, parent)
 {
   QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap(
     "GEOM", tr( "ICON_DLG_BOUNDING_BOX" ) ) );
@@ -72,7 +54,7 @@ MeasureGUI_BndBoxDlg::MeasureGUI_BndBoxDlg( GeometryGUI* GUI, QWidget* parent )
   setWindowTitle( tr( "GEOM_BNDBOX_TITLE" ) );
 
   /***************************************************************/
-  
+
   mainFrame()->GroupConstructors->setTitle( tr( "GEOM_BNDBOX" ) );
   mainFrame()->RadioButton1->setIcon( image0 );
 
@@ -102,7 +84,7 @@ MeasureGUI_BndBoxDlg::MeasureGUI_BndBoxDlg( GeometryGUI* GUI, QWidget* parent )
   QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
   layout->setMargin( 0 ); layout->setSpacing( 6 );
   layout->addWidget( myGrp );
-  
+
   /***************************************************************/
 
   myHelpFileName = "using_measurement_tools_page.html#bounding_box_anchor";
@@ -111,7 +93,6 @@ MeasureGUI_BndBoxDlg::MeasureGUI_BndBoxDlg( GeometryGUI* GUI, QWidget* parent )
   Init();
 }
 
-
 //=================================================================================
 // function : ~MeasureGUI_BndBoxDlg()
 // purpose  : Destroys the object and frees any allocated resources
@@ -120,7 +101,6 @@ MeasureGUI_BndBoxDlg::~MeasureGUI_BndBoxDlg()
 {
 }
 
-
 //=================================================================================
 // function : Init()
 // purpose  :
@@ -140,14 +120,14 @@ void MeasureGUI_BndBoxDlg::processObject()
 {
   double aXMin, aXMax, aYMin, aYMax, aZMin, aZMax;
 
-  if ( !getParameters( aXMin, aXMax, aYMin, aYMax, aZMin, aZMax ) ) {
-    mySelEdit->setText( "" );
-    myGrp->LineEdit11->setText( "" );
-    myGrp->LineEdit12->setText( "" );
-    myGrp->LineEdit21->setText( "" );
-    myGrp->LineEdit22->setText( "" );
-    myGrp->LineEdit31->setText( "" );
-    myGrp->LineEdit32->setText( "" );
+  if (!getParameters(aXMin, aXMax, aYMin, aYMax, aZMin, aZMax)) {
+    mySelEdit->setText("");
+    myGrp->LineEdit11->setText("");
+    myGrp->LineEdit12->setText("");
+    myGrp->LineEdit21->setText("");
+    myGrp->LineEdit22->setText("");
+    myGrp->LineEdit31->setText("");
+    myGrp->LineEdit32->setText("");
   }
   else {
     SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
@@ -168,71 +148,17 @@ void MeasureGUI_BndBoxDlg::processObject()
 // function : getParameters
 // purpose  :
 //=================================================================================
-bool MeasureGUI_BndBoxDlg::getParametersdouble& theXmin, double& theXmax,
+bool MeasureGUI_BndBoxDlg::getParameters (double& theXmin, double& theXmax,
                                           double& theYmin, double& theYmax,
-                                          double& theZmin, double& theZmax )
+                                          double& theZmin, double& theZmax)
 {
-  if ( myObj->_is_nil() )
+  if (myObj->_is_nil())
     return false;
-  else {
-    GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
-    try {
-      Handle(Poly_Triangulation) Trtn = 0; 
-
-      GEOM::GEOM_Gen_var aGeomGen = GeometryGUI::GetGeomGen();
-      if ( CORBA::is_nil(aGeomGen) )
-        return false;
-
-      QString IOR = GEOMBase::GetIORFromObject( myObj );
-      GEOM::GEOM_Object_var anObject = aGeomGen->GetIORFromString( IOR.toLatin1().constData() );
-      if ( CORBA::is_nil(anObject) )
-        return false;
-
-      TopoDS_Shape aShape;
-      GEOMBase::GetShape(anObject, aShape, TopAbs_SHAPE);
-      if ( aShape.IsNull() )
-        return false;
-      
-      TopLoc_Location l;
-      Handle(Poly_Triangulation) T;
-      TopExp_Explorer ex;
-      for (ex.Init(aShape,TopAbs_FACE); ex.More(); ex.Next()) {
-        const TopoDS_Face& F = TopoDS::Face(ex.Current());
-        BRepAdaptor_Surface surf(F);
-        if (surf.GetType() == GeomAbs_Sphere) {
-          T = BRep_Tool::Triangulation(F, l);
-          if (!T.IsNull()) {
-            Handle(Poly_Triangulation) NullTrtn = 0;
-            (*((Handle(BRep_TFace)*)&F.TShape()))->Triangulation(NullTrtn);
-            Trtn = T;
-            break;
-          }
-        }
-        else
-          break;
-      }
-      
-      anOper->GetBoundingBox( myObj, theXmin, theXmax, theYmin, theYmax, theZmin, theZmax );
-      
-      if (!Trtn.IsNull()) {
-        TopLoc_Location l;
-        Handle(Poly_Triangulation) T;
-        TopExp_Explorer ex;
-        for (ex.Init(aShape,TopAbs_FACE); ex.More(); ex.Next()) {
-          const TopoDS_Face& F = TopoDS::Face(ex.Current());
-          (*((Handle(BRep_TFace)*)&F.TShape()))->Triangulation(Trtn);
-          break;
-        }
-      }
-      
-    }
-    catch( const SALOME::SALOME_Exception& e ) {
-      SalomeApp_Tools::QtCatchCorbaException( e );
-      return false;
-    }
-
-    return anOper->IsDone();
-  }
+
+  GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow(getOperation());
+  anOper->GetBoundingBox(myObj, theXmin, theXmax, theYmin, theYmax, theZmin, theZmax);
+
+  return anOper->IsDone();
 }
 
 //=================================================================================
@@ -243,12 +169,11 @@ SALOME_Prs* MeasureGUI_BndBoxDlg::buildPrs()
 {
   double aXMin, aYMin, aZMin, aXMax, aYMax, aZMax;
 
-  if ( myObj->_is_nil() || !getParameters( aXMin, aXMax, aYMin, aYMax, aZMin, aZMax ) )
+  if (!getParameters(aXMin, aXMax, aYMin, aYMax, aZMin, aZMax))
     return 0;
 
-  TopoDS_Shape aShape = BRepPrimAPI_MakeBox( gp_Pnt( aXMin, aYMin, aZMin ),
-                                             gp_Pnt( aXMax, aYMax, aZMax ) ).Shape();
-       
-  return !aShape.IsNull() ? getDisplayer()->BuildPrs( aShape ) : 0;
+  TopoDS_Shape aShape = BRepPrimAPI_MakeBox(gp_Pnt(aXMin, aYMin, aZMin),
+                                            gp_Pnt(aXMax, aYMax, aZMax)).Shape();
 
+  return !aShape.IsNull() ? getDisplayer()->BuildPrs(aShape) : 0;
 }
index 84676e669b4c5490a28ffcc60e74732b151cdf5e..df20f449cc8dbb0136ad2d1189a59079f1d534cb 100644 (file)
@@ -84,7 +84,7 @@ MeasureGUI_CenterMassDlg::MeasureGUI_CenterMassDlg( GeometryGUI* theGeometryGUI,
 
   /***************************************************************/
 
-  myHelpFileName = "using_measurement_tools_page.html#center_mass_anchor";
+  myHelpFileName = "center_mass_page.html";
 
   /* Initialisation */
   Init();
index df12686dd70485966f18143d96d28570036e0f52..e94f29d689e1dc32d1c2feb750300118b4764971 100644 (file)
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 // GEOM GEOMGUI : GUI for Geometry component
 // File   : MeasureGUI_CheckSelfIntersectionsDlg.cxx
-// Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com)
 
 #include "MeasureGUI_CheckSelfIntersectionsDlg.h"
 #include "MeasureGUI_Widgets.h"
@@ -144,7 +142,13 @@ void MeasureGUI_CheckSelfIntersectionsDlg::processObject()
     SalomeApp_Tools::QtCatchCorbaException(e);
     isFailed = true;
   }
-  if (isFailed) {
+
+  if (!anOper->IsDone()) {
+    aMsg += tr(anOper->GetErrorCode());
+    myGrp->TextView1->setText(aMsg);
+    return;
+  }
+  else if (isFailed) {
     aMsg += tr("GEOM_CHECK_SELF_INTERSECTIONS_FAILED");
     myGrp->TextView1->setText(aMsg);
     return;
diff --git a/src/MeasureGUI/MeasureGUI_GetNonBlocksDlg.cxx b/src/MeasureGUI/MeasureGUI_GetNonBlocksDlg.cxx
new file mode 100644 (file)
index 0000000..517f597
--- /dev/null
@@ -0,0 +1,277 @@
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File   : MeasureGUI_GetNonBlocksDlg.cxx
+
+#include "MeasureGUI_GetNonBlocksDlg.h"
+
+#include <DlgRef.h>
+#include <GEOMBase.h>
+
+#include <GeometryGUI.h>
+
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+#include <SalomeApp_Application.h>
+#include <LightApp_SelectionMgr.h>
+#include <SalomeApp_Tools.h>
+
+//=================================================================================
+// class    : MeasureGUI_GetNonBlocksDlg()
+// purpose  : Constructs a MeasureGUI_GetNonBlocksDlg which is a child of 'parent',
+//            with the name 'name' and widget flags set to 'f'.
+//            The dialog will by default be modeless, unless you set 'modal' to
+//            true to construct a modal dialog.
+//=================================================================================
+MeasureGUI_GetNonBlocksDlg::MeasureGUI_GetNonBlocksDlg (GeometryGUI* theGeometryGUI, QWidget* parent)
+  : GEOMBase_Skeleton(theGeometryGUI, parent, false)
+{
+  QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_GETNONBLOCKS")));
+  QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
+
+  setWindowTitle(tr("GEOM_GETNONBLOCKS_TITLE"));
+
+  /***************************************************************/
+  mainFrame()->GroupConstructors->setTitle(tr("GEOM_GETNONBLOCKS"));
+  mainFrame()->RadioButton1->setIcon(image0);
+  mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
+  mainFrame()->RadioButton2->close();
+  mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
+  mainFrame()->RadioButton3->close();
+
+  myGrp = new DlgRef_1Sel (centralWidget());
+  myGrp->GroupBox1->setTitle(tr("GEOM_GETNONBLOCKS"));
+  myGrp->TextLabel1->setText(tr("GEOM_OBJECT"));
+  myGrp->PushButton1->setIcon(image1);
+  myGrp->LineEdit1->setReadOnly(true);
+
+  QVBoxLayout* layout = new QVBoxLayout(centralWidget());
+  layout->setMargin(0); layout->setSpacing(6);
+  layout->addWidget(myGrp);
+
+  /***************************************************************/
+
+  myHelpFileName = "get_non_blocks_page.html";
+
+  /* Initialisation */
+  Init();
+}
+
+//=================================================================================
+// function : ~MeasureGUI_GetNonBlocksDlg()
+// purpose  : Destroys the object and frees any allocated resources
+//=================================================================================
+MeasureGUI_GetNonBlocksDlg::~MeasureGUI_GetNonBlocksDlg()
+{
+}
+
+//=================================================================================
+// function : Init()
+// purpose  :
+//=================================================================================
+void MeasureGUI_GetNonBlocksDlg::Init()
+{
+  showOnlyPreviewControl();
+
+  /* init variables */
+  myEditCurrentArgument = myGrp->LineEdit1;
+
+   /* signals and slots connections */
+  connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+  connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+
+  connect(myGrp->LineEdit1,   SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+  connect(myGrp->PushButton1, SIGNAL(clicked()),       this, SLOT(SetEditCurrentArgument()));
+
+  connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+           SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+
+  //initName(tr("GEOM_NONBLOCKS"));
+  mainFrame()->ResultName->setText(tr("GEOM_NONBLOCKS"));
+  globalSelection();
+  SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose  :
+//=================================================================================
+void MeasureGUI_GetNonBlocksDlg::ClickOnOk()
+{
+  if (ClickOnApply())
+    ClickOnCancel();
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose  :
+//=================================================================================
+bool MeasureGUI_GetNonBlocksDlg::ClickOnApply()
+{
+  if (!onAccept())
+    return false;
+
+  //initName();
+  return true;
+}
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose  : Called when selection as changed or other case
+//=================================================================================
+void MeasureGUI_GetNonBlocksDlg::SelectionIntoArgument()
+{
+  erasePreview();
+  myObj = GEOM::GEOM_Object::_nil();
+
+  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+  SALOME_ListIO aSelList;
+  aSelMgr->selectedObjects(aSelList);
+
+  if (aSelList.Extent() != 1) {
+    processObject();
+    return;
+  }
+
+  GEOM::GEOM_Object_var aSelectedObject =
+    GEOMBase::ConvertIOinGEOMObject(aSelList.First());
+
+  if (aSelectedObject->_is_nil()) {
+    processObject();
+    return;
+  }
+
+  myObj = aSelectedObject;
+  processObject();
+}
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose  :
+//=================================================================================
+void MeasureGUI_GetNonBlocksDlg::SetEditCurrentArgument()
+{
+  myGrp->LineEdit1->setFocus();
+  myEditCurrentArgument = myGrp->LineEdit1;
+  SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : LineEditReturnPressed()
+// purpose  :
+//=================================================================================
+void MeasureGUI_GetNonBlocksDlg::LineEditReturnPressed()
+{
+  QLineEdit* send = (QLineEdit*)sender();
+  if (send == myGrp->LineEdit1) {
+    myEditCurrentArgument = myGrp->LineEdit1;
+    GEOMBase_Skeleton::LineEditReturnPressed();
+  }
+}
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose  :
+//=================================================================================
+void MeasureGUI_GetNonBlocksDlg::ActivateThisDialog()
+{
+  GEOMBase_Skeleton::ActivateThisDialog();
+
+  connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 
+           SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+
+  globalSelection();
+  processPreview();
+}
+
+//=================================================================================
+// function : processObject()
+// purpose  : Fill dialog fields in accordance with myObj
+//=================================================================================
+void MeasureGUI_GetNonBlocksDlg::processObject()
+{
+  if (myObj->_is_nil()) {
+    erasePreview();
+  }
+  else {
+    myGrp->LineEdit1->setText(GEOMBase::GetName(myObj));
+
+    processPreview();
+  }
+}
+
+//=================================================================================
+// function : enterEvent()
+// purpose  :
+//=================================================================================
+void MeasureGUI_GetNonBlocksDlg::enterEvent (QEvent*)
+{
+  if (!mainFrame()->GroupConstructors->isEnabled())
+    ActivateThisDialog();
+}
+
+//=================================================================================
+// function : createOperation
+// purpose  :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr MeasureGUI_GetNonBlocksDlg::createOperation()
+{
+  return getGeomEngine()->GetIBlocksOperations(getStudyId());
+}
+
+//=================================================================================
+// function : isValid
+// purpose  :
+//=================================================================================
+bool MeasureGUI_GetNonBlocksDlg::isValid (QString&)
+{
+  return !myObj->_is_nil();
+}
+
+//=================================================================================
+// function : execute
+// purpose  :
+//=================================================================================
+bool MeasureGUI_GetNonBlocksDlg::execute (ObjectList& objects)
+{
+  GEOM::GEOM_IBlocksOperations_var anOper = GEOM::GEOM_IBlocksOperations::_narrow(getOperation());
+  GEOM::GEOM_Object_var aNonQuads;
+  GEOM::GEOM_Object_var anObj = anOper->GetNonBlocks(myObj, aNonQuads);
+  //mainFrame()->ResultName->setText(tr("GEOM_NONBLOCKS"));
+
+  if (!anObj->_is_nil())
+    objects.push_back(anObj._retn());
+  if (!aNonQuads->_is_nil())
+    objects.push_back(aNonQuads._retn());
+
+  return true;
+}
+
+//================================================================
+// Function : getFather
+// Purpose  : Get father object for object to be added in study
+//            ( called with addInStudy method )
+//================================================================
+GEOM::GEOM_Object_ptr MeasureGUI_GetNonBlocksDlg::getFather (GEOM::GEOM_Object_ptr)
+{
+  return myObj;
+}
diff --git a/src/MeasureGUI/MeasureGUI_GetNonBlocksDlg.h b/src/MeasureGUI/MeasureGUI_GetNonBlocksDlg.h
new file mode 100644 (file)
index 0000000..438a4ec
--- /dev/null
@@ -0,0 +1,69 @@
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File   : MeasureGUI_GetNonBlocksDlg.h
+
+#ifndef MEASUREGUI_GETNONBLOCKSDLG_H
+#define MEASUREGUI_GETNONBLOCKSDLG_H
+
+#include <GEOMBase_Skeleton.h>
+
+class DlgRef_1Sel;
+
+//=================================================================================
+// class    : MeasureGUI_GetNonBlocksDlg
+// purpose  :
+//=================================================================================
+class MeasureGUI_GetNonBlocksDlg : public GEOMBase_Skeleton
+{
+  Q_OBJECT
+
+public:
+  MeasureGUI_GetNonBlocksDlg (GeometryGUI*, QWidget*);
+  ~MeasureGUI_GetNonBlocksDlg();
+
+protected:
+  // redefined from GEOMBase_Helper
+  virtual GEOM::GEOM_IOperations_ptr  createOperation();
+  virtual bool                        isValid (QString&);
+  virtual bool                        execute (ObjectList&);
+  virtual GEOM::GEOM_Object_ptr       getFather (GEOM::GEOM_Object_ptr);
+
+private slots:
+  void                                ClickOnOk();
+  bool                                ClickOnApply();
+  void                                ActivateThisDialog();
+  void                                LineEditReturnPressed();
+  void                                SelectionIntoArgument();
+  void                                SetEditCurrentArgument();
+  
+private:
+  void                                Init();
+  void                                enterEvent (QEvent*);
+  void                                processObject();
+
+private:
+  GEOM::GEOM_Object_var               myObj;
+  DlgRef_1Sel*                        myGrp;
+};
+
+#endif // MEASUREGUI_GETNONBLOCKSDLG_H
index 7cba7edbe6ff272308c52f87e3eba8ecb00d701d..4b5b686e43cb72288548af952fee46fc4d8b55aa 100644 (file)
@@ -513,4 +513,4 @@ Standard_Boolean GEOM_AISShape::switchTopLevel() {
 
 Standard_Boolean GEOM_AISShape::toActivate() {
        return Standard_True;
-}
\ No newline at end of file
+}
index b3db3ddda3048de0038a45a18797d06a95799812..f22b3197fbd3a8b9b5a4b3e26a2021bf466b41e8 100755 (executable)
@@ -99,4 +99,4 @@ Standard_Boolean GEOM_TopWireframeShape::switchTopLevel() {
 
 void GEOM_TopWireframeShape::setIO(const Handle(SALOME_InteractiveObject)& io){
   SetOwner( io );
-}
\ No newline at end of file
+}
index b15f3c670a27eeed52a27fbf0d5844f2da23464c..90e8d7b385ebcaf5cad4dd5d7809efe45bb2bae4 100755 (executable)
@@ -107,4 +107,4 @@ private:
 // other inline functions and methods (like "C++: function call" methods)
 //
 
-#endif
\ No newline at end of file
+#endif
index 5c940f1ea4d9acf2055cbde5b7604e8e2c3989a4..c6dd6c14bd25c11206d81ed24fd07267780f1c31 100644 (file)
 #include <TopoDS_Iterator.hxx>
 #include <TopoDS_Shape.hxx>
 
+// VSR 22/08/2012: issue 0021787: remove "Preview" button from BOP and Partition operations
+// Comment next line to enable preview in Partition dialog box
+#define NO_PREVIEW
+
 //=================================================================================
 // class    : OperationGUI_PartitionDlg()
 // purpose  : Constructs a OperationGUI_PartitionDlg which is a child of 'parent', with the
@@ -89,6 +93,10 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg( GeometryGUI* theGeometryGU
 
   setHelpFileName( "partition_page.html" );
 
+#ifdef NO_PREVIEW
+  mainFrame()->CheckBoxPreview->setChecked( false );
+  mainFrame()->CheckBoxPreview->hide();
+#endif
   Init();
 }
 
index f3f0c06c10b3342b98d313566f74442b473e684a..8a4015043f8879e06f4262a3627e4a27abdc1fc4 100644 (file)
@@ -18,7 +18,6 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 //  File:        STEPImport.cxx
 //  Created:     Wed May 19 14:41:10 2004
 #include <Basics_Utils.hxx>
 #include <Basics_OCCTVersion.hxx>
 
-#include <BRep_Builder.hxx>
+#include <TDF_ChildIDIterator.hxx>
+#include <TDF_Label.hxx>
+#include <TDataStd_Name.hxx>
+#include <TNaming_Builder.hxx>
+#include <TNaming_NamedShape.hxx>
+
 #include <IFSelect_ReturnStatus.hxx>
 #include <Interface_InterfaceModel.hxx>
 #include <Interface_Static.hxx>
 #include <StepBasic_ProductDefinitionFormation.hxx>
 #include <StepGeom_GeometricRepresentationItem.hxx>
 #include <StepShape_TopologicalRepresentationItem.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TDF_ChildIDIterator.hxx>
-#include <TDF_Label.hxx>
-#include <TDataStd_Name.hxx>
-#include <TNaming_Builder.hxx>
-#include <TNaming_NamedShape.hxx>
+#include <TransferBRep.hxx>
+#include <Transfer_Binder.hxx>
+#include <Transfer_TransientProcess.hxx>
+#include <XSControl_TransferReader.hxx>
+#include <XSControl_WorkSession.hxx>
+
+#include <BRep_Builder.hxx>
+
 #include <TopExp.hxx>
 #include <TopExp_Explorer.hxx>
 #include <TopTools_IndexedMapOfShape.hxx>
 #include <TopoDS_Compound.hxx>
 #include <TopoDS_Iterator.hxx>
 #include <TopoDS_Shape.hxx>
-#include <TransferBRep.hxx>
-#include <Transfer_Binder.hxx>
-#include <Transfer_TransientProcess.hxx>
-#include <XSControl_TransferReader.hxx>
-#include <XSControl_WorkSession.hxx>
+
+#include <TCollection_AsciiString.hxx>
+#include <TColStd_SequenceOfAsciiString.hxx>
 
 #include <Standard_Failure.hxx>
 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
 
 extern "C"
 {
+  STEPIMPORT_EXPORT
+  Handle(TCollection_HAsciiString) GetValue (const TCollection_AsciiString& theFileName,
+                                             const TCollection_AsciiString& theParameterName,
+                                             TCollection_AsciiString&       theError)
+  {
+    Handle(TCollection_HAsciiString) aValue;
+
+    if (theParameterName != "LEN_UNITS") {
+      theError = theParameterName + " parameter reading is not supported by STEP plugin";
+      return aValue;
+    }
+
+    // Set "C" numeric locale to save numbers correctly
+    Kernel_Utils::Localizer loc;
+
+    STEPControl_Reader aReader;
+
+    Interface_Static::SetCVal("xstep.cascade.unit","M");
+    Interface_Static::SetIVal("read.step.ideas", 1);
+    Interface_Static::SetIVal("read.step.nonmanifold", 1);
+
+    try {
+#if OCC_VERSION_LARGE > 0x06010000
+      OCC_CATCH_SIGNALS;
+#endif
+      IFSelect_ReturnStatus status = aReader.ReadFile(theFileName.ToCString());
+      if (status == IFSelect_RetDone) {
+        TColStd_SequenceOfAsciiString anUnitLengthNames;
+        TColStd_SequenceOfAsciiString anUnitAngleNames;
+        TColStd_SequenceOfAsciiString anUnitSolidAngleNames;
+        aReader.FileUnits(anUnitLengthNames, anUnitAngleNames, anUnitSolidAngleNames);
+        if (anUnitLengthNames.Length() > 0) {
+          TCollection_AsciiString aLenUnits = anUnitLengthNames.First();
+          if (aLenUnits == "millimetre")
+            aValue = new TCollection_HAsciiString ("UNIT_MM");
+          else if (aLenUnits == "centimetre")
+            aValue = new TCollection_HAsciiString ("UNIT_CM");
+          else if (aLenUnits == "metre")
+            aValue = new TCollection_HAsciiString ("UNIT_M");
+          else if (aLenUnits == "INCH")
+            aValue = new TCollection_HAsciiString ("UNIT_INCH");
+          // TODO
+          //else if (aLenUnits == "")
+          //  aValue = new TCollection_HAsciiString ("");
+
+          // tmp begin
+          //std::cout << "$$$ --- " << anUnitLengthNames.First();
+          //for (int ii = 2; ii <= anUnitLengthNames.Length(); ii++)
+          //  std::cout << ", " << anUnitLengthNames.Value(ii);
+          //std::cout << std::endl;
+          // tmp end
+        }
+      }
+      else {
+        theError = theFileName + " reading failed";
+      }
+    }
+    catch (Standard_Failure) {
+      Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+      theError = aFail->GetMessageString();
+    }
+
+    return aValue;
+  }
+
   STEPIMPORT_EXPORT
   TopoDS_Shape Import (const TCollection_AsciiString& theFileName,
-                       const TCollection_AsciiString& /*theFormatName*/,
+                       const TCollection_AsciiString& theFormatName,
                        TCollection_AsciiString&       theError,
                        const TDF_Label&               theShapeLabel)
   {
-    MESSAGE("Import STEP model from file " << theFileName.ToCString());
+    TopoDS_Shape aResShape;
+
     // Set "C" numeric locale to save numbers correctly
     Kernel_Utils::Localizer loc;
-    TopoDS_Shape aResShape;
-    //VRV: OCC 4.0 migration
+
     STEPControl_Reader aReader;
+
     //VSR: 16/09/09: Convert to METERS
     Interface_Static::SetCVal("xstep.cascade.unit","M");
     Interface_Static::SetIVal("read.step.ideas", 1);
     Interface_Static::SetIVal("read.step.nonmanifold", 1);
-    //VRV: OCC 4.0 migration
-    TopoDS_Compound compound;
+
     BRep_Builder B;
+    TopoDS_Compound compound;
     B.MakeCompound(compound);
+
     try {
-#if OCC_VERSION_LARGE > 0x06010000
       OCC_CATCH_SIGNALS;
-#endif
+
       IFSelect_ReturnStatus status = aReader.ReadFile(theFileName.ToCString());
 
       if (status == IFSelect_RetDone) {
+
+        // Regard or not the model units
+        if (theFormatName == "STEP_SCALE") {
+          // set UnitFlag to units from file
+          TColStd_SequenceOfAsciiString anUnitLengthNames;
+          TColStd_SequenceOfAsciiString anUnitAngleNames;
+          TColStd_SequenceOfAsciiString anUnitSolidAngleNames;
+          aReader.FileUnits(anUnitLengthNames, anUnitAngleNames, anUnitSolidAngleNames);
+          if (anUnitLengthNames.Length() > 0) {
+            TCollection_AsciiString aLenUnits = anUnitLengthNames.First();
+            if (aLenUnits == "millimetre")
+              Interface_Static::SetCVal("xstep.cascade.unit", "MM");
+            else if (aLenUnits == "centimetre")
+              Interface_Static::SetCVal("xstep.cascade.unit", "CM");
+            else if (aLenUnits == "metre")
+              Interface_Static::SetCVal("xstep.cascade.unit", "M");
+            else if (aLenUnits == "INCH")
+              Interface_Static::SetCVal("xstep.cascade.unit", "INCH");
+            else {
+              theError = "The file contains not supported units.";
+              return aResShape;
+            }
+            // TODO
+            //else if (aLenUnits == "")
+            //  Interface_Static::SetCVal("xstep.cascade.unit", "");
+          }
+        }
+        else {
+          //cout<<"need re-scale a model"<<endl;
+          // set UnitFlag to 'meter'
+          Interface_Static::SetCVal("xstep.cascade.unit","M");
+        }
+
         Standard_Boolean failsonly = Standard_False;
         aReader.PrintCheckLoad(failsonly, IFSelect_ItemsByEntity);
+
         /* Root transfers */
         Standard_Integer nbr = aReader.NbRootsForTransfer();
         aReader.PrintCheckTransfer(failsonly, IFSelect_ItemsByEntity);