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
subshapes of a given Type and returns a List of IDs of
sub-shapes.</li>
<li><em>geompy.SubShapeAllSorted(Shape, Type)</em> xplodes a shape on
subshapes of a given type and sorts them by coordinates of their
gravity centers, returning a list of sub-shapes.</li>
<li><em>geompy.SubShapeAllSortedIDs(Shape, Type)</em> explodes a shape
on subshapes of a given type and sorts them by coordinates of their
gravity centers, returning a List of IDs of sub-shapes.</li>
<li><em>geompy.SubShapeAllSortedCentres(Shape, Type)</em> explodes a
shape on subshapes of a given type and sorts them by coordinates of
their gravity centers, returning a list of sub-shapes.</li>
<li><em>geompy.SubShapeAllSortedCentresIDs(Shape, Type)</em> explodes
a shape on subshapes of a given type and sorts them by coordinates of
their gravity centers, returning a List of IDs of sub-shapes.</li>
<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
list of all sub-shapes of the given Type. Each index is in the range
[1, Nb_Sub-Shapes_Of_Given_Type].</li>
<li><em>geompy.SubShapeSorted(Shape, Type, ListOfInd)</em> allows to
obtain a compound of sub-shapes of the Shape, selected by they indices
in sorted list of all sub-shapes of the given Type. Each index is in
the range [1, Nb_Sub-Shapes_Of_Given_Type]</li>
<li><em>geompy.SubShapeSortedCentres(Shape, Type, ListOfInd)</em>
allows to obtain a compound of sub-shapes of the Shape, selected by
they indices in sorted list of all sub-shapes of the given Type. Each
index is in the range [1, Nb_Sub-Shapes_Of_Given_Type]</li>
</ul>
\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>
<li>\subpage shapesonshape_page "Get shapes on shape" operation, a
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>

View File

@ -132,7 +132,7 @@ face = geompy.MakeFaces([sketcher1, sketcher2],isPlanarFace)
prism = geompy.MakePrism(face, p0, pxyz)
# 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
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)
# 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
shell = geompy.MakeShell([prism_faces[0], prism_faces[1],

View File

@ -271,7 +271,7 @@ faces.append(f3)
faces.append(f4)
shell = geompy.MakeSewing(faces,1.e-6)
shells.append(shell)
faces = geompy.SubShapeAllSorted(shell, geompy.ShapeType["FACE"])
faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
subbases.append(faces[0])
# 2 section
@ -311,7 +311,7 @@ faces.append(f3)
faces.append(f4)
shell = geompy.MakeSewing(faces,1.e-6)
shells.append(shell)
faces = geompy.SubShapeAllSorted(shell, geompy.ShapeType["FACE"])
faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
subbases.append(faces[0])
# 3 section
@ -356,7 +356,7 @@ faces.append(f3)
faces.append(f4)
shell = geompy.MakeSewing(faces,1.e-6)
shells.append(shell)
faces = geompy.SubShapeAllSorted(shell, geompy.ShapeType["FACE"])
faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
subbases.append(faces[2])
# 4 section
@ -391,7 +391,7 @@ vp = geompy.MakeVertex(c3[0]-20,c3[1],c3[2])
ff = geompy.MakePlane(vp,vec,40)
fs.append(ff)
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[1])
@ -399,7 +399,7 @@ faces.append(fs[2])
faces.append(fs[3])
shell = geompy.MakeSewing(faces,1.e-6)
shells.append(shell)
faces = geompy.SubShapeAllSorted(shell, geompy.ShapeType["FACE"])
faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
#===========================================================
@ -501,25 +501,25 @@ locs = []
# 1 section
shell = MakeComplexSect(vs[0], geompy.MakeVectorDXDYDZ(1,0,0), 60, 40, 16)
shells.append(shell)
vs1 = geompy.SubShapeAllSorted(shell,geompy.ShapeType["VERTEX"])
vs1 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
locs.append(vs1[17])
# 2 section
shell = MakeComplexSect(vs[1], geompy.MakeVectorDXDYDZ(1,0,0), 80, 30, 16)
shells.append(shell)
vs2 = geompy.SubShapeAllSorted(shell,geompy.ShapeType["VERTEX"])
vs2 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
locs.append(vs2[17])
# 3 section
shell = MakeComplexSect(vs[2], geompy.MakeVectorDXDYDZ(1,0,0), 60, 40, 16)
shells.append(shell)
vs3 = geompy.SubShapeAllSorted(shell,geompy.ShapeType["VERTEX"])
vs3 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
locs.append(vs3[17])
# 4 section
shell = MakeComplexSect(vs[3], geompy.MakeVectorDXDYDZ(0,1,0), 40, 35, 16)
shells.append(shell)
vs4 = geompy.SubShapeAllSorted(shell,geompy.ShapeType["VERTEX"])
vs4 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
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")
# get a face
faces = geompy.SubShapeAllSorted(ImportFromBREP, geompy.ShapeType["FACE"])
faces = geompy.SubShapeAllSortedCentres(ImportFromBREP, geompy.ShapeType["FACE"])
# get the free boundary for face 32
Res = geompy.GetFreeBoundary(faces[32])
@ -223,7 +223,7 @@ cut = geompy.MakeCut(cone, cylinder)
# get faces as sub-shapes
faces = []
faces = geompy.SubShapeAllSorted(cut, geompy.ShapeType["FACE"])
faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"])
f_2 = geompy.GetSubShapeID(cut, faces[0])
# 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)
# 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 :
sub_shape_id = geompy.GetSubShapeID(cut_without_f_2, face)
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
sup_faces = []
sup_faces = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])
sup_faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"])
# get indices of the sub-shape
f1_id = geompy.GetSubShapeID(box, sup_faces[3])
@ -182,7 +182,7 @@ cut = geompy.MakeCut(cone, cylinder)
# get faces as sub-shapes
faces = []
faces = geompy.SubShapeAllSorted(cut, geompy.ShapeType["FACE"])
faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"])
f_2 = geompy.GetSubShapeID(cut, faces[2])
# remove one face from the shape
@ -190,7 +190,7 @@ cut_without_f_2 = geompy.SuppressFaces(cut, [f_2])
# get wires as sub-shapes
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])
# suppress the selected wire
@ -308,12 +308,12 @@ divide = geompy.DivideEdge(edge, -1, 0.5, 0)
# add objects in the study
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:
geompy.addToStudyInFather(edge, point, "Edge's point")
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:
geompy.addToStudyInFather(divide, point, "Edge's point after divide")

View File

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

View File

@ -381,7 +381,7 @@ gg = salome.ImportComponentGUI("GEOM")
# create box
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
# 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
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
@ -424,7 +424,7 @@ face = geompy.MakeFace(wire, 1)
prism = geompy.MakePrismVecH(face, vz, 100.0)
# 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.append(geompy.GetSubShapeID(prism, prism_edges[0]))
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)
# 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_2 = geompy.GetSubShapeID(prism, prism_faces[1])
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"])
# 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] :
FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
geompy.AddObject(group, FaceID)
@ -60,7 +60,7 @@ Box = geompy.MakeBoxTwoPnt(p0, p200)
group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
# 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] :
FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
geompy.AddObject(group, FaceID)
@ -89,7 +89,7 @@ Box = geompy.MakeBoxTwoPnt(p0, p200)
group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
# 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] :
FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
geompy.AddObject(group, FaceID)

View File

@ -1391,12 +1391,7 @@ module GEOM
in ListOfGO theFaces, in boolean doKeepNonSolids);
/*!
* Explode a shape on subshapes of a given type.
* \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.
* Deprecated method. Use MakeAllSubShapes() instead.
*/
ListOfGO MakeExplode (in GEOM_Object theShape,
in long theShapeType,
@ -1404,15 +1399,34 @@ module GEOM
/*!
* Explode a shape on subshapes of a given type.
* Does the same, as the above method, but returns IDs of sub-shapes,
* not GEOM_Objects. It works faster.
* \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 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 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 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 boolean isSorted);
@ -1502,6 +1516,15 @@ module GEOM
in GEOM_Object theShape2,
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
* the specified plane by the certain way, defined through \a theState parameter.

View File

@ -140,6 +140,7 @@ select1.png \
sewing.png \
shading.png \
shapesonshape.png \
shared_shapes.png \
sketch.png \
sphere.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
//
// GEOM GEOMGUI : GUI for Geometry component
// File : EntityGUI_SubShapeDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
//
#include "EntityGUI_SubShapeDlg.h"
#include <DlgRef.h>
@ -560,7 +559,7 @@ bool EntityGUI_SubShapeDlg::isValid (QString& msg)
bool EntityGUI_SubShapeDlg::execute (ObjectList& objects)
{
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())
return false;

View File

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

View File

@ -1737,7 +1737,7 @@ Please, select face, shell or solid and try again</translation>
</message>
<message>
<source>GEOM_SUBSHAPE_TYPE</source>
<translation>Sub Shapes Type :</translation>
<translation>Sub Shapes Type</translation>
</message>
<message>
<source>GEOM_SUB_SHAPE</source>
@ -3992,17 +3992,29 @@ Please, select face, shell or solid and try again</translation>
<translation>INOUT</translation>
</message>
<message>
<source>TOP_GET_SHAPES_ON_SHAPES</source>
<source>TOP_GET_SHAPES_ON_SHAPE</source>
<translation>Get shapes on shape</translation>
</message>
<message>
<source>MEN_GET_SHAPES_ON_SHAPES</source>
<source>MEN_GET_SHAPES_ON_SHAPE</source>
<translation>Get Shapes on Shape</translation>
</message>
<message>
<source>STB_GET_SHAPES_ON_SHAPES</source>
<source>STB_GET_SHAPES_ON_SHAPE</source>
<translation>Get shapes on shape</translation>
</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>
<source>GEOM_PUBLISH_RESULT_GRP</source>
<translation>Advanced options</translation>
@ -4513,6 +4525,29 @@ Would you like to continue?</translation>
<translation>Load Texture</translation>
</message>
</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>
<name>AdvancedGUI_PipeTShapeDlg</name>
<message>

View File

@ -19,11 +19,10 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component
// File : GeometryGUI.cxx
// 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 "Python.h"
#include "GeometryGUI.h"
@ -460,6 +459,7 @@ void GeometryGUI::OnGUIEvent( int id )
case GEOMOp::OpShapesOnShape: // MENU OPERATION - GET SHAPES ON SHAPE
case GEOMOp::OpFillet2d: // MENU OPERATION - FILLET 2D
case GEOMOp::OpFillet1d: // MENU OPERATION - FILLET 1D
case GEOMOp::OpSharedShapes: // MENU OPERATION - GET SHARED SHAPES
libName = "OperationGUI";
break;
case GEOMOp::OpSewing: // MENU REPAIR - SEWING
@ -663,7 +663,8 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( GEOMOp::OpFillet3d, "FILLET" );
createGeomAction( GEOMOp::OpChamfer, "CHAMFER" );
//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::OpFillet2d, "FILLET_2D" );
@ -840,6 +841,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createMenu( GEOMOp::OpPartition, operId, -1 );
createMenu( GEOMOp::OpArchimede, operId, -1 );
createMenu( GEOMOp::OpShapesOnShape, operId, -1 );
createMenu( GEOMOp::OpSharedShapes, operId, -1 );
createMenu( separator(), operId, -1 );
@ -970,6 +972,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createTool( GEOMOp::OpPartition, operTbId );
createTool( GEOMOp::OpArchimede, operTbId );
createTool( GEOMOp::OpShapesOnShape, operTbId );
createTool( GEOMOp::OpSharedShapes, operTbId );
createTool( separator(), operTbId );
createTool( GEOMOp::OpFillet1d, operTbId );
createTool( GEOMOp::OpFillet2d, operTbId );

View File

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

View File

@ -19,13 +19,12 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : GEOMImpl_IShapesOperations.cxx
// Created :
// Author : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007
// Project : SALOME
// $Header$
//
#include <Standard_Stream.hxx>
#include "GEOMImpl_IShapesOperations.hxx"
@ -811,7 +810,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList
Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode
(Handle(GEOM_Object) theShape,
const Standard_Integer theShapeType,
const Standard_Boolean isSorted)
const Standard_Boolean isSorted,
const Standard_Boolean isOldSorting)
{
SetErrorCode(KO);
@ -853,7 +853,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode
}
if (isSorted)
SortShapes(listShape);
SortShapes(listShape, isOldSorting);
TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes(aShape, anIndices);
@ -899,7 +899,10 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode
GEOM::TPythonDump pd (aMainShape, /*append=*/true);
pd << "[" << anAsciiList.ToCString();
pd << "] = geompy.SubShapeAll" << (isSorted ? "Sorted(" : "(");
if (isSorted)
pd << "] = geompy.SubShapeAllSorted" << (isOldSorting ? "(" : "Centres(");
else
pd << "] = geompy.SubShapeAll(";
pd << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")";
SetErrorCode(OK);
@ -915,7 +918,8 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode
Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs
(Handle(GEOM_Object) theShape,
const Standard_Integer theShapeType,
const Standard_Boolean isSorted)
const Standard_Boolean isSorted,
const Standard_Boolean isOldSorting)
{
SetErrorCode(KO);
@ -954,7 +958,7 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs
}
if (isSorted)
SortShapes(listShape);
SortShapes(listShape, isOldSorting);
TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes(aShape, anIndices);
@ -971,7 +975,10 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs
//Make a Python command
GEOM::TPythonDump pd (aFunction, /*append=*/true);
pd << "listSubShapeIDs = geompy.SubShapeAll";
pd << (isSorted ? "SortedIDs(" : "IDs(");
if (isSorted)
pd << "Sorted" << (isOldSorting ? "IDs(" : "CentresIDs(");
else
pd << "IDs(";
pd << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")";
SetErrorCode(OK);
@ -1413,6 +1420,112 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetSharedShapes
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;
}
//=============================================================================
/*!
*
@ -3373,7 +3486,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceByHistory
//function : SortShapes
//purpose :
//=======================================================================
void GEOMImpl_IShapesOperations::SortShapes(TopTools_ListOfShape& SL)
void GEOMImpl_IShapesOperations::SortShapes(TopTools_ListOfShape& SL,
const Standard_Boolean isOldSorting)
{
Standard_Integer MaxShapes = SL.Extent();
TopTools_Array1OfShape aShapes (1,MaxShapes);
@ -3392,14 +3506,27 @@ void GEOMImpl_IShapesOperations::SortShapes(TopTools_ListOfShape& SL)
SL.Remove( it ); // == it.Next()
aShapes(Index) = S;
OrderInd.SetValue (Index, Index);
if (S.ShapeType() == TopAbs_VERTEX)
{
if (S.ShapeType() == TopAbs_VERTEX) {
GPoint = BRep_Tool::Pnt( TopoDS::Vertex( S ));
Length.SetValue( Index, (Standard_Real) S.Orientation());
}
else
{
else {
// BEGIN: fix for Mantis issue 0020842
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();
Length.SetValue(Index, GPr.Mass());
}

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//=============================================================================
// File : GEOMImpl_IShapesOperations.hxx
@ -27,7 +26,7 @@
// Project : SALOME
// $Header$
//=============================================================================
//
#ifndef _GEOMImpl_IShapesOperations_HXX_
#define _GEOMImpl_IShapesOperations_HXX_
@ -85,13 +84,17 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
std::list<Handle(GEOM_Object)> theFaces,
const Standard_Boolean doKeepNonSolids);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode (Handle(GEOM_Object) theShape,
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode
(Handle(GEOM_Object) theShape,
const Standard_Integer theShapeType,
const Standard_Boolean isSorted);
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
(Handle(GEOM_Object) theShape,
const Standard_Integer theShapeType,
const Standard_Boolean isSorted);
const Standard_Boolean isSorted,
const Standard_Boolean isOldSorting = Standard_False);
Standard_EXPORT Handle(GEOM_Object) GetSubShape (Handle(GEOM_Object) theMainShape,
const Standard_Integer theID);
@ -111,11 +114,17 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
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)
GetSharedShapes (Handle(GEOM_Object) theShape1,
Handle(GEOM_Object) theShape2,
const Standard_Integer theShapeType);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnPlane (const Handle(GEOM_Object)& theShape,
Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
GetSharedShapes (std::list<Handle(GEOM_Object)> theShapes,
const Standard_Integer theShapeType);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
GetShapesOnPlane (const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
const Handle(GEOM_Object)& theAx1,
const GEOMAlgo_State theState);
@ -318,7 +327,8 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
* \brief Sort shapes in the list by their coordinates.
* \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.

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Standard_Stream.hxx>
@ -411,7 +410,6 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
return GetObject(anObject);
}
//=============================================================================
/*!
* MakeExplode
@ -427,7 +425,34 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeExplode (GEOM::GEOM_Object_ptr the
if (aShape.IsNull()) return aSeq._retn();
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())
return aSeq._retn();
@ -454,7 +479,33 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::SubShapeAllIDs (GEOM::GEOM_Object_pt
if (aShape.IsNull()) return aSeq._retn();
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();
Standard_Integer aLength = aHSeq->Length();
@ -672,6 +723,42 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes
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)
{
GEOMAlgo_State aState = GEOMAlgo_ST_UNKNOWN;

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef _GEOM_IShapesOperations_i_HeaderFile
#define _GEOM_IShapesOperations_i_HeaderFile
@ -76,14 +75,25 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
CORBA::Boolean doKeepNonSolids);
// For old SubShapeAll()
// Deprecated, use MakeAllSubShapes() instead
GEOM::ListOfGO* MakeExplode (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
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,
CORBA::Long theShapeType,
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,
CORBA::Long theID);
@ -108,6 +118,9 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
GEOM::GEOM_Object_ptr theShape2,
CORBA::Long theShapeType);
GEOM::ListOfGO* GetSharedShapesMulti (const GEOM::ListOfGO& theShapes,
CORBA::Long theShapeType);
GEOM::ListOfGO* GetShapesOnPlane (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theAx1,

View File

@ -105,7 +105,7 @@ def MakeSpanner (geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh = None):
else:
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
for aFace in Prism1_faces:
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
FaceTop_edges = geompy.SubShapeAllSorted(FaceTop, geompy.ShapeType["EDGE"])
FaceTop_edges = geompy.SubShapeAllSortedCentres(FaceTop, geompy.ShapeType["EDGE"])
Edge1 = FaceTop_edges[0]
Edge2 = FaceTop_edges[3]
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
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],
prism1_faces[3], prism1_faces[4],
prism1_faces[5], prism1_faces[2]])
@ -230,7 +230,7 @@ def TestAll (geompy, math):
Orientation = geompy.ChangeOrientation(Box)
#IDList for Fillet/Chamfer
prism_edges = geompy.SubShapeAllSorted(Prism, ShapeTypeEdge)
prism_edges = geompy.SubShapeAllSortedCentres(Prism, ShapeTypeEdge)
for anEdge in prism_edges:
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[2]))
prism_faces = geompy.SubShapeAllSorted(Prism, ShapeTypeFace)
prism_faces = geompy.SubShapeAllSortedCentres(Prism, ShapeTypeFace)
f_ind_1 = geompy.GetSubShapeID(Prism, prism_faces[0])
f_ind_2 = geompy.GetSubShapeID(Prism, prism_faces[1])
@ -432,8 +432,8 @@ def TestAll (geompy, math):
name = geompy.SubShapeName(SubFace, Box)
id_SubFace = geompy.addToStudyInFather(Box, SubFace, name)
# SubShapeSorted
SubFaceS = geompy.SubShapeSorted(Box, geompy.ShapeType["FACE"], [5])
# SubShapeSortedCentres
SubFaceS = geompy.SubShapeSortedCentres(Box, geompy.ShapeType["FACE"], [5])
nameS = geompy.SubShapeName(SubFaceS, Box)
id_SubFace = geompy.addToStudyInFather(Box, SubFaceS, nameS)
@ -451,8 +451,8 @@ def TestAll (geompy, math):
geompy.UnionIDs(group, SubEdgeIDsList)
geompy.addToStudyInFather(SubFace, group, "Group of all edges")
# SubShapeAllSortedIDs
SubEdgeIDsList = geompy.SubShapeAllSortedIDs(SubFace, geompy.ShapeType["EDGE"])
# SubShapeAllSortedCentresIDs
SubEdgeIDsList = geompy.SubShapeAllSortedCentresIDs(SubFace, geompy.ShapeType["EDGE"])
print "IDs of edges of SubFace:", SubEdgeIDsList, "(sorted)"
# GetSubShape and GetSubShapeID

View File

@ -86,7 +86,7 @@ def TestSuppressFaces (geompy):
#IDList for SuppHole
faces = []
faces = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"])
faces = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
f_glob_id = geompy.GetSubShapeID(Box, faces[5])
@ -237,7 +237,7 @@ def TestSuppressHoles (geompy):
#IDList for SuppressFaces
faces = []
faces = geompy.SubShapeAllSorted(Cut, geompy.ShapeType["FACE"])
faces = geompy.SubShapeAllSortedCentres(Cut, geompy.ShapeType["FACE"])
ind = 0
for face in faces:
f_name = "FACE %d"%(ind)
@ -249,9 +249,10 @@ def TestSuppressHoles (geompy):
f_glob_id_0 = geompy.GetSubShapeID(Cut, faces[0])
cut_without_f_0 = geompy.SuppressFaces(Cut, [f_glob_id_0])
geompy.addToStudy(cut_without_f_0, "Cut without face 0")
faces1 = []
faces1 = geompy.SubShapeAllSorted(cut_without_f_0, geompy.ShapeType["FACE"])
faces1 = geompy.SubShapeAllSortedCentres(cut_without_f_0, geompy.ShapeType["FACE"])
ind = 0
for face in faces1:
f_name = "FACE %d"%(ind)
@ -261,25 +262,25 @@ def TestSuppressHoles (geompy):
print "face ", ind, " global index = ", f_glob_id
ind = ind + 1
f_glob_id_5 = geompy.GetSubShapeID(cut_without_f_0, faces1[5])
cut_without_f_0_5 = geompy.SuppressFaces(cut_without_f_0, [f_glob_id_5])
cut_without_f_0_5_id = geompy.addToStudy(cut_without_f_0_5, "Cut without faces 0 and 5")
f_glob_id_3 = geompy.GetSubShapeID(cut_without_f_0, faces1[3])
cut_without_f_0_3 = geompy.SuppressFaces(cut_without_f_0, [f_glob_id_3])
cut_without_f_0_3_id = geompy.addToStudy(cut_without_f_0_3, "Cut without faces 0 and 3")
#IDList for SuppHole
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
for wire in wires:
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
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")
def TestMakeSewing (geompy, math):
@ -314,7 +315,7 @@ def TestDivideEdge (geompy):
Box = geompy.MakeBoxDXDYDZ(200., 200., 200.)
#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])
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 #######
faces = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])
faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"])
face0 = faces[0]
vnorm = geompy.GetNormal(face0)
if vnorm is None:

View File

@ -20,17 +20,17 @@
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# GEOM GEOM_SWIG : binding of C++ implementaion with Python
# File : GEOM_TestOthers.py
# Author : Julia DOROVSKIKH
# Module : GEOM
# $Header$
#
# ! Please, if you edit this example file, update also
# ! GEOM_SRC/doc/salome/gui/GEOM/input/tui_test_others.doc
# ! as some sequences of symbols from this example are used during
# ! documentation generation to identify certain places of this file
#
import os
def TestExportImport (geompy, shape):
@ -181,7 +181,7 @@ def TestOtherOperations (geompy, math):
# MakeFilletAll
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)
SuppFace = geompy.SuppressFaces(Box, [f_glob_id])
@ -196,7 +196,7 @@ def TestOtherOperations (geompy, math):
# MakeChamfer
d1 = 13.
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_2 = geompy.GetSubShapeID(Box, box_faces[1])
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, [])
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_2 = faces[39]
@ -471,9 +471,19 @@ def TestOtherOperations (geompy, math):
# GetSharedShapes
sharedFaces = geompy.GetSharedShapes(part, freeFacesWithoutExtra,
geompy.ShapeType["FACE"])
ind = 1
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
blocksComp = geompy.CheckAndImprove(part)

View File

@ -51,6 +51,7 @@
## @defgroup l3_advanced Creating Advanced Geometrical 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_obtain Access to subshapes by a criteria
## @defgroup l4_advanced Advanced objects creation functions
@ -1714,6 +1715,18 @@ class geompyDC(GEOM._objref_GEOM_Gen):
RaiseIfFailed("GetSharedShapes", self.ShapesOp)
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>,
# situated relatively the specified plane by the certain way,
# defined through <VAR>theState</VAR> parameter.
@ -2035,8 +2048,8 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref swig_all_decompose "Example"
def SubShapeAll(self, aShape, aType):
# Example: see GEOM_TestAll.py
ListObj = self.ShapesOp.MakeExplode(aShape,aType,0)
RaiseIfFailed("MakeExplode", self.ShapesOp)
ListObj = self.ShapesOp.MakeAllSubShapes(aShape, aType, False)
RaiseIfFailed("SubShapeAll", self.ShapesOp)
return ListObj
## Explode a shape on subshapes of a given type.
@ -2046,35 +2059,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
#
# @ref swig_all_decompose "Example"
def SubShapeAllIDs(self, aShape, aType):
ListObj = self.ShapesOp.SubShapeAllIDs(aShape,aType,0)
ListObj = self.ShapesOp.GetAllSubShapesIDs(aShape, aType, False)
RaiseIfFailed("SubShapeAllIDs", 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 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>,
# 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]
@ -2083,29 +2071,87 @@ class geompyDC(GEOM._objref_GEOM_Gen):
def SubShape(self, aShape, aType, ListOfInd):
# Example: see GEOM_TestAll.py
ListOfIDs = []
AllShapeList = self.SubShapeAll(aShape, aType)
AllShapeIDsList = self.SubShapeAllIDs(aShape, aType)
for ind in ListOfInd:
ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
ListOfIDs.append(AllShapeIDsList[ind - 1])
anObj = self.GetSubShape(aShape, ListOfIDs)
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>,
# 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]
#
# @ref swig_all_decompose "Example"
def SubShapeSorted(self,aShape, aType, ListOfInd):
def SubShapeSortedCentres(self, aShape, aType, ListOfInd):
# Example: see GEOM_TestAll.py
ListOfIDs = []
AllShapeList = self.SubShapeAllSorted(aShape, aType)
AllShapeIDsList = self.SubShapeAllSortedCentresIDs(aShape, aType)
for ind in ListOfInd:
ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
ListOfIDs.append(AllShapeIDsList[ind - 1])
anObj = self.GetSubShape(aShape, ListOfIDs)
return anObj
# 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
## @{

View File

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

View File

@ -19,11 +19,10 @@
//
// 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.
//
#include "OperationGUI.h"
#include <GeometryGUI.h>
@ -44,6 +43,7 @@
#include "OperationGUI_ChamferDlg.h" // Method CHAMFER
#include "OperationGUI_ClippingDlg.h" // Clipping dialog box
#include "OperationGUI_GetShapesOnShapeDlg.h"
#include "OperationGUI_GetSharedShapesDlg.h"
//=======================================================================
// function : OperationGUI()
@ -81,6 +81,7 @@ bool OperationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
case GEOMOp::OpChamfer: (new OperationGUI_ChamferDlg (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::OpSharedShapes: (new OperationGUI_GetSharedShapesDlg (getGeometryGUI(), parent))->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:

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
//
// GEOM GEOMGUI : GUI for Geometry component
// File : OperationGUI_PartitionDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
//
#include "OperationGUI_PartitionDlg.h"
#include <DlgRef.h>
@ -226,7 +225,6 @@ bool OperationGUI_PartitionDlg::ClickOnApply()
if (!onAccept())
return false;
initName();
// 0020854: EDF 1398 GEOM: Ergonomy of Partition GUI window
// ConstructorsClicked(getConstructorId());

View File

@ -19,11 +19,10 @@
//
// 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.
//
#ifndef OPERATIONGUI_PARTITIONDLG_H
#define OPERATIONGUI_PARTITIONDLG_H