Merge from V6_main (04/10/2012)
@ -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
|
||||
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 24 KiB |
BIN
doc/salome/gui/GEOM/images/groups_cut_dlg.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
doc/salome/gui/GEOM/images/groups_intersect_dlg.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
doc/salome/gui/GEOM/images/groups_union_dlg.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
doc/salome/gui/GEOM/images/measures2.png
Normal file
After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 26 KiB |
@ -2,41 +2,56 @@
|
||||
|
||||
\page create_3dsketcher_page 3D Sketcher
|
||||
|
||||
3D Sketcher allows creating a closed or unclosed 3D wire from a list of points.
|
||||
3D Sketcher allows creating a closed or unclosed 3D wire, made of
|
||||
consequent straight segments.
|
||||
|
||||
To create a 3D Sketch, select in the main menu <em>New Entity -> Basic -> 3D Sketch</em>.
|
||||
|
||||
\image html 3dsketch2.png
|
||||
|
||||
In this dialog it is possible to define the coordinates of the points.
|
||||
The first sketcher point can be defined by \b Absolute coordinates X, Y and Z.
|
||||
When the first point is defined, it is possible to add straight segments.
|
||||
Each segment will start at the end point of previous segment or at the
|
||||
sketcher first point, if there are no validated segments.
|
||||
|
||||
The position of each point can be defined by \b Absolute coordinates X, Y, Z or
|
||||
by \b Relative coordinates DX, DY, DZ with respect to the previous Applied point.
|
||||
The type of coordinates can be selected by the <b>Coordinates Type</b>
|
||||
Segment can be defined by:
|
||||
- \b Absolute coordinates X, Y and Z of its second end,
|
||||
- \b Relative coordinates DX, DY and DZ of its second end with
|
||||
respect to the previous applied point,
|
||||
- \b Direction and \b Length of the segment. Direction is set by two
|
||||
\b Angles in selected coordinate system.
|
||||
|
||||
The way of segment construction can be selected by the <b>Coordinates Type</b>
|
||||
radio buttons.
|
||||
|
||||
To add the point in the list of points and to proceed with the
|
||||
definition of the next point, click <b>Apply</b> button. \b Undo and
|
||||
\b Redo buttons, respectively, remove or restore the last point in the list.
|
||||
To validate the segment and to proceed with the definition of the next
|
||||
segment, click <b>Apply</b> button. \b Undo and \b Redo buttons,
|
||||
respectively, remove or restore the last segment in the wire.
|
||||
|
||||
\n <b>"Sketch Validation"</b> button applies the wire, built by the
|
||||
user, "as is".
|
||||
\n <b>"Sketch Closure"</b> closes the Sketch by a straight line from
|
||||
the start to the end point and applies it.
|
||||
|
||||
To make a closed wire using the TUI command, the first and the last point should
|
||||
have the same coordinates.
|
||||
|
||||
The Result of the operation will be a \b GEOM_Object.
|
||||
|
||||
<b>TUI Command:</b> <em>geompy.Make3DSketcher( [ PointsList ] )</em>
|
||||
This algorithm creates a wire from the list of real values, which define XYZ
|
||||
coordinates of points.
|
||||
|
||||
<b>Example:</b>
|
||||
|
||||
\image html 3dsketch1.png
|
||||
|
||||
<b>TUI Command:</b> <em>geompy.Make3DSketcher( [ PointsList ] )</em>
|
||||
This algorithm creates a wire from the list of real values, which
|
||||
define absolute XYZ coordinates of points. The Result of the operation
|
||||
will be a \b GEOM_Object.
|
||||
|
||||
\note To make a closed wire using this TUI command, the first and the
|
||||
last point should have the same coordinates.
|
||||
|
||||
\n Another way to create the 3D Sketcher in TUI is using Sketcher3D
|
||||
interface.
|
||||
<b>TUI Command:</b> <em>sk = geompy.Sketcher3D()</em>
|
||||
Returns an instance of Sketcher3D interface <i>sk</i>.
|
||||
Use the below examples and see the \ref gsketcher.Sketcher3D "Sketcher3D"
|
||||
interface documentation for more information.
|
||||
|
||||
Our <b>TUI Scripts</b> provide you with useful examples of the use of
|
||||
\ref tui_3dsketcher_page "3D Sketcher".
|
||||
*/
|
||||
|
@ -2,7 +2,12 @@
|
||||
|
||||
\page create_dividedcylinder_page DividedCylinder
|
||||
|
||||
The <b>Divided cylinder</b> object is a cylinder divided into \b blocks for easy hexaedral meshing</b>.
|
||||
The <b>Divided cylinder</b> object is a cylinder divided into \b blocks for easy hexaedral meshing.Two division patterns are available :
|
||||
|
||||
<ul>
|
||||
<li> A square pattern which is frequently used </li>
|
||||
<li> An hexagonal pattern which ensures a better mesh quality and especially less acute or obtuse angles </li>
|
||||
</ul>
|
||||
|
||||
\image html dividedcylinder.png
|
||||
|
||||
@ -13,11 +18,12 @@ Specify the parameters of the DividedCylinder object creation in the opened dial
|
||||
box and press "Apply" or "Apply & Close" button.
|
||||
Result of each operation will be a GEOM_Object.
|
||||
|
||||
<b>TUI Command:</b> <em>geompy.MakeDividedCylinder(R, H)</em>
|
||||
<b>TUI Command:</b> <em>geompy.MakeDividedCylinder(R, H, Pattern)</em>
|
||||
|
||||
<b>Arguments:</b>
|
||||
- \b R - Radius of the cylinder
|
||||
- \b H - Height of the cylinder
|
||||
- \b Pattern - Division pattern
|
||||
|
||||
\image html dividedcylinder_dlg.png
|
||||
|
||||
|
@ -2,10 +2,17 @@
|
||||
|
||||
\page create_divideddisk_page DividedDisk
|
||||
|
||||
The <b>Divided disk</b> object is a disk divided into \b blocks. It means that it's a shape <b>prepared for hexaedral meshing</b>.
|
||||
The <b>Divided disk</b> object is a disk divided into \b blocks. It means that it's a shape <b>prepared for hexaedral meshing</b>. Two division patterns are available :
|
||||
|
||||
<ul>
|
||||
<li> A square pattern which is frequently used </li>
|
||||
<li> An hexagonal pattern which ensures a better mesh quality and especially less acute or obtuse angles </li>
|
||||
</ul>
|
||||
|
||||
|
||||
\n Moreover this shape can be used as a basis in an \ref create_extrusion_alongpath_page "Extrusion along a path" operation in order to obtain any <b>tube shape</b> prepared for hexaedral meshing
|
||||
(see example below).
|
||||
(see example below). (Another alternative is to create a 2D mesh on the divided disk and create a 3D mesh by extrusion in the SMESH module.)
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
@ -18,27 +25,29 @@ Advanced - > DividedDisk </b>
|
||||
\n For both operations :
|
||||
Specify the parameters of the DividedDisk object creation in the opened dialog
|
||||
box and press "Apply" or "Apply & Close" button.
|
||||
Result of each operation will be a GEOM_Object.
|
||||
The result of each operation will be a GEOM_Object.
|
||||
|
||||
\n First way : by radius and orientation (plane "OXY", "OYZ" or "OZX"). The resulting disk is located at the origin of coordinates
|
||||
|
||||
<b>TUI Command:</b> <em>geompy.MakeDividedDisk(Radius, Orientation)</em>
|
||||
<b>TUI Command:</b> <em>geompy.MakeDividedDisk(Radius, Orientation, Pattern)</em>
|
||||
|
||||
<b>Arguments:</b>
|
||||
- \b Radius - Radius of the disk
|
||||
- \b Orientation - Plane on wich the disk will be built
|
||||
- \b Pattern - Division pattern
|
||||
|
||||
\image html divided_disk_dlg.png
|
||||
|
||||
\n Second way : by giving its center, normal and radius.
|
||||
|
||||
<b>TUI Command:</b> <em>geompy.MakeDividedDiskPntVecR(Center, Vector,
|
||||
Radius)</em>
|
||||
Radius, Pattern)</em>
|
||||
|
||||
<b>Arguments:</b>
|
||||
- \b Center - Center of the disk
|
||||
- \b Vector - Normal to the plane of the disk
|
||||
- \b Radius - Radius of the disk
|
||||
- \b Pattern - Division pattern
|
||||
|
||||
\image html divided_disk_PntVecR_dlg.png
|
||||
|
||||
|
@ -73,7 +73,7 @@ position of the point on the given face.
|
||||
\image html point5.png
|
||||
|
||||
Alternatively, it is possible to define 3D coordinates of the point projected on the given face.
|
||||
\n <b>TUI Command:</b> <em>geompy.MakeVertexOnSurface(myFace,X,Y,Z).</em>
|
||||
\n <b>TUI Command:</b> <em>geompy.MakeVertexOnSurfaceByCoord(myFace,X,Y,Z).</em>
|
||||
\n <b>Arguments:</b> Name + 1 face + 3 coordinate values
|
||||
to project point on the given face.
|
||||
|
||||
|
23
doc/salome/gui/GEOM/input/get_non_blocks.doc
Normal file
@ -0,0 +1,23 @@
|
||||
/*!
|
||||
|
||||
\page get_non_blocks_page Get Non Blocks
|
||||
|
||||
\image html measures2.png
|
||||
|
||||
Retrieve all non blocks solids and faces from the given shape.
|
||||
Collect them in two groups: solids and faces separately.
|
||||
|
||||
\n <b>Result:</b> Two or less groups are published in the Object
|
||||
Browser under the processed object. Reports error if
|
||||
no bad sub-shapes (solids and faces) have been found.
|
||||
|
||||
\n <b>TUI Command:</b>
|
||||
<em>geompy.GetNonBlocks(Compound).</em> Returns a tuple of two
|
||||
GEOM_Objects. The first object is a group of all non block solids
|
||||
(= not 6 faces, or with 6 faces, but with the presence of
|
||||
non-quadrangular faces). The second object is a group of all non
|
||||
quadrangular faces.
|
||||
|
||||
See also a \ref tui_get_non_blocks_page "TUI example".
|
||||
|
||||
*/
|
@ -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
|
||||
|
||||
*/
|
@ -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)
|
||||
|
32
doc/salome/gui/GEOM/input/tui_get_non_blocks.doc
Normal file
@ -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
|
||||
|
||||
*/
|
@ -17,6 +17,7 @@
|
||||
<li>\subpage tui_free_faces_page</li>
|
||||
<li>\subpage tui_check_shape_page</li>
|
||||
<li>\subpage tui_check_compound_of_blocks_page</li>
|
||||
<li>\subpage tui_get_non_blocks_page</li>
|
||||
<li>\subpage tui_check_self_intersections_page</li>
|
||||
</ul>
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -2,7 +2,9 @@
|
||||
|
||||
\page tui_working_with_groups_page Working with Groups
|
||||
|
||||
<br><h2>Creation of a group</h2>
|
||||
<br>
|
||||
\anchor tui_create_groups_anchor
|
||||
<h2>Creation of a group</h2>
|
||||
|
||||
\code
|
||||
import geompy
|
||||
@ -42,6 +44,8 @@ gg.createAndDisplayGO(id_group1)
|
||||
salome.sg.updateObjBrowser(1)
|
||||
\endcode
|
||||
|
||||
\anchor tui_edit_groups_anchor
|
||||
|
||||
<br><h2>Adding an object to the group</h2>
|
||||
|
||||
\code
|
||||
@ -107,4 +111,108 @@ gg.createAndDisplayGO(id_group1)
|
||||
salome.sg.updateObjBrowser(1)
|
||||
\endcode
|
||||
|
||||
<br>
|
||||
\anchor tui_union_groups_anchor
|
||||
<h2>Union Groups</h2>
|
||||
|
||||
\code
|
||||
import geompy
|
||||
import salome
|
||||
|
||||
# create a box and some groups of faces on it
|
||||
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
|
||||
Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
|
||||
geompy.UnionIDs(Group_1, [13, 23])
|
||||
Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
|
||||
geompy.UnionIDs(Group_2, [3, 27])
|
||||
Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
|
||||
geompy.UnionIDs(Group_3, [33, 23])
|
||||
Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
|
||||
geompy.UnionIDs(Group_4, [31, 27])
|
||||
|
||||
# union groups
|
||||
Group_U_1_2 = geompy.UnionGroups(Group_1, Group_2)
|
||||
Group_UL_3_4 = geompy.UnionListOfGroups([Group_3, Group_4])
|
||||
|
||||
# publish shapes
|
||||
geompy.addToStudy(Box_1, 'Box_1')
|
||||
geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
|
||||
geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
|
||||
geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
|
||||
geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
|
||||
geompy.addToStudyInFather(Box_1, Group_U_1_2, 'Group_U_1_2')
|
||||
geompy.addToStudyInFather(Box_1, Group_UL_3_4, 'Group_UL_3_4')
|
||||
salome.sg.updateObjBrowser(1)
|
||||
\endcode
|
||||
|
||||
<br>
|
||||
\anchor tui_intersect_groups_anchor
|
||||
<h2>Intersect Groups</h2>
|
||||
|
||||
\code
|
||||
import geompy
|
||||
import salome
|
||||
|
||||
# create a box and some groups of faces on it
|
||||
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
|
||||
Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
|
||||
geompy.UnionIDs(Group_1, [13, 23])
|
||||
Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
|
||||
geompy.UnionIDs(Group_2, [3, 27])
|
||||
Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
|
||||
geompy.UnionIDs(Group_3, [33, 23])
|
||||
Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
|
||||
geompy.UnionIDs(Group_4, [31, 27])
|
||||
|
||||
# intersect groups
|
||||
Group_I_1_3 = geompy.IntersectGroups(Group_1, Group_3)
|
||||
Group_IL_1_3 = geompy.IntersectListOfGroups([Group_1, Group_3])
|
||||
|
||||
# publish shapes
|
||||
geompy.addToStudy(Box_1, 'Box_1')
|
||||
geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
|
||||
geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
|
||||
geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
|
||||
geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
|
||||
geompy.addToStudyInFather(Box_1, Group_I_1_3, 'Group_I_1_3')
|
||||
geompy.addToStudyInFather(Box_1, Group_IL_1_3, 'Group_IL_1_3')
|
||||
salome.sg.updateObjBrowser(1)
|
||||
|
||||
\endcode
|
||||
|
||||
<br>
|
||||
\anchor tui_cut_groups_anchor
|
||||
<h2>Cut Groups</h2>
|
||||
|
||||
\code
|
||||
import geompy
|
||||
import salome
|
||||
|
||||
# create a box and some groups of faces on it
|
||||
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
|
||||
Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
|
||||
geompy.UnionIDs(Group_1, [13, 23])
|
||||
Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
|
||||
geompy.UnionIDs(Group_2, [3, 27])
|
||||
Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
|
||||
geompy.UnionIDs(Group_3, [33, 23])
|
||||
Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
|
||||
geompy.UnionIDs(Group_4, [31, 27])
|
||||
|
||||
# cut groups
|
||||
Group_C_2_4 = geompy.CutGroups(Group_2, Group_4)
|
||||
Group_CL_2_4 = geompy.CutListOfGroups([Group_2], [Group_4])
|
||||
|
||||
# publish shapes
|
||||
geompy.addToStudy(Box_1, 'Box_1')
|
||||
geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
|
||||
geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
|
||||
geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
|
||||
geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
|
||||
geompy.addToStudyInFather(Box_1, Group_C_2_4, 'Group_C_2_4')
|
||||
geompy.addToStudyInFather(Box_1, Group_CL_2_4, 'Group_CL_2_4')
|
||||
salome.sg.updateObjBrowser(1)
|
||||
|
||||
\endcode
|
||||
|
||||
*/
|
||||
|
@ -25,6 +25,7 @@ concerning created or imported geometrical objects :
|
||||
<li>\subpage free_faces_page "Check Free Faces"</li>
|
||||
<li>\subpage check_shape_page "Check Shape"</li>
|
||||
<li>\subpage check_compound_of_blocks_page "Check compound of blocks"</li>
|
||||
<li>\subpage get_non_blocks_page "Get non blocks"</li>
|
||||
<li>\subpage check_self_intersections_page "Detect Self-intersections"</li>
|
||||
</ul>
|
||||
|
||||
|
@ -74,18 +74,23 @@ on the viewer background:
|
||||
<li><b>Select Only</b> provides a filter for exclusive selection of objects of a certain type.</li>
|
||||
</ul>
|
||||
|
||||
The the following commands appear in the Object Browser context menu
|
||||
The following commands appear in the Object Browser context menu
|
||||
under certain conditions:
|
||||
|
||||
\image html ob_popup_menu.png <br>
|
||||
|
||||
<ul>
|
||||
<li>\ref work_with_groups_page "Create Group" - allows creating groups of geometrical objects.</li>
|
||||
<li><b>Hide Children</b> / <b>Show Children</b> - hides / shows child
|
||||
|
||||
<li><b>Conceal child items</b> / <b>Disclose child items</b> - hides / shows child
|
||||
sub-objects in the Object Browser, if the selected geometric object has
|
||||
child objects. When some child objects are hidden, the name of the
|
||||
parent object is hilghlighted with bold font.</li>
|
||||
|
||||
<li><b>Show Only Children</b> - erase in current viewer all objects
|
||||
and then display only children of the selected object(s).
|
||||
</li>
|
||||
|
||||
<li><b>Unpublish</b> - unpublish the selected geometric object from the Object Browser
|
||||
and erase it from all viewers. To publish unpublished geometric objects select in the
|
||||
context menu of the <b>Geometry</b> root object <b>Publish...</b> item.
|
||||
|
@ -3,13 +3,25 @@
|
||||
\page work_with_groups_page Working with groups
|
||||
|
||||
Creation and editing groups of sub-shapes of a geometrical object makes
|
||||
handling sub-shapes much easier. This functionality is available in OCC
|
||||
viewer only.
|
||||
handling sub-shapes much easier. Also some Boolean operations on
|
||||
groups are available.
|
||||
|
||||
<br><h2>Create a group</h2>
|
||||
<ul>
|
||||
<li>\ref create_groups_anchor "Create a Group"</li>
|
||||
<li>\ref edit_groups_anchor "Edit a Group"</li>
|
||||
<li>\ref union_groups_anchor "Union Groups"</li>
|
||||
<li>\ref intersect_groups_anchor "Intersect Groups"</li>
|
||||
<li>\ref cut_groups_anchor "Cut Groups"</li>
|
||||
</ul>
|
||||
|
||||
<br>
|
||||
\anchor create_groups_anchor
|
||||
<h2>Create a group</h2>
|
||||
|
||||
\image html image56.png
|
||||
|
||||
This functionality is available in OCC viewer only.
|
||||
|
||||
To create a group of sub-shapes of a geometrical object in the main
|
||||
menu select <b>New entity > Group > Create</b>
|
||||
\n The following menu will appear:
|
||||
@ -72,19 +84,29 @@ ShapeType),</em> where MainShape is a shape for which the group is
|
||||
created, ShapeType is a type of shapes in the created group.
|
||||
\n <b>Arguments:</b> 1 Shape + Type of sub-shape.
|
||||
|
||||
Our <b>TUI Scripts</b> provide you with useful examples of
|
||||
\ref tui_create_groups_anchor "Create a Group" operation.
|
||||
|
||||
<b>Example:</b>
|
||||
|
||||
\image html image193.png "Groups on a cylinder"
|
||||
|
||||
|
||||
<br><h2>Edit a group</h2>
|
||||
<br>
|
||||
\anchor edit_groups_anchor
|
||||
<h2>Edit a group</h2>
|
||||
|
||||
\image html image57.png
|
||||
|
||||
This functionality is available in OCC viewer only.
|
||||
|
||||
To \b Edit an existing group in the main menu select <b>New entity >
|
||||
Group > Edit</b>. This menu is designed in the same way as the
|
||||
<b>Create a group</b> menu.
|
||||
|
||||
\n <b>Dialog Box:</b>
|
||||
|
||||
\image html editgroup.png
|
||||
|
||||
\n The \b Result of the operation will be a \b GEOM_Object.
|
||||
|
||||
\n <b>TUI Command:</b>
|
||||
@ -101,11 +123,80 @@ the sub-shape to be removed from the group.</li>
|
||||
|
||||
\n <b>Arguments:</b> 1 Shape + its sub-shapes.
|
||||
|
||||
\n <b>Dialog Box:</b>
|
||||
Our <b>TUI Scripts</b> provide you with useful examples of
|
||||
\ref tui_edit_groups_anchor "Edit a Group" operation.
|
||||
|
||||
\image html editgroup.png
|
||||
<br>
|
||||
\anchor union_groups_anchor
|
||||
<h2>Union of groups</h2>
|
||||
|
||||
This operation allows to create a new group in such a way that all
|
||||
sub-shapes that are present in the initial groups will be added to
|
||||
the new one.
|
||||
|
||||
<em>To union groups:</em>
|
||||
<ol>
|
||||
<li>In the <b>New Entity</b> menu select the \b Group - <b>Union Groups</b> item.
|
||||
The following dialog box will appear:
|
||||
|
||||
\image html groups_union_dlg.png
|
||||
|
||||
In this dialog box you should specify the name of the resulting group
|
||||
and set of groups which will be united.
|
||||
</li>
|
||||
<li>Click the \b Apply or <b>Apply and Close</b> button to confirm creation of the group.</li>
|
||||
</ol>
|
||||
|
||||
<b>See Also</b> a sample TUI Script of a
|
||||
\ref tui_union_groups_anchor "Union of Groups" operation.
|
||||
|
||||
<br>
|
||||
\anchor intersect_groups_anchor
|
||||
<h2>Intersection of groups</h2>
|
||||
|
||||
This operation allows to create a new group in such a way that only
|
||||
sub-shapes that are present in all initial groups together are added to the
|
||||
new one.
|
||||
|
||||
<em>To intersect groups:</em>
|
||||
<ol>
|
||||
<li>In the <b>New Entity</b> menu select the \b Group - <b>Intersect Groups</b> item.
|
||||
The following dialog box will appear:
|
||||
|
||||
\image html groups_intersect_dlg.png
|
||||
|
||||
In this dialog box you should specify the name of the resulting group
|
||||
and set of groups which will be intersected.
|
||||
</li>
|
||||
<li>Click the \b Apply or <b>Apply and Close</b> button to confirm creation of the group.</li>
|
||||
</ol>
|
||||
|
||||
<b>See Also</b> a sample TUI Script of an
|
||||
\ref tui_intersect_groups_anchor "Intersection of Groups" operation.
|
||||
|
||||
<br>
|
||||
\anchor cut_groups_anchor
|
||||
<h2>Cut of groups</h2>
|
||||
|
||||
This operation allows to create a new group in such a way that all
|
||||
sub-shapes that are present in the main groups but are absent in the
|
||||
tool groups are added to the new one.
|
||||
|
||||
<em>To cut groups:</em>
|
||||
<ol>
|
||||
<li>In the <b>New Entity</b> menu select the \b Group - <b>Cut Groups</b> item.
|
||||
The following dialog box will appear:
|
||||
|
||||
\image html groups_cut_dlg.png
|
||||
|
||||
In this dialog box you should specify the name of the resulting group
|
||||
and groups which will be cut.
|
||||
</li>
|
||||
<li>Click the \b Apply or <b>Apply and Close</b> button to confirm creation of the
|
||||
group.</li>
|
||||
</ol>
|
||||
|
||||
Our <b>TUI Scripts</b> provide you with useful examples of
|
||||
\ref tui_working_with_groups_page "Working with Groups".
|
||||
\ref tui_cut_groups_anchor "Cut of Groups" operation.
|
||||
|
||||
*/
|
||||
|
158
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.
|
||||
*
|
||||
@ -2777,7 +2799,7 @@ module GEOM
|
||||
* 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.
|
||||
*
|
||||
* 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 <VAR>ImportTranslators()</VAR> method.
|
||||
* \param theParameterName Specify the parameter. For example, pass "LEN_UNITS"
|
||||
* to obtain length units, in which the file is written.
|
||||
* \return Value of requested parameter in form of text string.
|
||||
*/
|
||||
string ReadValue (in string theFileName, in string theFormatName, in string theParameterName);
|
||||
|
||||
/*!
|
||||
* \brief Get the supported import formats and corresponding patterns for File dialog.
|
||||
* \param theFormats Output. List of formats, available for import.
|
||||
@ -3218,6 +3279,14 @@ module GEOM
|
||||
void ExportTranslators (out string_array theFormats,
|
||||
out string_array thePatterns);
|
||||
|
||||
/*!
|
||||
* \brief Read a shape from the binary stream, containing its bounding representation (BRep).
|
||||
* \note GEOM_Object::GetShapeStream() method can be used to obtain the shape's BRep stream.
|
||||
* \param theStream The BRep binary stream.
|
||||
* \return New GEOM_Object, containing the shape, read from theStream.
|
||||
*/
|
||||
GEOM_Object RestoreShape (in SALOMEDS::TMPFile theStream);
|
||||
|
||||
/*!
|
||||
* \brief Load texture from file
|
||||
* \param theTextureFile texture file name
|
||||
@ -3635,6 +3704,65 @@ module GEOM
|
||||
*/
|
||||
void DifferenceIDs (in GEOM_Object theGroup, in ListOfLong theSubShapes);
|
||||
|
||||
/*!
|
||||
* \brief Union of two groups.
|
||||
* New group is created. It will contain all entities
|
||||
* which are present in groups theGroup1 and theGroup2.
|
||||
* \param theGroup1, theGroup2 are the initial GEOM groups
|
||||
* to create the united group from.
|
||||
* \return a newly created GEOM group.
|
||||
*/
|
||||
GEOM_Object UnionGroups (in GEOM_Object theGroup1, in GEOM_Object theGroup2);
|
||||
|
||||
/*!
|
||||
* \brief Intersection of two groups.
|
||||
* New group is created. It will contain only those entities
|
||||
* which are present in both groups theGroup1 and theGroup2.
|
||||
* \param theGroup1, theGroup2 are the initial GEOM groups to get common part of.
|
||||
* \return a newly created GEOM group.
|
||||
*/
|
||||
GEOM_Object IntersectGroups (in GEOM_Object theGroup1, in GEOM_Object theGroup2);
|
||||
|
||||
/*!
|
||||
* \brief Cut of two groups.
|
||||
* New group is created. It will contain entities which are
|
||||
* present in group theGroup1 but are not present in group theGroup2.
|
||||
* \param theGroup1 is a GEOM group to include elements of.
|
||||
* \param theGroup2 is a GEOM group to exclude elements of.
|
||||
* \return a newly created GEOM group.
|
||||
*/
|
||||
GEOM_Object CutGroups (in GEOM_Object theGroup1, in GEOM_Object theGroup2);
|
||||
|
||||
/*!
|
||||
* \brief Union of list of groups.
|
||||
* New group is created. It will contain all entities that are
|
||||
* present in groups listed in theGList.
|
||||
* \param theGList is a list of GEOM groups to create the united group from.
|
||||
* \return a newly created GEOM group.
|
||||
*/
|
||||
GEOM_Object UnionListOfGroups (in ListOfGO theGList);
|
||||
|
||||
/*!
|
||||
* \brief Intersection of list of groups.
|
||||
* New group is created. It will contain only entities
|
||||
* which are simultaneously present in the groups listed in theGList.
|
||||
* \param theGList is a list of GEOM groups to get common part of.
|
||||
* \return a newly created GEOM group.
|
||||
*/
|
||||
GEOM_Object IntersectListOfGroups (in ListOfGO theGList);
|
||||
|
||||
/*!
|
||||
* \brief Cut of lists of groups.
|
||||
* New group is created. It will contain only entities
|
||||
* which are present in groups listed in theGList1 but
|
||||
* are not present in groups from theGList2.
|
||||
* \param theGList1 is a list of GEOM groups to include elements of.
|
||||
* \param theGList2 is a list of GEOM groups to exclude elements of.
|
||||
* \return a newly created GEOM group.
|
||||
*/
|
||||
GEOM_Object CutListOfGroups (in ListOfGO theGList1,
|
||||
in ListOfGO theGList2);
|
||||
|
||||
/*!
|
||||
* \brief Returns a type of sub-objects stored in the group
|
||||
* \param theGroup is a GEOM group which type is returned.
|
||||
|
@ -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 \
|
||||
|
@ -43,7 +43,7 @@
|
||||
<parameter name="SettingsGeomStep" value="10" />
|
||||
<parameter name="display_mode" value="0" />
|
||||
<parameter name="shading_color" value="255, 255, 0" />
|
||||
<parameter name="edges_in_shading_color" value="255, 255, 255" />
|
||||
<parameter name="edges_in_shading_color" value="180, 180, 180" />
|
||||
<parameter name="wireframe_color" value="255, 255, 0" />
|
||||
<parameter name="free_bound_color" value="0, 255, 0" />
|
||||
<parameter name="line_color" value="255, 0, 0" />
|
||||
|
BIN
resources/get_non_blocks.png
Normal file
After Width: | Height: | Size: 1004 B |
@ -36,6 +36,10 @@
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
// VSR 22/08/2012: issue 0021787: remove "Preview" button from BOP and Partition operations
|
||||
// Comment next line to enable preview in BOP dialog box
|
||||
#define NO_PREVIEW
|
||||
|
||||
//=================================================================================
|
||||
// class : BooleanGUI_Dialog()
|
||||
// purpose : Constructs a BooleanGUI_Dialog which is a child of 'parent', with the
|
||||
@ -110,6 +114,10 @@ BooleanGUI_Dialog::BooleanGUI_Dialog (const int theOperation, GeometryGUI* theGe
|
||||
layout->addWidget(myGroup);
|
||||
/***************************************************************/
|
||||
|
||||
#ifdef NO_PREVIEW
|
||||
mainFrame()->CheckBoxPreview->setChecked( false );
|
||||
mainFrame()->CheckBoxPreview->hide();
|
||||
#endif
|
||||
// Initialisation
|
||||
Init();
|
||||
}
|
||||
@ -224,6 +232,7 @@ void BooleanGUI_Dialog::SelectionIntoArgument()
|
||||
if (myEditCurrentArgument == myGroup->LineEdit1) myObject1.nullify();
|
||||
else if (myEditCurrentArgument == myGroup->LineEdit2) myObject2.nullify();
|
||||
}
|
||||
processPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
|
@ -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 <GeometryGUI.h>
|
||||
#include "GeometryGUI_Operations.h"
|
||||
@ -110,6 +109,10 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
|
||||
getGeometryGUI()->EmitSignalDeactivateDialog();
|
||||
DisplayOnly();
|
||||
break;
|
||||
case GEOMOp::OpShowOnlyChildren: // POPUP MENU - SHOW ONLY CHILDREN
|
||||
getGeometryGUI()->EmitSignalDeactivateDialog();
|
||||
DisplayOnlyChildren();
|
||||
break;
|
||||
case GEOMOp::OpHideAll: // MENU VIEW - HIDE ALL
|
||||
EraseAll();
|
||||
break;
|
||||
@ -217,6 +220,62 @@ void DisplayGUI::DisplayOnly()
|
||||
Display();
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
// function : DisplayGUI::DisplayOnlyChildren()
|
||||
// purpose : Display only children of selected GEOM objects and erase other
|
||||
//=====================================================================================
|
||||
void DisplayGUI::DisplayOnlyChildren()
|
||||
{
|
||||
EraseAll();
|
||||
|
||||
SALOME_ListIO listIO;
|
||||
|
||||
SalomeApp_Application* app = getGeometryGUI()->getApp();
|
||||
if (!app) return;
|
||||
|
||||
SalomeApp_Study* anActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
|
||||
if (!anActiveStudy) return;
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
|
||||
if (!aSelMgr) return;
|
||||
|
||||
// get selection
|
||||
SALOME_ListIO aList;
|
||||
//aSelMgr->selectedObjects(aList);
|
||||
aSelMgr->selectedObjects(aList, "ObjectBrowser", false);
|
||||
SALOME_ListIteratorOfListIO It (aList);
|
||||
|
||||
SUIT_OverrideCursor();
|
||||
|
||||
for (; It.More(); It.Next()) {
|
||||
Handle(SALOME_InteractiveObject) anIObject = It.Value();
|
||||
if (anIObject->hasEntry()) {
|
||||
_PTR(SObject) SO (anActiveStudy->studyDS()->FindObjectID(anIObject->getEntry()));
|
||||
if (SO) {
|
||||
_PTR(SComponent) SC (SO->GetFatherComponent());
|
||||
if (QString(SO->GetID().c_str()) == QString(SO->GetFatherComponent()->GetID().c_str())) {
|
||||
// if component is selected, pass it
|
||||
}
|
||||
else {
|
||||
_PTR(ChildIterator) anIter (anActiveStudy->studyDS()->NewChildIterator(SO));
|
||||
anIter->InitEx(true);
|
||||
while (anIter->More()) {
|
||||
_PTR(SObject) valSO (anIter->Value());
|
||||
_PTR(SObject) refSO;
|
||||
if (!valSO->ReferencedObject(refSO)) {
|
||||
listIO.Append(new SALOME_InteractiveObject(valSO->GetID().c_str(),
|
||||
SC->ComponentDataType().c_str(),
|
||||
valSO->GetName().c_str()));
|
||||
}
|
||||
anIter->Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
GEOM_Displayer(anActiveStudy).Display(listIO, true);
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
// function : DisplayGUI::Display()
|
||||
// purpose : Display selected GEOM objects
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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<XYZ> XYZList;
|
||||
|
||||
public:
|
||||
EntityGUI_3DSketcherDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, const double = 2. );
|
||||
EntityGUI_3DSketcherDlg (GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, const double = 2.);
|
||||
~EntityGUI_3DSketcherDlg();
|
||||
|
||||
protected:
|
||||
@ -85,7 +85,7 @@ private:
|
||||
void displayTrihedron( int );
|
||||
|
||||
void displayAngle( double, double, double, int, bool store = false );
|
||||
void displayLength( double theLength = -1.0, bool store = false );
|
||||
void displayLength( double theLength = -1.0, bool store = false, int type = 1);
|
||||
|
||||
bool createShapes( GEOM::GEOM_Object_ptr,
|
||||
TopoDS_Shape&,
|
||||
@ -132,6 +132,7 @@ private slots:
|
||||
bool ClickOnApply();
|
||||
// bool isSameAsPrevious();
|
||||
void UpdateButtonsState();
|
||||
void UpdatePointCoordinates();
|
||||
|
||||
void ClickOnUndo();
|
||||
void ClickOnRedo();
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>327</width>
|
||||
<height>50</height>
|
||||
<width>278</width>
|
||||
<height>181</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -19,9 +19,17 @@
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="GroupBox1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="CheckBox2">
|
||||
@ -30,13 +38,100 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="CheckBox1">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="CheckBox3">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Start:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_1">
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_1"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Y</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_2"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Z</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_3"/>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>End:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="lineEdit_4"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Y</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QLineEdit" name="lineEdit_5"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Z</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QLineEdit" name="lineEdit_6"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -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,7 +906,17 @@ 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 );
|
||||
}
|
||||
|
@ -674,12 +674,13 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
|
||||
// add function description before dump
|
||||
if (!aCurScript.IsEmpty())
|
||||
{
|
||||
if ( aFunction->GetDriverGUID() == GEOM_Object::GetSubShapeID() )
|
||||
if ( aFunction->GetDriverGUID() == GEOM_Object::GetSubShapeID() &&
|
||||
aFuncScript.Length() > aCurScript.Length() )
|
||||
// avoid repeated SubShape...() command at the end
|
||||
if (aFuncScript.Location( aCurScript,
|
||||
aFuncScript.Length() - aCurScript.Length(),
|
||||
aFuncScript.Length()))
|
||||
continue;
|
||||
continue; // aCurScript is already at the end of aFuncScript
|
||||
aFuncScript += aCurScript;
|
||||
}
|
||||
if (isDumpCollected ) {
|
||||
@ -960,7 +961,7 @@ std::list<int> GEOM_Engine::getAllTextures(int theDocID)
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* ProcessFunction: Dump fucntion description into script
|
||||
* ProcessFunction: Dump function description into script
|
||||
*/
|
||||
//=============================================================================
|
||||
bool ProcessFunction(Handle(GEOM_Function)& theFunction,
|
||||
@ -1022,6 +1023,16 @@ bool ProcessFunction(Handle(GEOM_Function)& theFunction,
|
||||
//Check if its internal function which doesn't requires dumping
|
||||
if(aDescr == "None") return false;
|
||||
|
||||
//Check the very specific case of RestoreShape function,
|
||||
//which is not dumped, but the result can be published by the user.
|
||||
//We do not publish such objects to decrease danger of dumped script failure.
|
||||
if(aDescr.Value(1) == '#') {
|
||||
TCollection_AsciiString anObjEntry;
|
||||
TDF_Tool::Entry(theFunction->GetOwnerEntry(), anObjEntry);
|
||||
theIgnoreObjs.insert(anObjEntry);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 0020001 PTv, check for critical functions, which require dump of objects
|
||||
if (theIsPublished)
|
||||
{
|
||||
@ -1035,6 +1046,95 @@ bool ProcessFunction(Handle(GEOM_Function)& theFunction,
|
||||
|
||||
//Replace parameter by notebook variables
|
||||
ReplaceVariables(aDescr,theVariables);
|
||||
|
||||
//Process sketcher functions, replacing string command by calls to Sketcher interface
|
||||
if (aDescr.Search( "Make3DSketcher" ) != -1) {
|
||||
TCollection_AsciiString aNewDescr;
|
||||
int i = 1;
|
||||
TCollection_AsciiString aSubStr = aDescr.Token("\n\t", i);
|
||||
for (; !aSubStr.IsEmpty(); aSubStr = aDescr.Token("\n\t", i)) {
|
||||
if (aSubStr.Search( "Make3DSketcherCommand" ) != -1) {
|
||||
TCollection_AsciiString aResult = aSubStr.Token(" ", 1);
|
||||
// "3DSketcher:CMD[:CMD[:CMD...]]"
|
||||
TCollection_AsciiString aCommand = aSubStr.Token("\"", 2);
|
||||
|
||||
// Split the command string to separate CMDs
|
||||
int icmd = 2;
|
||||
TColStd_SequenceOfAsciiString aSequence;
|
||||
if (aCommand.Length()) {
|
||||
TCollection_AsciiString aToken = aCommand.Token(":", icmd);
|
||||
while (aToken.Length() > 0) {
|
||||
aSequence.Append(aToken);
|
||||
aToken = aCommand.Token(":", ++icmd);
|
||||
}
|
||||
}
|
||||
|
||||
if (aSequence.Length() > 0) {
|
||||
if (i > 1)
|
||||
aNewDescr += "\n\t";
|
||||
|
||||
aNewDescr += "sk = geompy.Sketcher3D()";
|
||||
int nbCMDs = aSequence.Length();
|
||||
for (icmd = 1; icmd <= nbCMDs; icmd++) {
|
||||
aNewDescr += "\n\t";
|
||||
|
||||
TCollection_AsciiString aCMD = aSequence.Value(icmd);
|
||||
|
||||
// Split the CMD into string values
|
||||
TColStd_SequenceOfAsciiString aStrVals;
|
||||
int ival = 1;
|
||||
TCollection_AsciiString aToken = aCMD.Token(" ", ival);
|
||||
while (aToken.Length() > 0) {
|
||||
aStrVals.Append(aToken);
|
||||
aToken = aCMD.Token(" ", ++ival);
|
||||
}
|
||||
|
||||
TCollection_AsciiString aCMDpref = aStrVals.Value(1);
|
||||
if (aCMDpref == "TT") {
|
||||
aNewDescr += "sk.addPointsAbsolute(";
|
||||
aNewDescr += aStrVals.Value(2) + ", " + aStrVals.Value(3) + ", " + aStrVals.Value(4) + ")";
|
||||
}
|
||||
else if (aCMDpref == "T") {
|
||||
aNewDescr += "sk.addPointsRelative(";
|
||||
aNewDescr += aStrVals.Value(2) + ", " + aStrVals.Value(3) + ", " + aStrVals.Value(4) + ")";
|
||||
}
|
||||
else if (aCMDpref == "WW") {
|
||||
aNewDescr += "sk.close()";
|
||||
}
|
||||
else {
|
||||
aNewDescr += "sk.addPointAnglesLength(\"";
|
||||
aNewDescr += aCMDpref + "\", " +
|
||||
aStrVals.Value(2) + ", " + aStrVals.Value(3) + ", " + aStrVals.Value(4) + ")";
|
||||
}
|
||||
}
|
||||
aNewDescr += "\n\t";
|
||||
aNewDescr += aResult + " = sk.wire()";
|
||||
}
|
||||
} // Make3DSketcherCommand
|
||||
else if (aSubStr.Search( "Make3DSketcher" ) != -1) {
|
||||
TCollection_AsciiString aResult = aSubStr.Token(" ", 1);
|
||||
TCollection_AsciiString aCommand = aSubStr.Token("[", 2);
|
||||
aCommand = aCommand.Token("]", 1);
|
||||
if (i > 1)
|
||||
aNewDescr += "\n\t";
|
||||
aNewDescr += "sk = geompy.Sketcher3D()";
|
||||
aNewDescr += "\n\t";
|
||||
aNewDescr += "sk.addPointsAbsolute(";
|
||||
aNewDescr += aCommand + ")";
|
||||
aNewDescr += "\n\t";
|
||||
aNewDescr += aResult + " = sk.wire()";
|
||||
}
|
||||
else {
|
||||
if (i > 1)
|
||||
aNewDescr += "\n\t";
|
||||
aNewDescr += aSubStr;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
aDescr = aNewDescr;
|
||||
}
|
||||
|
||||
if ( theIsDumpCollected ) {
|
||||
int i = 1;
|
||||
bool isBefore = true;
|
||||
|
@ -570,10 +570,12 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS)
|
||||
aPc.SetXYZ(aXYZc);
|
||||
aInfo.SetLocation(aPc);
|
||||
//
|
||||
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
|
||||
else if (aCT==GeomAbs_Line) {
|
||||
|
@ -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<SalomeApp_Study*>( study() );
|
||||
|
||||
if ( appStudy ) {
|
||||
QString anEntry = entry( index );
|
||||
_PTR(Study) study = appStudy->studyDS();
|
||||
if ( study && !anEntry.isEmpty() ) {
|
||||
_PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
|
||||
ok = hasChildren( aSO );
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool GEOMGUI_Selection::hasConcealedChildren( const int index ) const
|
||||
{
|
||||
bool OK = false;
|
||||
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
|
||||
@ -462,7 +479,7 @@ bool GEOMGUI_Selection::hasHiddenChildren( const int index ) const
|
||||
return OK;
|
||||
}
|
||||
|
||||
bool GEOMGUI_Selection::hasShownChildren( const int index ) const
|
||||
bool GEOMGUI_Selection::hasDisclosedChildren( const int index ) const
|
||||
{
|
||||
bool OK = false;
|
||||
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
|
||||
|
@ -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;
|
||||
|
@ -114,6 +114,13 @@
|
||||
#include <Graphic3d_HArray1OfBytes.hxx>
|
||||
#endif
|
||||
|
||||
// If the next macro is defined, autocolor feature works for all sub-shapes;
|
||||
// if it is undefined, autocolor feature works for groups only
|
||||
//#define GENERAL_AUTOCOLOR
|
||||
// Below macro, when uncommented, switches on simplified (more performant) algorithm
|
||||
// of auto-color picking up
|
||||
//#define SIMPLE_AUTOCOLOR
|
||||
|
||||
//================================================================
|
||||
// Function : getActiveStudy
|
||||
// Purpose : Get active study, returns 0 if no open study frame
|
||||
@ -1823,6 +1830,40 @@ int GEOM_Displayer::UnsetDisplayMode()
|
||||
return aPrevMode;
|
||||
}
|
||||
|
||||
SALOMEDS::Color GEOM_Displayer::getPredefinedUniqueColor()
|
||||
{
|
||||
static QList<QColor> colors;
|
||||
|
||||
if ( colors.isEmpty() ) {
|
||||
const int rfactor = 4; // red color component split factor, must be > 0
|
||||
const int gfactor = 4; // green color component split factor, must be > 0
|
||||
const int bfactor = 3; // blue color component split factor, must be > 0
|
||||
// -
|
||||
// total number of pre-defined colors is defined as
|
||||
// nbcolors = rfactor * gfactor * bfactor
|
||||
// NB: all three factors should not have same values
|
||||
// otherwise all colors will be greyish
|
||||
|
||||
for ( int g = 0; g < gfactor; g++ ) {
|
||||
for ( int r = 0; r < rfactor; r++ ) {
|
||||
for ( int b = 0; b < bfactor; b++ )
|
||||
colors.append( QColor( qRgb( r * 255 / (rfactor-1), g * 255 / (gfactor-1), b * 255 / (bfactor-1) ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int currentColor = 0;
|
||||
|
||||
SALOMEDS::Color color;
|
||||
color.R = (double)colors[currentColor].red() / 255.0;
|
||||
color.G = (double)colors[currentColor].green() / 255.0;
|
||||
color.B = (double)colors[currentColor].blue() / 255.0;
|
||||
|
||||
currentColor = (currentColor+1) % colors.count();
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
SALOMEDS::Color GEOM_Displayer::getUniqueColor( const QList<SALOMEDS::Color>& theReservedColors )
|
||||
{
|
||||
int aHue = -1;
|
||||
@ -2003,47 +2044,49 @@ SALOMEDS::Color GEOM_Displayer::getColor(GEOM::GEOM_Object_var theGeomObject, bo
|
||||
hasColor = false;
|
||||
|
||||
SUIT_Session* session = SUIT_Session::session();
|
||||
SUIT_Application* app = session->activeApplication();
|
||||
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
|
||||
|
||||
if ( app && !theGeomObject->_is_nil()) {
|
||||
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
|
||||
|
||||
if ( study ) {
|
||||
_PTR(Study) aStudy = study->studyDS();
|
||||
aSColor = theGeomObject->GetColor();
|
||||
hasColor = aSColor.R >= 0 && aSColor.G >= 0 && aSColor.B >= 0;
|
||||
if( !hasColor && theGeomObject->GetType() == GEOM_GROUP ) { // auto color for group
|
||||
GEOM::GEOM_Gen_var theGeomGen = GeometryGUI::GetGeomGen();
|
||||
GEOM::GEOM_IGroupOperations_var anOperations = theGeomGen->GetIGroupOperations( study->id() );
|
||||
GEOM::GEOM_Object_var aMainObject = anOperations->GetMainShape( theGeomObject );
|
||||
if ( !aMainObject->_is_nil() && aMainObject->GetAutoColor() )
|
||||
{
|
||||
if ( !hasColor ) {
|
||||
#ifdef GENERAL_AUTOCOLOR // auto-color for all sub-shapes
|
||||
bool general_autocolor = true;
|
||||
#else // auto-color for groups only
|
||||
bool general_autocolor = false;
|
||||
#endif // GENERAL_AUTOCOLOR
|
||||
if ( general_autocolor || theGeomObject->GetType() == GEOM_GROUP ) {
|
||||
GEOM::GEOM_Object_var aMainObject = theGeomObject->GetMainShape();
|
||||
if ( !CORBA::is_nil( aMainObject ) && aMainObject->GetAutoColor() ) {
|
||||
#ifdef SIMPLE_AUTOCOLOR // simplified algorithm for auto-colors
|
||||
aSColor = getPredefinedUniqueColor();
|
||||
hasColor = true;
|
||||
#else // old algorithm for auto-colors
|
||||
QList<SALOMEDS::Color> aReservedColors;
|
||||
|
||||
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( app );
|
||||
CORBA::String_var IOR = app->orb()->object_to_string( aMainObject );
|
||||
if ( strcmp(IOR.in(), "") != 0 )
|
||||
{
|
||||
_PTR(Study) aStudy = study->studyDS();
|
||||
_PTR(SObject) aMainSObject( aStudy->FindObjectIOR( std::string(IOR) ) );
|
||||
_PTR(SObject) aMainSObject( aStudy->FindObjectIOR( IOR.in() ) );
|
||||
if ( aMainSObject ) {
|
||||
_PTR(ChildIterator) it( aStudy->NewChildIterator( aMainSObject ) );
|
||||
for( ; it->More(); it->Next() )
|
||||
{
|
||||
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 )
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -169,6 +169,7 @@ public:
|
||||
SalomeApp_Study* getStudy() const;
|
||||
|
||||
static SALOMEDS::Color getUniqueColor( const QList<SALOMEDS::Color>& );
|
||||
static SALOMEDS::Color getPredefinedUniqueColor();
|
||||
|
||||
static PropMap getDefaultPropertyMap(const QString& viewer_type);
|
||||
|
||||
|
@ -167,6 +167,10 @@
|
||||
<source>ICON_DLG_CHECK_COMPOUND_OF_BLOCKS</source>
|
||||
<translation>check_blocks_compound.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_GETNONBLOCKS</source>
|
||||
<translation>get_non_blocks.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_CHECK_SELF_INTERSECTIONS</source>
|
||||
<translation>check_self_intersections.png</translation>
|
||||
@ -739,6 +743,10 @@
|
||||
<source>ICO_CHECK_COMPOUND</source>
|
||||
<translation>check_blocks_compound.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICO_GET_NON_BLOCKS</source>
|
||||
<translation>get_non_blocks.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICO_CHECK_SELF_INTERSECTIONS</source>
|
||||
<translation>check_self_intersections.png</translation>
|
||||
@ -763,6 +771,10 @@
|
||||
<source>ICO_COMMON</source>
|
||||
<translation>common.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICO_GROUP_INTERSECT</source>
|
||||
<translation>common.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICO_COMPOUND</source>
|
||||
<translation>build_compound.png</translation>
|
||||
@ -783,6 +795,10 @@
|
||||
<source>ICO_CUT</source>
|
||||
<translation>cut.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICO_GROUP_CUT</source>
|
||||
<translation>cut.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICO_CYLINDER</source>
|
||||
<translation>cylinder.png</translation>
|
||||
@ -887,6 +903,10 @@
|
||||
<source>ICO_FUSE</source>
|
||||
<translation>fuse.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICO_GROUP_UNION</source>
|
||||
<translation>fuse.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICO_GLUE_FACES</source>
|
||||
<translation>glue.png</translation>
|
||||
|
@ -7,6 +7,10 @@
|
||||
<source>BRep_API: command not done</source>
|
||||
<translation>Error: can't build object</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PAL_NOT_DONE_ERROR</source>
|
||||
<translation>Operation aborted</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CHANGE_ORIENTATION_NEW_OBJ_NAME</source>
|
||||
<translation>Invert</translation>
|
||||
@ -357,6 +361,18 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>GEOM_CHECK_BLOCKS_COMPOUND_SUBSHAPES</source>
|
||||
<translation>Incriminated Sub-shapes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_GETNONBLOCKS_TITLE</source>
|
||||
<translation>Get non-hexahedral solids and non-quadrangular faces</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_GETNONBLOCKS</source>
|
||||
<translation>Get non blocks</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_NONBLOCKS</source>
|
||||
<translation>NonBlocksGroup</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_CHECK_INFOS</source>
|
||||
<translation>Object And Its Topological Information</translation>
|
||||
@ -1830,6 +1846,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>GEOM_COORDINATES_TYPE</source>
|
||||
<translation>Coordinates Type</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_CONTROLS</source>
|
||||
<translation>Dimensions</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_SOLID</source>
|
||||
<translation>Solid</translation>
|
||||
@ -2310,6 +2330,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>MEN_CHECK_COMPOUND</source>
|
||||
<translation>Check Compound of Blocks</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_GET_NON_BLOCKS</source>
|
||||
<translation>Get Non Blocks</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_CHECK_SELF_INTERSECTIONS</source>
|
||||
<translation>Detect Self-intersections</translation>
|
||||
@ -2422,6 +2446,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>MEN_DISPLAY_ONLY</source>
|
||||
<translation>Show Only</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_SHOW_ONLY_CHILDREN</source>
|
||||
<translation>Show Only Children</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_BRING_TO_FRONT</source>
|
||||
<translation>Bring To Front</translation>
|
||||
@ -2550,6 +2578,18 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>MEN_GROUP_EDIT</source>
|
||||
<translation>Edit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_GROUP_UNION</source>
|
||||
<translation>Union Groups</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_GROUP_INTERSECT</source>
|
||||
<translation>Intersect Groups</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_GROUP_CUT</source>
|
||||
<translation>Cut Groups</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_RELOAD_IMPORTED</source>
|
||||
<translation>Reload From Disk</translation>
|
||||
@ -2667,12 +2707,12 @@ Please, select face, shell or solid and try again</translation>
|
||||
<translation>Create Group</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_POP_SHOW_CHILDREN</source>
|
||||
<translation>Show Children</translation>
|
||||
<source>MEN_POP_DISCLOSE_CHILDREN</source>
|
||||
<translation>Disclose child items</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_POP_HIDE_CHILDREN</source>
|
||||
<translation>Hide Children</translation>
|
||||
<source>MEN_POP_CONCEAL_CHILDREN</source>
|
||||
<translation>Conceal child items</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_POP_UNPUBLISH_OBJ</source>
|
||||
@ -3154,6 +3194,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>STB_CHECK_COMPOUND</source>
|
||||
<translation>Check compound of blocks</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_GET_NON_BLOCKS</source>
|
||||
<translation>Get non blocks</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_CHECK_SELF_INTERSECTIONS</source>
|
||||
<translation>Detect Self-intersections</translation>
|
||||
@ -3234,6 +3278,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>STB_DISPLAY_ONLY</source>
|
||||
<translation>Show only</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_SHOW_ONLY_CHILDREN</source>
|
||||
<translation>Show Only Children</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_EDGE</source>
|
||||
<translation>Build an edge</translation>
|
||||
@ -3322,6 +3370,18 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>STB_GROUP_EDIT</source>
|
||||
<translation>Edit a group</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_GROUP_UNION</source>
|
||||
<translation>Union Groups</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_GROUP_INTERSECT</source>
|
||||
<translation>Intersect Groups</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_GROUP_CUT</source>
|
||||
<translation>Cut Groups</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_RELOAD_IMPORTED</source>
|
||||
<translation>Reload imported shape from its original place on disk</translation>
|
||||
@ -3426,10 +3486,6 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>STB_POP_CREATE_GROUP</source>
|
||||
<translation>Create Group</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_POP_SHOW_CHILDREN</source>
|
||||
<translation>Show child objects</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_POP_UNPUBLISH_OBJ</source>
|
||||
<translation>Unpublish object</translation>
|
||||
@ -3439,8 +3495,12 @@ Please, select face, shell or solid and try again</translation>
|
||||
<translation>Publish object</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_POP_HIDE_CHILDREN</source>
|
||||
<translation>Hide child objects</translation>
|
||||
<source>STB_POP_DISCLOSE_CHILDREN</source>
|
||||
<translation>Disclose child items</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_POP_CONCEAL_CHILDREN</source>
|
||||
<translation>Conceal child items</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_POP_ISOS</source>
|
||||
@ -3762,6 +3822,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>TOP_CHECK_COMPOUND</source>
|
||||
<translation>Check compound of blocks</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_GET_NON_BLOCKS</source>
|
||||
<translation>Get non blocks</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_CHECK_SELF_INTERSECTIONS</source>
|
||||
<translation>Detect Self-intersections</translation>
|
||||
@ -3838,6 +3902,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>TOP_DISPLAY_ONLY</source>
|
||||
<translation>Show only</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_SHOW_ONLY_CHILDREN</source>
|
||||
<translation>Show Only Children</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_EDGE</source>
|
||||
<translation>Build edge</translation>
|
||||
@ -3918,6 +3986,18 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>TOP_GROUP_EDIT</source>
|
||||
<translation>Edit a group</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_GROUP_UNION</source>
|
||||
<translation>Union Groups</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_GROUP_INTERSECT</source>
|
||||
<translation>Intersect Groups</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_GROUP_CUT</source>
|
||||
<translation>Cut Groups</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_HEX_SOLID</source>
|
||||
<translation>Hexahedral Solid</translation>
|
||||
@ -4026,10 +4106,6 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>TOP_POP_CREATE_GROUP</source>
|
||||
<translation>Create Group</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_SHOW_CHILDREN</source>
|
||||
<translation>Show Children</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_UNPUBLISH_OBJ</source>
|
||||
<translation>Unpublish object</translation>
|
||||
@ -4039,8 +4115,12 @@ Please, select face, shell or solid and try again</translation>
|
||||
<translation>Publish object</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_HIDE_CHILDREN</source>
|
||||
<translation>Hide Children</translation>
|
||||
<source>TOP_POP_DISCLOSE_CHILDREN</source>
|
||||
<translation>Disclose child items</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_CONCEAL_CHILDREN</source>
|
||||
<translation>Conceal child items</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_ISOS</source>
|
||||
@ -5037,6 +5117,45 @@ Number of sketch points too small</translation>
|
||||
<translation>Please, select a group to edit</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GroupGUI_BooleanDlg</name>
|
||||
<message>
|
||||
<source>GEOM_UNION</source>
|
||||
<translation>Union</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_UNION_TITLE</source>
|
||||
<translation>Union Groups</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_INTERSECT</source>
|
||||
<translation>Intersect</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_INTERSECT_TITLE</source>
|
||||
<translation>Intersect Groups</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_CUT</source>
|
||||
<translation>Cut</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_CUT_TITLE</source>
|
||||
<translation>Cut Groups</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_GROUPS</source>
|
||||
<translation>Groups</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_MAIN_GROUPS</source>
|
||||
<translation>Main Groups</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_TOOL_GROUPS</source>
|
||||
<translation>Tool Groups</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GroupGUI_GroupDlg</name>
|
||||
<message>
|
||||
|
@ -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" );
|
||||
@ -949,6 +960,9 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
int groupId = createMenu( tr( "MEN_GROUP" ), newEntId, -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,6 +1211,7 @@ 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" ) );
|
||||
@ -1229,11 +1245,11 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
mgr->setRule( action( GEOMOp::OpDelete ), QString("$type in {'Shape' 'Group'} and selcount>0"), QtxPopupMgr::VisibleRule );
|
||||
mgr->insert( action( GEOMOp::OpGroupCreatePopup ), -1, -1 ); // create group
|
||||
mgr->setRule( action( GEOMOp::OpGroupCreatePopup ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule );
|
||||
mgr->insert( action( GEOMOp::OpShowChildren ), -1, -1 ); // show children
|
||||
mgr->setRule( action( GEOMOp::OpShowChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasHiddenChildren=true"), QtxPopupMgr::VisibleRule );
|
||||
mgr->insert( action( GEOMOp::OpDiscloseChildren ), -1, -1 ); // disclose child items
|
||||
mgr->setRule( action( GEOMOp::OpDiscloseChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasConcealedChildren=true"), QtxPopupMgr::VisibleRule );
|
||||
|
||||
mgr->insert( action( GEOMOp::OpHideChildren ), -1, -1 ); // hide children
|
||||
mgr->setRule( action( GEOMOp::OpHideChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasShownChildren=true"), QtxPopupMgr::VisibleRule );
|
||||
mgr->insert( action( GEOMOp::OpConcealChildren ), -1, -1 ); // conceal shild items
|
||||
mgr->setRule( action( GEOMOp::OpConcealChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasDisclosedChildren=true"), QtxPopupMgr::VisibleRule );
|
||||
mgr->insert( action( GEOMOp::OpGroupEdit ), -1, -1 ); // edit group
|
||||
mgr->setRule( action( GEOMOp::OpGroupEdit ), QString("client='ObjectBrowser' and type='Group' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule );
|
||||
mgr->insert( separator(), -1, -1 ); // -----------
|
||||
@ -1340,6 +1356,8 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
mgr->setRule(action(GEOMOp::OpSelectAll), selectOnly + " and selectionmode='ALL'", QtxPopupMgr::ToggleRule);
|
||||
mgr->insert( action(GEOMOp::OpShowOnly ), -1, -1 ); // display only
|
||||
mgr->setRule(action(GEOMOp::OpShowOnly ), rule.arg( types ).arg( "true" ), QtxPopupMgr::VisibleRule );
|
||||
mgr->insert( action(GEOMOp::OpShowOnlyChildren ), -1, -1 ); // display only children
|
||||
mgr->setRule(action(GEOMOp::OpShowOnlyChildren ), (canDisplay + "and ($type in {%1}) and client='ObjectBrowser' and hasChildren=true").arg( types ), QtxPopupMgr::VisibleRule );
|
||||
|
||||
mgr->insert( separator(), -1, -1 ); // -----------
|
||||
mgr->insert( action( GEOMOp::OpUnpublishObject ), -1, -1 ); // Unpublish object
|
||||
@ -1663,41 +1681,19 @@ LightApp_Selection* GeometryGUI::createSelection() const
|
||||
void GeometryGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& title )
|
||||
{
|
||||
SalomeApp_Module::contextMenuPopup( client, menu, title );
|
||||
|
||||
/*
|
||||
SALOME_ListIO lst;
|
||||
getApp()->selectionMgr()->selectedObjects(lst);
|
||||
if (lst.Extent() < 1)
|
||||
return;
|
||||
|
||||
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
|
||||
getApp()->selectionMgr()->selectedObjects( lst );
|
||||
if ( ( client == "OCCViewer" || client == "VTKViewer" ) && lst.Extent() == 1 ) {
|
||||
Handle(SALOME_InteractiveObject) io = lst.First();
|
||||
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
|
||||
_PTR(Study) study = appStudy->studyDS();
|
||||
|
||||
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;
|
||||
_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()
|
||||
|
@ -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,20 +171,24 @@ 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
|
||||
//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 @@//
|
||||
|
@ -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();
|
||||
};
|
@ -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
|
||||
|
@ -15,7 +15,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
@ -26,9 +25,13 @@
|
||||
|
||||
#include <GEOMImpl_IMeasureOperations.hxx>
|
||||
|
||||
#include <Basics_Utils.hxx>
|
||||
|
||||
// OCCT Includes
|
||||
#include <BRepBuilderAPI_MakePolygon.hxx>
|
||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
@ -68,6 +71,7 @@ Standard_Integer GEOMImpl_3DSketcherDriver::Execute(TFunction_Logbook& log) cons
|
||||
|
||||
TopoDS_Shape aShape;
|
||||
|
||||
if (aFunction->GetType() == SKETCHER3D_COORDS) {
|
||||
Handle(TColStd_HArray1OfReal) aCoordsArray = aCI.GetCoordinates();
|
||||
int anArrayLength = aCoordsArray->Length();
|
||||
|
||||
@ -99,6 +103,198 @@ Standard_Integer GEOMImpl_3DSketcherDriver::Execute(TFunction_Logbook& log) cons
|
||||
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;
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
|
@ -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 <TColStd_HArray1OfReal.hxx>
|
||||
|
||||
#define SKETCH_ARG_COORDS 1
|
||||
|
||||
class GEOMImpl_I3DSketcher
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
GEOMImpl_I3DSketcher(Handle(GEOM_Function) theFunction): _func(theFunction) {}
|
||||
GEOMImpl_I3DSketcher (Handle(GEOM_Function) theFunction): _func(theFunction) {}
|
||||
|
||||
void SetCoordinates(const Handle(TColStd_HArray1OfReal)& theValue)
|
||||
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;
|
||||
};
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
@ -212,6 +211,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
|
||||
case PointOn_CurveByCoord: fType = POINT_CURVE_COORD; break;
|
||||
case PointOn_SurfaceByParam: fType = POINT_SURFACE_PAR; break;
|
||||
case PointOn_SurfaceByCoord: fType = POINT_SURFACE_COORD; break;
|
||||
case PointOn_Face: fType = POINT_FACE_ANY; break;
|
||||
default: break;
|
||||
}
|
||||
Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), fType);
|
||||
@ -254,6 +254,10 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
|
||||
aPI.SetX(theParam1);
|
||||
aPI.SetY(theParam2);
|
||||
aPI.SetZ(theParam3);
|
||||
break;
|
||||
case PointOn_Face:
|
||||
aPI.SetSurface(aRefFunction);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
@ -298,6 +302,11 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
|
||||
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);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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_
|
||||
@ -134,6 +133,9 @@ class GEOMImpl_IBlocksOperations : public GEOM_IOperations {
|
||||
Standard_EXPORT TCollection_AsciiString PrintBCErrors (Handle(GEOM_Object) theCompound,
|
||||
const std::list<BCError>& theErrors);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) GetNonBlocks (Handle(GEOM_Object) theShape,
|
||||
Handle(GEOM_Object)& theNonQuads);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) RemoveExtraEdges (Handle(GEOM_Object) theShape,
|
||||
const Standard_Integer theOptimumNbFaces = 6);
|
||||
|
||||
@ -142,7 +144,8 @@ class GEOMImpl_IBlocksOperations : public GEOM_IOperations {
|
||||
Standard_EXPORT static void AddBlocksFrom (const TopoDS_Shape& theShape,
|
||||
TopTools_ListOfShape& BLO,
|
||||
TopTools_ListOfShape& NOT,
|
||||
TopTools_ListOfShape& EXT);
|
||||
TopTools_ListOfShape& EXT,
|
||||
TopTools_ListOfShape& NOQ);
|
||||
|
||||
// Extract blocks from blocks compounds
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) ExplodeCompoundOfBlocks
|
||||
|
@ -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<double> theCoordinates)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
//Add a new Sketcher object
|
||||
Handle(GEOM_Object) a3DSketcher = GetEngine()->AddObject(GetDocID(), GEOM_3DSKETCHER);
|
||||
|
||||
//Add a new Sketcher function
|
||||
Handle(GEOM_Function) aFunction =
|
||||
a3DSketcher->AddFunction(GEOMImpl_3DSketcherDriver::GetID(), 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<double>::iterator it = theCoordinates.begin();
|
||||
for (; it != theCoordinates.end(); it++)
|
||||
nbOfCoords++;
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aCoordsArray = new TColStd_HArray1OfReal (1, nbOfCoords);
|
||||
|
||||
it = theCoordinates.begin();
|
||||
int ind = 1;
|
||||
for (; it != theCoordinates.end(); it++, ind++)
|
||||
aCoordsArray->SetValue(ind, *it);
|
||||
|
||||
aCI.SetCoordinates(aCoordsArray);
|
||||
|
||||
//Compute the Sketcher value
|
||||
try {
|
||||
#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<double> theCoordinates)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
//Add a new Sketcher object
|
||||
Handle(GEOM_Object) a3DSketcher = GetEngine()->AddObject(GetDocID(), GEOM_3DSKETCHER);
|
||||
|
||||
//Add a new Sketcher function
|
||||
Handle(GEOM_Function) aFunction =
|
||||
a3DSketcher->AddFunction(GEOMImpl_3DSketcherDriver::GetID(), SKETCHER3D_COORDS);
|
||||
if (aFunction.IsNull()) return NULL;
|
||||
|
||||
//Check if the function is set correctly
|
||||
if (aFunction->GetDriverGUID() != GEOMImpl_3DSketcherDriver::GetID()) return NULL;
|
||||
|
||||
GEOMImpl_I3DSketcher aCI (aFunction);
|
||||
|
||||
int nbOfCoords = 0;
|
||||
std::list<double>::iterator it = theCoordinates.begin();
|
||||
for (; it != theCoordinates.end(); it++)
|
||||
nbOfCoords++;
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aCoordsArray = new TColStd_HArray1OfReal (1, nbOfCoords);
|
||||
|
||||
it = theCoordinates.begin();
|
||||
int ind = 1;
|
||||
for (; it != theCoordinates.end(); it++, ind++)
|
||||
aCoordsArray->SetValue(ind, *it);
|
||||
|
||||
aCI.SetCoordinates(aCoordsArray);
|
||||
|
||||
//Compute the Sketcher value
|
||||
try {
|
||||
#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;
|
||||
}
|
||||
|
@ -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,
|
||||
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);
|
||||
CurveType theCurveType, int theParamNbStep=0, bool theNewMethod=false);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeSketcher (const char* theCommand,
|
||||
std::list<double> theWorkingPlane);
|
||||
Standard_EXPORT Handle(GEOM_Object) Make3DSketcher (std::list<double> theCoordinates);
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeSketcherOnPlane (const char* theCommand,
|
||||
Handle(GEOM_Object) theWorkingPlane);
|
||||
Standard_EXPORT Handle(GEOM_Object) Make3DSketcherCommand (const char* theCommand);
|
||||
Standard_EXPORT Handle(GEOM_Object) Make3DSketcher (std::list<double> theCoordinates);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
@ -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
|
||||
|
@ -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_
|
||||
@ -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);
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
@ -47,7 +46,9 @@
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
|
||||
@ -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 = "<<theFormatName.ToCString()<<endl;
|
||||
|
||||
//Perform the Import
|
||||
try {
|
||||
@ -257,7 +253,8 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::Import
|
||||
|
||||
SetErrorCode(OK);
|
||||
|
||||
if( theFormatName == "IGES_UNIT" ) {
|
||||
// OLD CODE: begin
|
||||
if (theFormatName == "IGES_UNIT") {
|
||||
TopoDS_Shape S = aFunction->GetValue();
|
||||
TopoDS_Vertex V = TopoDS::Vertex(S);
|
||||
gp_Pnt P = BRep_Tool::Pnt(V);
|
||||
@ -270,10 +267,42 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::Import
|
||||
//cout<<"IIO: aUnitName = "<<aUnitName.ToCString()<<endl;
|
||||
SetErrorCode(aUnitName);
|
||||
}
|
||||
// OLD CODE: end
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* ReadValue
|
||||
*/
|
||||
//=============================================================================
|
||||
TCollection_AsciiString GEOMImpl_IInsertOperations::ReadValue
|
||||
(const TCollection_AsciiString& theFileName,
|
||||
const TCollection_AsciiString& theFormatName,
|
||||
const TCollection_AsciiString& theParameterName)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
TCollection_AsciiString aValue, anError;
|
||||
|
||||
if (theFileName.IsEmpty() || theFormatName.IsEmpty() || theParameterName.IsEmpty()) return aValue;
|
||||
|
||||
Handle(TCollection_HAsciiString) aHLibName;
|
||||
if (!IsSupported(Standard_True, theFormatName.SubString(1,4), aHLibName)) {
|
||||
return aValue;
|
||||
}
|
||||
TCollection_AsciiString aLibName = aHLibName->String();
|
||||
|
||||
aValue = GEOMImpl_ImportDriver::ReadValue(theFileName, aLibName, theParameterName, anError);
|
||||
if (anError.IsEmpty())
|
||||
SetErrorCode(OK);
|
||||
else
|
||||
SetErrorCode(anError.ToCString());
|
||||
|
||||
return aValue;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* ImportTranslators
|
||||
@ -554,6 +583,48 @@ Standard_Boolean GEOMImpl_IInsertOperations::InitResMgr()
|
||||
myResMgrUser->Find("Import") || myResMgrUser->Find("Export"));
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* RestoreShape
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_IInsertOperations::RestoreShape (std::istringstream& theStream)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
//Add a new result object
|
||||
Handle(GEOM_Object) result = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
|
||||
|
||||
//Add a Copy function
|
||||
Handle(GEOM_Function) aFunction = result->AddFunction(GEOMImpl_CopyDriver::GetID(), COPY_WITHOUT_REF);
|
||||
if (aFunction.IsNull()) return NULL;
|
||||
|
||||
//Check if the function is set correctly
|
||||
if (aFunction->GetDriverGUID() != GEOMImpl_CopyDriver::GetID()) return NULL;
|
||||
|
||||
//Read a shape from the stream
|
||||
TopoDS_Shape aShape;
|
||||
BRep_Builder B;
|
||||
BRepTools::Read(aShape, theStream, B);
|
||||
if (aShape.IsNull()) {
|
||||
SetErrorCode("RestoreShape error: BREP reading failed");
|
||||
}
|
||||
|
||||
//Set function value
|
||||
aFunction->SetValue(aShape);
|
||||
|
||||
//Special dump to avoid restored shapes publication.
|
||||
//See correcponding code in GEOM_Engine.cxx (method ProcessFunction)
|
||||
//GEOM::TPythonDump(aFunction) << "#";
|
||||
|
||||
GEOM::TPythonDump(aFunction) << result
|
||||
<< " = geompy.RestoreShape(\"\") # the shape string has not been dump for performance reason";
|
||||
|
||||
SetErrorCode(OK);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int GEOMImpl_IInsertOperations::LoadTexture(const TCollection_AsciiString& theTextureFile)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
@ -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,
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
@ -40,10 +39,8 @@
|
||||
#include <NMTDS_Tools.hxx>
|
||||
#include <NMTDS_InterfPool.hxx>
|
||||
#include <NMTDS_PInterfPool.hxx>
|
||||
//#include <NMTDS_PassKeyBoolean.hxx>
|
||||
#include <NMTDS_PairBoolean.hxx>
|
||||
#include <NMTDS_ShapesDataStructure.hxx>
|
||||
//#include <NMTDS_ListIteratorOfListOfPassKeyBoolean.hxx>
|
||||
#include <NMTDS_ListIteratorOfListOfPairBoolean.hxx>
|
||||
|
||||
#include <Basics_OCCTVersion.hxx>
|
||||
@ -58,22 +55,23 @@
|
||||
#include <TFunction_Logbook.hxx>
|
||||
#include <TDF_Tool.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_TFace.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <BRepBuilderAPI_Copy.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <BRepCheck.hxx>
|
||||
#include <BRepCheck_ListIteratorOfListOfStatus.hxx>
|
||||
#include <BRepCheck_Result.hxx>
|
||||
#include <BRepCheck_Shell.hxx>
|
||||
#include <BRepClass3d_SolidClassifier.hxx>
|
||||
#include <BRepExtrema_DistShapeShape.hxx>
|
||||
#include <BRepGProp.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
|
||||
#include <GProp_GProps.hxx>
|
||||
#include <GProp_PrincipalProps.hxx>
|
||||
|
||||
#include <TopAbs.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
@ -81,49 +79,49 @@
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
|
||||
#include <ShapeAnalysis.hxx>
|
||||
#include <ShapeAnalysis_Surface.hxx>
|
||||
#include <ShapeFix_Shape.hxx>
|
||||
|
||||
#include <GeomAPI_IntSS.hxx>
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_SphericalSurface.hxx>
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
#include <Geom_ToroidalSurface.hxx>
|
||||
#include <Geom_ConicalSurface.hxx>
|
||||
#include <Geom_SurfaceOfLinearExtrusion.hxx>
|
||||
#include <Geom_SurfaceOfRevolution.hxx>
|
||||
|
||||
#include <Geom_BezierSurface.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||
#include <Geom_OffsetSurface.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_ConicalSurface.hxx>
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom_OffsetSurface.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||
#include <Geom_SphericalSurface.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_SurfaceOfLinearExtrusion.hxx>
|
||||
#include <Geom_SurfaceOfRevolution.hxx>
|
||||
#include <Geom_ToroidalSurface.hxx>
|
||||
|
||||
#include <GeomLProp_CLProps.hxx>
|
||||
#include <GeomLProp_SLProps.hxx>
|
||||
|
||||
#include <GProp_GProps.hxx>
|
||||
#include <GProp_PrincipalProps.hxx>
|
||||
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
#include <GeomLProp_CLProps.hxx>
|
||||
#include <GeomLProp_SLProps.hxx>
|
||||
#include <ShapeAnalysis.hxx>
|
||||
#include <ShapeAnalysis_Surface.hxx>
|
||||
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
|
||||
|
||||
#include <BRepClass3d_SolidClassifier.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <GeomAPI_IntSS.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_SphericalSurface.hxx>
|
||||
#include <Geom_ToroidalSurface.hxx>
|
||||
#include <ShapeFix_Shape.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Constructor
|
||||
@ -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);
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
@ -27,10 +26,12 @@
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
#include <GEOM_Function.hxx>
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
@ -57,6 +58,10 @@ typedef TopoDS_Shape (*funcPoint)(const TCollection_AsciiString&,
|
||||
TCollection_AsciiString&,
|
||||
const TDF_Label&);
|
||||
|
||||
typedef Handle(TCollection_HAsciiString) (*pGetValue)(const TCollection_AsciiString&,
|
||||
const TCollection_AsciiString&,
|
||||
TCollection_AsciiString&);
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
@ -67,7 +72,6 @@ const Standard_GUID& GEOMImpl_ImportDriver::GetID()
|
||||
return aImportDriver;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GEOMImpl_ImportDriver
|
||||
//purpose :
|
||||
@ -97,6 +101,8 @@ Standard_Integer GEOMImpl_ImportDriver::Execute(TFunction_Logbook& log) const
|
||||
|
||||
// load plugin library
|
||||
LibHandle anImportLib = LoadLib( aLibName.ToCString() ); //This is workaround of BUG OCC13051
|
||||
|
||||
// Get Import method
|
||||
funcPoint fp = 0;
|
||||
if ( anImportLib )
|
||||
fp = (funcPoint)GetProc( anImportLib, "Import" );
|
||||
@ -129,6 +135,53 @@ Standard_Integer GEOMImpl_ImportDriver::Execute(TFunction_Logbook& log) const
|
||||
return 1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TCollection_AsciiString GEOMImpl_ImportDriver::ReadValue(const TCollection_AsciiString& theFileName,
|
||||
const TCollection_AsciiString& theLibName,
|
||||
const TCollection_AsciiString& theParameterName,
|
||||
TCollection_AsciiString& theError)
|
||||
{
|
||||
TCollection_AsciiString aValue;
|
||||
|
||||
if (theFileName.IsEmpty() || theLibName.IsEmpty() || theParameterName.IsEmpty())
|
||||
return aValue;
|
||||
|
||||
// load plugin library
|
||||
LibHandle anImportLib = LoadLib(theLibName.ToCString()); //This is workaround of BUG OCC13051
|
||||
if (!anImportLib) {
|
||||
theError = theLibName + " library was not installed";
|
||||
return aValue;
|
||||
}
|
||||
|
||||
// Get GetValue method
|
||||
pGetValue pGV = (pGetValue)GetProc(anImportLib, "GetValue");
|
||||
|
||||
if (!pGV) {
|
||||
theError = theLibName + " library doesn't support GetValue method";
|
||||
return aValue;
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) aHValue = pGV(theFileName, theParameterName, theError);
|
||||
|
||||
if (aHValue.IsNull()) {
|
||||
if (theError.IsEmpty())
|
||||
theError = theFileName + " doesn't contain requested parameter";
|
||||
return aValue;
|
||||
}
|
||||
|
||||
aValue = aHValue->String();
|
||||
|
||||
// unload plugin library
|
||||
// commented by enk:
|
||||
// the bug was occured: using ACIS Import/Export plugin
|
||||
//UnLoadLib( anImportLib ); //This is workaround of BUG OCC13051
|
||||
|
||||
return aValue;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GEOMImpl_ImportDriver_Type_
|
||||
|
@ -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 <Standard_CString.hxx>
|
||||
#endif
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
class TColStd_SequenceOfExtendedString;
|
||||
|
||||
|
||||
@ -148,6 +149,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r
|
||||
Standard_EXPORT static const Standard_GUID& GetID();
|
||||
Standard_EXPORT ~GEOMImpl_ImportDriver() {};
|
||||
|
||||
// Static method
|
||||
Standard_EXPORT static TCollection_AsciiString ReadValue (const TCollection_AsciiString& theFileName,
|
||||
const TCollection_AsciiString& theLibName,
|
||||
const TCollection_AsciiString& theParameterName,
|
||||
TCollection_AsciiString& theError);
|
||||
|
||||
// Type management
|
||||
//
|
||||
|
@ -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()) {
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
@ -26,6 +25,7 @@
|
||||
#include <GEOMImpl_IPoint.hxx>
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
#include <GEOM_Function.hxx>
|
||||
#include <GEOMAlgo_Tools3D.hxx>
|
||||
|
||||
#include <ShapeAnalysis.hxx>
|
||||
|
||||
@ -124,8 +124,8 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
|
||||
aPnt = gp_Pnt(aPI.GetX(), aPI.GetY(), aPI.GetZ());
|
||||
}
|
||||
else if (aType == POINT_XYZ_REF) {
|
||||
Handle(GEOM_Function) aRefPoint = aPI.GetRef();
|
||||
TopoDS_Shape aRefShape = aRefPoint->GetValue();
|
||||
Handle(GEOM_Function) aRefFunc = aPI.GetRef();
|
||||
TopoDS_Shape aRefShape = aRefFunc->GetValue();
|
||||
if (aRefShape.ShapeType() != TopAbs_VERTEX) {
|
||||
Standard_TypeMismatch::Raise
|
||||
("Point creation aborted : referenced shape is not a vertex");
|
||||
@ -134,8 +134,8 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
|
||||
aPnt = gp_Pnt(P.X() + aPI.GetX(), P.Y() + aPI.GetY(), P.Z() + aPI.GetZ());
|
||||
}
|
||||
else if (aType == POINT_CURVE_PAR) {
|
||||
Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
|
||||
TopoDS_Shape aRefShape = aRefCurve->GetValue();
|
||||
Handle(GEOM_Function) aRefFunc = aPI.GetCurve();
|
||||
TopoDS_Shape aRefShape = aRefFunc->GetValue();
|
||||
if (aRefShape.ShapeType() != TopAbs_EDGE) {
|
||||
Standard_TypeMismatch::Raise
|
||||
("Point On Curve creation aborted : curve shape is not an edge");
|
||||
@ -146,8 +146,8 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
|
||||
aPnt = aCurve->Value(aP);
|
||||
}
|
||||
else if (aType == POINT_CURVE_COORD) {
|
||||
Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
|
||||
TopoDS_Shape aRefShape = aRefCurve->GetValue();
|
||||
Handle(GEOM_Function) aRefFunc = aPI.GetCurve();
|
||||
TopoDS_Shape aRefShape = aRefFunc->GetValue();
|
||||
if (aRefShape.ShapeType() != TopAbs_EDGE) {
|
||||
Standard_TypeMismatch::Raise
|
||||
("Point On Curve creation aborted : curve shape is not an edge");
|
||||
@ -160,12 +160,12 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
|
||||
}
|
||||
else if (aType == POINT_CURVE_LENGTH) {
|
||||
// RefCurve
|
||||
Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
|
||||
if (aRefCurve.IsNull()) {
|
||||
Handle(GEOM_Function) aRefFunc = aPI.GetCurve();
|
||||
if (aRefFunc.IsNull()) {
|
||||
Standard_NullObject::Raise
|
||||
("Point On Curve creation aborted : curve object is null");
|
||||
}
|
||||
TopoDS_Shape aRefShape1 = aRefCurve->GetValue();
|
||||
TopoDS_Shape aRefShape1 = aRefFunc->GetValue();
|
||||
if (aRefShape1.ShapeType() != TopAbs_EDGE) {
|
||||
Standard_TypeMismatch::Raise
|
||||
("Point On Curve creation aborted : curve shape is not an edge");
|
||||
@ -222,8 +222,8 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
|
||||
aPnt = AdapCurve.Value(aParam);
|
||||
}
|
||||
else if (aType == POINT_SURFACE_PAR) {
|
||||
Handle(GEOM_Function) aRefCurve = aPI.GetSurface();
|
||||
TopoDS_Shape aRefShape = aRefCurve->GetValue();
|
||||
Handle(GEOM_Function) aRefFunc = aPI.GetSurface();
|
||||
TopoDS_Shape aRefShape = aRefFunc->GetValue();
|
||||
if (aRefShape.ShapeType() != TopAbs_FACE) {
|
||||
Standard_TypeMismatch::Raise
|
||||
("Point On Surface creation aborted : surface shape is not a face");
|
||||
@ -238,8 +238,8 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
|
||||
aPnt = aSurf->Value(U,V);
|
||||
}
|
||||
else if (aType == POINT_SURFACE_COORD) {
|
||||
Handle(GEOM_Function) aRefCurve = aPI.GetSurface();
|
||||
TopoDS_Shape aRefShape = aRefCurve->GetValue();
|
||||
Handle(GEOM_Function) aRefFunc = aPI.GetSurface();
|
||||
TopoDS_Shape aRefShape = aRefFunc->GetValue();
|
||||
if (aRefShape.ShapeType() != TopAbs_FACE) {
|
||||
Standard_TypeMismatch::Raise
|
||||
("Point On Surface creation aborted : surface shape is not a face");
|
||||
@ -250,6 +250,17 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
|
||||
("Point On Surface creation aborted : cannot project point");
|
||||
}
|
||||
}
|
||||
else if (aType == POINT_FACE_ANY) {
|
||||
Handle(GEOM_Function) aRefFunc = aPI.GetSurface();
|
||||
TopoDS_Shape aRefShape = aRefFunc->GetValue();
|
||||
if (aRefShape.ShapeType() != TopAbs_FACE) {
|
||||
Standard_TypeMismatch::Raise
|
||||
("Point On Surface creation aborted : surface shape is not a face");
|
||||
}
|
||||
TopoDS_Face F = TopoDS::Face(aRefShape);
|
||||
gp_Pnt2d aP2d;
|
||||
GEOMAlgo_Tools3D::PntInFace(F, aPnt, aP2d);
|
||||
}
|
||||
else if (aType == POINT_LINES_INTERSECTION) {
|
||||
Handle(GEOM_Function) aRef1 = aPI.GetLine1();
|
||||
Handle(GEOM_Function) aRef2 = aPI.GetLine2();
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <GEOMImpl_ShapeDriver.hxx>
|
||||
|
||||
@ -349,7 +348,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
||||
unsigned int ind, nbshapes = aShapes->Length();
|
||||
|
||||
// add faces
|
||||
BRepBuilderAPI_Sewing aSewing(Precision::Confusion()*10.0);
|
||||
BRepBuilderAPI_Sewing aSewing (Precision::Confusion()*10.0);
|
||||
for (ind = 1; ind <= nbshapes; ind++) {
|
||||
Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
|
||||
TopoDS_Shape aShape_i = aRefShape->GetValue();
|
||||
@ -362,7 +361,8 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
||||
aSewing.Perform();
|
||||
|
||||
TopoDS_Shape sh = aSewing.SewedShape();
|
||||
if( sh.ShapeType()==TopAbs_FACE && nbshapes==1 ) {
|
||||
|
||||
if (sh.ShapeType()==TopAbs_FACE && nbshapes==1) {
|
||||
// case for creation of shell from one face - PAL12722 (skl 26.06.2006)
|
||||
TopoDS_Shell ss;
|
||||
B.MakeShell(ss);
|
||||
@ -378,9 +378,26 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
||||
ish++;
|
||||
}
|
||||
|
||||
if (ish != 1)
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (aType == SOLID_SHELL) {
|
||||
|
@ -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
|
||||
@ -117,6 +116,7 @@
|
||||
#define POINT_CURVE_COORD 6
|
||||
#define POINT_SURFACE_COORD 7
|
||||
#define POINT_CURVE_LENGTH 8
|
||||
#define POINT_FACE_ANY 9
|
||||
|
||||
// Vector
|
||||
#define VECTOR_TWO_PNT 1
|
||||
@ -297,6 +297,9 @@
|
||||
#define SKETCHER_NINE_DOUBLS 1
|
||||
#define SKETCHER_PLANE 2
|
||||
|
||||
#define SKETCHER3D_COORDS 1
|
||||
#define SKETCHER3D_COMMAND 2
|
||||
|
||||
// Measures
|
||||
#define CDG_MEASURE 1
|
||||
#define VECTOR_FACE_NORMALE 4
|
||||
|
@ -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() ) {
|
||||
|
@ -30,12 +30,16 @@
|
||||
#include "GEOM_ToolsGUI.hxx"
|
||||
|
||||
#include <GEOMGUI.h>
|
||||
|
||||
#include <SALOMEDSClient.hxx>
|
||||
|
||||
class GEOM_Displayer;
|
||||
class SALOME_View;
|
||||
class SALOME_ListIO;
|
||||
class SalomeApp_Study;
|
||||
class SVTK_View;
|
||||
class QColor;
|
||||
class Handle_SALOME_InteractiveObject;
|
||||
class Handle_AIS_InteractiveContext;
|
||||
|
||||
#include <QList>
|
||||
|
||||
@ -54,6 +58,8 @@ public:
|
||||
|
||||
enum ActionType { SHOWDLG, INCR, DECR };
|
||||
|
||||
static void SetColor( const QString&, const QColor&, bool );
|
||||
|
||||
private:
|
||||
// Import and export topology methods
|
||||
bool Import();
|
||||
@ -71,7 +77,7 @@ private:
|
||||
void OnNbIsos( ActionType actionType = SHOWDLG );
|
||||
void OnDeflection();
|
||||
void OnSelectOnly(int mode);
|
||||
void OnShowHideChildren( bool );
|
||||
void OnDiscloseConcealChildren( bool );
|
||||
void OnUnpublishObject();
|
||||
void OnPublishObject() ;
|
||||
void OnPointMarker();
|
||||
@ -89,6 +95,18 @@ private:
|
||||
_PTR(Study),
|
||||
QList<SALOME_View*>,
|
||||
GEOM_Displayer* );
|
||||
|
||||
static void setVtkColor( SalomeApp_Study* study,
|
||||
int mgrId,
|
||||
SVTK_View* view,
|
||||
const Handle_SALOME_InteractiveObject& IO,
|
||||
const QColor& color );
|
||||
|
||||
static void setOccColor( SalomeApp_Study* study,
|
||||
int mgrId,
|
||||
const Handle_AIS_InteractiveContext& ic,
|
||||
const Handle_SALOME_InteractiveObject& IO,
|
||||
const QColor& color );
|
||||
};
|
||||
|
||||
#endif // GEOMTOOLSGUI_H
|
||||
|
@ -109,6 +109,13 @@
|
||||
// VTK includes
|
||||
#include <vtkRenderer.h>
|
||||
|
||||
// If the next macro is defined, autocolor feature works for all sub-shapes;
|
||||
// if it is undefined, autocolor feature works for groups only
|
||||
//#define GENERAL_AUTOCOLOR
|
||||
// Below macro, when uncommented, switches on simplified (more performant) algorithm
|
||||
// of auto-color picking up
|
||||
//#define SIMPLE_AUTOCOLOR
|
||||
|
||||
void GEOMToolsGUI::OnCheckGeometry()
|
||||
{
|
||||
SalomeApp_Application* app =
|
||||
@ -163,12 +170,18 @@ void GEOMToolsGUI::OnAutoColor()
|
||||
if( CORBA::is_nil( aChildObject ) )
|
||||
continue;
|
||||
|
||||
#ifndef GENERAL_AUTOCOLOR // auto-color for groups only
|
||||
if( aChildObject->GetType() != GEOM_GROUP )
|
||||
continue;
|
||||
#endif // GENERAL_AUTOCOLOR
|
||||
|
||||
#ifdef SIMPLE_AUTOCOLOR // simplified algorithm for auto-colors
|
||||
SALOMEDS::Color aColor = GEOM_Displayer::getPredefinedUniqueColor();
|
||||
#else // old algorithm for auto-colors
|
||||
SALOMEDS::Color aColor = GEOM_Displayer::getUniqueColor( aReservedColors );
|
||||
aChildObject->SetColor( aColor );
|
||||
aReservedColors.append( aColor );
|
||||
#endif // SIMPLE_AUTOCOLOR
|
||||
aChildObject->SetColor( aColor );
|
||||
|
||||
QColor c( (int)( aColor.R * 255.0 ), (int)( aColor.G * 255.0 ), (int)( aColor.B * 255.0 ) );
|
||||
|
||||
@ -267,88 +280,198 @@ void GEOMToolsGUI::OnDisableAutoColor()
|
||||
return;
|
||||
|
||||
aMainObject->SetAutoColor( false );
|
||||
}
|
||||
|
||||
void GEOMToolsGUI::SetColor( const QString& entry, const QColor& color, bool updateViewer )
|
||||
{
|
||||
if ( entry.isEmpty() || !color.isValid() ) return;
|
||||
|
||||
// get active application
|
||||
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
||||
if ( !app ) return;
|
||||
|
||||
// get current study
|
||||
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
|
||||
if ( !appStudy ) return;
|
||||
|
||||
// get active view
|
||||
SUIT_ViewWindow* window = app->desktop()->activeWindow();
|
||||
if ( !window ) return;
|
||||
|
||||
bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
|
||||
bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
|
||||
|
||||
// get view id
|
||||
int mgrId = window->getViewManager()->getGlobalId();
|
||||
|
||||
Handle(SALOME_InteractiveObject) IO =
|
||||
new SALOME_InteractiveObject( entry.toLatin1().data(), "GEOM", "");
|
||||
|
||||
if ( isVTK ) {
|
||||
SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
|
||||
if ( !vtkVW ) return;
|
||||
SVTK_View* aView = vtkVW->getView();
|
||||
|
||||
GEOMToolsGUI::setVtkColor( appStudy, mgrId, aView, IO, color );
|
||||
if ( updateViewer ) aView->Repaint();
|
||||
}
|
||||
else if ( isOCC ) {
|
||||
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*> ( window->getViewManager()->getViewModel() );
|
||||
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
|
||||
GEOMToolsGUI::setOccColor( appStudy, mgrId, ic, IO, color );
|
||||
if ( updateViewer ) ic->UpdateCurrentViewer();
|
||||
}
|
||||
|
||||
// mark study as modified
|
||||
GeometryGUI::Modified();
|
||||
|
||||
// update actions
|
||||
app->updateActions(); //SRN: To update a Save button in the toolbar
|
||||
}
|
||||
|
||||
void GEOMToolsGUI::OnColor()
|
||||
{
|
||||
SALOME_ListIO selected;
|
||||
// get active application
|
||||
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
||||
if ( !app ) return;
|
||||
|
||||
// get current study
|
||||
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
|
||||
if ( app && appStudy ) {
|
||||
if ( !appStudy ) return;
|
||||
|
||||
// get selection manager
|
||||
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
|
||||
if ( aSelMgr ) {
|
||||
if ( !aSelMgr ) return;
|
||||
|
||||
// get selection
|
||||
SALOME_ListIO selected;
|
||||
aSelMgr->selectedObjects( selected );
|
||||
if ( !selected.IsEmpty() ) {
|
||||
if ( selected.IsEmpty() ) return;
|
||||
|
||||
// get active view
|
||||
SUIT_ViewWindow* window = app->desktop()->activeWindow();
|
||||
bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
|
||||
bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
|
||||
|
||||
// get view id
|
||||
int mgrId = window->getViewManager()->getGlobalId();
|
||||
|
||||
if ( isVTK ) {
|
||||
SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
|
||||
if ( !vtkVW )
|
||||
return;
|
||||
if ( !vtkVW ) return;
|
||||
|
||||
// get initial color (use first object from selection)
|
||||
SVTK_View* aView = vtkVW->getView();
|
||||
QColor initcolor = aView->GetColor( selected.First() );
|
||||
QColor c = QColorDialog::getColor( initcolor, app->desktop() );
|
||||
if ( c.isValid() ) {
|
||||
QColor color = aView->GetColor( selected.First() );
|
||||
QVariant v = appStudy->getObjectProperty( mgrId, selected.First()->getEntry(), COLOR_PROP, color );
|
||||
|
||||
// show Choose Color dialog box
|
||||
color = QColorDialog::getColor( v.value<QColor>(), app->desktop() );
|
||||
if ( !color.isValid() ) return;
|
||||
|
||||
// iterate through list of objects and assign new color
|
||||
SUIT_OverrideCursor();
|
||||
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
|
||||
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);
|
||||
GEOMToolsGUI::setVtkColor( appStudy, mgrId, aView, It.Value(), color );
|
||||
}
|
||||
// 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 );
|
||||
aView->Repaint();
|
||||
}
|
||||
GeometryGUI::Modified();
|
||||
}
|
||||
} // if ( isVTK )
|
||||
else if ( isOCC ) {
|
||||
// find AIS interactive object (for first item in selection)
|
||||
Handle(AIS_InteractiveObject) io = GEOMBase::GetAIS( selected.First() );
|
||||
if ( !io.IsNull() ) {
|
||||
if ( io.IsNull() ) return;
|
||||
|
||||
// get initial color (use first object from selection)
|
||||
Quantity_Color aColor;
|
||||
io->Color( aColor );
|
||||
QColor ic = QColor((int )( aColor.Red() * 255.0 ),
|
||||
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 );
|
||||
|
||||
QVariant v = appStudy->getObjectProperty(mgrId,selected.First()->getEntry(), COLOR_PROP, ic);
|
||||
// show Choose Color dialog box
|
||||
color = QColorDialog::getColor( v.value<QColor>(), app->desktop() );
|
||||
if ( !color.isValid() ) return;
|
||||
|
||||
QColor initcolor = v.value<QColor>();
|
||||
QColor c = QColorDialog::getColor( initcolor, app->desktop() );
|
||||
if ( c.isValid() ) {
|
||||
// iterate through list of objects and assign new color
|
||||
SUIT_OverrideCursor();
|
||||
aColor = Quantity_Color( c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB );
|
||||
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*> ( window->getViewManager()->getViewModel() );
|
||||
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
|
||||
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
|
||||
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 = appStudy->getObjectProperty(mgrId,It.Value()->getEntry(), MATERIAL_PROP, matProp).toString();
|
||||
matProp = study->getObjectProperty( mgrId, IO->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
|
||||
|
||||
// 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
|
||||
|
||||
if ( onlyVertex ) {
|
||||
// set color for a point
|
||||
Handle(AIS_Drawer) aCurDrawer = io->Attributes();
|
||||
Handle(Prs3d_PointAspect) aCurPointAspect = aCurDrawer->PointAspect();
|
||||
Quantity_Color aCurColor;
|
||||
@ -356,21 +479,19 @@ void GEOMToolsGUI::OnColor()
|
||||
Aspect_TypeOfMarker aCurTypeOfMarker;
|
||||
aCurPointAspect->Aspect()->Values( aCurColor, aCurTypeOfMarker, aCurScale );
|
||||
if ( aCurTypeOfMarker != Aspect_TOM_USERDEFINED ) {
|
||||
aCurDrawer->SetPointAspect(new Prs3d_PointAspect(aCurTypeOfMarker, aColor, aCurScale));
|
||||
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));
|
||||
aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aColor, 1, aWidth, aHeight, aTexture ) );
|
||||
}
|
||||
ic->SetLocalAttributes(io, aCurDrawer, Standard_False);
|
||||
ic->SetLocalAttributes( io, aCurDrawer, Standard_False );
|
||||
}
|
||||
}
|
||||
|
||||
@ -381,35 +502,22 @@ void GEOMToolsGUI::OnColor()
|
||||
aGAISShape->storeBoundaryColors();
|
||||
}
|
||||
|
||||
appStudy->setObjectProperty(mgrId,It.Value()->getEntry(), COLOR_PROP, c);
|
||||
|
||||
io->Redisplay( Standard_True );
|
||||
|
||||
study->setObjectProperty( mgrId, IO->getEntry(), COLOR_PROP, color );
|
||||
}
|
||||
|
||||
// store color to GEOM_Object
|
||||
_PTR(Study) aStudy = appStudy->studyDS();
|
||||
_PTR(SObject) aSObject( aStudy->FindObjectID( It.Value()->getEntry() ) );
|
||||
_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)c.red() / 255.0;
|
||||
aSColor.G = (double)c.green() / 255.0;
|
||||
aSColor.B = (double)c.blue() / 255.0;
|
||||
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 );
|
||||
}
|
||||
} // for
|
||||
ic->UpdateCurrentViewer();
|
||||
GeometryGUI::Modified();
|
||||
} // if c.isValid()
|
||||
} // first IO is not null
|
||||
} // if ( isOCC )
|
||||
} // if ( selection not empty )
|
||||
}
|
||||
}
|
||||
|
||||
app->updateActions(); //SRN: To update a Save button in the toolbar
|
||||
}
|
||||
|
||||
void GEOMToolsGUI::OnTexture()
|
||||
@ -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 =
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
@ -277,6 +276,29 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnSurfaceByCoord
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* MakePointOnFace
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnFace (GEOM::GEOM_Object_ptr theFace)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
//Get the reference face
|
||||
Handle(GEOM_Object) aReference = GetObjectImpl(theFace);
|
||||
if (aReference.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
//Create the point
|
||||
Handle(GEOM_Object) anObject = GetOperations()->MakePointOnFace(aReference);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
|
@ -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);
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
@ -742,6 +741,39 @@ char* GEOM_IBlocksOperations_i::PrintBCErrors
|
||||
return CORBA::string_dup(aDescr.ToCString());
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* GetNonBlocks
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetNonBlocks
|
||||
(GEOM::GEOM_Object_ptr theShape,
|
||||
GEOM::GEOM_Object_out theNonQuads)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
GEOM::GEOM_Object_var aNonQuads;
|
||||
|
||||
theNonQuads = aNonQuads._retn();
|
||||
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
//Get the reference Objects
|
||||
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
|
||||
if (aShape.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
//Get the result
|
||||
Handle(GEOM_Object) aFaces;
|
||||
Handle(GEOM_Object) anObject = GetOperations()->GetNonBlocks(aShape, aFaces);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
if (!aFaces.IsNull())
|
||||
theNonQuads = GetObject(aFaces);
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* RemoveExtraEdges
|
||||
|
@ -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);
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
@ -433,9 +432,11 @@ 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,
|
||||
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::curve_type theCurveType)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
@ -455,7 +456,6 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametric(const char*
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Make Polyline
|
||||
Handle(GEOM_Object) anObject =
|
||||
GetOperations()->MakeCurveParametric(thexExpr, theyExpr, thezExpr,
|
||||
@ -473,9 +473,11 @@ 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,
|
||||
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::curve_type theCurveType)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
@ -495,7 +497,6 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametricNew(const cha
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Make Polyline
|
||||
Handle(GEOM_Object) anObject =
|
||||
GetOperations()->MakeCurveParametric(thexExpr, theyExpr, thezExpr,
|
||||
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
@ -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,
|
||||
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,
|
||||
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(); }
|
||||
};
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
@ -202,7 +201,6 @@ void GEOM_IGroupOperations_i::UnionIDs (GEOM::GEOM_Object_ptr theGroup,
|
||||
|
||||
//Perform the operation
|
||||
GetOperations()->UnionIDs(aGroupRef, aSubShapes);
|
||||
return;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -230,7 +228,176 @@ void GEOM_IGroupOperations_i::DifferenceIDs (GEOM::GEOM_Object_ptr theGroup,
|
||||
|
||||
//Perform the operation
|
||||
GetOperations()->DifferenceIDs(aGroupRef, aSubShapes);
|
||||
return;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* UnionGroups
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::UnionGroups (GEOM::GEOM_Object_ptr theGroup1,
|
||||
GEOM::GEOM_Object_ptr theGroup2)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
//Get the reference groups
|
||||
Handle(GEOM_Object) aGroupRef1 = GetObjectImpl(theGroup1);
|
||||
Handle(GEOM_Object) aGroupRef2 = GetObjectImpl(theGroup2);
|
||||
if (aGroupRef1.IsNull() || aGroupRef2.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
//Perform the operation
|
||||
Handle(GEOM_Object) anObject = GetOperations()->UnionGroups(aGroupRef1, aGroupRef2);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* IntersectGroups
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::IntersectGroups (GEOM::GEOM_Object_ptr theGroup1,
|
||||
GEOM::GEOM_Object_ptr theGroup2)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
//Get the reference groups
|
||||
Handle(GEOM_Object) aGroupRef1 = GetObjectImpl(theGroup1);
|
||||
Handle(GEOM_Object) aGroupRef2 = GetObjectImpl(theGroup2);
|
||||
if (aGroupRef1.IsNull() || aGroupRef2.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
//Perform the operation
|
||||
Handle(GEOM_Object) anObject = GetOperations()->IntersectGroups(aGroupRef1, aGroupRef2);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* CutGroups
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::CutGroups (GEOM::GEOM_Object_ptr theGroup1,
|
||||
GEOM::GEOM_Object_ptr theGroup2)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
//Get the reference groups
|
||||
Handle(GEOM_Object) aGroupRef1 = GetObjectImpl(theGroup1);
|
||||
Handle(GEOM_Object) aGroupRef2 = GetObjectImpl(theGroup2);
|
||||
if (aGroupRef1.IsNull() || aGroupRef2.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
//Perform the operation
|
||||
Handle(GEOM_Object) anObject = GetOperations()->CutGroups(aGroupRef1, aGroupRef2);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* UnionListOfGroups
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::UnionListOfGroups (const GEOM::ListOfGO& theGList)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
//Get the reference groups
|
||||
Handle(TColStd_HSequenceOfTransient) aGroups = new TColStd_HSequenceOfTransient;
|
||||
|
||||
int ind, aLen = theGList.length();
|
||||
for (ind = 0; ind < aLen; ind++) {
|
||||
Handle(GEOM_Object) aGr = GetObjectImpl(theGList[ind]);
|
||||
if (aGr.IsNull()) return aGEOMObject._retn();
|
||||
aGroups->Append(aGr);
|
||||
}
|
||||
|
||||
//Perform the operation
|
||||
Handle(GEOM_Object) anObject = GetOperations()->UnionListOfGroups(aGroups);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* IntersectListOfGroups
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::IntersectListOfGroups (const GEOM::ListOfGO& theGList)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
//Get the reference groups
|
||||
Handle(TColStd_HSequenceOfTransient) aGroups = new TColStd_HSequenceOfTransient;
|
||||
|
||||
int ind, aLen = theGList.length();
|
||||
for (ind = 0; ind < aLen; ind++) {
|
||||
Handle(GEOM_Object) aGr = GetObjectImpl(theGList[ind]);
|
||||
if (aGr.IsNull()) return aGEOMObject._retn();
|
||||
aGroups->Append(aGr);
|
||||
}
|
||||
|
||||
//Perform the operation
|
||||
Handle(GEOM_Object) anObject = GetOperations()->IntersectListOfGroups(aGroups);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* CutListOfGroups
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::CutListOfGroups (const GEOM::ListOfGO& theGList1,
|
||||
const GEOM::ListOfGO& theGList2)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
//Get the reference groups
|
||||
Handle(TColStd_HSequenceOfTransient) aGroups1 = new TColStd_HSequenceOfTransient;
|
||||
Handle(TColStd_HSequenceOfTransient) aGroups2 = new TColStd_HSequenceOfTransient;
|
||||
|
||||
int ind, aLen = theGList1.length();
|
||||
for (ind = 0; ind < aLen; ind++) {
|
||||
Handle(GEOM_Object) aGr = GetObjectImpl(theGList1[ind]);
|
||||
if (aGr.IsNull()) return aGEOMObject._retn();
|
||||
aGroups1->Append(aGr);
|
||||
}
|
||||
aLen = theGList2.length();
|
||||
for (ind = 0; ind < aLen; ind++) {
|
||||
Handle(GEOM_Object) aGr = GetObjectImpl(theGList2[ind]);
|
||||
if (aGr.IsNull()) return aGEOMObject._retn();
|
||||
aGroups2->Append(aGr);
|
||||
}
|
||||
|
||||
//Perform the operation
|
||||
Handle(GEOM_Object) anObject = GetOperations()->CutListOfGroups(aGroups1, aGroups2);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -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
|
||||
@ -56,6 +55,14 @@ 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);
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#ifdef WNT
|
||||
#pragma warning( disable:4786 )
|
||||
@ -47,7 +46,7 @@
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* constructor:
|
||||
* constructor
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM_IInsertOperations_i::GEOM_IInsertOperations_i (PortableServer::POA_ptr thePOA,
|
||||
@ -155,6 +154,32 @@ GEOM::GEOM_Object_ptr GEOM_IInsertOperations_i::ImportFile
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* ReadValue
|
||||
*/
|
||||
//=============================================================================
|
||||
char* GEOM_IInsertOperations_i::ReadValue(const char* theFileName,
|
||||
const char* theFormatName,
|
||||
const char* theParameterName)
|
||||
{
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
char* aFileName = strdup(theFileName);
|
||||
char* aFormatName = strdup(theFormatName);
|
||||
char* aParameterName = strdup(theParameterName);
|
||||
|
||||
TCollection_AsciiString aUnits = GetOperations()->ReadValue
|
||||
(aFileName, aFormatName, aParameterName);
|
||||
|
||||
free(aFileName);
|
||||
free(aFormatName);
|
||||
free(aParameterName);
|
||||
|
||||
return CORBA::string_dup(aUnits.ToCString());
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* ImportTranslators
|
||||
@ -225,12 +250,47 @@ void GEOM_IInsertOperations_i::ExportTranslators
|
||||
thePatterns = aPatternsArray._retn();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* RestoreShape
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_IInsertOperations_i::RestoreShape (const SALOMEDS::TMPFile& theStream)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
if (theStream.length() < 1)
|
||||
return aGEOMObject._retn();
|
||||
|
||||
char* buf = (char*)theStream.NP_data();
|
||||
std::istringstream aStream (buf);
|
||||
|
||||
Handle(GEOM_Object) anObject = GetOperations()->RestoreShape(aStream);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* LoadTexture
|
||||
*/
|
||||
//=============================================================================
|
||||
CORBA::Long GEOM_IInsertOperations_i::LoadTexture(const char* theTextureFile)
|
||||
{
|
||||
GetOperations()->SetNotDone();
|
||||
return GetOperations()->LoadTexture( theTextureFile );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* AddTexture
|
||||
*/
|
||||
//=============================================================================
|
||||
CORBA::Long GEOM_IInsertOperations_i::AddTexture(CORBA::Long theWidth, CORBA::Long theHeight,
|
||||
const SALOMEDS::TMPFile& theTexture)
|
||||
{
|
||||
@ -255,6 +315,11 @@ CORBA::Long GEOM_IInsertOperations_i::AddTexture(CORBA::Long theWidth, CORBA::Lo
|
||||
return GetOperations()->AddTexture( theWidth, theHeight, aTexture );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* GetTexture
|
||||
*/
|
||||
//=============================================================================
|
||||
SALOMEDS::TMPFile* GEOM_IInsertOperations_i::GetTexture(CORBA::Long theID,
|
||||
CORBA::Long& theWidth,
|
||||
CORBA::Long& theHeight)
|
||||
@ -278,6 +343,11 @@ SALOMEDS::TMPFile* GEOM_IInsertOperations_i::GetTexture(CORBA::Long theID,
|
||||
return aTexture._retn();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* GetAllTextures
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::ListOfLong* GEOM_IInsertOperations_i::GetAllTextures()
|
||||
{
|
||||
std::list<int> localIDs = GetOperations()->GetAllTextures();
|
||||
|
@ -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);
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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,7 +104,17 @@ 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")
|
||||
|
@ -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
|
||||
# -----------------------------------------------------------------------------
|
||||
|
@ -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 \
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
@ -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
|
||||
#
|
||||
|
182
src/GEOM_SWIG/gsketcher.py
Normal file
@ -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
|
@ -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
|
||||
# <prefix>/bin/salome directory.
|
||||
# The library _libGEOM_Swig.so will be installed to the
|
||||
# The files libGEOM_Swig.py and _libGEOM_Swig.so will be installed to the
|
||||
# <prefix>/lib/python<version>/site-package/salome directory.
|
||||
#
|
||||
|
||||
SWIG_FLAGS = @SWIG_FLAGS@ -I$(srcdir) -I$(srcdir)/../GEOMGUI
|
||||
SWIG_SOURCES = libGEOM_Swig.i
|
||||
|
||||
salomeinclude_HEADERS = $(SWIG_SOURCES) libGEOM_Swig.h
|
||||
|
||||
salomepython_PYTHON = libGEOM_Swig.py
|
||||
salomepyexec_LTLIBRARIES = _libGEOM_Swig.la
|
||||
|
||||
libGEOM_Swig.py: swig_wrap.cpp
|
||||
BUILT_SOURCES = swig_wrap.cpp
|
||||
_libGEOM_Swig_la_SOURCES = $(SWIG_SOURCES)
|
||||
nodist__libGEOM_Swig_la_SOURCES = $(BUILT_SOURCES)
|
||||
|
||||
salomeinclude_HEADERS = $(SWIG_SOURCES)
|
||||
_libGEOM_Swig_la_SOURCES = $(SWIG_SOURCES) libGEOM_Swig.h libGEOM_Swig.cxx
|
||||
nodist__libGEOM_Swig_la_SOURCES = swig_wrap.cpp
|
||||
|
||||
_libGEOM_Swig_la_CPPFLAGS = \
|
||||
$(QT_INCLUDES) \
|
||||
@ -73,16 +61,23 @@ _libGEOM_Swig_la_CPPFLAGS = \
|
||||
$(GUI_CXXFLAGS) \
|
||||
$(CORBA_CXXFLAGS) \
|
||||
$(CORBA_INCLUDES) \
|
||||
$(BOOST_CPPFLAGS) \
|
||||
-I$(srcdir)/../GEOMClient \
|
||||
-I$(srcdir)/../OBJECT \
|
||||
-I$(srcdir)/../GEOMGUI \
|
||||
-I$(srcdir)/../GEOMToolsGUI \
|
||||
-I$(top_builddir)/idl
|
||||
|
||||
_libGEOM_Swig_la_LDFLAGS = -module
|
||||
_libGEOM_Swig_la_LIBADD = \
|
||||
../GEOMGUI/libGEOM.la \
|
||||
../GEOMToolsGUI/libGEOMToolsGUI.la \
|
||||
$(PYTHON_LIBS)
|
||||
|
||||
swig_wrap.cpp : $(SWIG_SOURCES)
|
||||
$(SWIG) $(SWIG_FLAGS) -o $@ $<
|
||||
|
||||
libGEOM_Swig.py: swig_wrap.cpp
|
||||
|
||||
CLEANFILES = swig_wrap.cpp libGEOM_Swig.py
|
||||
|
||||
|
@ -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 <AIS_ListOfInteractive.hxx>
|
||||
#include <AIS_ListIteratorOfListOfInteractive.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
#include <Prs3d_IsoAspect.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
|
||||
// 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<SalomeApp_Study*>(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 (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app)) {
|
||||
SVTK_Viewer* aView = dynamic_cast<SVTK_Viewer*>(aViewWindow->getViewManager()->getViewModel());
|
||||
SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( aView->CreatePrs( myEntry.c_str() ) );
|
||||
if ( vtkPrs ) {
|
||||
vtkActorCollection* anActors = vtkPrs->GetObjects();
|
||||
anActors->InitTraversal();
|
||||
GEOM_Actor* anActor = GEOM_Actor::SafeDownCast( anActors->GetNextActor() );
|
||||
if ( anActor ) {
|
||||
int aIsos[2]={myNbU,myNbV};
|
||||
anActor->SetNbIsos(aIsos);
|
||||
anActor->StoreIsoNumbers();
|
||||
QString anIsos = QString("%1%2%3").arg(myNbU).arg(DIGIT_SEPARATOR).arg(myNbV);
|
||||
int aMgrId = aView->getViewManager()->getGlobalId();
|
||||
study->setObjectProperty(aMgrId, myEntry.c_str(), ISOS_PROP, anIsos);
|
||||
}
|
||||
}
|
||||
|
||||
if (myUpdateViewer)
|
||||
aView->Repaint();
|
||||
} else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
|
||||
}
|
||||
else if (OCCViewer_Viewer* occViewer = GetOCCViewer(app)) {
|
||||
Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
|
||||
SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
|
||||
if (soccViewer)
|
||||
{
|
||||
SALOME_Prs* prs= soccViewer->CreatePrs( myEntry.c_str() );
|
||||
const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( prs );
|
||||
if ( !anOCCPrs || anOCCPrs->IsNull() )
|
||||
return;
|
||||
|
||||
// get objects to be displayed
|
||||
AIS_ListOfInteractive anAISObjects;
|
||||
anOCCPrs->GetObjects( anAISObjects );
|
||||
AIS_ListIteratorOfListOfInteractive ite( anAISObjects );
|
||||
Quantity_Color CSFColor = Quantity_Color(myRed/255., myGreen/255., myBlue/255., Quantity_TOC_RGB);
|
||||
for ( ; ite.More(); ite.Next() )
|
||||
{
|
||||
if(!ic->IsDisplayed(ite.Value()))continue; //only displayed ais
|
||||
ite.Value()->SetColor(CSFColor);
|
||||
if (ite.Value()->IsKind(STANDARD_TYPE(GEOM_AISShape))) Handle(GEOM_AISShape)::DownCast(ite.Value())->SetShadingColor(CSFColor);
|
||||
ite.Value()->Redisplay(Standard_True); // as in OnColor
|
||||
if (soccViewer) {
|
||||
int aMgrId = soccViewer->getViewManager()->getGlobalId();
|
||||
SOCC_Prs* occPrs = dynamic_cast<SOCC_Prs*>( soccViewer->CreatePrs( myEntry.c_str() ) );
|
||||
if ( occPrs && !occPrs->IsNull() ) {
|
||||
AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes );
|
||||
AIS_ListIteratorOfListOfInteractive interIter( shapes );
|
||||
for ( ; interIter.More(); interIter.Next() ) {
|
||||
Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() );
|
||||
if ( !aSh.IsNull() ) {
|
||||
Handle(AIS_Drawer) drawer = aSh->Attributes();
|
||||
QVariant v = study->getObjectProperty( aMgrId, myEntry.c_str(), EDGE_WIDTH_PROP, QVariant() );
|
||||
int width = v.isValid() ? v.toInt() : 1;
|
||||
drawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, width, myNbU) );
|
||||
drawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, width, myNbV) );
|
||||
aSh->storeIsoNumbers();
|
||||
ic->SetLocalAttributes(aSh, drawer);
|
||||
ic->Redisplay(aSh);
|
||||
QString anIsos = QString("%1%2%3").arg(myNbU).arg(DIGIT_SEPARATOR).arg(myNbV);
|
||||
study->setObjectProperty(aMgrId, myEntry.c_str(), ISOS_PROP, anIsos);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (myUpdateViewer) occViewer->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
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)
|
@ -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);
|
@ -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();
|
||||
};
|
||||
|
||||
|