diff --git a/doc/salome/gui/GEOM/doxyfile_py.in b/doc/salome/gui/GEOM/doxyfile_py.in
index c35ee2024..bd50daa50 100755
--- a/doc/salome/gui/GEOM/doxyfile_py.in
+++ b/doc/salome/gui/GEOM/doxyfile_py.in
@@ -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
diff --git a/doc/salome/gui/GEOM/images/3dsketch2.png b/doc/salome/gui/GEOM/images/3dsketch2.png
index 51f171d9f..1925ecfd8 100755
Binary files a/doc/salome/gui/GEOM/images/3dsketch2.png and b/doc/salome/gui/GEOM/images/3dsketch2.png differ
diff --git a/doc/salome/gui/GEOM/images/bool1.png b/doc/salome/gui/GEOM/images/bool1.png
index 5dac3ca24..704a7a37d 100755
Binary files a/doc/salome/gui/GEOM/images/bool1.png and b/doc/salome/gui/GEOM/images/bool1.png differ
diff --git a/doc/salome/gui/GEOM/images/bool2.png b/doc/salome/gui/GEOM/images/bool2.png
index a14fec4e8..026e60705 100755
Binary files a/doc/salome/gui/GEOM/images/bool2.png and b/doc/salome/gui/GEOM/images/bool2.png differ
diff --git a/doc/salome/gui/GEOM/images/bool3.png b/doc/salome/gui/GEOM/images/bool3.png
index 1e8941a3c..11c5ade72 100755
Binary files a/doc/salome/gui/GEOM/images/bool3.png and b/doc/salome/gui/GEOM/images/bool3.png differ
diff --git a/doc/salome/gui/GEOM/images/divided_disk_PntVecR_dlg.png b/doc/salome/gui/GEOM/images/divided_disk_PntVecR_dlg.png
index c57f8f6b5..bb5155e25 100644
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
diff --git a/doc/salome/gui/GEOM/images/divided_disk_dlg.png b/doc/salome/gui/GEOM/images/divided_disk_dlg.png
index 3a8b8baad..71c17bedf 100644
Binary files a/doc/salome/gui/GEOM/images/divided_disk_dlg.png and b/doc/salome/gui/GEOM/images/divided_disk_dlg.png differ
diff --git a/doc/salome/gui/GEOM/images/dividedcylinder_dlg.png b/doc/salome/gui/GEOM/images/dividedcylinder_dlg.png
index 95b96d00e..360042571 100644
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
index 000000000..248eebaa5
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
index 000000000..0109f670c
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
index 000000000..9df9cd651
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
index 000000000..21e5218a4
Binary files /dev/null and b/doc/salome/gui/GEOM/images/measures2.png differ
diff --git a/doc/salome/gui/GEOM/images/neo-section.png b/doc/salome/gui/GEOM/images/neo-section.png
index 532d1f835..901b1f3c2 100755
Binary files a/doc/salome/gui/GEOM/images/neo-section.png and b/doc/salome/gui/GEOM/images/neo-section.png differ
diff --git a/doc/salome/gui/GEOM/images/ob_popup_menu.png b/doc/salome/gui/GEOM/images/ob_popup_menu.png
index 51ae305d7..1d9f0e321 100644
Binary files a/doc/salome/gui/GEOM/images/ob_popup_menu.png and b/doc/salome/gui/GEOM/images/ob_popup_menu.png differ
diff --git a/doc/salome/gui/GEOM/images/partition1.png b/doc/salome/gui/GEOM/images/partition1.png
index baf8c4ac9..b0136adb8 100755
Binary files a/doc/salome/gui/GEOM/images/partition1.png and b/doc/salome/gui/GEOM/images/partition1.png differ
diff --git a/doc/salome/gui/GEOM/images/partition2.png b/doc/salome/gui/GEOM/images/partition2.png
index 12b92335b..38b3dd474 100755
Binary files a/doc/salome/gui/GEOM/images/partition2.png and b/doc/salome/gui/GEOM/images/partition2.png differ
diff --git a/doc/salome/gui/GEOM/input/creating_3dsketcher.doc b/doc/salome/gui/GEOM/input/creating_3dsketcher.doc
index fcc0ba56d..651ebc461 100755
--- a/doc/salome/gui/GEOM/input/creating_3dsketcher.doc
+++ b/doc/salome/gui/GEOM/input/creating_3dsketcher.doc
@@ -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 New Entity -> Basic -> 3D Sketch.
\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 Coordinates Type
+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 Coordinates Type
radio buttons.
-To add the point in the list of points and to proceed with the
-definition of the next point, click Apply 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 Apply button. \b Undo and \b Redo buttons,
+respectively, remove or restore the last segment in the wire.
\n "Sketch Validation" button applies the wire, built by the
user, "as is".
\n "Sketch Closure" 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.
-
-TUI Command:geompy.Make3DSketcher( [ PointsList ] )
-This algorithm creates a wire from the list of real values, which define XYZ
-coordinates of points.
-
Example:
\image html 3dsketch1.png
+TUI Command:geompy.Make3DSketcher( [ PointsList ] )
+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.
+TUI Command:sk = geompy.Sketcher3D()
+Returns an instance of Sketcher3D interface sk.
+Use the below examples and see the \ref gsketcher.Sketcher3D "Sketcher3D"
+interface documentation for more information.
+
Our TUI Scripts provide you with useful examples of the use of
\ref tui_3dsketcher_page "3D Sketcher".
*/
diff --git a/doc/salome/gui/GEOM/input/creating_dividedcylinder.doc b/doc/salome/gui/GEOM/input/creating_dividedcylinder.doc
index 1b9de1e2d..169666a39 100644
--- a/doc/salome/gui/GEOM/input/creating_dividedcylinder.doc
+++ b/doc/salome/gui/GEOM/input/creating_dividedcylinder.doc
@@ -2,7 +2,12 @@
\page create_dividedcylinder_page DividedCylinder
-The Divided cylinder object is a cylinder divided into \b blocks for easy hexaedral meshing.
+The Divided cylinder object is a cylinder divided into \b blocks for easy hexaedral meshing.Two division patterns are available :
+
+
+
A square pattern which is frequently used
+
An hexagonal pattern which ensures a better mesh quality and especially less acute or obtuse angles
+
\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.
-TUI Command:geompy.MakeDividedCylinder(R, H)
+TUI Command:geompy.MakeDividedCylinder(R, H, Pattern)Arguments:
- \b R - Radius of the cylinder
- \b H - Height of the cylinder
+- \b Pattern - Division pattern
\image html dividedcylinder_dlg.png
diff --git a/doc/salome/gui/GEOM/input/creating_divideddisk.doc b/doc/salome/gui/GEOM/input/creating_divideddisk.doc
index b42460f40..2d471e6a1 100644
--- a/doc/salome/gui/GEOM/input/creating_divideddisk.doc
+++ b/doc/salome/gui/GEOM/input/creating_divideddisk.doc
@@ -2,10 +2,17 @@
\page create_divideddisk_page DividedDisk
-The Divided disk object is a disk divided into \b blocks. It means that it's a shape prepared for hexaedral meshing.
+The Divided disk object is a disk divided into \b blocks. It means that it's a shape prepared for hexaedral meshing. Two division patterns are available :
+
+
+
A square pattern which is frequently used
+
An hexagonal pattern which ensures a better mesh quality and especially less acute or obtuse angles
+
+
\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 tube shape 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
\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
-TUI Command:geompy.MakeDividedDisk(Radius, Orientation)
+TUI Command:geompy.MakeDividedDisk(Radius, Orientation, Pattern)Arguments:
- \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.
TUI Command:geompy.MakeDividedDiskPntVecR(Center, Vector,
-Radius)
+Radius, Pattern)
Arguments:
- \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
diff --git a/doc/salome/gui/GEOM/input/creating_point.doc b/doc/salome/gui/GEOM/input/creating_point.doc
index 9844a3cff..46da86628 100644
--- a/doc/salome/gui/GEOM/input/creating_point.doc
+++ b/doc/salome/gui/GEOM/input/creating_point.doc
@@ -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 TUI Command:geompy.MakeVertexOnSurface(myFace,X,Y,Z).
+\n TUI Command:geompy.MakeVertexOnSurfaceByCoord(myFace,X,Y,Z).
\n Arguments: 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
index 000000000..8df0e324c
--- /dev/null
+++ b/doc/salome/gui/GEOM/input/get_non_blocks.doc
@@ -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 Result: 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 TUI Command:
+geompy.GetNonBlocks(Compound). 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".
+
+*/
diff --git a/doc/salome/gui/GEOM/input/tui_3dsketcher.doc b/doc/salome/gui/GEOM/input/tui_3dsketcher.doc
index c9760fbcf..4916dfce2 100755
--- a/doc/salome/gui/GEOM/input/tui_3dsketcher.doc
+++ b/doc/salome/gui/GEOM/input/tui_3dsketcher.doc
@@ -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
+*/
diff --git a/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc b/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc
index 0cb092228..7f230b142 100644
--- a/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc
+++ b/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc
@@ -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
index 000000000..6f648f9a0
--- /dev/null
+++ b/doc/salome/gui/GEOM/input/tui_get_non_blocks.doc
@@ -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
+
+*/
diff --git a/doc/salome/gui/GEOM/input/tui_measurement_tools.doc b/doc/salome/gui/GEOM/input/tui_measurement_tools.doc
index 4ce9b4239..583f3de0f 100644
--- a/doc/salome/gui/GEOM/input/tui_measurement_tools.doc
+++ b/doc/salome/gui/GEOM/input/tui_measurement_tools.doc
@@ -17,6 +17,7 @@
\subpage tui_free_faces_page
\subpage tui_check_shape_page
\subpage tui_check_compound_of_blocks_page
+
\subpage tui_get_non_blocks_page
\subpage tui_check_self_intersections_page
diff --git a/doc/salome/gui/GEOM/input/tui_test_all.doc b/doc/salome/gui/GEOM/input/tui_test_all.doc
index 2fe8d7623..56beffc5d 100644
--- a/doc/salome/gui/GEOM/input/tui_test_all.doc
+++ b/doc/salome/gui/GEOM/input/tui_test_all.doc
@@ -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
diff --git a/doc/salome/gui/GEOM/input/tui_test_others.doc b/doc/salome/gui/GEOM/input/tui_test_others.doc
index 2b1b44c7c..e89f89957 100644
--- a/doc/salome/gui/GEOM/input/tui_test_others.doc
+++ b/doc/salome/gui/GEOM/input/tui_test_others.doc
@@ -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
diff --git a/doc/salome/gui/GEOM/input/tui_test_spanner.doc b/doc/salome/gui/GEOM/input/tui_test_spanner.doc
index 5c9df4651..81b212de6 100644
--- a/doc/salome/gui/GEOM/input/tui_test_spanner.doc
+++ b/doc/salome/gui/GEOM/input/tui_test_spanner.doc
@@ -35,6 +35,11 @@
\anchor swig_GetOppositeFace
\until id_face41
+\until id_glueALL
+
+\anchor swig_GetNonBlocks
+\until Spanner is a
+
\anchor spanner_continue
\until return Spanner
diff --git a/doc/salome/gui/GEOM/input/tui_working_with_groups.doc b/doc/salome/gui/GEOM/input/tui_working_with_groups.doc
index e608a0923..37813417c 100644
--- a/doc/salome/gui/GEOM/input/tui_working_with_groups.doc
+++ b/doc/salome/gui/GEOM/input/tui_working_with_groups.doc
@@ -2,7 +2,9 @@
\page tui_working_with_groups_page Working with Groups
-
@@ -32,4 +33,4 @@ concerning created or imported geometrical objects :
\ref tui_measurement_tools_page "Measurement Tools" with TUI
commands.
-*/
\ No newline at end of file
+*/
diff --git a/doc/salome/gui/GEOM/input/viewing_geom_obj.doc b/doc/salome/gui/GEOM/input/viewing_geom_obj.doc
index 44cea48a6..ada09fef1 100644
--- a/doc/salome/gui/GEOM/input/viewing_geom_obj.doc
+++ b/doc/salome/gui/GEOM/input/viewing_geom_obj.doc
@@ -74,18 +74,23 @@ on the viewer background:
Select Only provides a filter for exclusive selection of objects of a certain type.
-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
\ref work_with_groups_page "Create Group" - allows creating groups of geometrical objects.
-
Hide Children / Show Children - hides / shows child
+
+
Conceal child items / Disclose child items - 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.
+
Show Only Children - erase in current viewer all objects
+and then display only children of the selected object(s).
+
+
Unpublish - 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 Geometry root object Publish... item.
diff --git a/doc/salome/gui/GEOM/input/working_with_groups.doc b/doc/salome/gui/GEOM/input/working_with_groups.doc
index 07838d585..a09865efa 100644
--- a/doc/salome/gui/GEOM/input/working_with_groups.doc
+++ b/doc/salome/gui/GEOM/input/working_with_groups.doc
@@ -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.
-
Create a group
+
+
\ref create_groups_anchor "Create a Group"
+
\ref edit_groups_anchor "Edit a Group"
+
\ref union_groups_anchor "Union Groups"
+
\ref intersect_groups_anchor "Intersect Groups"
+
\ref cut_groups_anchor "Cut Groups"
+
+
+
+\anchor create_groups_anchor
+
Create a group
\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 New entity > Group > Create
\n The following menu will appear:
@@ -72,19 +84,29 @@ ShapeType), where MainShape is a shape for which the group is
created, ShapeType is a type of shapes in the created group.
\n Arguments: 1 Shape + Type of sub-shape.
+Our TUI Scripts provide you with useful examples of
+\ref tui_create_groups_anchor "Create a Group" operation.
+
Example:
\image html image193.png "Groups on a cylinder"
-
-
Edit a group
+
+\anchor edit_groups_anchor
+
Edit a group
\image html image57.png
+This functionality is available in OCC viewer only.
+
To \b Edit an existing group in the main menu select New entity >
Group > Edit. This menu is designed in the same way as the
Create a group menu.
+\n Dialog Box:
+
+\image html editgroup.png
+
\n The \b Result of the operation will be a \b GEOM_Object.
\n TUI Command:
@@ -101,11 +123,80 @@ the sub-shape to be removed from the group.
\n Arguments: 1 Shape + its sub-shapes.
-\n Dialog Box:
+Our TUI Scripts provide you with useful examples of
+\ref tui_edit_groups_anchor "Edit a Group" operation.
-\image html editgroup.png
+
+\anchor union_groups_anchor
+
Union of groups
+
+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.
+
+To union groups:
+
+
In the New Entity menu select the \b Group - Union Groups 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.
+
+
Click the \b Apply or Apply and Close button to confirm creation of the group.
+
+
+See Also a sample TUI Script of a
+\ref tui_union_groups_anchor "Union of Groups" operation.
+
+
+\anchor intersect_groups_anchor
+
Intersection of groups
+
+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.
+
+To intersect groups:
+
+
In the New Entity menu select the \b Group - Intersect Groups 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.
+
+
Click the \b Apply or Apply and Close button to confirm creation of the group.
+
+
+See Also a sample TUI Script of an
+\ref tui_intersect_groups_anchor "Intersection of Groups" operation.
+
+
+\anchor cut_groups_anchor
+
Cut of groups
+
+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.
+
+To cut groups:
+
+
In the New Entity menu select the \b Group - Cut Groups 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.
+
+
Click the \b Apply or Apply and Close button to confirm creation of the
+group.
+
Our TUI Scripts provide you with useful examples of
-\ref tui_working_with_groups_page "Working with Groups".
+\ref tui_cut_groups_anchor "Cut of Groups" operation.
*/
diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl
index f3a41ad16..8f90021eb 100644
--- a/idl/GEOM_Gen.idl
+++ b/idl/GEOM_Gen.idl
@@ -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.
- *
- * Format of the description string have to be the following:
- *
- * "Make3DSketcher[x1, y1, z1, x2, y2, z2, ..., xN, yN, zN]"
- */
-
- GEOM_Object Make3DSketcher (in ListOfDouble theCoordinates);
-
- /*!
* \brief Create a sketcher (wire or face), following the textual description,
- * passed through \a theCommand argument.
+ * passed through \a theCommand argument.
*
* 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.
+ * \return New GEOM_Object, containing the created wire or face.
*/
GEOM_Object MakeSketcherOnPlane (in string theCommand, in GEOM_Object theWorkingPlane);
+
+ /*!
+ * \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)
+ *
+ * \param theCommand String, defining the sketcher in local
+ * coordinates of the working plane.
+ * \return New GEOM_Object, containing the created wire.
+ */
+ 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 ImportTranslators() 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.
diff --git a/resources/Makefile.am b/resources/Makefile.am
index d5aab779c..57c92dd2d 100644
--- a/resources/Makefile.am
+++ b/resources/Makefile.am
@@ -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 \
diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in
index dd0dfdfd2..6fb716e5a 100644
--- a/resources/SalomeApp.xml.in
+++ b/resources/SalomeApp.xml.in
@@ -43,7 +43,7 @@
-
+
diff --git a/resources/get_non_blocks.png b/resources/get_non_blocks.png
new file mode 100644
index 000000000..b13b294f2
Binary files /dev/null and b/resources/get_non_blocks.png differ
diff --git a/src/BooleanGUI/BooleanGUI_Dialog.cxx b/src/BooleanGUI/BooleanGUI_Dialog.cxx
index a72aba04a..94143574e 100644
--- a/src/BooleanGUI/BooleanGUI_Dialog.cxx
+++ b/src/BooleanGUI/BooleanGUI_Dialog.cxx
@@ -36,6 +36,10 @@
#include
#include
+// 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();
}
//=================================================================================
diff --git a/src/DisplayGUI/DisplayGUI.cxx b/src/DisplayGUI/DisplayGUI.cxx
index 07613982f..67665f66e 100644
--- a/src/DisplayGUI/DisplayGUI.cxx
+++ b/src/DisplayGUI/DisplayGUI.cxx
@@ -18,12 +18,11 @@
// 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
#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(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
diff --git a/src/DisplayGUI/DisplayGUI.h b/src/DisplayGUI/DisplayGUI.h
index a52fe0352..74de0e22f 100644
--- a/src/DisplayGUI/DisplayGUI.h
+++ b/src/DisplayGUI/DisplayGUI.h
@@ -18,12 +18,11 @@
// 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();
diff --git a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx
index 53b0694e9..b44cbd49c 100755
--- a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx
+++ b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx
@@ -15,12 +15,11 @@
// 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
#include
#include
@@ -31,7 +30,7 @@
#include
#include
-#include
+#include
#include
#include
@@ -49,14 +48,8 @@
#include
//OCCT includes
-//#include
-//#include
-//#include
-//#include
#include
#include
-//#include
-//#include
#include
#include
#include
@@ -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_3DSketcherDlg( GeometryGUI* 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 );
+ 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() );
+ 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
+ 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 );
+ buttonOk()->setText(tr("GEOM_BUT_END_SKETCH"));
+ buttonApply()->setText(tr("GEOM_BUT_CLOSE_SKETCH"));
- setHelpFileName( "create_3dsketcher_page.html" );
+ 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_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
myLengthPrs = dynamic_cast(((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(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(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(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+ connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+
+ initName(tr("GEOM_3DSKETCHER"));
- 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( 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( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
-
- connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
- connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) );
-
- 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 );
- }
- else if ( myMode == 2 )
+
+ if (myMode == 1)
{
- GroupAngles->SpinBox_DA->setValue( 0.0 );
- GroupAngles->SpinBox_DL->setValue( 0.0 );
- GroupAngles->SpinBox_DA2->setValue( 0.0 );
+ Group3Spin->SpinBox_DX->setValue(0.0);
+ Group3Spin->SpinBox_DY->setValue(0.0);
+ Group3Spin->SpinBox_DZ->setValue(0.0);
+ }
+ else if (myMode == 2)
+ {
+ 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::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;
- double aLength = GroupAngles->SpinBox_DL->value();
-
- if (GroupAngles->checkBox->isChecked())
- anAngle2 = GroupAngles->SpinBox_DA2->value() * M_PI/180.0;
-
- double aProjectedLength = aLength * cos(anAngle2);
-
- xyz = getLastPoint();
+ 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.x += aProjectedLength * cos(anAngle);
- xyz.y += aProjectedLength * sin(anAngle);
- xyz.z += aLength * sin(anAngle2);
- }
+ xyz.command = "OXY ";
else if (GroupAngles->radioButton_2->isChecked())
- {
- xyz.y += aProjectedLength * cos(anAngle);
- xyz.z += aProjectedLength * sin(anAngle);
- xyz.x += aLength * sin(anAngle2);
- }
+ xyz.command = "OYZ ";
else
+ xyz.command = "OXZ ";
+
+ double anAngle = GroupAngles->SpinBox_DA->value();
+ double aLength = GroupAngles->SpinBox_DL->value();
+
+ 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 xyzP = getLastPoint();
+ if (GroupAngles->radioButton_1->isChecked()) // OXY
{
- xyz.z += aProjectedLength * sin(anAngle);
- xyz.x += aProjectedLength * cos(anAngle);
- xyz.y += 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()) // OYZ
+ {
+ xyz.y = xyzP.y + aProjectedLength * cos(anAngle);
+ xyz.z = xyzP.z + aProjectedLength * sin(anAngle);
+ xyz.x = xyzP.x + aLength * sin(anAngle2);
+ }
+ else // OXZ
+ {
+ 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::displayPreview( GEOM::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 );
-
- // Build prs
- SALOME_Prs* aPrs = getDisplayer()->BuildPrs( anApplyedWire );
- if ( aPrs != 0 && !aPrs->IsNull() )
- GEOMBase_Helper::displayPreview( aPrs, append, update );
+ getDisplayer()->SetColor(line_color);
+
+ // Build prs
+ 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_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
-
- if (aSPrs)
- {
+
+ SOCC_Prs* aSPrs = dynamic_cast
+ (((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_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
-
+
+ SOCC_Prs* aSPrs = dynamic_cast
+ (((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 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;
+ }
}
- }
+ 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
- // 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();
-// }
-// }
-
- 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_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
+ SOCC_Prs* aSPrs = dynamic_cast
+ (((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::createShapes( GEOM::GEOM_Object_ptr /*theObject*/,
+bool EntityGUI_3DSketcherDlg::createShapes (GEOM::GEOM_Object_ptr /*theObject*/,
TopoDS_Shape& theApplyedWire,
- TopoDS_Shape& theLastSegment )
+ TopoDS_Shape& theLastSegment)
{
QList points;
- foreach( XYZ 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();
}
diff --git a/src/EntityGUI/EntityGUI_3DSketcherDlg.h b/src/EntityGUI/EntityGUI_3DSketcherDlg.h
index af81a199d..8888cf065 100755
--- a/src/EntityGUI/EntityGUI_3DSketcherDlg.h
+++ b/src/EntityGUI/EntityGUI_3DSketcherDlg.h
@@ -15,12 +15,11 @@
// 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 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();
diff --git a/src/EntityGUI/EntityGUI_Controls_QTD.ui b/src/EntityGUI/EntityGUI_Controls_QTD.ui
index 0c3222bea..b58621ea5 100644
--- a/src/EntityGUI/EntityGUI_Controls_QTD.ui
+++ b/src/EntityGUI/EntityGUI_Controls_QTD.ui
@@ -6,8 +6,8 @@
00
- 327
- 50
+ 278
+ 181
@@ -19,23 +19,118 @@
+
+
+ 0
+ 0
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+ Start:
+
+
+
+
+
+
+ X
+
+
+
+
+
+
+
+
+
+ Y
+
+
+
+
+
+
+
+
+
+ Z
+
+
+
+
+
+
+
+
+
+ End:
+
+
+
+
+
+
+ X
+
+
+
+
+
+
+
+
+
+ Y
+
+
+
+
+
+
+
+
+
+ Z
+
+
+
+
+
+
+
diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx
index d0333cd59..b884d9067 100644
--- a/src/EntityGUI/EntityGUI_SketcherDlg.cxx
+++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx
@@ -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 );
}
diff --git a/src/GEOM/GEOM_Engine.cxx b/src/GEOM/GEOM_Engine.cxx
index 6efcaf7e0..32d3e97c2 100644
--- a/src/GEOM/GEOM_Engine.cxx
+++ b/src/GEOM/GEOM_Engine.cxx
@@ -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 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;
diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx
index a599ca89e..5bfdb55cb 100644
--- a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx
+++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx
@@ -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
diff --git a/src/GEOMGUI/GEOMGUI_Selection.cxx b/src/GEOMGUI/GEOMGUI_Selection.cxx
index 734234269..0aa1da20a 100644
--- a/src/GEOMGUI/GEOMGUI_Selection.cxx
+++ b/src/GEOMGUI/GEOMGUI_Selection.cxx
@@ -18,11 +18,10 @@
// 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( 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( 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( study() );
diff --git a/src/GEOMGUI/GEOMGUI_Selection.h b/src/GEOMGUI/GEOMGUI_Selection.h
index c6e9b59da..acef7e196 100644
--- a/src/GEOMGUI/GEOMGUI_Selection.h
+++ b/src/GEOMGUI/GEOMGUI_Selection.h
@@ -18,11 +18,10 @@
// 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;
diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx
index 15f36281d..7edbae5b2 100644
--- a/src/GEOMGUI/GEOM_Displayer.cxx
+++ b/src/GEOMGUI/GEOM_Displayer.cxx
@@ -114,6 +114,13 @@
#include
#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 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& 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( session->activeApplication() );
if ( app && !theGeomObject->_is_nil()) {
SalomeApp_Study* study = dynamic_cast( 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 aReservedColors;
-
- SalomeApp_Application* app = dynamic_cast( 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 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
+ }
+ }
}
}
}
diff --git a/src/GEOMGUI/GEOM_Displayer.h b/src/GEOMGUI/GEOM_Displayer.h
index 07305f66b..656612776 100644
--- a/src/GEOMGUI/GEOM_Displayer.h
+++ b/src/GEOMGUI/GEOM_Displayer.h
@@ -169,6 +169,7 @@ public:
SalomeApp_Study* getStudy() const;
static SALOMEDS::Color getUniqueColor( const QList& );
+ static SALOMEDS::Color getPredefinedUniqueColor();
static PropMap getDefaultPropertyMap(const QString& viewer_type);
diff --git a/src/GEOMGUI/GEOM_images.ts b/src/GEOMGUI/GEOM_images.ts
index d15ade1d2..96b164f7b 100644
--- a/src/GEOMGUI/GEOM_images.ts
+++ b/src/GEOMGUI/GEOM_images.ts
@@ -167,6 +167,10 @@
check_blocks_compound.png
+
+
+ get_non_blocks.png
+ check_self_intersections.png
@@ -739,6 +743,10 @@
check_blocks_compound.png
+
+
+ get_non_blocks.png
+ check_self_intersections.png
@@ -763,6 +771,10 @@
common.png
+
+
+ common.png
+ build_compound.png
@@ -783,6 +795,10 @@
cut.png
+
+
+ cut.png
+ cylinder.png
@@ -887,6 +903,10 @@
fuse.png
+
+
+ fuse.png
+ glue.png
diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts
index cf4c13db2..d0ec111bb 100644
--- a/src/GEOMGUI/GEOM_msg_en.ts
+++ b/src/GEOMGUI/GEOM_msg_en.ts
@@ -7,6 +7,10 @@
Error: can't build object
+
+
+ Operation aborted
+ Invert
@@ -357,6 +361,18 @@ Please, select face, shell or solid and try again
Incriminated Sub-shapes
+
+
+ Get non-hexahedral solids and non-quadrangular faces
+
+
+
+ Get non blocks
+
+
+
+ NonBlocksGroup
+ Object And Its Topological Information
@@ -1830,6 +1846,10 @@ Please, select face, shell or solid and try again
Coordinates Type
+
+
+ Dimensions
+ Solid
@@ -2310,6 +2330,10 @@ Please, select face, shell or solid and try again
Check Compound of Blocks
+
+
+ Get Non Blocks
+ Detect Self-intersections
@@ -2422,6 +2446,10 @@ Please, select face, shell or solid and try again
Show Only
+
+
+ Show Only Children
+ Bring To Front
@@ -2550,6 +2578,18 @@ Please, select face, shell or solid and try again
Edit
+
+
+ Union Groups
+
+
+
+ Intersect Groups
+
+
+
+ Cut Groups
+ Reload From Disk
@@ -2667,12 +2707,12 @@ Please, select face, shell or solid and try again
Create Group
-
- Show Children
+
+ Disclose child items
-
- Hide Children
+
+ Conceal child items
@@ -3154,6 +3194,10 @@ Please, select face, shell or solid and try again
Check compound of blocks
+
+
+ Get non blocks
+ Detect Self-intersections
@@ -3234,6 +3278,10 @@ Please, select face, shell or solid and try again
Show only
+
+
+ Show Only Children
+ Build an edge
@@ -3322,6 +3370,18 @@ Please, select face, shell or solid and try again
Edit a group
+
+
+ Union Groups
+
+
+
+ Intersect Groups
+
+
+
+ Cut Groups
+ Reload imported shape from its original place on disk
@@ -3426,10 +3486,6 @@ Please, select face, shell or solid and try again
Create Group
-
-
- Show child objects
- Unpublish object
@@ -3439,8 +3495,12 @@ Please, select face, shell or solid and try again
Publish object
-
- Hide child objects
+
+ Disclose child items
+
+
+
+ Conceal child items
@@ -3762,6 +3822,10 @@ Please, select face, shell or solid and try again
Check compound of blocks
+
+
+ Get non blocks
+ Detect Self-intersections
@@ -3838,6 +3902,10 @@ Please, select face, shell or solid and try again
Show only
+
+
+ Show Only Children
+ Build edge
@@ -3918,6 +3986,18 @@ Please, select face, shell or solid and try again
Edit a group
+
+
+ Union Groups
+
+
+
+ Intersect Groups
+
+
+
+ Cut Groups
+ Hexahedral Solid
@@ -4026,10 +4106,6 @@ Please, select face, shell or solid and try again
Create Group
-
-
- Show Children
- Unpublish object
@@ -4039,8 +4115,12 @@ Please, select face, shell or solid and try again
Publish object
-
- Hide Children
+
+ Disclose child items
+
+
+
+ Conceal child items
@@ -5037,6 +5117,45 @@ Number of sketch points too small
Please, select a group to edit
+
+ GroupGUI_BooleanDlg
+
+
+ Union
+
+
+
+ Union Groups
+
+
+
+ Intersect
+
+
+
+ Intersect Groups
+
+
+
+ Cut
+
+
+
+ Cut Groups
+
+
+
+ Groups
+
+
+
+ Main Groups
+
+
+
+ Tool Groups
+
+GroupGUI_GroupDlg
diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx
index 23694246d..cfb646deb 100644
--- a/src/GEOMGUI/GeometryGUI.cxx
+++ b/src/GEOMGUI/GeometryGUI.cxx
@@ -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(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( 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()
diff --git a/src/GEOMGUI/GeometryGUI_Operations.h b/src/GEOMGUI/GeometryGUI_Operations.h
index 3d8a41d4e..75e45e43f 100644
--- a/src/GEOMGUI/GeometryGUI_Operations.h
+++ b/src/GEOMGUI/GeometryGUI_Operations.h
@@ -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.i b/src/GEOMGUI/GeometryGUI_Swig.i
deleted file mode 100644
index d5bdfdf1a..000000000
--- a/src/GEOMGUI/GeometryGUI_Swig.i
+++ /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();
-};
diff --git a/src/GEOMGUI/Makefile.am b/src/GEOMGUI/Makefile.am
index 2ac3a347b..71f187ae0 100644
--- a/src/GEOMGUI/Makefile.am
+++ b/src/GEOMGUI/Makefile.am
@@ -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
diff --git a/src/GEOMImpl/GEOMImpl_3DSketcherDriver.cxx b/src/GEOMImpl/GEOMImpl_3DSketcherDriver.cxx
index 5c00c4655..d50aec791 100755
--- a/src/GEOMImpl/GEOMImpl_3DSketcherDriver.cxx
+++ b/src/GEOMImpl/GEOMImpl_3DSketcherDriver.cxx
@@ -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
@@ -26,9 +25,13 @@
#include
+#include
+
// OCCT Includes
#include
#include
+#include
+#include
#include
#include
#include
@@ -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 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 points;
- 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::iterator it;
- for (it = points.begin(); it != points.end(); ++it) {
- aMakePoly.Add(*it);
+ 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() > 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();
+ 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::iterator it;
+ for (it = points.begin(); it != points.end(); ++it) {
+ aMakePoly.Add(*it);
+ }
+
+ 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 (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);
+ }
+ }
+
+ 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;
diff --git a/src/GEOMImpl/GEOMImpl_BlockDriver.cxx b/src/GEOMImpl/GEOMImpl_BlockDriver.cxx
index 95c2dbf08..d50d24858 100644
--- a/src/GEOMImpl/GEOMImpl_BlockDriver.cxx
+++ b/src/GEOMImpl/GEOMImpl_BlockDriver.cxx
@@ -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");
diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx
index 12d2e4df2..dc2ab3599 100644
--- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx
+++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx
@@ -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);
diff --git a/src/GEOMImpl/GEOMImpl_I3DSketcher.hxx b/src/GEOMImpl/GEOMImpl_I3DSketcher.hxx
index fa6e04639..4f4c9664d 100755
--- a/src/GEOMImpl/GEOMImpl_I3DSketcher.hxx
+++ b/src/GEOMImpl/GEOMImpl_I3DSketcher.hxx
@@ -15,28 +15,35 @@
// 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
-#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;
};
diff --git a/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx
index e29905bd3..ae1d5959f 100644
--- a/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx
+++ b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx
@@ -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
@@ -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);
+}
//=============================================================================
/*!
diff --git a/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx b/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx
index 1e743415f..736e8afc0 100644
--- a/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx
+++ b/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx
@@ -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,
diff --git a/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx b/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx
index 42aaa4260..efb69f42c 100644
--- a/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx
+++ b/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx
@@ -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
diff --git a/src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx b/src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx
index f702da402..8a34d5510 100644
--- a/src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx
+++ b/src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx
@@ -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& theErrors);
+ std::list& theErrors);
Standard_EXPORT Standard_Boolean CheckCompoundOfBlocks (Handle(GEOM_Object) theCompound,
- std::list& theErrors);
+ std::list& theErrors);
- Standard_EXPORT TCollection_AsciiString PrintBCErrors (Handle(GEOM_Object) theCompound,
+ Standard_EXPORT TCollection_AsciiString PrintBCErrors (Handle(GEOM_Object) theCompound,
const std::list& 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
diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx
index ca1ac5db0..f4508d35b 100644
--- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx
+++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx
@@ -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
@@ -1166,73 +1165,6 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCom
return aSketcher;
}
-//=============================================================================
-/*!
- * Make3DSketcher
- */
-//=============================================================================
-Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcher (std::list 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(), GEOM_3DSKETCHER);
- 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::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 {
-#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 << a3DSketcher << " = geompy.Make3DSketcher([";
-
- it = theCoordinates.begin();
- pd << (*it++);
- while (it != theCoordinates.end()) {
- pd << ", " << (*it++);
- }
- pd << "])";
-
- SetErrorCode(OK);
- return a3DSketcher;
-}
-
//=============================================================================
/*!
* MakeSketcherOnPlane
@@ -1289,3 +1221,121 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane
SetErrorCode(OK);
return aSketcher;
}
+
+//=============================================================================
+/*!
+ * Make3DSketcherCommand
+ */
+//=============================================================================
+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_3DSKETCHER);
+
+ //Add a new Sketcher function
+ Handle(GEOM_Function) aFunction =
+ aSketcher->AddFunction(GEOMImpl_3DSketcherDriver::GetID(), SKETCHER3D_COMMAND);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_3DSketcherDriver::GetID()) return NULL;
+
+ GEOMImpl_I3DSketcher aCI (aFunction);
+
+ TCollection_AsciiString aCommand ((char*) theCommand);
+ aCI.SetCommand(aCommand);
+
+ //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 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::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 {
+#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 << a3DSketcher << " = geompy.Make3DSketcher([";
+
+ it = theCoordinates.begin();
+ pd << (*it++);
+ while (it != theCoordinates.end()) {
+ pd << ", " << (*it++);
+ }
+ pd << "])";
+
+ SetErrorCode(OK);
+ return a3DSketcher;
+}
diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx
index 2e71bbd38..829f9cc5d 100644
--- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx
+++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx
@@ -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 theWorkingPlane);
- Standard_EXPORT Handle(GEOM_Object) Make3DSketcher (std::list 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 theCoordinates);
};
#endif
diff --git a/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx b/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx
index db55c72b6..dc47e1f0e 100644
--- a/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx
+++ b/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx
@@ -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
@@ -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
diff --git a/src/GEOMImpl/GEOMImpl_IGroupOperations.hxx b/src/GEOMImpl/GEOMImpl_IGroupOperations.hxx
index 0b6a89110..6b8d485ec 100644
--- a/src/GEOMImpl/GEOMImpl_IGroupOperations.hxx
+++ b/src/GEOMImpl/GEOMImpl_IGroupOperations.hxx
@@ -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
-#include
+#include
#include
#include
@@ -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);
diff --git a/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx b/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx
index 3bb7cec61..6aca179a1 100644
--- a/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx
+++ b/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx
@@ -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
@@ -47,7 +46,9 @@
#include
#include
+#include
#include
+#include
#include
#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
@@ -61,10 +62,9 @@
//=============================================================================
/*!
- * 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 = "<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 = "<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);
diff --git a/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx b/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx
index e60c22b32..56ea89d42 100644
--- a/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx
+++ b/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx
@@ -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,
diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx
index 98abba29c..df3a87a49 100644
--- a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx
+++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx
@@ -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
@@ -40,10 +39,8 @@
#include
#include
#include
-//#include
#include
#include
-//#include
#include
#include
@@ -58,22 +55,23 @@
#include
#include
+#include
+#include
#include
#include
+#include
#include
#include
#include
#include
#include
+#include
#include
#include
#include
#include
-#include
-#include
-
#include
#include
#include
@@ -81,49 +79,49 @@
#include
#include
#include
+#include
#include
#include
#include
#include
#include
+#include
+#include
+#include
+
+#include
+#include
+
#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+
#include
#include
-#include
-#include
+#include
+#include
+#include
#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+#include
#include
#include
-#include
-#include
-#include
-#include
-#include
-
#include
#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-
//=============================================================================
/*!
* Constructor
@@ -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();
diff --git a/src/GEOMImpl/GEOMImpl_ImportDriver.cxx b/src/GEOMImpl/GEOMImpl_ImportDriver.cxx
index ee1495f0e..748a5a735 100644
--- a/src/GEOMImpl/GEOMImpl_ImportDriver.cxx
+++ b/src/GEOMImpl/GEOMImpl_ImportDriver.cxx
@@ -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
@@ -27,10 +26,12 @@
#include
#include
-#include "utilities.h"
-
#include
+#include
+
+#include "utilities.h"
+
#include
#include
@@ -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_
diff --git a/src/GEOMImpl/GEOMImpl_ImportDriver.hxx b/src/GEOMImpl/GEOMImpl_ImportDriver.hxx
index 0c625e05c..265e5ac4c 100644
--- a/src/GEOMImpl/GEOMImpl_ImportDriver.hxx
+++ b/src/GEOMImpl/GEOMImpl_ImportDriver.hxx
@@ -18,11 +18,10 @@
// 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
#endif
+#include
+
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
//
diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx
index e3c734a10..21475ee42 100644
--- a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx
+++ b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx
@@ -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()) {
diff --git a/src/GEOMImpl/GEOMImpl_PointDriver.cxx b/src/GEOMImpl/GEOMImpl_PointDriver.cxx
index b25807bd0..9fa9cf9c0 100644
--- a/src/GEOMImpl/GEOMImpl_PointDriver.cxx
+++ b/src/GEOMImpl/GEOMImpl_PointDriver.cxx
@@ -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
@@ -26,6 +25,7 @@
#include
#include
#include
+#include
#include
@@ -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();
diff --git a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx
index e1ef28022..9f2ec8081 100644
--- a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx
+++ b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx
@@ -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
@@ -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();
+ }
+ }
}
}
diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx
index 2e5f871b8..5182f8cdc 100755
--- a/src/GEOMImpl/GEOMImpl_Types.hxx
+++ b/src/GEOMImpl/GEOMImpl_Types.hxx
@@ -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
@@ -116,7 +115,8 @@
#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
@@ -295,7 +295,10 @@
#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
diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx
index f0acaa34f..e83523ea4 100644
--- a/src/GEOMToolsGUI/GEOMToolsGUI.cxx
+++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx
@@ -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() ) {
diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.h b/src/GEOMToolsGUI/GEOMToolsGUI.h
index 4241124f6..8b6c32c78 100644
--- a/src/GEOMToolsGUI/GEOMToolsGUI.h
+++ b/src/GEOMToolsGUI/GEOMToolsGUI.h
@@ -30,12 +30,16 @@
#include "GEOM_ToolsGUI.hxx"
#include
-
#include
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
@@ -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,
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
diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx
index 64983d176..c73767ca2 100644
--- a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx
+++ b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx
@@ -109,6 +109,13 @@
// VTK includes
#include
+// 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( 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( 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 ( 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( 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( 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 ));
+ if ( !appStudy ) return;
- QVariant v = appStudy->getObjectProperty(mgrId,selected.First()->getEntry(), COLOR_PROP, ic);
+ // get selection manager
+ LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+ if ( !aSelMgr ) return;
- QColor initcolor = v.value();
- 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 ( 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
+ // 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() );
- 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 );
+ // get view id
+ int mgrId = window->getViewManager()->getGlobalId();
-#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
- Handle(TColStd_HArray1OfByte) aTexture = aCurPointAspect->GetTexture();
-#else
- Handle(Graphic3d_HArray1OfBytes) aTexture = aCurPointAspect->GetTexture();
-#endif
+ if ( isVTK ) {
+ SVTK_ViewWindow* vtkVW = dynamic_cast( window );
+ if ( !vtkVW ) return;
- aCurDrawer->SetPointAspect(new Prs3d_PointAspect(aColor, 1, aWidth, aHeight, aTexture));
- }
- ic->SetLocalAttributes(io, aCurDrawer, Standard_False);
- }
- }
+ // 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 );
- io->SetColor( aColor );
- if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) ) {
- Handle(GEOM_AISShape) aGAISShape = Handle(GEOM_AISShape)::DownCast( io );
- aGAISShape->SetShadingColor( aColor );
- aGAISShape->storeBoundaryColors();
- }
+ // show Choose Color dialog box
+ color = QColorDialog::getColor( v.value(), app->desktop() );
+ if ( !color.isValid() ) return;
- 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 )
+ // 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(), app->desktop() );
+ if ( !color.isValid() ) return;
+
+ // iterate through list of objects and assign new color
+ SUIT_OverrideCursor();
+ OCCViewer_Viewer* vm = dynamic_cast ( 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 =
diff --git a/src/GEOM_I/GEOM_IBasicOperations_i.cc b/src/GEOM_I/GEOM_IBasicOperations_i.cc
index 47979c7b0..b5d674b7f 100644
--- a/src/GEOM_I/GEOM_IBasicOperations_i.cc
+++ b/src/GEOM_I/GEOM_IBasicOperations_i.cc
@@ -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
@@ -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);
+}
//=============================================================================
/*!
diff --git a/src/GEOM_I/GEOM_IBasicOperations_i.hh b/src/GEOM_I/GEOM_IBasicOperations_i.hh
index 841a08221..7861a06bc 100644
--- a/src/GEOM_I/GEOM_IBasicOperations_i.hh
+++ b/src/GEOM_I/GEOM_IBasicOperations_i.hh
@@ -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);
diff --git a/src/GEOM_I/GEOM_IBlocksOperations_i.cc b/src/GEOM_I/GEOM_IBlocksOperations_i.cc
index 0c1917d46..c71432528 100644
--- a/src/GEOM_I/GEOM_IBlocksOperations_i.cc
+++ b/src/GEOM_I/GEOM_IBlocksOperations_i.cc
@@ -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
@@ -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
diff --git a/src/GEOM_I/GEOM_IBlocksOperations_i.hh b/src/GEOM_I/GEOM_IBlocksOperations_i.hh
index a801a1e7e..6f5765092 100644
--- a/src/GEOM_I/GEOM_IBlocksOperations_i.hh
+++ b/src/GEOM_I/GEOM_IBlocksOperations_i.hh
@@ -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);
diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.cc b/src/GEOM_I/GEOM_ICurvesOperations_i.cc
index b5109c9bb..3f1a67800 100644
--- a/src/GEOM_I/GEOM_ICurvesOperations_i.cc
+++ b/src/GEOM_I/GEOM_ICurvesOperations_i.cc
@@ -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
@@ -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);
}
@@ -534,6 +535,46 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakeSketcherOnPlane
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane
+ (const char* theCommand, GEOM::GEOM_Object_ptr theWorkingPlane)
+{
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ Handle(GEOM_Object) aWorkingPlane = GetObjectImpl(theWorkingPlane);
+
+ // Make Sketcher
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeSketcherOnPlane(theCommand, aWorkingPlane);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return GEOM::GEOM_Object::_nil();
+
+ return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ * Make3DSketcherCommand
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::Make3DSketcherCommand (const char* theCommand)
+{
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ // Make 3D Sketcher
+ Handle(GEOM_Object) anObject = GetOperations()->Make3DSketcherCommand(theCommand);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return GEOM::GEOM_Object::_nil();
+
+ return GetObject(anObject);
+}
+
//=============================================================================
/*!
* Make3DSketcher
@@ -559,25 +600,3 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::Make3DSketcher
return GetObject(anObject);
}
-
-//=============================================================================
-/*!
- * MakeSketcherOnPlane
- */
-//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane
- (const char* theCommand, GEOM::GEOM_Object_ptr theWorkingPlane)
-{
- //Set a not done flag
- GetOperations()->SetNotDone();
-
- Handle(GEOM_Object) aWorkingPlane = GetObjectImpl(theWorkingPlane);
-
- // Make Sketcher
- Handle(GEOM_Object) anObject =
- GetOperations()->MakeSketcherOnPlane(theCommand, aWorkingPlane);
- if (!GetOperations()->IsDone() || anObject.IsNull())
- return GEOM::GEOM_Object::_nil();
-
- return GetObject(anObject);
-}
diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.hh b/src/GEOM_I/GEOM_ICurvesOperations_i.hh
index 5fc09cc55..e50ab2111 100644
--- a/src/GEOM_I/GEOM_ICurvesOperations_i.hh
+++ b/src/GEOM_I/GEOM_ICurvesOperations_i.hh
@@ -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
@@ -33,49 +32,49 @@
#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(); }
};
diff --git a/src/GEOM_I/GEOM_IGroupOperations_i.cc b/src/GEOM_I/GEOM_IGroupOperations_i.cc
index 3a8cef597..60a26e129 100644
--- a/src/GEOM_I/GEOM_IGroupOperations_i.cc
+++ b/src/GEOM_I/GEOM_IGroupOperations_i.cc
@@ -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
@@ -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);
}
//=============================================================================
diff --git a/src/GEOM_I/GEOM_IGroupOperations_i.hh b/src/GEOM_I/GEOM_IGroupOperations_i.hh
index b3871e0fe..f213e8be2 100644
--- a/src/GEOM_I/GEOM_IGroupOperations_i.hh
+++ b/src/GEOM_I/GEOM_IGroupOperations_i.hh
@@ -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
@@ -33,17 +32,17 @@
#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);
diff --git a/src/GEOM_I/GEOM_IInsertOperations_i.cc b/src/GEOM_I/GEOM_IInsertOperations_i.cc
index e27a6876b..57a20c3b3 100644
--- a/src/GEOM_I/GEOM_IInsertOperations_i.cc
+++ b/src/GEOM_I/GEOM_IInsertOperations_i.cc
@@ -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 localIDs = GetOperations()->GetAllTextures();
diff --git a/src/GEOM_I/GEOM_IInsertOperations_i.hh b/src/GEOM_I/GEOM_IInsertOperations_i.hh
index a7f8cf1dd..97ca19c70 100644
--- a/src/GEOM_I/GEOM_IInsertOperations_i.hh
+++ b/src/GEOM_I/GEOM_IInsertOperations_i.hh
@@ -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);
diff --git a/src/GEOM_SWIG/GEOM_Spanner.py b/src/GEOM_SWIG/GEOM_Spanner.py
index 05c23aed6..7c17db76a 100644
--- a/src/GEOM_SWIG/GEOM_Spanner.py
+++ b/src/GEOM_SWIG/GEOM_Spanner.py
@@ -20,18 +20,17 @@
#
# 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"
diff --git a/src/GEOM_SWIG/GEOM_TestAll.py b/src/GEOM_SWIG/GEOM_TestAll.py
index 3e7c14dc2..b74b80816 100644
--- a/src/GEOM_SWIG/GEOM_TestAll.py
+++ b/src/GEOM_SWIG/GEOM_TestAll.py
@@ -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")
diff --git a/src/GEOM_SWIG/GEOM_TestOthers.py b/src/GEOM_SWIG/GEOM_TestOthers.py
index 8e65788e2..4db5841a0 100644
--- a/src/GEOM_SWIG/GEOM_TestOthers.py
+++ b/src/GEOM_SWIG/GEOM_TestOthers.py
@@ -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
# -----------------------------------------------------------------------------
diff --git a/src/GEOM_SWIG/Makefile.am b/src/GEOM_SWIG/Makefile.am
index 3fe82e1a4..c9742d239 100644
--- a/src/GEOM_SWIG/Makefile.am
+++ b/src/GEOM_SWIG/Makefile.am
@@ -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 \
diff --git a/src/GEOM_SWIG/geompy.py b/src/GEOM_SWIG/geompy.py
index 13df41063..f715dc8a4 100644
--- a/src/GEOM_SWIG/geompy.py
+++ b/src/GEOM_SWIG/geompy.py
@@ -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
diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py
index ca34d8893..0dd628e5a 100644
--- a/src/GEOM_SWIG/geompyDC.py
+++ b/src/GEOM_SWIG/geompyDC.py
@@ -73,9 +73,14 @@
## @}
-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
index 000000000..11cb0771c
--- /dev/null
+++ b/src/GEOM_SWIG/gsketcher.py
@@ -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
diff --git a/src/GEOM_SWIG_WITHIHM/Makefile.am b/src/GEOM_SWIG_WITHIHM/Makefile.am
index e468bfb0d..59166af81 100644
--- a/src/GEOM_SWIG_WITHIHM/Makefile.am
+++ b/src/GEOM_SWIG_WITHIHM/Makefile.am
@@ -17,14 +17,6 @@
# 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
-# /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
# /lib/python/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/GEOMGUI/GeometryGUI_Swig.cxx b/src/GEOM_SWIG_WITHIHM/libGEOM_Swig.cxx
similarity index 87%
rename from src/GEOMGUI/GeometryGUI_Swig.cxx
rename to src/GEOM_SWIG_WITHIHM/libGEOM_Swig.cxx
index 59410211f..616fd5097 100644
--- a/src/GEOMGUI/GeometryGUI_Swig.cxx
+++ b/src/GEOM_SWIG_WITHIHM/libGEOM_Swig.cxx
@@ -21,12 +21,13 @@
//
// GEOM GEOMGUI : GUI for Geometry component
-// File : GeometryGUI_Swig.cxx
+// File : libGEOM_Swig.cxx
// Author : Nicolas REJNERI, Paul RASCLE
//
-#include "GeometryGUI_Swig.hxx"
+#include "libGEOM_Swig.h"
#include "GeometryGUI.h"
+#include "GEOMToolsGUI.h"
#include "SUIT_Desktop.h"
#include "SUIT_Session.h"
@@ -51,6 +52,7 @@
#include "GEOM_AISShape.hxx"
#include "GEOM_InteractiveObject.hxx"
#include "GEOM_Displayer.h"
+#include "GEOM_Constants.h"
#include "SALOME_Event.h"
@@ -60,6 +62,7 @@
#include
#include
#include
+#include
#include
// IDL Headers
@@ -448,7 +451,7 @@ void GEOM_Swig::setVectorsMode(const char* theEntry, bool isOn, bool isUpdated)
void GEOM_Swig::setColor(const char* theEntry, int red, int green, int blue, bool isUpdated)
{
class TEvent: public SALOME_Event {
- std::string myEntry;
+ QString myEntry;
int myRed;
int myGreen;
int myBlue;
@@ -460,44 +463,82 @@ void GEOM_Swig::setColor(const char* theEntry, int red, int green, int blue, boo
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(app->activeStudy());
+ if (!study) 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)
+ if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app)) {
+ SVTK_Viewer* aView = dynamic_cast(aViewWindow->getViewManager()->getViewModel());
+ SVTK_Prs* vtkPrs = dynamic_cast( 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(anApp)) {
+ }
+ else if (OCCViewer_Viewer* occViewer = GetOCCViewer(app)) {
Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
SOCC_Viewer* soccViewer = dynamic_cast(occViewer);
- if (soccViewer)
- {
- SALOME_Prs* prs= soccViewer->CreatePrs( myEntry.c_str() );
- const SOCC_Prs* anOCCPrs = dynamic_cast( 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();
+ if (soccViewer) {
+ int aMgrId = soccViewer->getViewManager()->getGlobalId();
+ SOCC_Prs* occPrs = dynamic_cast( 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(theEntry, red, green, blue, isUpdated));
+
+ ProcessVoidEvent(new TEvent (Entry, nbU, nbV, isUpdated));
}
void GEOM_Swig::setTransparency(const char* theEntry, float transp, bool isUpdated)
diff --git a/src/GEOMGUI/GeometryGUI_Swig.hxx b/src/GEOM_SWIG_WITHIHM/libGEOM_Swig.h
similarity index 95%
rename from src/GEOMGUI/GeometryGUI_Swig.hxx
rename to src/GEOM_SWIG_WITHIHM/libGEOM_Swig.h
index 0f93ab727..5f85b568b 100644
--- a/src/GEOMGUI/GeometryGUI_Swig.hxx
+++ b/src/GEOM_SWIG_WITHIHM/libGEOM_Swig.h
@@ -21,9 +21,10 @@
//
// GEOM GEOMGUI : GUI for Geometry component
-// File : GeometryGUI_Swig.hxx
+// File : libGEOM_Swig.h
// Author : Nicolas REJNERI, Paul RASCLE
//
+
#ifndef GEOMETRYGUI_SWIG_HXX
#define GEOMETRYGUI_SWIG_HXX
@@ -49,6 +50,7 @@ public:
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);
diff --git a/src/GEOM_SWIG_WITHIHM/libGEOM_Swig.i b/src/GEOM_SWIG_WITHIHM/libGEOM_Swig.i
index fc1b8fea4..6bf220c2d 100644
--- a/src/GEOM_SWIG_WITHIHM/libGEOM_Swig.i
+++ b/src/GEOM_SWIG_WITHIHM/libGEOM_Swig.i
@@ -26,5 +26,51 @@
//
%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();
+};
diff --git a/src/GroupGUI/GroupGUI.cxx b/src/GroupGUI/GroupGUI.cxx
index 990263407..d8f92294f 100644
--- a/src/GroupGUI/GroupGUI.cxx
+++ b/src/GroupGUI/GroupGUI.cxx
@@ -18,14 +18,14 @@
// 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
#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( app->activeStudy() );
- if ( !appStudy ) return false;
+ SalomeApp_Study* appStudy = dynamic_cast(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
index 000000000..3c227e0c7
--- /dev/null
+++ b/src/GroupGUI/GroupGUI_BooleanDlg.cxx
@@ -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
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+
+//=================================================================================
+// 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
index 000000000..467130eec
--- /dev/null
+++ b/src/GroupGUI/GroupGUI_BooleanDlg.h
@@ -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
diff --git a/src/GroupGUI/Makefile.am b/src/GroupGUI/Makefile.am
index 068c3587a..78e540589 100755
--- a/src/GroupGUI/Makefile.am
+++ b/src/GroupGUI/Makefile.am
@@ -15,13 +15,11 @@
# 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 = \
diff --git a/src/IGESImport/IGESImport.cxx b/src/IGESImport/IGESImport.cxx
index cff70de18..e9c73ac4a 100644
--- a/src/IGESImport/IGESImport.cxx
+++ b/src/IGESImport/IGESImport.cxx
@@ -51,6 +51,8 @@
#include
#include
+#include