# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
#
-# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+# 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 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.
+# 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
+# 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
+# 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):
geompy.ExportSTEP(shape, fileExportImportSTEP)
# Import
- Import = geompy.Import(fileExportImport, "BREP")
+ Import = geompy.ImportFile(fileExportImport, "BREP")
id_Import = geompy.addToStudy(Import, "Import")
# 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])
# 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])
IsValid = geompy.CheckCompoundOfBlocks(Compound1)
if IsValid == 0:
print "The Blocks Compound is NOT VALID"
+ (NonBlocks, NonQuads) = geompy.GetNonBlocks(Compound1)
+ if NonBlocks is not None:
+ geompy.addToStudyInFather(Compound1, NonBlocks, "Group of non-hexahedral solids")
+ if NonQuads is not None:
+ geompy.addToStudyInFather(Compound1, NonQuads, "Group of non-quadrangular faces")
else:
print "The Blocks Compound is VALID"
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]
geompy.addToStudy(freeFacesWithoutExtra, "freeFacesWithoutExtra")
# GetSharedShapes
- sharedFaces = geompy.GetSharedShapes(part, freeFacesWithoutExtra,
+ sharedFaces = geompy.GetSharedShapes(part, freeFaces,
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, freeFaces],
+ geompy.ShapeType["EDGE"])
+ ind = 1
+ for shEdge in sharedEdges:
+ geompy.addToStudy(shEdge, "sharedEdge_" + `ind`)
+ ind = ind + 1
+ pass
# CheckAndImprove
blocksComp = geompy.CheckAndImprove(part)
geompy.addToStudyInFather(blocksComp, pb0_top_1, "point from blocksComp (-50, 50, 50)")
geompy.addToStudyInFather(blocksComp, pb0_bot_1, "point from blocksComp (-50, -50, -50)")
+ # GetVertexNearPoint(theShape, thePoint)
+ pb0_top_2_near = geompy.MakeVertex(40, 40, 40)
+ pb0_top_2 = geompy.GetVertexNearPoint(blocksComp, pb0_top_2_near)
+
+ geompy.addToStudyInFather(blocksComp, pb0_top_2, "point from blocksComp near (40, 40, 40)")
+
+ # GetEdge(theShape, thePoint1, thePoint2)
+ edge_top_y50 = geompy.GetEdge(blocksComp, pb0_top_1, pb0_top_2)
+
+ geompy.addToStudyInFather(blocksComp, edge_top_y50, "edge from blocksComp by two points")
+
# GetEdgeNearPoint(theShape, thePoint)
pmidle = geompy.MakeVertex(50, 0, 50)
edge1 = geompy.GetEdgeNearPoint(blocksComp, pmidle)
geompy.addToStudyInFather(blocksComp, b0_image, "b0 image")
+ # GetShapesNearPoint(theShape, thePoint, theShapeType, theTolerance)
+ b0_faces_plus = geompy.GetShapesNearPoint(blocksComp, pb0_top_2_near, geompy.ShapeType["FACE"], 0.01)
+
+ geompy.addToStudyInFather(blocksComp, b0_faces_plus, "faces near point (40, 40, 40)")
+
# GetShapesOnPlane
faces_on_pln = geompy.GetShapesOnPlane(blocksComp, geompy.ShapeType["FACE"],
v_0pp, geompy.GEOM.ST_ONIN)
pcyl = geompy.MakeVertex(50, 50, -50)
cyli = geompy.MakeCylinder(pcyl, vz, 40, 100)
fuse = geompy.MakeFuse(sph1, cyli)
- fuse = geompy.MakeFuse(fuse, sph2)
+ sh_1 = geompy.MakeFuse(fuse, sph2)
# As after Fuse we have a compound, we need to obtain a solid from it
- shsh = geompy.SubShapeAll(fuse, geompy.ShapeType["SOLID"])
- sh_1 = shsh[0]
+ #shsh = geompy.SubShapeAll(fuse, geompy.ShapeType["SOLID"])
+ #sh_1 = shsh[0]
geompy.addToStudy(sh_1, "sh_1")
# GetShapesOnShape