Mantis issues 0020939(GetSharedShapes) and 0020842(AllSorted meaning).

This commit is contained in:
jfa 2010-11-18 12:14:05 +00:00
parent ac9b96fa48
commit 8d072adad7
33 changed files with 1234 additions and 433 deletions

View File

@ -20,20 +20,20 @@ subshapes of a given Type and returns a List of sub-shapes.</li>
<li><em>geompy.SubShapeAllIDs(Shape, Type)</em> explodes a Shape on <li><em>geompy.SubShapeAllIDs(Shape, Type)</em> explodes a Shape on
subshapes of a given Type and returns a List of IDs of subshapes of a given Type and returns a List of IDs of
sub-shapes.</li> sub-shapes.</li>
<li><em>geompy.SubShapeAllSorted(Shape, Type)</em> xplodes a shape on <li><em>geompy.SubShapeAllSortedCentres(Shape, Type)</em> explodes a
subshapes of a given type and sorts them by coordinates of their shape on subshapes of a given type and sorts them by coordinates of
gravity centers, returning a list of sub-shapes.</li> their gravity centers, returning a list of sub-shapes.</li>
<li><em>geompy.SubShapeAllSortedIDs(Shape, Type)</em> explodes a shape <li><em>geompy.SubShapeAllSortedCentresIDs(Shape, Type)</em> explodes
on subshapes of a given type and sorts them by coordinates of their a shape on subshapes of a given type and sorts them by coordinates of
gravity centers, returning a List of IDs of sub-shapes.</li> their gravity centers, returning a List of IDs of sub-shapes.</li>
<li><em>geompy.SubShape(Shape, Type, ListOfInd)</em> allows to obtain <li><em>geompy.SubShape(Shape, Type, ListOfInd)</em> allows to obtain
a compound of sub-shapes of the Shape, selected by they indices in a a compound of sub-shapes of the Shape, selected by they indices in a
list of all sub-shapes of the given Type. Each index is in the range list of all sub-shapes of the given Type. Each index is in the range
[1, Nb_Sub-Shapes_Of_Given_Type].</li> [1, Nb_Sub-Shapes_Of_Given_Type].</li>
<li><em>geompy.SubShapeSorted(Shape, Type, ListOfInd)</em> allows to <li><em>geompy.SubShapeSortedCentres(Shape, Type, ListOfInd)</em>
obtain a compound of sub-shapes of the Shape, selected by they indices allows to obtain a compound of sub-shapes of the Shape, selected by
in sorted list of all sub-shapes of the given Type. Each index is in they indices in sorted list of all sub-shapes of the given Type. Each
the range [1, Nb_Sub-Shapes_Of_Given_Type]</li> index is in the range [1, Nb_Sub-Shapes_Of_Given_Type]</li>
</ul> </ul>
\n <b>Arguments: </b>1 SHAPE + 1 type of SubShape. \n <b>Arguments: </b>1 SHAPE + 1 type of SubShape.

View File

@ -18,6 +18,8 @@ plane corresponding to the modelled waterline of the object plunged
into water.</li> into water.</li>
<li>\subpage shapesonshape_page "Get shapes on shape" operation, a <li>\subpage shapesonshape_page "Get shapes on shape" operation, a
special case of \b Explode operation. </li> special case of \b Explode operation. </li>
<li>\subpage shared_shapes_page "Get shared shapes" operation, a
special case of \b Explode operation. </li>
<li>Operations with \subpage blocks_operations_page "Blocks".</li> <li>Operations with \subpage blocks_operations_page "Blocks".</li>

View File

@ -132,7 +132,7 @@ face = geompy.MakeFaces([sketcher1, sketcher2],isPlanarFace)
prism = geompy.MakePrism(face, p0, pxyz) prism = geompy.MakePrism(face, p0, pxyz)
# explode the prism into faces # explode the prism into faces
prism_faces = geompy.SubShapeAllSorted(prism, geompy.ShapeType["FACE"]) prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
# create a shell from a set of faces # create a shell from a set of faces
shell = geompy.MakeShell([prism_faces[0], prism_faces[2], prism_faces[3], shell = geompy.MakeShell([prism_faces[0], prism_faces[2], prism_faces[3],
@ -168,7 +168,7 @@ face = geompy.MakeFace(sketcher,1)
prism = geompy.MakePrism(face, p0, pz) prism = geompy.MakePrism(face, p0, pz)
# explode the prism into faces # explode the prism into faces
prism_faces = geompy.SubShapeAllSorted(prism, geompy.ShapeType["FACE"]) prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
# create a shell from a set of faces # create a shell from a set of faces
shell = geompy.MakeShell([prism_faces[0], prism_faces[1], shell = geompy.MakeShell([prism_faces[0], prism_faces[1],

View File

@ -271,7 +271,7 @@ faces.append(f3)
faces.append(f4) faces.append(f4)
shell = geompy.MakeSewing(faces,1.e-6) shell = geompy.MakeSewing(faces,1.e-6)
shells.append(shell) shells.append(shell)
faces = geompy.SubShapeAllSorted(shell, geompy.ShapeType["FACE"]) faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
subbases.append(faces[0]) subbases.append(faces[0])
# 2 section # 2 section
@ -311,7 +311,7 @@ faces.append(f3)
faces.append(f4) faces.append(f4)
shell = geompy.MakeSewing(faces,1.e-6) shell = geompy.MakeSewing(faces,1.e-6)
shells.append(shell) shells.append(shell)
faces = geompy.SubShapeAllSorted(shell, geompy.ShapeType["FACE"]) faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
subbases.append(faces[0]) subbases.append(faces[0])
# 3 section # 3 section
@ -356,7 +356,7 @@ faces.append(f3)
faces.append(f4) faces.append(f4)
shell = geompy.MakeSewing(faces,1.e-6) shell = geompy.MakeSewing(faces,1.e-6)
shells.append(shell) shells.append(shell)
faces = geompy.SubShapeAllSorted(shell, geompy.ShapeType["FACE"]) faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
subbases.append(faces[2]) subbases.append(faces[2])
# 4 section # 4 section
@ -391,7 +391,7 @@ vp = geompy.MakeVertex(c3[0]-20,c3[1],c3[2])
ff = geompy.MakePlane(vp,vec,40) ff = geompy.MakePlane(vp,vec,40)
fs.append(ff) fs.append(ff)
aPartition = geompy.MakePartition(shellsph,fs) aPartition = geompy.MakePartition(shellsph,fs)
fs = geompy.SubShapeAllSorted(aPartition, geompy.ShapeType["FACE"]) fs = geompy.SubShapeAllSortedCentres(aPartition, geompy.ShapeType["FACE"])
faces.append(fs[0]) faces.append(fs[0])
faces.append(fs[1]) faces.append(fs[1])
@ -399,7 +399,7 @@ faces.append(fs[2])
faces.append(fs[3]) faces.append(fs[3])
shell = geompy.MakeSewing(faces,1.e-6) shell = geompy.MakeSewing(faces,1.e-6)
shells.append(shell) shells.append(shell)
faces = geompy.SubShapeAllSorted(shell, geompy.ShapeType["FACE"]) faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
#=========================================================== #===========================================================
@ -501,25 +501,25 @@ locs = []
# 1 section # 1 section
shell = MakeComplexSect(vs[0], geompy.MakeVectorDXDYDZ(1,0,0), 60, 40, 16) shell = MakeComplexSect(vs[0], geompy.MakeVectorDXDYDZ(1,0,0), 60, 40, 16)
shells.append(shell) shells.append(shell)
vs1 = geompy.SubShapeAllSorted(shell,geompy.ShapeType["VERTEX"]) vs1 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
locs.append(vs1[17]) locs.append(vs1[17])
# 2 section # 2 section
shell = MakeComplexSect(vs[1], geompy.MakeVectorDXDYDZ(1,0,0), 80, 30, 16) shell = MakeComplexSect(vs[1], geompy.MakeVectorDXDYDZ(1,0,0), 80, 30, 16)
shells.append(shell) shells.append(shell)
vs2 = geompy.SubShapeAllSorted(shell,geompy.ShapeType["VERTEX"]) vs2 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
locs.append(vs2[17]) locs.append(vs2[17])
# 3 section # 3 section
shell = MakeComplexSect(vs[2], geompy.MakeVectorDXDYDZ(1,0,0), 60, 40, 16) shell = MakeComplexSect(vs[2], geompy.MakeVectorDXDYDZ(1,0,0), 60, 40, 16)
shells.append(shell) shells.append(shell)
vs3 = geompy.SubShapeAllSorted(shell,geompy.ShapeType["VERTEX"]) vs3 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
locs.append(vs3[17]) locs.append(vs3[17])
# 4 section # 4 section
shell = MakeComplexSect(vs[3], geompy.MakeVectorDXDYDZ(0,1,0), 40, 35, 16) shell = MakeComplexSect(vs[3], geompy.MakeVectorDXDYDZ(0,1,0), 40, 35, 16)
shells.append(shell) shells.append(shell)
vs4 = geompy.SubShapeAllSorted(shell,geompy.ShapeType["VERTEX"]) vs4 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
locs.append(vs4[17]) locs.append(vs4[17])

View File

@ -136,7 +136,7 @@ compound = geompy.MakeCompound([box1, box2])
ImportFromBREP = geompy.ImportBREP(os.getenv("DATA_DIR")+"/Shapes/Brep/flight_solid.brep") ImportFromBREP = geompy.ImportBREP(os.getenv("DATA_DIR")+"/Shapes/Brep/flight_solid.brep")
# get a face # get a face
faces = geompy.SubShapeAllSorted(ImportFromBREP, geompy.ShapeType["FACE"]) faces = geompy.SubShapeAllSortedCentres(ImportFromBREP, geompy.ShapeType["FACE"])
# get the free boundary for face 32 # get the free boundary for face 32
Res = geompy.GetFreeBoundary(faces[32]) Res = geompy.GetFreeBoundary(faces[32])
@ -223,7 +223,7 @@ cut = geompy.MakeCut(cone, cylinder)
# get faces as sub-shapes # get faces as sub-shapes
faces = [] faces = []
faces = geompy.SubShapeAllSorted(cut, geompy.ShapeType["FACE"]) faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"])
f_2 = geompy.GetSubShapeID(cut, faces[0]) f_2 = geompy.GetSubShapeID(cut, faces[0])
# remove one face from the shape # remove one face from the shape
@ -234,7 +234,7 @@ result = geompy.GetFreeFacesIDs(cut_without_f_2)
print "A number of free faces is ", len(result) print "A number of free faces is ", len(result)
# add objects in the study # add objects in the study
all_faces = geompy.SubShapeAllSorted(cut_without_f_2, geompy.ShapeType["FACE"]) all_faces = geompy.SubShapeAllSortedCentres(cut_without_f_2, geompy.ShapeType["FACE"])
for face in all_faces : for face in all_faces :
sub_shape_id = geompy.GetSubShapeID(cut_without_f_2, face) sub_shape_id = geompy.GetSubShapeID(cut_without_f_2, face)
if result.count(sub_shape_id) > 0 : if result.count(sub_shape_id) > 0 :

View File

@ -65,7 +65,7 @@ box = geompy.MakeBoxDXDYDZ(200, 200, 200)
# The list of IDs (IDList) for suppress faces # The list of IDs (IDList) for suppress faces
sup_faces = [] sup_faces = []
sup_faces = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"]) sup_faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"])
# get indices of the sub-shape # get indices of the sub-shape
f1_id = geompy.GetSubShapeID(box, sup_faces[3]) f1_id = geompy.GetSubShapeID(box, sup_faces[3])
@ -182,7 +182,7 @@ cut = geompy.MakeCut(cone, cylinder)
# get faces as sub-shapes # get faces as sub-shapes
faces = [] faces = []
faces = geompy.SubShapeAllSorted(cut, geompy.ShapeType["FACE"]) faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"])
f_2 = geompy.GetSubShapeID(cut, faces[2]) f_2 = geompy.GetSubShapeID(cut, faces[2])
# remove one face from the shape # remove one face from the shape
@ -190,7 +190,7 @@ cut_without_f_2 = geompy.SuppressFaces(cut, [f_2])
# get wires as sub-shapes # get wires as sub-shapes
wires = [] wires = []
wires = geompy.SubShapeAllSorted(cut_without_f_2, geompy.ShapeType["WIRE"]) wires = geompy.SubShapeAllSortedCentres(cut_without_f_2, geompy.ShapeType["WIRE"])
w_0 = geompy.GetSubShapeID(cut_without_f_2, wires[0]) w_0 = geompy.GetSubShapeID(cut_without_f_2, wires[0])
# suppress the selected wire # suppress the selected wire
@ -308,12 +308,12 @@ divide = geompy.DivideEdge(edge, -1, 0.5, 0)
# add objects in the study # add objects in the study
id_edge = geompy.addToStudy(edge, "Edge") id_edge = geompy.addToStudy(edge, "Edge")
edge_points = geompy.SubShapeAllSorted(edge, geompy.ShapeType["VERTEX"]) edge_points = geompy.SubShapeAllSortedCentres(edge, geompy.ShapeType["VERTEX"])
for point in edge_points: for point in edge_points:
geompy.addToStudyInFather(edge, point, "Edge's point") geompy.addToStudyInFather(edge, point, "Edge's point")
id_divide = geompy.addToStudy(divide, "Divided edge") id_divide = geompy.addToStudy(divide, "Divided edge")
edge_points = geompy.SubShapeAllSorted(divide, geompy.ShapeType["VERTEX"]) edge_points = geompy.SubShapeAllSortedCentres(divide, geompy.ShapeType["VERTEX"])
for point in edge_points: for point in edge_points:
geompy.addToStudyInFather(divide, point, "Edge's point after divide") geompy.addToStudyInFather(divide, point, "Edge's point after divide")

View File

@ -88,7 +88,7 @@
\until "freeFacesWithoutExtra" \until "freeFacesWithoutExtra"
\anchor swig_GetSharedShapes \anchor swig_GetSharedShapes
\until "sharedFace" \until "sharedEdge_"
\anchor swig_CheckAndImprove \anchor swig_CheckAndImprove
\until "blocksComp" \until "blocksComp"

View File

@ -381,7 +381,7 @@ gg = salome.ImportComponentGUI("GEOM")
# create box # create box
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
# take box edges to create custom complex wire # take box edges to create custom complex wire
[Edge_1,Edge_2,Edge_3,Edge_4,Edge_5,Edge_6,Edge_7,Edge_8,Edge_9,Edge_10,Edge_11,Edge_12] = geompy.SubShapeAllSorted(Box_1, geompy.ShapeType["EDGE"]) [Edge_1,Edge_2,Edge_3,Edge_4,Edge_5,Edge_6,Edge_7,Edge_8,Edge_9,Edge_10,Edge_11,Edge_12] = geompy.SubShapeAllSortedCentres(Box_1, geompy.ShapeType["EDGE"])
# create wire # create wire
Wire_1 = geompy.MakeWire([Edge_12, Edge_7, Edge_11, Edge_6, Edge_1,Edge_4]) Wire_1 = geompy.MakeWire([Edge_12, Edge_7, Edge_11, Edge_6, Edge_1,Edge_4])
# make fillet at given wire vertices with giver radius # make fillet at given wire vertices with giver radius
@ -424,7 +424,7 @@ face = geompy.MakeFace(wire, 1)
prism = geompy.MakePrismVecH(face, vz, 100.0) prism = geompy.MakePrismVecH(face, vz, 100.0)
# get the list of IDs (IDList) for the fillet # get the list of IDs (IDList) for the fillet
prism_edges = geompy.SubShapeAllSorted(prism, ShapeTypeEdge) prism_edges = geompy.SubShapeAllSortedCentres(prism, ShapeTypeEdge)
IDlist_e = [] IDlist_e = []
IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[0])) IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[0]))
IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[1])) IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[1]))
@ -482,7 +482,7 @@ face = geompy.MakeFace(wire, 1)
prism = geompy.MakePrismVecH(face, vz, 100.0) prism = geompy.MakePrismVecH(face, vz, 100.0)
# get the list of IDs (IDList) for the chamfer # get the list of IDs (IDList) for the chamfer
prism_faces = geompy.SubShapeAllSorted(prism, ShapeTypeFace) prism_faces = geompy.SubShapeAllSortedCentres(prism, ShapeTypeFace)
f_ind_1 = geompy.GetSubShapeID(prism, prism_faces[0]) f_ind_1 = geompy.GetSubShapeID(prism, prism_faces[0])
f_ind_2 = geompy.GetSubShapeID(prism, prism_faces[1]) f_ind_2 = geompy.GetSubShapeID(prism, prism_faces[1])
IDlist_f = [f_ind_1, f_ind_2] IDlist_f = [f_ind_1, f_ind_2]

View File

@ -20,7 +20,7 @@ Box = geompy.MakeBoxTwoPnt(p0, p200)
group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"]) group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
# add objects to the group # add objects to the group
SubFaceList = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"]) SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
for i in [0, 3, 5] : for i in [0, 3, 5] :
FaceID = geompy.GetSubShapeID(Box, SubFaceList[i]) FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
geompy.AddObject(group, FaceID) geompy.AddObject(group, FaceID)
@ -60,7 +60,7 @@ Box = geompy.MakeBoxTwoPnt(p0, p200)
group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"]) group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
# add objects to the group # add objects to the group
SubFaceList = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"]) SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
for i in [0, 3, 5] : for i in [0, 3, 5] :
FaceID = geompy.GetSubShapeID(Box, SubFaceList[i]) FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
geompy.AddObject(group, FaceID) geompy.AddObject(group, FaceID)
@ -89,7 +89,7 @@ Box = geompy.MakeBoxTwoPnt(p0, p200)
group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"]) group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
# add objects to the group # add objects to the group
SubFaceList = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"]) SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
for i in [0, 3, 5] : for i in [0, 3, 5] :
FaceID = geompy.GetSubShapeID(Box, SubFaceList[i]) FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
geompy.AddObject(group, FaceID) geompy.AddObject(group, FaceID)
@ -107,4 +107,4 @@ gg.createAndDisplayGO(id_group1)
salome.sg.updateObjBrowser(1) salome.sg.updateObjBrowser(1)
\endcode \endcode
*/ */

View File

@ -1391,12 +1391,7 @@ module GEOM
in ListOfGO theFaces, in boolean doKeepNonSolids); in ListOfGO theFaces, in boolean doKeepNonSolids);
/*! /*!
* Explode a shape on subshapes of a given type. * Deprecated method. Use MakeAllSubShapes() instead.
* \param theShape Shape to be exploded.
* \param theShapeType Type of sub-shapes to be retrieved.
* \param isSorted If this parameter is TRUE, sub-shapes will be
* sorted by coordinates of their gravity centers.
* \return List of sub-shapes of type theShapeType, contained in theShape.
*/ */
ListOfGO MakeExplode (in GEOM_Object theShape, ListOfGO MakeExplode (in GEOM_Object theShape,
in long theShapeType, in long theShapeType,
@ -1404,17 +1399,36 @@ module GEOM
/*! /*!
* Explode a shape on subshapes of a given type. * Explode a shape on subshapes of a given type.
* Does the same, as the above method, but returns IDs of sub-shapes, * \param theShape Shape to be exploded.
* not GEOM_Objects. It works faster. * \param theShapeType Type of sub-shapes to be retrieved.
* \param isSorted If this parameter is TRUE, sub-shapes will be
* sorted by coordinates of their gravity centers.
* \return List of sub-shapes of type theShapeType, contained in theShape.
*/
ListOfGO MakeAllSubShapes (in GEOM_Object theShape,
in long theShapeType,
in boolean isSorted);
/*!
* Deprecated method. Use GetAllSubShapesIDs() instead.
*/
ListOfLong SubShapeAllIDs (in GEOM_Object theShape,
in long theShapeType,
in boolean isSorted);
/*!
* Explode a shape on subshapes of a given type.
* Does the same, as MakeAllSubShapes, but returns IDs of
* sub-shapes, not GEOM_Objects. It works faster.
* \param theShape Shape to be exploded. * \param theShape Shape to be exploded.
* \param theShapeType Type of sub-shapes to be retrieved. * \param theShapeType Type of sub-shapes to be retrieved.
* \param isSorted If this parameter is TRUE, sub-shapes will be * \param isSorted If this parameter is TRUE, sub-shapes will be
* sorted by coordinates of their gravity centers. * sorted by coordinates of their gravity centers.
* \return List of IDs of sub-shapes of type theShapeType, contained in theShape. * \return List of IDs of sub-shapes of type theShapeType, contained in theShape.
*/ */
ListOfLong SubShapeAllIDs (in GEOM_Object theShape, ListOfLong GetAllSubShapesIDs (in GEOM_Object theShape,
in long theShapeType, in long theShapeType,
in boolean isSorted); in boolean isSorted);
/*! /*!
* Get a sub shape defined by its unique ID inside \a theMainShape * Get a sub shape defined by its unique ID inside \a theMainShape
@ -1502,6 +1516,15 @@ module GEOM
in GEOM_Object theShape2, in GEOM_Object theShape2,
in long theShapeType); in long theShapeType);
/*!
* Get all sub-shapes, shared by all shapes in the list \a theShapes.
* \param theShapes Shapes to find common sub-shapes of.
* \param theShapeType Type of sub-shapes to be retrieved.
* \return List of objects, that are sub-shapes of all given shapes.
*/
ListOfGO GetSharedShapesMulti (in ListOfGO theShapes,
in long theShapeType);
/*! /*!
* Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
* the specified plane by the certain way, defined through \a theState parameter. * the specified plane by the certain way, defined through \a theState parameter.

View File

@ -140,6 +140,7 @@ select1.png \
sewing.png \ sewing.png \
shading.png \ shading.png \
shapesonshape.png \ shapesonshape.png \
shared_shapes.png \
sketch.png \ sketch.png \
sphere.png \ sphere.png \
spheredxyz.png \ spheredxyz.png \

BIN
resources/shared_shapes.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

View File

@ -19,11 +19,10 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// File : EntityGUI_SubShapeDlg.cxx // File : EntityGUI_SubShapeDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
//
#include "EntityGUI_SubShapeDlg.h" #include "EntityGUI_SubShapeDlg.h"
#include <DlgRef.h> #include <DlgRef.h>
@ -560,7 +559,7 @@ bool EntityGUI_SubShapeDlg::isValid (QString& msg)
bool EntityGUI_SubShapeDlg::execute (ObjectList& objects) bool EntityGUI_SubShapeDlg::execute (ObjectList& objects)
{ {
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation()); GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
GEOM::ListOfGO_var aList = anOper->MakeExplode(myObject, shapeType(), true); GEOM::ListOfGO_var aList = anOper->MakeAllSubShapes(myObject, shapeType(), true);
if (!aList->length()) if (!aList->length())
return false; return false;

View File

@ -1062,9 +1062,13 @@
<translation>planeWorking.png</translation> <translation>planeWorking.png</translation>
</message> </message>
<message> <message>
<source>ICO_GET_SHAPES_ON_SHAPES</source> <source>ICO_GET_SHAPES_ON_SHAPE</source>
<translation>shapesonshape.png</translation> <translation>shapesonshape.png</translation>
</message> </message>
<message>
<source>ICO_GET_SHARED_SHAPES</source>
<translation>shared_shapes.png</translation>
</message>
<message> <message>
<source>ICON_DLG_POINT_FACE</source> <source>ICON_DLG_POINT_FACE</source>
<translation>pointonface.png</translation> <translation>pointonface.png</translation>
@ -1073,6 +1077,10 @@
<source>ICON_DLG_SHAPES_ON_SHAPE</source> <source>ICON_DLG_SHAPES_ON_SHAPE</source>
<translation>shapesonshape.png</translation> <translation>shapesonshape.png</translation>
</message> </message>
<message>
<source>ICON_DLG_SHARED_SHAPES</source>
<translation>shared_shapes.png</translation>
</message>
<message> <message>
<source>ICON_DLG_SCALE_ALONG_AXES</source> <source>ICON_DLG_SCALE_ALONG_AXES</source>
<translation>scale_along_axes.png</translation> <translation>scale_along_axes.png</translation>

View File

@ -1737,7 +1737,7 @@ Please, select face, shell or solid and try again</translation>
</message> </message>
<message> <message>
<source>GEOM_SUBSHAPE_TYPE</source> <source>GEOM_SUBSHAPE_TYPE</source>
<translation>Sub Shapes Type :</translation> <translation>Sub Shapes Type</translation>
</message> </message>
<message> <message>
<source>GEOM_SUB_SHAPE</source> <source>GEOM_SUB_SHAPE</source>
@ -3992,17 +3992,29 @@ Please, select face, shell or solid and try again</translation>
<translation>INOUT</translation> <translation>INOUT</translation>
</message> </message>
<message> <message>
<source>TOP_GET_SHAPES_ON_SHAPES</source> <source>TOP_GET_SHAPES_ON_SHAPE</source>
<translation>Get shapes on shape</translation> <translation>Get shapes on shape</translation>
</message> </message>
<message> <message>
<source>MEN_GET_SHAPES_ON_SHAPES</source> <source>MEN_GET_SHAPES_ON_SHAPE</source>
<translation>Get Shapes on Shape</translation> <translation>Get Shapes on Shape</translation>
</message> </message>
<message> <message>
<source>STB_GET_SHAPES_ON_SHAPES</source> <source>STB_GET_SHAPES_ON_SHAPE</source>
<translation>Get shapes on shape</translation> <translation>Get shapes on shape</translation>
</message> </message>
<message>
<source>TOP_GET_SHARED_SHAPES</source>
<translation>Get shared shapes</translation>
</message>
<message>
<source>MEN_GET_SHARED_SHAPES</source>
<translation>Get Shared Shapes</translation>
</message>
<message>
<source>STB_GET_SHARED_SHAPES</source>
<translation>Get shared shapes</translation>
</message>
<message> <message>
<source>GEOM_PUBLISH_RESULT_GRP</source> <source>GEOM_PUBLISH_RESULT_GRP</source>
<translation>Advanced options</translation> <translation>Advanced options</translation>
@ -4513,6 +4525,29 @@ Would you like to continue?</translation>
<translation>Load Texture</translation> <translation>Load Texture</translation>
</message> </message>
</context> </context>
<context>
<name>OperationGUI_GetSharedShapesDlg</name>
<message>
<source>GEOM_SHARED_SHAPES_TITLE</source>
<translation>Get Shared Shapes</translation>
</message>
<message>
<source>GEOM_GET_SHARED_SHAPES</source>
<translation>Shared shapes</translation>
</message>
<message>
<source>GEOM_SHARED_SHAPES_INPUT</source>
<translation>Input data</translation>
</message>
<message>
<source>MSG_SHARED_SHAPES_TOO_FEW_SHAPES</source>
<translation>To few shapes selected.</translation>
</message>
<message>
<source>GEOM_SHARED_SHAPE</source>
<translation>Shared_%1</translation>
</message>
</context>
<context> <context>
<name>AdvancedGUI_PipeTShapeDlg</name> <name>AdvancedGUI_PipeTShapeDlg</name>
<message> <message>

View File

@ -19,11 +19,10 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// File : GeometryGUI.cxx // File : GeometryGUI.cxx
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
//
#include <Standard_math.hxx> // E.A. must be included before Python.h to fix compilation on windows #include <Standard_math.hxx> // E.A. must be included before Python.h to fix compilation on windows
#include "Python.h" #include "Python.h"
#include "GeometryGUI.h" #include "GeometryGUI.h"
@ -342,12 +341,12 @@ void GeometryGUI::OnGUIEvent( int id )
// fix for IPAL8958 - allow some commands to execute even when NO viewer is active (rename for example) // fix for IPAL8958 - allow some commands to execute even when NO viewer is active (rename for example)
QList<int> NotViewerDependentCommands; QList<int> NotViewerDependentCommands;
NotViewerDependentCommands << GEOMOp::OpRename NotViewerDependentCommands << GEOMOp::OpRename
<< GEOMOp::OpDelete << GEOMOp::OpDelete
<< GEOMOp::OpShow << GEOMOp::OpShow
<< GEOMOp::OpShowOnly << GEOMOp::OpShowOnly
<< GEOMOp::OpShowChildren << GEOMOp::OpShowChildren
<< GEOMOp::OpHideChildren << GEOMOp::OpHideChildren
<< GEOMOp::OpPointMarker; << GEOMOp::OpPointMarker;
if ( !ViewOCC && !ViewVTK && !NotViewerDependentCommands.contains( id ) ) if ( !ViewOCC && !ViewVTK && !NotViewerDependentCommands.contains( id ) )
return; return;
@ -460,6 +459,7 @@ void GeometryGUI::OnGUIEvent( int id )
case GEOMOp::OpShapesOnShape: // MENU OPERATION - GET SHAPES ON SHAPE case GEOMOp::OpShapesOnShape: // MENU OPERATION - GET SHAPES ON SHAPE
case GEOMOp::OpFillet2d: // MENU OPERATION - FILLET 2D case GEOMOp::OpFillet2d: // MENU OPERATION - FILLET 2D
case GEOMOp::OpFillet1d: // MENU OPERATION - FILLET 1D case GEOMOp::OpFillet1d: // MENU OPERATION - FILLET 1D
case GEOMOp::OpSharedShapes: // MENU OPERATION - GET SHARED SHAPES
libName = "OperationGUI"; libName = "OperationGUI";
break; break;
case GEOMOp::OpSewing: // MENU REPAIR - SEWING case GEOMOp::OpSewing: // MENU REPAIR - SEWING
@ -575,14 +575,14 @@ void GeometryGUI::createGeomAction( const int id, const QString& label, const QS
QPixmap icon = icolabel.isEmpty() ? resMgr->loadPixmap( "GEOM", tr( (QString( "ICO_" )+label).toLatin1().constData() ), false ) QPixmap icon = icolabel.isEmpty() ? resMgr->loadPixmap( "GEOM", tr( (QString( "ICO_" )+label).toLatin1().constData() ), false )
: resMgr->loadPixmap( "GEOM", tr( icolabel.toLatin1().constData() ) ); : resMgr->loadPixmap( "GEOM", tr( icolabel.toLatin1().constData() ) );
createAction( id, createAction( id,
tr( QString( "TOP_%1" ).arg( label ).toLatin1().constData() ), tr( QString( "TOP_%1" ).arg( label ).toLatin1().constData() ),
icon, icon,
tr( QString( "MEN_%1" ).arg( label ).toLatin1().constData() ), tr( QString( "MEN_%1" ).arg( label ).toLatin1().constData() ),
tr( QString( "STB_%1" ).arg( label ).toLatin1().constData() ), tr( QString( "STB_%1" ).arg( label ).toLatin1().constData() ),
accel, accel,
application()->desktop(), application()->desktop(),
toggle, toggle,
this, SLOT( OnGUIEvent() ) ); this, SLOT( OnGUIEvent() ) );
} }
@ -663,7 +663,8 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( GEOMOp::OpFillet3d, "FILLET" ); createGeomAction( GEOMOp::OpFillet3d, "FILLET" );
createGeomAction( GEOMOp::OpChamfer, "CHAMFER" ); createGeomAction( GEOMOp::OpChamfer, "CHAMFER" );
//createGeomAction( GEOMOp::OpClipping, "CLIPPING" ); //createGeomAction( GEOMOp::OpClipping, "CLIPPING" );
createGeomAction( GEOMOp::OpShapesOnShape, "GET_SHAPES_ON_SHAPES" ); createGeomAction( GEOMOp::OpShapesOnShape, "GET_SHAPES_ON_SHAPE" );
createGeomAction( GEOMOp::OpSharedShapes, "GET_SHARED_SHAPES" );
createGeomAction( GEOMOp::OpFillet1d, "FILLET_1D" ); createGeomAction( GEOMOp::OpFillet1d, "FILLET_1D" );
createGeomAction( GEOMOp::OpFillet2d, "FILLET_2D" ); createGeomAction( GEOMOp::OpFillet2d, "FILLET_2D" );
@ -732,7 +733,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( GEOMOp::OpShowChildren, "POP_SHOW_CHILDREN" ); createGeomAction( GEOMOp::OpShowChildren, "POP_SHOW_CHILDREN" );
createGeomAction( GEOMOp::OpHideChildren, "POP_HIDE_CHILDREN" ); createGeomAction( GEOMOp::OpHideChildren, "POP_HIDE_CHILDREN" );
createGeomAction( GEOMOp::OpPointMarker, "POP_POINT_MARKER" ); createGeomAction( GEOMOp::OpPointMarker, "POP_POINT_MARKER" );
createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" ); createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" );
// createGeomAction( GEOMOp::OpPipeTShapeGroups, "PIPETSHAPEGROUPS" ); // createGeomAction( GEOMOp::OpPipeTShapeGroups, "PIPETSHAPEGROUPS" );
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@// //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
@ -840,6 +841,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createMenu( GEOMOp::OpPartition, operId, -1 ); createMenu( GEOMOp::OpPartition, operId, -1 );
createMenu( GEOMOp::OpArchimede, operId, -1 ); createMenu( GEOMOp::OpArchimede, operId, -1 );
createMenu( GEOMOp::OpShapesOnShape, operId, -1 ); createMenu( GEOMOp::OpShapesOnShape, operId, -1 );
createMenu( GEOMOp::OpSharedShapes, operId, -1 );
createMenu( separator(), operId, -1 ); createMenu( separator(), operId, -1 );
@ -970,6 +972,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createTool( GEOMOp::OpPartition, operTbId ); createTool( GEOMOp::OpPartition, operTbId );
createTool( GEOMOp::OpArchimede, operTbId ); createTool( GEOMOp::OpArchimede, operTbId );
createTool( GEOMOp::OpShapesOnShape, operTbId ); createTool( GEOMOp::OpShapesOnShape, operTbId );
createTool( GEOMOp::OpSharedShapes, operTbId );
createTool( separator(), operTbId ); createTool( separator(), operTbId );
createTool( GEOMOp::OpFillet1d, operTbId ); createTool( GEOMOp::OpFillet1d, operTbId );
createTool( GEOMOp::OpFillet2d, operTbId ); createTool( GEOMOp::OpFillet2d, operTbId );
@ -1174,7 +1177,7 @@ bool GeometryGUI::activateModule( SUIT_Study* study )
SALOME_ListIO selected; SALOME_ListIO selected;
sm->selectedObjects( selected ); sm->selectedObjects( selected );
sm->clearSelected(); sm->clearSelected();
// disable OCC selectors // disable OCC selectors
getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() ); getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() );
QListIterator<GEOMGUI_OCCSelector*> itOCCSel( myOCCSelectors ); QListIterator<GEOMGUI_OCCSelector*> itOCCSel( myOCCSelectors );
@ -1423,7 +1426,7 @@ void GeometryGUI::createPreferences()
setPreferenceProperty( genGroup, "columns", 2 ); setPreferenceProperty( genGroup, "columns", 2 );
int dispmode = addPreference( tr( "PREF_DISPLAY_MODE" ), genGroup, int dispmode = addPreference( tr( "PREF_DISPLAY_MODE" ), genGroup,
LightApp_Preferences::Selector, LightApp_Preferences::Selector,
"Geometry", "display_mode" ); "Geometry", "display_mode" );
addPreference( tr( "PREF_SHADING_COLOR" ), genGroup, addPreference( tr( "PREF_SHADING_COLOR" ), genGroup,
@ -1449,36 +1452,36 @@ void GeometryGUI::createPreferences()
int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup, int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup,
LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" ); LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" );
// Quantities with individual precision settings // Quantities with individual precision settings
int precGroup = addPreference( tr( "GEOM_PREF_GROUP_PRECISION" ), tabId ); int precGroup = addPreference( tr( "GEOM_PREF_GROUP_PRECISION" ), tabId );
setPreferenceProperty( precGroup, "columns", 2 ); setPreferenceProperty( precGroup, "columns", 2 );
const int nbQuantities = 8; const int nbQuantities = 8;
int prec[nbQuantities], ii = 0; int prec[nbQuantities], ii = 0;
prec[ii++] = addPreference( tr( "GEOM_PREF_length_precision" ), precGroup, prec[ii++] = addPreference( tr( "GEOM_PREF_length_precision" ), precGroup,
LightApp_Preferences::IntSpin, "Geometry", "length_precision" ); LightApp_Preferences::IntSpin, "Geometry", "length_precision" );
prec[ii++] = addPreference( tr( "GEOM_PREF_angle_precision" ), precGroup, prec[ii++] = addPreference( tr( "GEOM_PREF_angle_precision" ), precGroup,
LightApp_Preferences::IntSpin, "Geometry", "angle_precision" ); LightApp_Preferences::IntSpin, "Geometry", "angle_precision" );
prec[ii++] = addPreference( tr( "GEOM_PREF_len_tol_precision" ), precGroup, prec[ii++] = addPreference( tr( "GEOM_PREF_len_tol_precision" ), precGroup,
LightApp_Preferences::IntSpin, "Geometry", "len_tol_precision" ); LightApp_Preferences::IntSpin, "Geometry", "len_tol_precision" );
prec[ii++] = addPreference( tr( "GEOM_PREF_ang_tol_precision" ), precGroup, prec[ii++] = addPreference( tr( "GEOM_PREF_ang_tol_precision" ), precGroup,
LightApp_Preferences::IntSpin, "Geometry", "ang_tol_precision" ); LightApp_Preferences::IntSpin, "Geometry", "ang_tol_precision" );
prec[ii++] = addPreference( tr( "GEOM_PREF_weight_precision" ), precGroup, prec[ii++] = addPreference( tr( "GEOM_PREF_weight_precision" ), precGroup,
LightApp_Preferences::IntSpin, "Geometry", "weight_precision" ); LightApp_Preferences::IntSpin, "Geometry", "weight_precision" );
prec[ii++] = addPreference( tr( "GEOM_PREF_density_precision" ), precGroup, prec[ii++] = addPreference( tr( "GEOM_PREF_density_precision" ), precGroup,
LightApp_Preferences::IntSpin, "Geometry", "density_precision" ); LightApp_Preferences::IntSpin, "Geometry", "density_precision" );
prec[ii++] = addPreference( tr( "GEOM_PREF_parametric_precision" ), precGroup, prec[ii++] = addPreference( tr( "GEOM_PREF_parametric_precision" ), precGroup,
LightApp_Preferences::IntSpin, "Geometry", "parametric_precision" ); LightApp_Preferences::IntSpin, "Geometry", "parametric_precision" );
prec[ii ] = addPreference( tr( "GEOM_PREF_param_tol_precision" ), precGroup, prec[ii ] = addPreference( tr( "GEOM_PREF_param_tol_precision" ), precGroup,
LightApp_Preferences::IntSpin, "Geometry", "param_tol_precision" ); LightApp_Preferences::IntSpin, "Geometry", "param_tol_precision" );
// Set property for precision value for spinboxes // Set property for precision value for spinboxes
for ( ii = 0; ii < nbQuantities; ii++ ){ for ( ii = 0; ii < nbQuantities; ii++ ){
setPreferenceProperty( prec[ii], "min", -14 ); setPreferenceProperty( prec[ii], "min", -14 );
setPreferenceProperty( prec[ii], "max", 14 ); setPreferenceProperty( prec[ii], "max", 14 );
setPreferenceProperty( prec[ii], "precision", 2 ); setPreferenceProperty( prec[ii], "precision", 2 );
} }
int VertexGroup = addPreference( tr( "PREF_GROUP_VERTEX" ), tabId ); int VertexGroup = addPreference( tr( "PREF_GROUP_VERTEX" ), tabId );
setPreferenceProperty( VertexGroup, "columns", 2 ); setPreferenceProperty( VertexGroup, "columns", 2 );

View File

@ -16,10 +16,9 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : GeometryGUI_Operations.h // File : GeometryGUI_Operations.h
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
//
#ifndef GEOMETRYGUI_OPERATIONS_H #ifndef GEOMETRYGUI_OPERATIONS_H
#define GEOMETRYGUI_OPERATIONS_H #define GEOMETRYGUI_OPERATIONS_H
@ -117,6 +116,7 @@ namespace GEOMOp {
OpFillet2d = 3705, // MENU OPERATION - FILLET 2D OpFillet2d = 3705, // MENU OPERATION - FILLET 2D
OpFillet1d = 3706, // MENU OPERATION - FILLET 1D OpFillet1d = 3706, // MENU OPERATION - FILLET 1D
OpClipping = 3707, // MENU OPERATION - CLIPPING RANGE OpClipping = 3707, // MENU OPERATION - CLIPPING RANGE
OpSharedShapes = 3708, // MENU OPERATION - GET SHARED SHAPES
// RepairGUI -----------------//-------------------------------- // RepairGUI -----------------//--------------------------------
OpSewing = 4000, // MENU REPAIR - SEWING OpSewing = 4000, // MENU REPAIR - SEWING
OpSuppressFaces = 4001, // MENU REPAIR - SUPPRESS FACES OpSuppressFaces = 4001, // MENU REPAIR - SUPPRESS FACES

View File

@ -19,13 +19,12 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : GEOMImpl_IShapesOperations.cxx // File : GEOMImpl_IShapesOperations.cxx
// Created : // Created :
// Author : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007 // Author : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007
// Project : SALOME // Project : SALOME
// $Header$ // $Header$
//
#include <Standard_Stream.hxx> #include <Standard_Stream.hxx>
#include "GEOMImpl_IShapesOperations.hxx" #include "GEOMImpl_IShapesOperations.hxx"
@ -811,7 +810,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList
Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode
(Handle(GEOM_Object) theShape, (Handle(GEOM_Object) theShape,
const Standard_Integer theShapeType, const Standard_Integer theShapeType,
const Standard_Boolean isSorted) const Standard_Boolean isSorted,
const Standard_Boolean isOldSorting)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -853,7 +853,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode
} }
if (isSorted) if (isSorted)
SortShapes(listShape); SortShapes(listShape, isOldSorting);
TopTools_IndexedMapOfShape anIndices; TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes(aShape, anIndices); TopExp::MapShapes(aShape, anIndices);
@ -899,7 +899,10 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode
GEOM::TPythonDump pd (aMainShape, /*append=*/true); GEOM::TPythonDump pd (aMainShape, /*append=*/true);
pd << "[" << anAsciiList.ToCString(); pd << "[" << anAsciiList.ToCString();
pd << "] = geompy.SubShapeAll" << (isSorted ? "Sorted(" : "("); if (isSorted)
pd << "] = geompy.SubShapeAllSorted" << (isOldSorting ? "(" : "Centres(");
else
pd << "] = geompy.SubShapeAll(";
pd << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")"; pd << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")";
SetErrorCode(OK); SetErrorCode(OK);
@ -915,7 +918,8 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode
Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs
(Handle(GEOM_Object) theShape, (Handle(GEOM_Object) theShape,
const Standard_Integer theShapeType, const Standard_Integer theShapeType,
const Standard_Boolean isSorted) const Standard_Boolean isSorted,
const Standard_Boolean isOldSorting)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -954,7 +958,7 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs
} }
if (isSorted) if (isSorted)
SortShapes(listShape); SortShapes(listShape, isOldSorting);
TopTools_IndexedMapOfShape anIndices; TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes(aShape, anIndices); TopExp::MapShapes(aShape, anIndices);
@ -971,7 +975,10 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs
//Make a Python command //Make a Python command
GEOM::TPythonDump pd (aFunction, /*append=*/true); GEOM::TPythonDump pd (aFunction, /*append=*/true);
pd << "listSubShapeIDs = geompy.SubShapeAll"; pd << "listSubShapeIDs = geompy.SubShapeAll";
pd << (isSorted ? "SortedIDs(" : "IDs("); if (isSorted)
pd << "Sorted" << (isOldSorting ? "IDs(" : "CentresIDs(");
else
pd << "IDs(";
pd << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")"; pd << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")";
SetErrorCode(OK); SetErrorCode(OK);
@ -1413,6 +1420,112 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetSharedShapes
return aSeq; return aSeq;
} }
//=======================================================================
//function : GetSharedShapes
//purpose :
//=======================================================================
Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetSharedShapes
(std::list<Handle(GEOM_Object)> theShapes,
const Standard_Integer theShapeType)
{
SetErrorCode(KO);
int aLen = theShapes.size();
if (aLen < 1) return NULL;
int ind = 1;
std::list<Handle(GEOM_Object)>::iterator it = theShapes.begin();
Handle(GEOM_Object) aMainObj = (*it++);
Handle(GEOM_Function) aMainShape = aMainObj->GetLastFunction();
if (aMainShape.IsNull()) {
SetErrorCode("NULL shape for GetSharedShapes");
return NULL;
}
TopoDS_Shape aShape1 = aMainShape->GetValue();
if (aShape1.IsNull()) return NULL;
TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes(aShape1, anIndices);
TopTools_IndexedMapOfShape mapSelected;
TopExp::MapShapes(aShape1, TopAbs_ShapeEnum(theShapeType), mapSelected);
// Find shared shapes
BRep_Builder B;
TopoDS_Compound aCurrSelection;
for (; it != theShapes.end(); it++, ind++) {
Handle(GEOM_Function) aRefShape = (*it)->GetLastFunction();
if (aRefShape.IsNull()) {
SetErrorCode("NULL shape for GetSharedShapes");
return NULL;
}
TopoDS_Compound aCompound;
B.MakeCompound(aCompound);
TopoDS_Shape aShape2 = aRefShape->GetValue();
if (aShape2.IsNull()) return NULL;
TopTools_MapOfShape mapShape2;
TopExp_Explorer exp (aShape2, TopAbs_ShapeEnum(theShapeType));
for (; exp.More(); exp.Next()) {
TopoDS_Shape aSS = exp.Current();
if (mapShape2.Add(aSS) && mapSelected.Contains(aSS)) {
B.Add(aCompound, aSS);
}
}
mapSelected.Clear();
TopExp::MapShapes(aCompound, TopAbs_ShapeEnum(theShapeType), mapSelected);
aCurrSelection = aCompound;
}
// Create GEOM_Object for each found shared shape (collected in aCurrSelection)
Handle(GEOM_Object) anObj;
Handle(TColStd_HArray1OfInteger) anArray;
Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
TCollection_AsciiString anAsciiList, anEntry;
TopoDS_Iterator itSel (aCurrSelection, Standard_True, Standard_True);
for (; itSel.More(); itSel.Next()) {
anArray = new TColStd_HArray1OfInteger(1,1);
anArray->SetValue(1, anIndices.FindIndex(itSel.Value()));
anObj = GetEngine()->AddSubShape(aMainObj, anArray);
aSeq->Append(anObj);
// for python command
TDF_Tool::Entry(anObj->GetEntry(), anEntry);
anAsciiList += anEntry;
anAsciiList += ",";
}
if (aSeq->IsEmpty()) {
SetErrorCode("The given shapes have no shared sub-shapes of the requested type");
return aSeq;
}
// Make a Python command
anAsciiList.Trunc(anAsciiList.Length() - 1);
GEOM::TPythonDump pd (aMainShape, /*append=*/true);
pd << "[" << anAsciiList.ToCString()
<< "] = geompy.GetSharedShapesMulti([";
it = theShapes.begin();
pd << (*it++);
while (it != theShapes.end()) {
pd << ", " << (*it++);
}
pd << "], " << TopAbs_ShapeEnum(theShapeType) << ")";
SetErrorCode(OK);
return aSeq;
}
//============================================================================= //=============================================================================
/*! /*!
* *
@ -2576,7 +2689,7 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetShapesOnCylind
aSeq = getShapesOnSurfaceIDs( aCylinder, aShape, aShapeType, theState ); aSeq = getShapesOnSurfaceIDs( aCylinder, aShape, aShapeType, theState );
// The GetShapesOnCylinder() doesn't change object so no new function is required. // The GetShapesOnCylinder() doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction = Handle(GEOM_Function) aFunction =
GEOM::GetCreatedLast(theShape, GEOM::GetCreatedLast(thePnt,theAxis))->GetLastFunction(); GEOM::GetCreatedLast(theShape, GEOM::GetCreatedLast(thePnt,theAxis))->GetLastFunction();
// Make a Python command // Make a Python command
@ -3373,7 +3486,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceByHistory
//function : SortShapes //function : SortShapes
//purpose : //purpose :
//======================================================================= //=======================================================================
void GEOMImpl_IShapesOperations::SortShapes(TopTools_ListOfShape& SL) void GEOMImpl_IShapesOperations::SortShapes(TopTools_ListOfShape& SL,
const Standard_Boolean isOldSorting)
{ {
Standard_Integer MaxShapes = SL.Extent(); Standard_Integer MaxShapes = SL.Extent();
TopTools_Array1OfShape aShapes (1,MaxShapes); TopTools_Array1OfShape aShapes (1,MaxShapes);
@ -3392,16 +3506,29 @@ void GEOMImpl_IShapesOperations::SortShapes(TopTools_ListOfShape& SL)
SL.Remove( it ); // == it.Next() SL.Remove( it ); // == it.Next()
aShapes(Index) = S; aShapes(Index) = S;
OrderInd.SetValue (Index, Index); OrderInd.SetValue (Index, Index);
if (S.ShapeType() == TopAbs_VERTEX) if (S.ShapeType() == TopAbs_VERTEX) {
{
GPoint = BRep_Tool::Pnt( TopoDS::Vertex( S )); GPoint = BRep_Tool::Pnt( TopoDS::Vertex( S ));
Length.SetValue( Index, (Standard_Real) S.Orientation()); Length.SetValue( Index, (Standard_Real) S.Orientation());
} }
else else {
{ // BEGIN: fix for Mantis issue 0020842
BRepGProp::LinearProperties (S, GPr); if (isOldSorting) {
BRepGProp::LinearProperties (S, GPr);
}
else {
if (S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) {
BRepGProp::LinearProperties (S, GPr);
}
else if (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL) {
BRepGProp::SurfaceProperties(S, GPr);
}
else {
BRepGProp::VolumeProperties(S, GPr);
}
}
// END: fix for Mantis issue 0020842
GPoint = GPr.CentreOfMass(); GPoint = GPr.CentreOfMass();
Length.SetValue( Index, GPr.Mass() ); Length.SetValue(Index, GPr.Mass());
} }
MidXYZ.SetValue(Index, MidXYZ.SetValue(Index,
GPoint.X()*999 + GPoint.Y()*99 + GPoint.Z()*0.9); GPoint.X()*999 + GPoint.Y()*99 + GPoint.Z()*0.9);

View File

@ -18,16 +18,15 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//============================================================================= //=============================================================================
// File : GEOMImpl_IShapesOperations.hxx // File : GEOMImpl_IShapesOperations.hxx
// Created : // Created :
// Author : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007 // Author : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007
// Project : SALOME // Project : SALOME
// $Header$ // $Header$
//============================================================================= //=============================================================================
//
#ifndef _GEOMImpl_IShapesOperations_HXX_ #ifndef _GEOMImpl_IShapesOperations_HXX_
#define _GEOMImpl_IShapesOperations_HXX_ #define _GEOMImpl_IShapesOperations_HXX_
@ -55,7 +54,7 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
Standard_EXPORT ~GEOMImpl_IShapesOperations(); Standard_EXPORT ~GEOMImpl_IShapesOperations();
Standard_EXPORT Handle(GEOM_Object) MakeEdge (Handle(GEOM_Object) thePoint1, Standard_EXPORT Handle(GEOM_Object) MakeEdge (Handle(GEOM_Object) thePoint1,
Handle(GEOM_Object) thePoint2); Handle(GEOM_Object) thePoint2);
Standard_EXPORT Handle(GEOM_Object) MakeWire (std::list<Handle(GEOM_Object)> theEdgesAndWires, Standard_EXPORT Handle(GEOM_Object) MakeWire (std::list<Handle(GEOM_Object)> theEdgesAndWires,
const Standard_Real theTolerance); const Standard_Real theTolerance);
@ -63,7 +62,7 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
Standard_EXPORT Handle(GEOM_Object) MakeFace (Handle(GEOM_Object) theWire, const bool isPlanarWanted); Standard_EXPORT Handle(GEOM_Object) MakeFace (Handle(GEOM_Object) theWire, const bool isPlanarWanted);
Standard_EXPORT Handle(GEOM_Object) MakeFaceWires (std::list<Handle(GEOM_Object)> theWires, Standard_EXPORT Handle(GEOM_Object) MakeFaceWires (std::list<Handle(GEOM_Object)> theWires,
const bool isPlanarWanted); const bool isPlanarWanted);
Standard_EXPORT Handle(GEOM_Object) MakeShell (std::list<Handle(GEOM_Object)> theShapes); Standard_EXPORT Handle(GEOM_Object) MakeShell (std::list<Handle(GEOM_Object)> theShapes);
@ -85,13 +84,17 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
std::list<Handle(GEOM_Object)> theFaces, std::list<Handle(GEOM_Object)> theFaces,
const Standard_Boolean doKeepNonSolids); const Standard_Boolean doKeepNonSolids);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode (Handle(GEOM_Object) theShape, Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode
const Standard_Integer theShapeType, (Handle(GEOM_Object) theShape,
const Standard_Boolean isSorted); const Standard_Integer theShapeType,
const Standard_Boolean isSorted,
const Standard_Boolean isOldSorting = Standard_False);
Standard_EXPORT Handle(TColStd_HSequenceOfInteger) SubShapeAllIDs (Handle(GEOM_Object) theShape, Standard_EXPORT Handle(TColStd_HSequenceOfInteger) SubShapeAllIDs
const Standard_Integer theShapeType, (Handle(GEOM_Object) theShape,
const Standard_Boolean isSorted); const Standard_Integer theShapeType,
const Standard_Boolean isSorted,
const Standard_Boolean isOldSorting = Standard_False);
Standard_EXPORT Handle(GEOM_Object) GetSubShape (Handle(GEOM_Object) theMainShape, Standard_EXPORT Handle(GEOM_Object) GetSubShape (Handle(GEOM_Object) theMainShape,
const Standard_Integer theID); const Standard_Integer theID);
@ -111,14 +114,20 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetFreeFacesIDs (Handle(GEOM_Object) theShape); Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetFreeFacesIDs (Handle(GEOM_Object) theShape);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetSharedShapes (Handle(GEOM_Object) theShape1, Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
Handle(GEOM_Object) theShape2, GetSharedShapes (Handle(GEOM_Object) theShape1,
const Standard_Integer theShapeType); Handle(GEOM_Object) theShape2,
const Standard_Integer theShapeType);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnPlane (const Handle(GEOM_Object)& theShape, Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
const Standard_Integer theShapeType, GetSharedShapes (std::list<Handle(GEOM_Object)> theShapes,
const Handle(GEOM_Object)& theAx1, const Standard_Integer theShapeType);
const GEOMAlgo_State theState);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
GetShapesOnPlane (const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
const Handle(GEOM_Object)& theAx1,
const GEOMAlgo_State theState);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
GetShapesOnPlaneWithLocation (const Handle(GEOM_Object)& theShape, GetShapesOnPlaneWithLocation (const Handle(GEOM_Object)& theShape,
@ -226,14 +235,14 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
const GEOMAlgo_State theState); const GEOMAlgo_State theState);
Standard_EXPORT Handle(GEOM_Object) GetShapesOnCylinderOld (Handle(GEOM_Object) theShape, Standard_EXPORT Handle(GEOM_Object) GetShapesOnCylinderOld (Handle(GEOM_Object) theShape,
const Standard_Integer theShapeType, const Standard_Integer theShapeType,
Handle(GEOM_Object) theAxis, Handle(GEOM_Object) theAxis,
const Standard_Real theRadius); const Standard_Real theRadius);
Standard_EXPORT Handle(GEOM_Object) GetShapesOnSphereOld (Handle(GEOM_Object) theShape, Standard_EXPORT Handle(GEOM_Object) GetShapesOnSphereOld (Handle(GEOM_Object) theShape,
const Standard_Integer theShapeType, const Standard_Integer theShapeType,
Handle(GEOM_Object) theCenter, Handle(GEOM_Object) theCenter,
const Standard_Real theRadius); const Standard_Real theRadius);
void GetShapeProperties(const TopoDS_Shape aShape, Standard_Real propertiesArray[], gp_Pnt & aPnt); void GetShapeProperties(const TopoDS_Shape aShape, Standard_Real propertiesArray[], gp_Pnt & aPnt);
@ -318,7 +327,8 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
* \brief Sort shapes in the list by their coordinates. * \brief Sort shapes in the list by their coordinates.
* \param SL The list of shapes to sort. * \param SL The list of shapes to sort.
*/ */
Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL); Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL,
const Standard_Boolean isOldSorting = Standard_True);
/*! /*!
* \brief Convert TopoDS_COMPSOLID to TopoDS_COMPOUND. * \brief Convert TopoDS_COMPSOLID to TopoDS_COMPOUND.

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Standard_Stream.hxx> #include <Standard_Stream.hxx>
@ -411,7 +410,6 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
return GetObject(anObject); return GetObject(anObject);
} }
//============================================================================= //=============================================================================
/*! /*!
* MakeExplode * MakeExplode
@ -427,7 +425,34 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeExplode (GEOM::GEOM_Object_ptr the
if (aShape.IsNull()) return aSeq._retn(); if (aShape.IsNull()) return aSeq._retn();
Handle(TColStd_HSequenceOfTransient) aHSeq = Handle(TColStd_HSequenceOfTransient) aHSeq =
GetOperations()->MakeExplode(aShape, theShapeType, isSorted); GetOperations()->MakeExplode(aShape, theShapeType, isSorted, Standard_True);
if (!GetOperations()->IsDone() || aHSeq.IsNull())
return aSeq._retn();
Standard_Integer aLength = aHSeq->Length();
aSeq->length(aLength);
for (Standard_Integer i = 1; i <= aLength; i++)
aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
return aSeq._retn();
}
//=============================================================================
/*!
* MakeAllSubShapes
*/
//=============================================================================
GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeAllSubShapes (GEOM::GEOM_Object_ptr theShape,
const CORBA::Long theShapeType,
const CORBA::Boolean isSorted)
{
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
if (aShape.IsNull()) return aSeq._retn();
Handle(TColStd_HSequenceOfTransient) aHSeq =
GetOperations()->MakeExplode(aShape, theShapeType, isSorted, Standard_False);
if (!GetOperations()->IsDone() || aHSeq.IsNull()) if (!GetOperations()->IsDone() || aHSeq.IsNull())
return aSeq._retn(); return aSeq._retn();
@ -454,7 +479,33 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::SubShapeAllIDs (GEOM::GEOM_Object_pt
if (aShape.IsNull()) return aSeq._retn(); if (aShape.IsNull()) return aSeq._retn();
Handle(TColStd_HSequenceOfInteger) aHSeq = Handle(TColStd_HSequenceOfInteger) aHSeq =
GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted); GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted, Standard_True);
if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
Standard_Integer aLength = aHSeq->Length();
aSeq->length(aLength);
for (Standard_Integer i = 1; i <= aLength; i++)
aSeq[i-1] = aHSeq->Value(i);
return aSeq._retn();
}
//=============================================================================
/*!
* GetAllSubShapesIDs
*/
//=============================================================================
GEOM::ListOfLong* GEOM_IShapesOperations_i::GetAllSubShapesIDs (GEOM::GEOM_Object_ptr theShape,
const CORBA::Long theShapeType,
const CORBA::Boolean isSorted)
{
GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
if (aShape.IsNull()) return aSeq._retn();
Handle(TColStd_HSequenceOfInteger) aHSeq =
GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted, Standard_False);
if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn(); if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn();
Standard_Integer aLength = aHSeq->Length(); Standard_Integer aLength = aHSeq->Length();
@ -672,6 +723,42 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes
return aSeq._retn(); return aSeq._retn();
} }
//=============================================================================
/*!
* GetSharedShapesMulti
*/
//=============================================================================
GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapesMulti
(const GEOM::ListOfGO& theShapes,
const CORBA::Long theShapeType)
{
//Set a not done flag
GetOperations()->SetNotDone();
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
//Get the shapes
std::list<Handle(GEOM_Object)> aShapes;
int aLen = theShapes.length();
for (int ind = 0; ind < aLen; ind++) {
Handle(GEOM_Object) aSh = GetObjectImpl(theShapes[ind]);
if (aSh.IsNull()) return aSeq._retn();
aShapes.push_back(aSh);
}
Handle(TColStd_HSequenceOfTransient) aHSeq =
GetOperations()->GetSharedShapes(aShapes, theShapeType);
if (!GetOperations()->IsDone() || aHSeq.IsNull())
return aSeq._retn();
Standard_Integer aLength = aHSeq->Length();
aSeq->length(aLength);
for (Standard_Integer i = 1; i <= aLength; i++)
aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
return aSeq._retn();
}
static GEOMAlgo_State ShapeState (const GEOM::shape_state theState) static GEOMAlgo_State ShapeState (const GEOM::shape_state theState)
{ {
GEOMAlgo_State aState = GEOMAlgo_ST_UNKNOWN; GEOMAlgo_State aState = GEOMAlgo_ST_UNKNOWN;

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef _GEOM_IShapesOperations_i_HeaderFile #ifndef _GEOM_IShapesOperations_i_HeaderFile
#define _GEOM_IShapesOperations_i_HeaderFile #define _GEOM_IShapesOperations_i_HeaderFile
@ -39,21 +38,21 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
{ {
public: public:
GEOM_IShapesOperations_i (PortableServer::POA_ptr thePOA, GEOM_IShapesOperations_i (PortableServer::POA_ptr thePOA,
GEOM::GEOM_Gen_ptr theEngine, GEOM::GEOM_Gen_ptr theEngine,
::GEOMImpl_IShapesOperations* theImpl); ::GEOMImpl_IShapesOperations* theImpl);
~GEOM_IShapesOperations_i(); ~GEOM_IShapesOperations_i();
GEOM::GEOM_Object_ptr MakeEdge (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr MakeEdge (GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2); GEOM::GEOM_Object_ptr thePnt2);
GEOM::GEOM_Object_ptr MakeWire (const GEOM::ListOfGO& theEdgesAndWires, GEOM::GEOM_Object_ptr MakeWire (const GEOM::ListOfGO& theEdgesAndWires,
const CORBA::Double theTolerance); const CORBA::Double theTolerance);
GEOM::GEOM_Object_ptr MakeFace (GEOM::GEOM_Object_ptr theWire, GEOM::GEOM_Object_ptr MakeFace (GEOM::GEOM_Object_ptr theWire,
CORBA::Boolean isPlanarWanted); CORBA::Boolean isPlanarWanted);
GEOM::GEOM_Object_ptr MakeFaceWires (const GEOM::ListOfGO& theWires, GEOM::GEOM_Object_ptr MakeFaceWires (const GEOM::ListOfGO& theWires,
CORBA::Boolean isPlanarWanted); CORBA::Boolean isPlanarWanted);
GEOM::GEOM_Object_ptr MakeShell (const GEOM::ListOfGO& theFacesAndShells); GEOM::GEOM_Object_ptr MakeShell (const GEOM::ListOfGO& theFacesAndShells);
@ -64,34 +63,45 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
GEOM::GEOM_Object_ptr MakeCompound (const GEOM::ListOfGO& theShapes); GEOM::GEOM_Object_ptr MakeCompound (const GEOM::ListOfGO& theShapes);
GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance, CORBA::Double theTolerance,
CORBA::Boolean doKeepNonSolids); CORBA::Boolean doKeepNonSolids);
GEOM::ListOfGO* GetGlueFaces (GEOM::GEOM_Object_ptr theShape, GEOM::ListOfGO* GetGlueFaces (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance); CORBA::Double theTolerance);
GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance, CORBA::Double theTolerance,
const GEOM::ListOfGO& theFaces, const GEOM::ListOfGO& theFaces,
CORBA::Boolean doKeepNonSolids); CORBA::Boolean doKeepNonSolids);
// For old SubShapeAll()
// Deprecated, use MakeAllSubShapes() instead
GEOM::ListOfGO* MakeExplode (GEOM::GEOM_Object_ptr theShape, GEOM::ListOfGO* MakeExplode (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,
CORBA::Boolean isSorted); CORBA::Boolean isSorted);
GEOM::ListOfGO* MakeAllSubShapes (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
CORBA::Boolean isSorted);
// Deprecated, use GetAllSubShapesIDs() instead
GEOM::ListOfLong* SubShapeAllIDs (GEOM::GEOM_Object_ptr theShape, GEOM::ListOfLong* SubShapeAllIDs (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,
CORBA::Boolean isSorted); CORBA::Boolean isSorted);
GEOM::ListOfLong* GetAllSubShapesIDs (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
CORBA::Boolean isSorted);
GEOM::GEOM_Object_ptr GetSubShape (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr GetSubShape (GEOM::GEOM_Object_ptr theMainShape,
CORBA::Long theID); CORBA::Long theID);
CORBA::Long GetSubShapeIndex (GEOM::GEOM_Object_ptr theMainShape, CORBA::Long GetSubShapeIndex (GEOM::GEOM_Object_ptr theMainShape,
GEOM::GEOM_Object_ptr theSubShape); GEOM::GEOM_Object_ptr theSubShape);
CORBA::Long GetTopologyIndex (GEOM::GEOM_Object_ptr theMainShape, CORBA::Long GetTopologyIndex (GEOM::GEOM_Object_ptr theMainShape,
GEOM::GEOM_Object_ptr theSubShape); GEOM::GEOM_Object_ptr theSubShape);
char* GetShapeTypeString (GEOM::GEOM_Object_ptr theShape); char* GetShapeTypeString (GEOM::GEOM_Object_ptr theShape);
@ -105,25 +115,28 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
GEOM::ListOfLong* GetFreeFacesIDs (GEOM::GEOM_Object_ptr theShape); GEOM::ListOfLong* GetFreeFacesIDs (GEOM::GEOM_Object_ptr theShape);
GEOM::ListOfGO* GetSharedShapes (GEOM::GEOM_Object_ptr theShape1, GEOM::ListOfGO* GetSharedShapes (GEOM::GEOM_Object_ptr theShape1,
GEOM::GEOM_Object_ptr theShape2, GEOM::GEOM_Object_ptr theShape2,
CORBA::Long theShapeType); CORBA::Long theShapeType);
GEOM::ListOfGO* GetSharedShapesMulti (const GEOM::ListOfGO& theShapes,
CORBA::Long theShapeType);
GEOM::ListOfGO* GetShapesOnPlane (GEOM::GEOM_Object_ptr theShape, GEOM::ListOfGO* GetShapesOnPlane (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theAx1, GEOM::GEOM_Object_ptr theAx1,
GEOM::shape_state theState); GEOM::shape_state theState);
GEOM::ListOfGO* GetShapesOnPlaneWithLocation(GEOM::GEOM_Object_ptr theShape, GEOM::ListOfGO* GetShapesOnPlaneWithLocation(GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theAx1, GEOM::GEOM_Object_ptr theAx1,
GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr thePnt,
GEOM::shape_state theState); GEOM::shape_state theState);
GEOM::ListOfGO* GetShapesOnCylinder (GEOM::GEOM_Object_ptr theShape, GEOM::ListOfGO* GetShapesOnCylinder (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theAxis, GEOM::GEOM_Object_ptr theAxis,
CORBA::Double theRadius, CORBA::Double theRadius,
GEOM::shape_state theState); GEOM::shape_state theState);
GEOM::ListOfGO* GetShapesOnCylinderWithLocation (GEOM::GEOM_Object_ptr theShape, GEOM::ListOfGO* GetShapesOnCylinderWithLocation (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,
@ -133,10 +146,10 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
GEOM::shape_state theState); GEOM::shape_state theState);
GEOM::ListOfGO* GetShapesOnSphere (GEOM::GEOM_Object_ptr theShape, GEOM::ListOfGO* GetShapesOnSphere (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theCenter, GEOM::GEOM_Object_ptr theCenter,
CORBA::Double theRadius, CORBA::Double theRadius,
GEOM::shape_state theState); GEOM::shape_state theState);
GEOM::ListOfGO* GetShapesOnQuadrangle (GEOM::GEOM_Object_ptr theShape, GEOM::ListOfGO* GetShapesOnQuadrangle (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,
@ -147,21 +160,21 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
GEOM::shape_state theState); GEOM::shape_state theState);
GEOM::ListOfLong* GetShapesOnPlaneIDs (GEOM::GEOM_Object_ptr theShape, GEOM::ListOfLong* GetShapesOnPlaneIDs (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theAx1, GEOM::GEOM_Object_ptr theAx1,
GEOM::shape_state theState); GEOM::shape_state theState);
GEOM::ListOfLong* GetShapesOnPlaneWithLocationIDs (GEOM::GEOM_Object_ptr theShape, GEOM::ListOfLong* GetShapesOnPlaneWithLocationIDs (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theAx1, GEOM::GEOM_Object_ptr theAx1,
GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr thePnt,
GEOM::shape_state theState); GEOM::shape_state theState);
GEOM::ListOfLong* GetShapesOnCylinderIDs (GEOM::GEOM_Object_ptr theShape, GEOM::ListOfLong* GetShapesOnCylinderIDs (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theAxis, GEOM::GEOM_Object_ptr theAxis,
CORBA::Double theRadius, CORBA::Double theRadius,
GEOM::shape_state theState); GEOM::shape_state theState);
GEOM::ListOfLong* GetShapesOnCylinderWithLocationIDs (GEOM::GEOM_Object_ptr theShape, GEOM::ListOfLong* GetShapesOnCylinderWithLocationIDs (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,
@ -171,10 +184,10 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
GEOM::shape_state theState); GEOM::shape_state theState);
GEOM::ListOfLong* GetShapesOnSphereIDs (GEOM::GEOM_Object_ptr theShape, GEOM::ListOfLong* GetShapesOnSphereIDs (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theCenter, GEOM::GEOM_Object_ptr theCenter,
CORBA::Double theRadius, CORBA::Double theRadius,
GEOM::shape_state theState); GEOM::shape_state theState);
GEOM::ListOfLong* GetShapesOnQuadrangleIDs (GEOM::GEOM_Object_ptr theShape, GEOM::ListOfLong* GetShapesOnQuadrangleIDs (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,
@ -185,39 +198,39 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
GEOM::shape_state theState); GEOM::shape_state theState);
GEOM::ListOfGO* GetShapesOnBox (GEOM::GEOM_Object_ptr theBox, GEOM::ListOfGO* GetShapesOnBox (GEOM::GEOM_Object_ptr theBox,
GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,
GEOM::shape_state theState); GEOM::shape_state theState);
GEOM::ListOfLong* GetShapesOnBoxIDs (GEOM::GEOM_Object_ptr theBox, GEOM::ListOfLong* GetShapesOnBoxIDs (GEOM::GEOM_Object_ptr theBox,
GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,
GEOM::shape_state theState); GEOM::shape_state theState);
GEOM::ListOfGO* GetShapesOnShape (GEOM::GEOM_Object_ptr theSheckShape, GEOM::ListOfGO* GetShapesOnShape (GEOM::GEOM_Object_ptr theSheckShape,
GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType, CORBA::Short theShapeType,
GEOM::shape_state theState); GEOM::shape_state theState);
GEOM::GEOM_Object_ptr GetShapesOnShapeAsCompound GEOM::GEOM_Object_ptr GetShapesOnShapeAsCompound
(GEOM::GEOM_Object_ptr theSheckShape, (GEOM::GEOM_Object_ptr theSheckShape,
GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType, CORBA::Short theShapeType,
GEOM::shape_state theState); GEOM::shape_state theState);
GEOM::ListOfLong* GetShapesOnShapeIDs (GEOM::GEOM_Object_ptr theCheckShape, GEOM::ListOfLong* GetShapesOnShapeIDs (GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType, CORBA::Short theShapeType,
GEOM::shape_state theState); GEOM::shape_state theState);
GEOM::GEOM_Object_ptr GetInPlace (GEOM::GEOM_Object_ptr theShapeWhere, GEOM::GEOM_Object_ptr GetInPlace (GEOM::GEOM_Object_ptr theShapeWhere,
GEOM::GEOM_Object_ptr theShapeWhat); GEOM::GEOM_Object_ptr theShapeWhat);
GEOM::GEOM_Object_ptr GetInPlaceByHistory (GEOM::GEOM_Object_ptr theShapeWhere, GEOM::GEOM_Object_ptr GetInPlaceByHistory (GEOM::GEOM_Object_ptr theShapeWhere,
GEOM::GEOM_Object_ptr theShapeWhat); GEOM::GEOM_Object_ptr theShapeWhat);
GEOM::GEOM_Object_ptr GetSame (GEOM::GEOM_Object_ptr theShapeWhere, GEOM::GEOM_Object_ptr GetSame (GEOM::GEOM_Object_ptr theShapeWhere,
GEOM::GEOM_Object_ptr theShapeWhat); GEOM::GEOM_Object_ptr theShapeWhat);
::GEOMImpl_IShapesOperations* GetOperations() ::GEOMImpl_IShapesOperations* GetOperations()
{ return (::GEOMImpl_IShapesOperations*)GetImpl(); } { return (::GEOMImpl_IShapesOperations*)GetImpl(); }

View File

@ -105,7 +105,7 @@ def MakeSpanner (geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh = None):
else: else:
print "Prism 1 is not a hexahedral solid" print "Prism 1 is not a hexahedral solid"
Prism1_faces = geompy.SubShapeAllSorted(Prism1, geompy.ShapeType["FACE"]) Prism1_faces = geompy.SubShapeAllSortedCentres(Prism1, geompy.ShapeType["FACE"])
ii = 1 ii = 1
for aFace in Prism1_faces: for aFace in Prism1_faces:
name = geompy.SubShapeName(aFace, Prism1) name = geompy.SubShapeName(aFace, Prism1)
@ -383,7 +383,7 @@ def MakeSpanner (geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh = None):
# ---- add long edges of the top face in study # ---- add long edges of the top face in study
FaceTop_edges = geompy.SubShapeAllSorted(FaceTop, geompy.ShapeType["EDGE"]) FaceTop_edges = geompy.SubShapeAllSortedCentres(FaceTop, geompy.ShapeType["EDGE"])
Edge1 = FaceTop_edges[0] Edge1 = FaceTop_edges[0]
Edge2 = FaceTop_edges[3] Edge2 = FaceTop_edges[3]
Id_Edge1 = geompy.addToStudyInFather(FaceTop, Edge1, "Edge 1") Id_Edge1 = geompy.addToStudyInFather(FaceTop, Edge1, "Edge 1")

View File

@ -165,7 +165,7 @@ def TestAll (geompy, math):
Shell = geompy.MakeShell([Face, Face1]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr Shell = geompy.MakeShell([Face, Face1]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr
Prism1 = geompy.MakePrism(Face2, p0, pxyz) #(3 GEOM_Object_ptr)->GEOM_Object_ptr Prism1 = geompy.MakePrism(Face2, p0, pxyz) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
prism1_faces = geompy.SubShapeAllSorted(Prism1, ShapeTypeFace) prism1_faces = geompy.SubShapeAllSortedCentres(Prism1, ShapeTypeFace)
Shell1 = geompy.MakeShell([prism1_faces[0], prism1_faces[1], Shell1 = geompy.MakeShell([prism1_faces[0], prism1_faces[1],
prism1_faces[3], prism1_faces[4], prism1_faces[3], prism1_faces[4],
prism1_faces[5], prism1_faces[2]]) prism1_faces[5], prism1_faces[2]])
@ -230,7 +230,7 @@ def TestAll (geompy, math):
Orientation = geompy.ChangeOrientation(Box) Orientation = geompy.ChangeOrientation(Box)
#IDList for Fillet/Chamfer #IDList for Fillet/Chamfer
prism_edges = geompy.SubShapeAllSorted(Prism, ShapeTypeEdge) prism_edges = geompy.SubShapeAllSortedCentres(Prism, ShapeTypeEdge)
for anEdge in prism_edges: for anEdge in prism_edges:
eid = geompy.GetSubShapeID(Prism, anEdge) eid = geompy.GetSubShapeID(Prism, anEdge)
@ -245,7 +245,7 @@ def TestAll (geompy, math):
IDlist_e.append(geompy.GetSubShapeID(Prism, prism_edges[1])) IDlist_e.append(geompy.GetSubShapeID(Prism, prism_edges[1]))
IDlist_e.append(geompy.GetSubShapeID(Prism, prism_edges[2])) IDlist_e.append(geompy.GetSubShapeID(Prism, prism_edges[2]))
prism_faces = geompy.SubShapeAllSorted(Prism, ShapeTypeFace) prism_faces = geompy.SubShapeAllSortedCentres(Prism, ShapeTypeFace)
f_ind_1 = geompy.GetSubShapeID(Prism, prism_faces[0]) f_ind_1 = geompy.GetSubShapeID(Prism, prism_faces[0])
f_ind_2 = geompy.GetSubShapeID(Prism, prism_faces[1]) f_ind_2 = geompy.GetSubShapeID(Prism, prism_faces[1])
@ -432,8 +432,8 @@ def TestAll (geompy, math):
name = geompy.SubShapeName(SubFace, Box) name = geompy.SubShapeName(SubFace, Box)
id_SubFace = geompy.addToStudyInFather(Box, SubFace, name) id_SubFace = geompy.addToStudyInFather(Box, SubFace, name)
# SubShapeSorted # SubShapeSortedCentres
SubFaceS = geompy.SubShapeSorted(Box, geompy.ShapeType["FACE"], [5]) SubFaceS = geompy.SubShapeSortedCentres(Box, geompy.ShapeType["FACE"], [5])
nameS = geompy.SubShapeName(SubFaceS, Box) nameS = geompy.SubShapeName(SubFaceS, Box)
id_SubFace = geompy.addToStudyInFather(Box, SubFaceS, nameS) id_SubFace = geompy.addToStudyInFather(Box, SubFaceS, nameS)
@ -451,8 +451,8 @@ def TestAll (geompy, math):
geompy.UnionIDs(group, SubEdgeIDsList) geompy.UnionIDs(group, SubEdgeIDsList)
geompy.addToStudyInFather(SubFace, group, "Group of all edges") geompy.addToStudyInFather(SubFace, group, "Group of all edges")
# SubShapeAllSortedIDs # SubShapeAllSortedCentresIDs
SubEdgeIDsList = geompy.SubShapeAllSortedIDs(SubFace, geompy.ShapeType["EDGE"]) SubEdgeIDsList = geompy.SubShapeAllSortedCentresIDs(SubFace, geompy.ShapeType["EDGE"])
print "IDs of edges of SubFace:", SubEdgeIDsList, "(sorted)" print "IDs of edges of SubFace:", SubEdgeIDsList, "(sorted)"
# GetSubShape and GetSubShapeID # GetSubShape and GetSubShapeID

View File

@ -86,7 +86,7 @@ def TestSuppressFaces (geompy):
#IDList for SuppHole #IDList for SuppHole
faces = [] faces = []
faces = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"]) faces = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
f_glob_id = geompy.GetSubShapeID(Box, faces[5]) f_glob_id = geompy.GetSubShapeID(Box, faces[5])
@ -237,7 +237,7 @@ def TestSuppressHoles (geompy):
#IDList for SuppressFaces #IDList for SuppressFaces
faces = [] faces = []
faces = geompy.SubShapeAllSorted(Cut, geompy.ShapeType["FACE"]) faces = geompy.SubShapeAllSortedCentres(Cut, geompy.ShapeType["FACE"])
ind = 0 ind = 0
for face in faces: for face in faces:
f_name = "FACE %d"%(ind) f_name = "FACE %d"%(ind)
@ -249,9 +249,10 @@ def TestSuppressHoles (geompy):
f_glob_id_0 = geompy.GetSubShapeID(Cut, faces[0]) f_glob_id_0 = geompy.GetSubShapeID(Cut, faces[0])
cut_without_f_0 = geompy.SuppressFaces(Cut, [f_glob_id_0]) cut_without_f_0 = geompy.SuppressFaces(Cut, [f_glob_id_0])
geompy.addToStudy(cut_without_f_0, "Cut without face 0")
faces1 = [] faces1 = []
faces1 = geompy.SubShapeAllSorted(cut_without_f_0, geompy.ShapeType["FACE"]) faces1 = geompy.SubShapeAllSortedCentres(cut_without_f_0, geompy.ShapeType["FACE"])
ind = 0 ind = 0
for face in faces1: for face in faces1:
f_name = "FACE %d"%(ind) f_name = "FACE %d"%(ind)
@ -261,25 +262,25 @@ def TestSuppressHoles (geompy):
print "face ", ind, " global index = ", f_glob_id print "face ", ind, " global index = ", f_glob_id
ind = ind + 1 ind = ind + 1
f_glob_id_5 = geompy.GetSubShapeID(cut_without_f_0, faces1[5]) f_glob_id_3 = geompy.GetSubShapeID(cut_without_f_0, faces1[3])
cut_without_f_0_5 = geompy.SuppressFaces(cut_without_f_0, [f_glob_id_5]) cut_without_f_0_3 = geompy.SuppressFaces(cut_without_f_0, [f_glob_id_3])
cut_without_f_0_5_id = geompy.addToStudy(cut_without_f_0_5, "Cut without faces 0 and 5") cut_without_f_0_3_id = geompy.addToStudy(cut_without_f_0_3, "Cut without faces 0 and 3")
#IDList for SuppHole #IDList for SuppHole
wires = [] wires = []
wires = geompy.SubShapeAllSorted(cut_without_f_0_5, geompy.ShapeType["WIRE"]) wires = geompy.SubShapeAllSortedCentres(cut_without_f_0_3, geompy.ShapeType["WIRE"])
ind = 0 ind = 0
for wire in wires: for wire in wires:
w_name = "WIRE %d"%(ind) w_name = "WIRE %d"%(ind)
w_id = geompy.addToStudyInFather(cut_without_f_0_5, wire, w_name) w_id = geompy.addToStudyInFather(cut_without_f_0_3, wire, w_name)
w_glob_id = geompy.GetSubShapeID(cut_without_f_0_5, wire) w_glob_id = geompy.GetSubShapeID(cut_without_f_0_3, wire)
print "wire ", ind, " global index = ", w_glob_id print "wire ", ind, " global index = ", w_glob_id
ind = ind + 1 ind = ind + 1
w_3 = geompy.GetSubShapeID(cut_without_f_0_5, wires[3]) w_3 = geompy.GetSubShapeID(cut_without_f_0_3, wires[3])
SuppHole3 = geompy.SuppressHoles(cut_without_f_0_5, [w_3]) SuppHole3 = geompy.SuppressHoles(cut_without_f_0_3, [w_3])
SuppHole3_id = geompy.addToStudy(SuppHole3, "Supp Hole 3") SuppHole3_id = geompy.addToStudy(SuppHole3, "Supp Hole 3")
def TestMakeSewing (geompy, math): def TestMakeSewing (geompy, math):
@ -314,7 +315,7 @@ def TestDivideEdge (geompy):
Box = geompy.MakeBoxDXDYDZ(200., 200., 200.) Box = geompy.MakeBoxDXDYDZ(200., 200., 200.)
#Divide Edge #Divide Edge
box_edges = geompy.SubShapeAllSorted(Box, geompy.ShapeType["EDGE"]) box_edges = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["EDGE"])
edge_ind = geompy.GetSubShapeID(Box, box_edges[1]) edge_ind = geompy.GetSubShapeID(Box, box_edges[1])
Divide = geompy.DivideEdge(Box, edge_ind, 0.5, 1) # Obj, ind, param, is_curve_param Divide = geompy.DivideEdge(Box, edge_ind, 0.5, 1) # Obj, ind, param, is_curve_param

View File

@ -115,7 +115,7 @@ def TestMeasureOperations (geompy, math):
####### GetNormal ####### ####### GetNormal #######
faces = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"]) faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"])
face0 = faces[0] face0 = faces[0]
vnorm = geompy.GetNormal(face0) vnorm = geompy.GetNormal(face0)
if vnorm is None: if vnorm is None:

View File

@ -20,17 +20,17 @@
# #
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
# GEOM GEOM_SWIG : binding of C++ implementaion with Python # GEOM GEOM_SWIG : binding of C++ implementaion with Python
# File : GEOM_TestOthers.py # File : GEOM_TestOthers.py
# Author : Julia DOROVSKIKH # Author : Julia DOROVSKIKH
# Module : GEOM # Module : GEOM
# $Header$ # $Header$
#
# ! Please, if you edit this example file, update also # ! Please, if you edit this example file, update also
# ! GEOM_SRC/doc/salome/gui/GEOM/input/tui_test_others.doc # ! GEOM_SRC/doc/salome/gui/GEOM/input/tui_test_others.doc
# ! as some sequences of symbols from this example are used during # ! as some sequences of symbols from this example are used during
# ! documentation generation to identify certain places of this file # ! documentation generation to identify certain places of this file
#
import os import os
def TestExportImport (geompy, shape): def TestExportImport (geompy, shape):
@ -181,7 +181,7 @@ def TestOtherOperations (geompy, math):
# MakeFilletAll # MakeFilletAll
radius_fillet = 10. radius_fillet = 10.
face5 = geompy.SubShapeSorted(Box, geompy.ShapeType["FACE"], [5]) face5 = geompy.SubShapeSortedCentres(Box, geompy.ShapeType["FACE"], [5])
f_glob_id = geompy.GetSubShapeID(Box, face5) f_glob_id = geompy.GetSubShapeID(Box, face5)
SuppFace = geompy.SuppressFaces(Box, [f_glob_id]) SuppFace = geompy.SuppressFaces(Box, [f_glob_id])
@ -196,7 +196,7 @@ def TestOtherOperations (geompy, math):
# MakeChamfer # MakeChamfer
d1 = 13. d1 = 13.
d2 = 7. d2 = 7.
box_faces = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"]) box_faces = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
f_ind_1 = geompy.GetSubShapeID(Box, box_faces[0]) f_ind_1 = geompy.GetSubShapeID(Box, box_faces[0])
f_ind_2 = geompy.GetSubShapeID(Box, box_faces[1]) f_ind_2 = geompy.GetSubShapeID(Box, box_faces[1])
f_ind_3 = geompy.GetSubShapeID(Box, box_faces[2]) f_ind_3 = geompy.GetSubShapeID(Box, box_faces[2])
@ -426,7 +426,7 @@ def TestOtherOperations (geompy, math):
Partition_1 = geompy.MakePartition([Sphere], tools, [], [], geompy.ShapeType["SOLID"], 0, []) Partition_1 = geompy.MakePartition([Sphere], tools, [], [], geompy.ShapeType["SOLID"], 0, [])
geompy.addToStudy(Partition_1, "Partition_1") geompy.addToStudy(Partition_1, "Partition_1")
faces = geompy.SubShapeAllSorted(Partition_1, geompy.ShapeType["FACE"]) faces = geompy.SubShapeAllSortedCentres(Partition_1, geompy.ShapeType["FACE"])
Face_1 = faces[0] Face_1 = faces[0]
Face_2 = faces[39] Face_2 = faces[39]
@ -471,9 +471,19 @@ def TestOtherOperations (geompy, math):
# GetSharedShapes # GetSharedShapes
sharedFaces = geompy.GetSharedShapes(part, freeFacesWithoutExtra, sharedFaces = geompy.GetSharedShapes(part, freeFacesWithoutExtra,
geompy.ShapeType["FACE"]) geompy.ShapeType["FACE"])
ind = 1
for shFace in sharedFaces: for shFace in sharedFaces:
geompy.addToStudy(shFace, "sharedFace") geompy.addToStudy(shFace, "sharedFace_" + `ind`)
ind = ind + 1
pass
sharedEdges = geompy.GetSharedShapesMulti([part, freeFacesWithoutExtra],
geompy.ShapeType["EDGE"])
ind = 1
for shEdge in sharedEdges:
geompy.addToStudy(shEdge, "sharedEdge_" + `ind`)
ind = ind + 1
pass
# CheckAndImprove # CheckAndImprove
blocksComp = geompy.CheckAndImprove(part) blocksComp = geompy.CheckAndImprove(part)

View File

@ -51,6 +51,7 @@
## @defgroup l3_advanced Creating Advanced Geometrical Objects ## @defgroup l3_advanced Creating Advanced Geometrical Objects
## @{ ## @{
## @defgroup l4_decompose Decompose objects ## @defgroup l4_decompose Decompose objects
## @defgroup l4_decompose_d Decompose objects deprecated methods
## @defgroup l4_access Access to sub-shapes by their unique IDs inside the main shape ## @defgroup l4_access Access to sub-shapes by their unique IDs inside the main shape
## @defgroup l4_obtain Access to subshapes by a criteria ## @defgroup l4_obtain Access to subshapes by a criteria
## @defgroup l4_advanced Advanced objects creation functions ## @defgroup l4_advanced Advanced objects creation functions
@ -1714,6 +1715,18 @@ class geompyDC(GEOM._objref_GEOM_Gen):
RaiseIfFailed("GetSharedShapes", self.ShapesOp) RaiseIfFailed("GetSharedShapes", self.ShapesOp)
return aList return aList
## Get all sub-shapes, shared by all shapes in the list <VAR>theShapes</VAR>.
# @param theShapes Shapes to find common sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved.
# @return List of objects, that are sub-shapes of all given shapes.
#
# @ref swig_GetSharedShapes "Example"
def GetSharedShapesMulti(self, theShapes, theShapeType):
# Example: see GEOM_TestOthers.py
aList = self.ShapesOp.GetSharedShapesMulti(theShapes, theShapeType)
RaiseIfFailed("GetSharedShapesMulti", self.ShapesOp)
return aList
## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>, ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
# situated relatively the specified plane by the certain way, # situated relatively the specified plane by the certain way,
# defined through <VAR>theState</VAR> parameter. # defined through <VAR>theState</VAR> parameter.
@ -2035,8 +2048,8 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref swig_all_decompose "Example" # @ref swig_all_decompose "Example"
def SubShapeAll(self, aShape, aType): def SubShapeAll(self, aShape, aType):
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
ListObj = self.ShapesOp.MakeExplode(aShape,aType,0) ListObj = self.ShapesOp.MakeAllSubShapes(aShape, aType, False)
RaiseIfFailed("MakeExplode", self.ShapesOp) RaiseIfFailed("SubShapeAll", self.ShapesOp)
return ListObj return ListObj
## Explode a shape on subshapes of a given type. ## Explode a shape on subshapes of a given type.
@ -2046,35 +2059,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# #
# @ref swig_all_decompose "Example" # @ref swig_all_decompose "Example"
def SubShapeAllIDs(self, aShape, aType): def SubShapeAllIDs(self, aShape, aType):
ListObj = self.ShapesOp.SubShapeAllIDs(aShape,aType,0) ListObj = self.ShapesOp.GetAllSubShapesIDs(aShape, aType, False)
RaiseIfFailed("SubShapeAllIDs", self.ShapesOp) RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
return ListObj return ListObj
## Explode a shape on subshapes of a given type.
# Sub-shapes will be sorted by coordinates of their gravity centers.
# @param aShape Shape to be exploded.
# @param aType Type of sub-shapes to be retrieved.
# @return List of sub-shapes of type theShapeType, contained in theShape.
#
# @ref swig_SubShapeAllSorted "Example"
def SubShapeAllSorted(self, aShape, aType):
# Example: see GEOM_TestAll.py
ListObj = self.ShapesOp.MakeExplode(aShape,aType,1)
RaiseIfFailed("MakeExplode", self.ShapesOp)
return ListObj
## Explode a shape on subshapes of a given type.
# Sub-shapes will be sorted by coordinates of their gravity centers.
# @param aShape Shape to be exploded.
# @param aType Type of sub-shapes to be retrieved.
# @return List of IDs of sub-shapes.
#
# @ref swig_all_decompose "Example"
def SubShapeAllSortedIDs(self, aShape, aType):
ListIDs = self.ShapesOp.SubShapeAllIDs(aShape,aType,1)
RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
return ListIDs
## Obtain a compound of sub-shapes of <VAR>aShape</VAR>, ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
# selected by they indices in list of all sub-shapes of type <VAR>aType</VAR>. # selected by they indices in list of all sub-shapes of type <VAR>aType</VAR>.
# Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type] # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
@ -2083,29 +2071,87 @@ class geompyDC(GEOM._objref_GEOM_Gen):
def SubShape(self, aShape, aType, ListOfInd): def SubShape(self, aShape, aType, ListOfInd):
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
ListOfIDs = [] ListOfIDs = []
AllShapeList = self.SubShapeAll(aShape, aType) AllShapeIDsList = self.SubShapeAllIDs(aShape, aType)
for ind in ListOfInd: for ind in ListOfInd:
ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1])) ListOfIDs.append(AllShapeIDsList[ind - 1])
anObj = self.GetSubShape(aShape, ListOfIDs) anObj = self.GetSubShape(aShape, ListOfIDs)
return anObj return anObj
## Explode a shape on subshapes of a given type.
# Sub-shapes will be sorted by coordinates of their gravity centers.
# @param aShape Shape to be exploded.
# @param aType Type of sub-shapes to be retrieved.
# @return List of sub-shapes of type theShapeType, contained in theShape.
#
# @ref swig_SubShapeAllSorted "Example"
def SubShapeAllSortedCentres(self, aShape, aType):
# Example: see GEOM_TestAll.py
ListObj = self.ShapesOp.MakeAllSubShapes(aShape, aType, True)
RaiseIfFailed("SubShapeAllSortedCentres", self.ShapesOp)
return ListObj
## Explode a shape on subshapes of a given type.
# Sub-shapes will be sorted by coordinates of their gravity centers.
# @param aShape Shape to be exploded.
# @param aType Type of sub-shapes to be retrieved.
# @return List of IDs of sub-shapes.
#
# @ref swig_all_decompose "Example"
def SubShapeAllSortedCentresIDs(self, aShape, aType):
ListIDs = self.ShapesOp.GetAllSubShapesIDs(aShape, aType, True)
RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
return ListIDs
## Obtain a compound of sub-shapes of <VAR>aShape</VAR>, ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
# selected by they indices in sorted list of all sub-shapes of type <VAR>aType</VAR>. # selected by they indices in sorted list of all sub-shapes of type <VAR>aType</VAR>.
# Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type] # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
# #
# @ref swig_all_decompose "Example" # @ref swig_all_decompose "Example"
def SubShapeSorted(self,aShape, aType, ListOfInd): def SubShapeSortedCentres(self, aShape, aType, ListOfInd):
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
ListOfIDs = [] ListOfIDs = []
AllShapeList = self.SubShapeAllSorted(aShape, aType) AllShapeIDsList = self.SubShapeAllSortedCentresIDs(aShape, aType)
for ind in ListOfInd: for ind in ListOfInd:
ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1])) ListOfIDs.append(AllShapeIDsList[ind - 1])
anObj = self.GetSubShape(aShape, ListOfIDs) anObj = self.GetSubShape(aShape, ListOfIDs)
return anObj return anObj
# end of l4_decompose # end of l4_decompose
## @} ## @}
## @addtogroup l4_decompose_d
## @{
## Deprecated method
# It works like SubShapeAllSortedCentres, but wrongly
# defines centres of faces, shells and solids.
def SubShapeAllSorted(self, aShape, aType):
ListObj = self.ShapesOp.MakeExplode(aShape, aType, True)
RaiseIfFailed("MakeExplode", self.ShapesOp)
return ListObj
## Deprecated method
# It works like SubShapeAllSortedCentresIDs, but wrongly
# defines centres of faces, shells and solids.
def SubShapeAllSortedIDs(self, aShape, aType):
ListIDs = self.ShapesOp.SubShapeAllIDs(aShape, aType, True)
RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
return ListIDs
## Deprecated method
# It works like SubShapeSortedCentres, but has a bug
# (wrongly defines centres of faces, shells and solids).
def SubShapeSorted(self, aShape, aType, ListOfInd):
ListOfIDs = []
AllShapeIDsList = self.SubShapeAllSortedIDs(aShape, aType)
for ind in ListOfInd:
ListOfIDs.append(AllShapeIDsList[ind - 1])
anObj = self.GetSubShape(aShape, ListOfIDs)
return anObj
# end of l4_decompose_d
## @}
## @addtogroup l3_healing ## @addtogroup l3_healing
## @{ ## @{

View File

@ -16,12 +16,11 @@
# #
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
# GEOM OPERATIONGUI : # GEOM OPERATIONGUI :
# File : Makefile.am # File : Makefile.am
# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com)
# Package : OperationGUI # Package : OperationGUI
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am include $(top_srcdir)/adm_local/unix/make_common_starter.am
# header files # header files
@ -33,6 +32,7 @@ salomeinclude_HEADERS = \
OperationGUI_Fillet1d2dDlg.h \ OperationGUI_Fillet1d2dDlg.h \
OperationGUI_ChamferDlg.h \ OperationGUI_ChamferDlg.h \
OperationGUI_GetShapesOnShapeDlg.h \ OperationGUI_GetShapesOnShapeDlg.h \
OperationGUI_GetSharedShapesDlg.h \
OperationGUI_ClippingDlg.h OperationGUI_ClippingDlg.h
# Libraries targets # Libraries targets
@ -43,6 +43,7 @@ dist_libOperationGUI_la_SOURCES = \
OperationGUI_ArchimedeDlg.cxx \ OperationGUI_ArchimedeDlg.cxx \
OperationGUI_PartitionDlg.cxx \ OperationGUI_PartitionDlg.cxx \
OperationGUI_GetShapesOnShapeDlg.cxx \ OperationGUI_GetShapesOnShapeDlg.cxx \
OperationGUI_GetSharedShapesDlg.cxx \
OperationGUI_FilletDlg.cxx \ OperationGUI_FilletDlg.cxx \
OperationGUI_Fillet1d2dDlg.cxx \ OperationGUI_Fillet1d2dDlg.cxx \
OperationGUI_ChamferDlg.cxx \ OperationGUI_ChamferDlg.cxx \
@ -52,6 +53,7 @@ MOC_FILES = \
OperationGUI_ArchimedeDlg_moc.cxx \ OperationGUI_ArchimedeDlg_moc.cxx \
OperationGUI_PartitionDlg_moc.cxx \ OperationGUI_PartitionDlg_moc.cxx \
OperationGUI_GetShapesOnShapeDlg_moc.cxx\ OperationGUI_GetShapesOnShapeDlg_moc.cxx\
OperationGUI_GetSharedShapesDlg_moc.cxx \
OperationGUI_FilletDlg_moc.cxx \ OperationGUI_FilletDlg_moc.cxx \
OperationGUI_Fillet1d2dDlg_moc.cxx \ OperationGUI_Fillet1d2dDlg_moc.cxx \
OperationGUI_ChamferDlg_moc.cxx \ OperationGUI_ChamferDlg_moc.cxx \

View File

@ -19,11 +19,10 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// GEOM GEOMGUI : GUI for Geometry component
// File : OperationGUI.cxx
// Author : Damien COQUERET, Open CASCADE S.A.S.
// GEOM GEOMGUI : GUI for Geometry component
// File : OperationGUI.cxx
// Author : Damien COQUERET, Open CASCADE S.A.S.
//
#include "OperationGUI.h" #include "OperationGUI.h"
#include <GeometryGUI.h> #include <GeometryGUI.h>
@ -44,6 +43,7 @@
#include "OperationGUI_ChamferDlg.h" // Method CHAMFER #include "OperationGUI_ChamferDlg.h" // Method CHAMFER
#include "OperationGUI_ClippingDlg.h" // Clipping dialog box #include "OperationGUI_ClippingDlg.h" // Clipping dialog box
#include "OperationGUI_GetShapesOnShapeDlg.h" #include "OperationGUI_GetShapesOnShapeDlg.h"
#include "OperationGUI_GetSharedShapesDlg.h"
//======================================================================= //=======================================================================
// function : OperationGUI() // function : OperationGUI()
@ -67,24 +67,25 @@ OperationGUI::~OperationGUI()
// function : OnGUIEvent() // function : OnGUIEvent()
// purpose : // purpose :
//======================================================================= //=======================================================================
bool OperationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) bool OperationGUI::OnGUIEvent (int theCommandID, SUIT_Desktop* parent)
{ {
SalomeApp_Application* app = getGeometryGUI()->getApp(); SalomeApp_Application* app = getGeometryGUI()->getApp();
if ( !app ) return false; if (!app) return false;
getGeometryGUI()->EmitSignalDeactivateDialog(); getGeometryGUI()->EmitSignalDeactivateDialog();
switch ( theCommandID ) { switch (theCommandID) {
case GEOMOp::OpPartition: ( new OperationGUI_PartitionDlg ( getGeometryGUI(), parent ) )->show(); break; case GEOMOp::OpPartition: (new OperationGUI_PartitionDlg (getGeometryGUI(), parent))->show(); break;
case GEOMOp::OpArchimede: ( new OperationGUI_ArchimedeDlg ( getGeometryGUI(), parent ) )->show(); break; case GEOMOp::OpArchimede: (new OperationGUI_ArchimedeDlg (getGeometryGUI(), parent))->show(); break;
case GEOMOp::OpFillet3d: ( new OperationGUI_FilletDlg ( getGeometryGUI(), parent ) )->show(); break; case GEOMOp::OpFillet3d: (new OperationGUI_FilletDlg (getGeometryGUI(), parent))->show(); break;
case GEOMOp::OpChamfer: ( new OperationGUI_ChamferDlg ( getGeometryGUI(), parent ) )->show(); break; case GEOMOp::OpChamfer: (new OperationGUI_ChamferDlg (getGeometryGUI(), parent))->show(); break;
case GEOMOp::OpClipping: ( new OperationGUI_ClippingDlg ( getGeometryGUI(), parent ) )->show(); break; case GEOMOp::OpClipping: (new OperationGUI_ClippingDlg (getGeometryGUI(), parent))->show(); break;
case GEOMOp::OpShapesOnShape: ( new OperationGUI_GetShapesOnShapeDlg( getGeometryGUI(), parent ) )->show(); break; case GEOMOp::OpShapesOnShape: (new OperationGUI_GetShapesOnShapeDlg(getGeometryGUI(), parent))->show(); break;
case GEOMOp::OpFillet1d: ( new OperationGUI_Fillet1d2dDlg ( getGeometryGUI(), parent, true ) )->show(); break; case GEOMOp::OpSharedShapes: (new OperationGUI_GetSharedShapesDlg (getGeometryGUI(), parent))->show(); break;
case GEOMOp::OpFillet2d: ( new OperationGUI_Fillet1d2dDlg ( getGeometryGUI(), parent, false ) )->show(); break; case GEOMOp::OpFillet1d: (new OperationGUI_Fillet1d2dDlg (getGeometryGUI(), parent, true))->show(); break;
case GEOMOp::OpFillet2d: (new OperationGUI_Fillet1d2dDlg (getGeometryGUI(), parent, false))->show(); break;
default: default:
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
} }
return true; return true;

View File

@ -0,0 +1,363 @@
// Copyright (C) 2007-2010 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 : OperationGUI_GetSharedShapesDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
#include "OperationGUI_GetSharedShapesDlg.h"
#include <DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include <GEOMImpl_Types.hxx>
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_MessageBox.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
//=================================================================================
// class : OperationGUI_GetSharedShapesDlg()
// purpose : Constructs a OperationGUI_GetSharedShapesDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
OperationGUI_GetSharedShapesDlg::OperationGUI_GetSharedShapesDlg
(GeometryGUI* theGeometryGUI, QWidget* parent)
: GEOMBase_Skeleton(theGeometryGUI, parent, false)
{
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0(aResMgr->loadPixmap("GEOM", tr("ICON_DLG_SHARED_SHAPES")));
QPixmap image2(aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
setWindowTitle(tr("GEOM_SHARED_SHAPES_TITLE"));
/***************************************************************/
mainFrame()->GroupConstructors->setTitle(tr("GEOM_GET_SHARED_SHAPES"));
mainFrame()->RadioButton1->setIcon(image0);
mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_2Sel1List1Check(centralWidget());
GroupPoints->GroupBox1->setTitle(tr("GEOM_SHARED_SHAPES_INPUT"));
GroupPoints->TextLabel1->setText(tr("GEOM_SHAPES"));
GroupPoints->TextLabel2->hide();
GroupPoints->TextLabel3->setText(tr("GEOM_SUBSHAPE_TYPE"));
GroupPoints->PushButton1->setIcon(image2);
GroupPoints->PushButton2->hide();
GroupPoints->LineEdit1->setReadOnly(true);
GroupPoints->LineEdit2->hide();
GroupPoints->LineEdit1->setEnabled(true);
GroupPoints->CheckButton1->hide();
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(GroupPoints);
/***************************************************************/
setHelpFileName("shared_shapes_page.html");
Init();
}
//=================================================================================
// function : ~OperationGUI_GetSharedShapesDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
OperationGUI_GetSharedShapesDlg::~OperationGUI_GetSharedShapesDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void OperationGUI_GetSharedShapesDlg::Init()
{
/* type for sub shape selection */
GroupPoints->ComboBox1->addItem(tr("GEOM_SOLID"));
GroupPoints->ComboBox1->addItem(tr("GEOM_SHELL"));
GroupPoints->ComboBox1->addItem(tr("GEOM_FACE"));
GroupPoints->ComboBox1->addItem(tr("GEOM_WIRE"));
GroupPoints->ComboBox1->addItem(tr("GEOM_EDGE"));
GroupPoints->ComboBox1->addItem(tr("GEOM_VERTEX"));
GroupPoints->ComboBox1->setCurrentIndex(0);
/* signals and slots connections */
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged()));
connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName(getNewObjectName());
ConstructorsClicked(0);
GroupPoints->PushButton1->click();
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void OperationGUI_GetSharedShapesDlg::ConstructorsClicked (int constructorId)
{
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
globalSelection();
myListShapes.length(0);
GroupPoints->ComboBox1->setCurrentIndex(0);
GroupPoints->PushButton1->setDown(true);
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->clear();
qApp->processEvents();
updateGeometry();
resize(minimumSizeHint());
myEditCurrentArgument->setFocus();
connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
SelectionIntoArgument();
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void OperationGUI_GetSharedShapesDlg::ClickOnOk()
{
if (ClickOnApply())
ClickOnCancel();
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
bool OperationGUI_GetSharedShapesDlg::ClickOnApply()
{
if (!onAccept())
return false;
initName(getNewObjectName());
return true;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void OperationGUI_GetSharedShapesDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("");
QString aString = "";
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true);
if (nbSel < 1) {
myListShapes.length(0);
}
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListShapes, true);
if (!myListShapes.length())
return;
myEditCurrentArgument->setText(aString);
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void OperationGUI_GetSharedShapesDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
if (send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setEnabled(true);
}
globalSelection(GEOM_ALLSHAPES);
myEditCurrentArgument->setFocus();
SelectionIntoArgument();
send->setDown(true);
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void OperationGUI_GetSharedShapesDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
ConstructorsClicked(getConstructorId());
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void OperationGUI_GetSharedShapesDlg::enterEvent(QEvent*)
{
if (!mainFrame()->GroupConstructors->isEnabled())
this->ActivateThisDialog();
}
//=======================================================================
//function : ComboTextChanged
//purpose :
//=======================================================================
void OperationGUI_GetSharedShapesDlg::ComboTextChanged()
{
initName(getNewObjectName());
}
//=================================================================================
// function : GetType()
// purpose :
//=================================================================================
int OperationGUI_GetSharedShapesDlg::GetType() const
{
int aLimit = GroupPoints->ComboBox1->currentIndex();
switch (aLimit) {
case 0: aLimit = GEOM::SOLID ; break;
case 1: aLimit = GEOM::SHELL ; break;
case 2: aLimit = GEOM::FACE ; break;
case 3: aLimit = GEOM::WIRE ; break;
case 4: aLimit = GEOM::EDGE ; break;
case 5: aLimit = GEOM::VERTEX; break;
default: aLimit = GEOM::SHAPE ;
}
return aLimit;
}
//=================================================================================
// function : createOperation
// purpose :
//=================================================================================
GEOM::GEOM_IOperations_ptr OperationGUI_GetSharedShapesDlg::createOperation()
{
return getGeomEngine()->GetIShapesOperations(getStudyId());
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
bool OperationGUI_GetSharedShapesDlg::isValid (QString& msg)
{
if (myListShapes.length() < 2) {
//msg = "Too few shapes selected";
msg = "MSG_SHARED_SHAPES_TOO_FEW_SHAPES";
return false;
}
return true;
}
//=================================================================================
// function : execute
// purpose :
//=================================================================================
bool OperationGUI_GetSharedShapesDlg::execute (ObjectList& objects)
{
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
GEOM::ListOfGO_var aList = anOper->GetSharedShapesMulti(myListShapes, GetType());
if (!aList->length())
return false;
for (int i = 0, n = aList->length(); i < n; i++)
objects.push_back(GEOM::GEOM_Object::_duplicate(aList[i]));
return objects.size();
}
//================================================================
// Function : getFather
// Purpose : Get father object for object to be added in study
// ( called with addInStudy method )
//================================================================
GEOM::GEOM_Object_ptr OperationGUI_GetSharedShapesDlg::getFather (GEOM::GEOM_Object_ptr)
{
if (myListShapes.length() > 0)
//return myListShapes[0]._retn();
return myListShapes[0];
return NULL;
}
//================================================================
// Function : getNewObjectName
// Purpose :
//================================================================
QString OperationGUI_GetSharedShapesDlg::getNewObjectName() const
{
int aLimit = GroupPoints->ComboBox1->currentIndex();
//QString aName = tr("GEOM_SHARED_SHAPE");
QString aName;
switch (aLimit) {
case 0: aName = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_SOLID")) ; break;
case 1: aName = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_SHELL")) ; break;
case 2: aName = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_FACE")) ; break;
case 3: aName = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_WIRE")) ; break;
case 4: aName = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_EDGE")) ; break;
case 5: aName = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_VERTEX")); break;
default: aName = tr("GEOM_SHARED_SHAPE").arg(tr("GEOM_SHAPE")) ;
}
return aName;
}

View File

@ -0,0 +1,73 @@
// Copyright (C) 2007-2010 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 : OperationGUI_GetSharedShapesDlg.h
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
#ifndef OPERATIONGUI_GETSHAREDSHAPESDLG_H
#define OPERATIONGUI_GETSHAREDSHAPESDLG_H
#include <GEOMBase_Skeleton.h>
class DlgRef_2Sel1List1Check;
//=================================================================================
// class : OperationGUI_GetSharedShapesDlg
// purpose :
//=================================================================================
class OperationGUI_GetSharedShapesDlg : public GEOMBase_Skeleton
{
Q_OBJECT
public:
OperationGUI_GetSharedShapesDlg (GeometryGUI*, QWidget* = 0);
~OperationGUI_GetSharedShapesDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
virtual QString getNewObjectName() const;
private:
void Init();
void enterEvent (QEvent*);
int GetType() const;
private:
GEOM::ListOfGO myListShapes;
DlgRef_2Sel1List1Check* GroupPoints;
private slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void ConstructorsClicked (int);
void ComboTextChanged();
};
#endif // OPERATIONGUI_GETSHAREDSHAPESDLG_H

View File

@ -19,11 +19,10 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// GEOM GEOMGUI : GUI for Geometry component
// File : OperationGUI_PartitionDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// GEOM GEOMGUI : GUI for Geometry component
// File : OperationGUI_PartitionDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
//
#include "OperationGUI_PartitionDlg.h" #include "OperationGUI_PartitionDlg.h"
#include <DlgRef.h> #include <DlgRef.h>
@ -44,50 +43,50 @@
//================================================================================= //=================================================================================
// class : OperationGUI_PartitionDlg() // class : OperationGUI_PartitionDlg()
// purpose : Constructs a OperationGUI_PartitionDlg which is a child of 'parent', with the // purpose : Constructs a OperationGUI_PartitionDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'. // name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
OperationGUI_PartitionDlg::OperationGUI_PartitionDlg( GeometryGUI* theGeometryGUI, QWidget* parent ) OperationGUI_PartitionDlg::OperationGUI_PartitionDlg(GeometryGUI* theGeometryGUI, QWidget* parent)
: GEOMBase_Skeleton( theGeometryGUI, parent, false ) : GEOMBase_Skeleton(theGeometryGUI, parent, false)
{ {
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_PARTITION" ) ) ); QPixmap image0(aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PARTITION")));
QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_PARTITION_PLANE" ) ) ); QPixmap image1(aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PARTITION_PLANE")));
QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); QPixmap image2(aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
setWindowTitle( tr( "GEOM_PARTITION_TITLE" ) ); setWindowTitle(tr("GEOM_PARTITION_TITLE"));
/***************************************************************/ /***************************************************************/
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_PARTITION" ) ); mainFrame()->GroupConstructors->setTitle(tr("GEOM_PARTITION"));
mainFrame()->RadioButton1->setIcon( image0 ); mainFrame()->RadioButton1->setIcon(image0);
mainFrame()->RadioButton2->setIcon( image1 ); mainFrame()->RadioButton2->setIcon(image1);
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close(); mainFrame()->RadioButton3->close();
// Full partition (contains half-space partition) // Full partition (contains half-space partition)
GroupPoints = new DlgRef_2Sel1List1Check( centralWidget() ); GroupPoints = new DlgRef_2Sel1List1Check(centralWidget());
GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) ); GroupPoints->GroupBox1->setTitle(tr("GEOM_PARTITION"));
GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) ); GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS"));
GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECTS" ) ); GroupPoints->TextLabel2->setText(tr("GEOM_TOOL_OBJECTS"));
GroupPoints->TextLabel3->setText( tr( "GEOM_RECONSTRUCTION_LIMIT" ) ); GroupPoints->TextLabel3->setText(tr("GEOM_RECONSTRUCTION_LIMIT"));
GroupPoints->PushButton1->setIcon( image2 ); GroupPoints->PushButton1->setIcon(image2);
GroupPoints->PushButton2->setIcon( image2 ); GroupPoints->PushButton2->setIcon(image2);
GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit1->setReadOnly(true);
GroupPoints->LineEdit2->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly(true);
GroupPoints->LineEdit1->setEnabled(true); GroupPoints->LineEdit1->setEnabled(true);
GroupPoints->LineEdit2->setEnabled(false); GroupPoints->LineEdit2->setEnabled(false);
GroupPoints->CheckButton1->setText( tr( "GEOM_KEEP_NONLIMIT_SHAPES" ) ); GroupPoints->CheckButton1->setText(tr("GEOM_KEEP_NONLIMIT_SHAPES"));
QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin( 0 ); layout->setSpacing( 6 ); layout->setMargin(0); layout->setSpacing(6);
layout->addWidget( GroupPoints ); layout->addWidget(GroupPoints);
/***************************************************************/ /***************************************************************/
setHelpFileName( "partition_page.html" ); setHelpFileName("partition_page.html");
Init(); Init();
} }
@ -101,14 +100,14 @@ OperationGUI_PartitionDlg::~OperationGUI_PartitionDlg()
// no need to delete child widgets, Qt does it all for us // no need to delete child widgets, Qt does it all for us
} }
void OperationGUI_PartitionDlg::SetListMaterials( GEOM::ListOfLong ListMaterials ) void OperationGUI_PartitionDlg::SetListMaterials(GEOM::ListOfLong ListMaterials)
{ {
myListMaterials = ListMaterials; myListMaterials = ListMaterials;
} }
GEOM::ListOfLong OperationGUI_PartitionDlg::GetListMaterials() GEOM::ListOfLong OperationGUI_PartitionDlg::GetListMaterials()
{ {
return myListMaterials; return myListMaterials;
} }
//================================================================================= //=================================================================================
@ -118,36 +117,36 @@ GEOM::ListOfLong OperationGUI_PartitionDlg::GetListMaterials()
void OperationGUI_PartitionDlg::Init() void OperationGUI_PartitionDlg::Init()
{ {
/* type for sub shape selection */ /* type for sub shape selection */
GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_SOLID" ) ); GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_SOLID"));
GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_SHELL" ) ); GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_SHELL"));
GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_FACE" ) ); GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_FACE"));
GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_WIRE" ) ); GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_WIRE"));
GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_EDGE" ) ); GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_EDGE"));
GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_VERTEX" ) ); GroupPoints->ComboBox1->addItem(tr("GEOM_RECONSTRUCTION_LIMIT_VERTEX"));
GroupPoints->CheckButton1->setChecked( false ); GroupPoints->CheckButton1->setChecked(false);
mainFrame()->GroupBoxPublish->show(); mainFrame()->GroupBoxPublish->show();
/* signals and slots connections */ /* signals and slots connections */
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupPoints->ComboBox1, SIGNAL( activated( int ) ), this, SLOT( ComboTextChanged() ) );
connect( myGeomGUI->getApp()->selectionMgr(), connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
initName( tr( "GEOM_PARTITION" ) );
ConstructorsClicked( 0 ); connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged()));
connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName(tr("GEOM_PARTITION"));
ConstructorsClicked(0);
GroupPoints->PushButton1->click(); GroupPoints->PushButton1->click();
} }
@ -156,40 +155,40 @@ void OperationGUI_PartitionDlg::Init()
// function : ConstructorsClicked() // function : ConstructorsClicked()
// purpose : Radio button management // purpose : Radio button management
//================================================================================= //=================================================================================
void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId ) void OperationGUI_PartitionDlg::ConstructorsClicked(int constructorId)
{ {
disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 ); disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
globalSelection(); globalSelection();
myListShapes.length( 0 ); myListShapes.length(0);
myListTools.length( 0 ); myListTools.length(0);
myListKeepInside.length( 0 ); myListKeepInside.length(0);
myListRemoveInside.length( 0 ); myListRemoveInside.length(0);
myListMaterials.length( 0 ); myListMaterials.length(0);
switch ( constructorId ) { switch (constructorId) {
case 0: /*Full partition */ case 0: /*Full partition */
GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) ); GroupPoints->GroupBox1->setTitle(tr("GEOM_PARTITION"));
GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECTS" ) ); GroupPoints->TextLabel2->setText(tr("GEOM_TOOL_OBJECTS"));
GroupPoints->TextLabel3->show(); GroupPoints->TextLabel3->show();
GroupPoints->ComboBox1->show(); GroupPoints->ComboBox1->show();
GroupPoints->ComboBox1->setCurrentIndex( 0 ); GroupPoints->ComboBox1->setCurrentIndex(0);
GroupPoints->CheckButton1->show(); GroupPoints->CheckButton1->show();
GroupPoints->PushButton1->setDown( true ); GroupPoints->PushButton1->setDown(true);
GroupPoints->PushButton2->setDown( false ); GroupPoints->PushButton2->setDown(false);
GroupPoints->LineEdit1->setEnabled(true); GroupPoints->LineEdit1->setEnabled(true);
GroupPoints->LineEdit2->setEnabled(false); GroupPoints->LineEdit2->setEnabled(false);
break; break;
case 1: /*Half-space partition */ case 1: /*Half-space partition */
GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION_HALFSPACE" ) ); GroupPoints->GroupBox1->setTitle(tr("GEOM_PARTITION_HALFSPACE"));
GroupPoints->TextLabel3->hide(); GroupPoints->TextLabel3->hide();
GroupPoints->ComboBox1->hide(); GroupPoints->ComboBox1->hide();
GroupPoints->TextLabel2->setText( tr( "GEOM_PLANE" ) ); GroupPoints->TextLabel2->setText(tr("GEOM_PLANE"));
GroupPoints->CheckButton1->hide(); GroupPoints->CheckButton1->hide();
GroupPoints->PushButton1->setDown( true ); GroupPoints->PushButton1->setDown(true);
GroupPoints->LineEdit1->setEnabled(true); GroupPoints->LineEdit1->setEnabled(true);
break; break;
} }
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->clear(); GroupPoints->LineEdit1->clear();
@ -197,11 +196,11 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId )
qApp->processEvents(); qApp->processEvents();
updateGeometry(); updateGeometry();
resize( minimumSizeHint() ); resize(minimumSizeHint());
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
connect( myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
SelectionIntoArgument(); SelectionIntoArgument();
} }
@ -212,7 +211,7 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId )
//================================================================================= //=================================================================================
void OperationGUI_PartitionDlg::ClickOnOk() void OperationGUI_PartitionDlg::ClickOnOk()
{ {
if ( ClickOnApply() ) if (ClickOnApply())
ClickOnCancel(); ClickOnCancel();
} }
@ -223,13 +222,12 @@ void OperationGUI_PartitionDlg::ClickOnOk()
//================================================================================= //=================================================================================
bool OperationGUI_PartitionDlg::ClickOnApply() bool OperationGUI_PartitionDlg::ClickOnApply()
{ {
if ( !onAccept() ) if (!onAccept())
return false; return false;
initName(); initName();
// 0020854: EDF 1398 GEOM: Ergonomy of Partition GUI window // 0020854: EDF 1398 GEOM: Ergonomy of Partition GUI window
// ConstructorsClicked( getConstructorId() ); // ConstructorsClicked(getConstructorId());
return true; return true;
} }
@ -240,46 +238,46 @@ bool OperationGUI_PartitionDlg::ClickOnApply()
//================================================================================= //=================================================================================
void OperationGUI_PartitionDlg::SelectionIntoArgument() void OperationGUI_PartitionDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText("");
QString aString = ""; QString aString = "";
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList; SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList); aSelMgr->selectedObjects(aSelList);
int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true); int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true);
if ( nbSel < 1 ) { if (nbSel < 1) {
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { if (myEditCurrentArgument == GroupPoints->LineEdit1) {
myListShapes.length( 0 ); myListShapes.length(0);
myListMaterials.length( 0 ); myListMaterials.length(0);
} }
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) else if (myEditCurrentArgument == GroupPoints->LineEdit2)
myListTools.length( 0 ); myListTools.length(0);
} }
// One and only one plane can be selected // One and only one plane can be selected
if ( getConstructorId() == 1 && if (getConstructorId() == 1 &&
myEditCurrentArgument == GroupPoints->LineEdit2 && myEditCurrentArgument == GroupPoints->LineEdit2 &&
nbSel != 1 ) { nbSel != 1) {
myListTools.length( 0 ); myListTools.length(0);
return; return;
} }
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { if (myEditCurrentArgument == GroupPoints->LineEdit1) {
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListShapes, true); GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListShapes, true);
myListMaterials.length( 0 ); myListMaterials.length(0);
if ( !myListShapes.length() ) if (!myListShapes.length())
return; return;
} }
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListTools, true); GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListTools, true);
if ( !myListTools.length() ) if (!myListTools.length())
return; return;
} }
myEditCurrentArgument->setText( aString ); myEditCurrentArgument->setText(aString);
} }
@ -290,25 +288,25 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
void OperationGUI_PartitionDlg::SetEditCurrentArgument() void OperationGUI_PartitionDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if ( send == GroupPoints->PushButton1 ) { if (send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->PushButton2->setDown(false); GroupPoints->PushButton2->setDown(false);
GroupPoints->LineEdit1->setEnabled(true); GroupPoints->LineEdit1->setEnabled(true);
GroupPoints->LineEdit2->setEnabled(false); GroupPoints->LineEdit2->setEnabled(false);
} }
else if ( send == GroupPoints->PushButton2 ) { else if (send == GroupPoints->PushButton2) {
myGeomGUI->getApp()->selectionMgr()->clearSelected(); //clear prewious selection myGeomGUI->getApp()->selectionMgr()->clearSelected(); //clear prewious selection
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;
GroupPoints->PushButton1->setDown(false); GroupPoints->PushButton1->setDown(false);
GroupPoints->LineEdit1->setEnabled(false); GroupPoints->LineEdit1->setEnabled(false);
GroupPoints->LineEdit2->setEnabled(true); GroupPoints->LineEdit2->setEnabled(true);
if ( getConstructorId() == 1 ) if (getConstructorId() == 1)
globalSelection( GEOM_PLANE ); globalSelection(GEOM_PLANE);
} }
globalSelection( GEOM_ALLSHAPES ); globalSelection(GEOM_ALLSHAPES);
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
SelectionIntoArgument(); SelectionIntoArgument();
send->setDown(true); send->setDown(true);
@ -323,8 +321,8 @@ void OperationGUI_PartitionDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupPoints->LineEdit1 || if (send == GroupPoints->LineEdit1 ||
send == GroupPoints->LineEdit2 ) { send == GroupPoints->LineEdit2) {
myEditCurrentArgument = send; myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -338,10 +336,10 @@ void OperationGUI_PartitionDlg::LineEditReturnPressed()
void OperationGUI_PartitionDlg::ActivateThisDialog() void OperationGUI_PartitionDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect( myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
ConstructorsClicked( getConstructorId() ); ConstructorsClicked(getConstructorId());
} }
@ -349,9 +347,9 @@ void OperationGUI_PartitionDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void OperationGUI_PartitionDlg::enterEvent( QEvent* ) void OperationGUI_PartitionDlg::enterEvent(QEvent*)
{ {
if ( !mainFrame()->GroupConstructors->isEnabled() ) if (!mainFrame()->GroupConstructors->isEnabled())
this->ActivateThisDialog(); this->ActivateThisDialog();
} }
@ -362,7 +360,7 @@ void OperationGUI_PartitionDlg::enterEvent( QEvent* )
//================================================================================= //=================================================================================
GEOM::GEOM_IOperations_ptr OperationGUI_PartitionDlg::createOperation() GEOM::GEOM_IOperations_ptr OperationGUI_PartitionDlg::createOperation()
{ {
return getGeomEngine()->GetIBooleanOperations( getStudyId() ); return getGeomEngine()->GetIBooleanOperations(getStudyId());
} }
@ -370,10 +368,10 @@ GEOM::GEOM_IOperations_ptr OperationGUI_PartitionDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool OperationGUI_PartitionDlg::isValid( QString& ) bool OperationGUI_PartitionDlg::isValid(QString&)
{ {
return ( myListShapes.length() || myListTools.length() || return (myListShapes.length() || myListTools.length() ||
myListKeepInside.length() || myListRemoveInside.length() ); myListKeepInside.length() || myListRemoveInside.length());
} }
@ -381,7 +379,7 @@ bool OperationGUI_PartitionDlg::isValid( QString& )
// function : execute // function : execute
// purpose : // purpose :
//================================================================================= //=================================================================================
bool OperationGUI_PartitionDlg::execute( ObjectList& objects ) bool OperationGUI_PartitionDlg::execute(ObjectList& objects)
{ {
bool res = false; bool res = false;
@ -392,11 +390,11 @@ bool OperationGUI_PartitionDlg::execute( ObjectList& objects )
int aConstructorId = getConstructorId(); int aConstructorId = getConstructorId();
int aKeepNonlimitShapes = 0; int aKeepNonlimitShapes = 0;
if ( aConstructorId == 1 ) { if (aConstructorId == 1) {
aLimit = GEOM::SHAPE; aLimit = GEOM::SHAPE;
} }
else { else {
if ( GroupPoints->CheckButton1->isChecked() ) { if (GroupPoints->CheckButton1->isChecked()) {
aKeepNonlimitShapes = 1; aKeepNonlimitShapes = 1;
} }
else { else {
@ -404,15 +402,15 @@ bool OperationGUI_PartitionDlg::execute( ObjectList& objects )
} }
} }
if ( isValid( msg ) ) { if (isValid(msg)) {
GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation()); GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());
anObj = anOper->MakePartition( myListShapes, myListTools, anObj = anOper->MakePartition(myListShapes, myListTools,
myListKeepInside, myListRemoveInside, myListKeepInside, myListRemoveInside,
aLimit, false, myListMaterials, aKeepNonlimitShapes ); aLimit, false, myListMaterials, aKeepNonlimitShapes);
res = true; res = true;
} }
if ( !anObj->_is_nil() ) { if (!anObj->_is_nil()) {
TopoDS_Shape aShape; TopoDS_Shape aShape;
GEOMBase::GetShape(anObj, aShape, TopAbs_SHAPE); GEOMBase::GetShape(anObj, aShape, TopAbs_SHAPE);
TopoDS_Iterator It (aShape, Standard_True, Standard_True); TopoDS_Iterator It (aShape, Standard_True, Standard_True);
@ -421,7 +419,7 @@ bool OperationGUI_PartitionDlg::execute( ObjectList& objects )
nbSubshapes++; nbSubshapes++;
if (nbSubshapes) if (nbSubshapes)
objects.push_back( anObj._retn() ); objects.push_back(anObj._retn());
else else
SUIT_MessageBox::warning(this, SUIT_MessageBox::warning(this,
QObject::tr("GEOM_ERROR"), QObject::tr("GEOM_ERROR"),
@ -435,21 +433,21 @@ bool OperationGUI_PartitionDlg::execute( ObjectList& objects )
// function : restoreSubShapes // function : restoreSubShapes
// purpose : // purpose :
//================================================================================= //=================================================================================
void OperationGUI_PartitionDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy, void OperationGUI_PartitionDlg::restoreSubShapes(SALOMEDS::Study_ptr theStudy,
SALOMEDS::SObject_ptr theSObject ) SALOMEDS::SObject_ptr theSObject)
{ {
if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) { if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
// empty list of arguments means that all arguments should be restored // empty list of arguments means that all arguments should be restored
getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(), getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
/*theFindMethod=*/GEOM::FSM_GetInPlaceByHistory, /*theFindMethod=*/GEOM::FSM_GetInPlaceByHistory,
/*theInheritFirstArg=*/myListShapes.length() == 1, /*theInheritFirstArg=*/myListShapes.length() == 1,
mainFrame()->CheckBoxAddPrefix->isChecked() ); // ? false mainFrame()->CheckBoxAddPrefix->isChecked()); // ? false
} }
} }
//======================================================================= //=======================================================================
//function : ComboTextChanged //function : ComboTextChanged
//purpose : //purpose :
//======================================================================= //=======================================================================
void OperationGUI_PartitionDlg::ComboTextChanged() void OperationGUI_PartitionDlg::ComboTextChanged()
{ {
@ -464,13 +462,13 @@ void OperationGUI_PartitionDlg::ComboTextChanged()
//================================================================================= //=================================================================================
// function : GetLimit() // function : GetLimit()
// purpose : // purpose :
//================================================================================= //=================================================================================
int OperationGUI_PartitionDlg::GetLimit() const int OperationGUI_PartitionDlg::GetLimit() const
{ {
int aLimit = GroupPoints->ComboBox1->currentIndex(); int aLimit = GroupPoints->ComboBox1->currentIndex();
switch ( aLimit ) { switch (aLimit) {
case 0: aLimit = GEOM::SOLID ; break; case 0: aLimit = GEOM::SOLID ; break;
case 1: aLimit = GEOM::SHELL ; break; case 1: aLimit = GEOM::SHELL ; break;
case 2: aLimit = GEOM::FACE ; break; case 2: aLimit = GEOM::FACE ; break;

View File

@ -19,11 +19,10 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// GEOM GEOMGUI : GUI for Geometry component
// File : OperationGUI_PartitionDlg.h
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// GEOM GEOMGUI : GUI for Geometry component
// File : OperationGUI_PartitionDlg.h
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
//
#ifndef OPERATIONGUI_PARTITIONDLG_H #ifndef OPERATIONGUI_PARTITIONDLG_H
#define OPERATIONGUI_PARTITIONDLG_H #define OPERATIONGUI_PARTITIONDLG_H
@ -36,13 +35,13 @@ class DlgRef_2Sel1List1Check;
// purpose : // purpose :
//================================================================================= //=================================================================================
class OperationGUI_PartitionDlg : public GEOMBase_Skeleton class OperationGUI_PartitionDlg : public GEOMBase_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
OperationGUI_PartitionDlg( GeometryGUI*, QWidget* = 0 ); OperationGUI_PartitionDlg( GeometryGUI*, QWidget* = 0 );
~OperationGUI_PartitionDlg(); ~OperationGUI_PartitionDlg();
void SetListMaterials( GEOM::ListOfLong ); void SetListMaterials( GEOM::ListOfLong );
GEOM::ListOfLong GetListMaterials(); GEOM::ListOfLong GetListMaterials();