X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOM_SWIG%2FGEOM_Nut.py;h=66ff092f3bfd6c527de574eac529b81a8d1ddbdd;hb=c31446905814a9a2f97f24aed67df3e69f68031b;hp=2cd2d7e526f347164eaec13628b344b9a920e366;hpb=e180c20f73ffa96c2d039106f2a2a868c8bc0df1;p=modules%2Fgeom.git diff --git a/src/GEOM_SWIG/GEOM_Nut.py b/src/GEOM_SWIG/GEOM_Nut.py index 2cd2d7e52..66ff092f3 100755 --- a/src/GEOM_SWIG/GEOM_Nut.py +++ b/src/GEOM_SWIG/GEOM_Nut.py @@ -1,87 +1,91 @@ -# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE # -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS # -# 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 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. # -# 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 +# 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. # -# See http://www.salome-platform.org/ +# 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 # -##################################################################### -#Created :17/02/2005 -#Auhtor :MASLOV Eugeny, KOVALTCHUK Alexey -##################################################################### - -import geompy -import salome -import os -import math - -#Sketcher_1 creation -Sketcher_1 = geompy.MakeSketcher("Sketcher:F 100 -57.7:TT 100 57.7:TT 0 115.47:TT -100 57.7:TT -100 -57.7:TT 0 -115.47:WW") -geompy.addToStudy(Sketcher_1, "Sketcher_1") -Face_1 = geompy.MakeFace(Sketcher_1, 1) -geompy.addToStudy(Face_1, "Face_1") - -#Line creation -Line_1 = geompy.MakeLineTwoPnt(geompy.MakeVertex(0,0,0), geompy.MakeVertex(0,0,100)) -geompy.addToStudy(Line_1, "Line_1") - -#Prism creation -Prism_1 = geompy.MakePrismVecH(Face_1, Line_1, 100) -geompy.addToStudy(Prism_1, "Prism_1") - -#Sketcher_2 creation -Sketcher_2 = geompy.MakeSketcher("Sketcher:F 50 0:TT 80 0:TT 112 13:TT 112 48:TT 80 63:TT 80 90:TT 50 90:WW", [0,0,0, 1,0,0, 0,1,0]) -geompy.addToStudy(Sketcher_2, "Sketcher_2") -Face_2 = geompy.MakeFace(Sketcher_2, 1) -geompy.addToStudy(Face_2, "Face_2") - -#Revolution creation -Revolution_1 = geompy.MakeRevolution(Face_2, Line_1, 2*math.pi) -geompy.addToStudy(Revolution_1, "Revolution_1") - -#Common applying -Common_1 = geompy.MakeBoolean(Revolution_1, Prism_1, 1) -geompy.addToStudy(Common_1, "Common_1") - -#Explode Common_1 on edges -CommonExplodedListEdges = geompy.SubShapeAll(Common_1, geompy.ShapeType["EDGE"]) -for i in range(0, len(CommonExplodedListEdges)): - name = "Edge_"+str(i+1) - geompy.addToStudyInFather(Common_1, CommonExplodedListEdges[i], name) - -#Fillet applying -#ID = geompy.GetSubShapeID(Common_1, CommonExplodedListEdges[0]) -Fillet_1 = geompy.MakeFillet(Common_1, 10, geompy.ShapeType["EDGE"], [6]) -geompy.addToStudy(Fillet_1, "Fillet_1") - -#Chamfer applying -Chamfer_1 = geompy.MakeChamferEdge(Fillet_1, 10, 10, 16, 50 ) -geompy.addToStudy(Chamfer_1, "Chamfer_1") - -Chamfer_2 = geompy.MakeChamferEdge(Chamfer_1, 10, 10, 21, 31 ) -geompy.addToStudy(Chamfer_2, "Chamfer_2") - -#Import of the shape from "slots.brep" -thePath = os.getenv("DATA_DIR") -theFileName = thePath + "/Shapes/Brep/slots.brep" -theShapeForCut = geompy.ImportBREP(theFileName) -geompy.addToStudy(theShapeForCut, "slot.brep_1") - -#Cut applying -Cut_1 = geompy.MakeBoolean(Chamfer_2, theShapeForCut, 2) -geompy.addToStudy(Cut_1, "Cut_1") - -salome.sg.updateObjBrowser(1) - +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +##################################################################### +#Created :17/02/2005 +#Auhtor :MASLOV Eugeny, KOVALTCHUK Alexey +##################################################################### +# +import geompy +import salome +import os +import math + +#Sketcher_1 creation +Sketcher_1 = geompy.MakeSketcher("Sketcher:F 100 -57.7:TT 100 57.7:TT 0 115.47:TT -100 57.7:TT -100 -57.7:TT 0 -115.47:WW") +geompy.addToStudy(Sketcher_1, "Sketcher_1") +Face_1 = geompy.MakeFace(Sketcher_1, 1) +geompy.addToStudy(Face_1, "Face_1") + +#Line creation +Line_1 = geompy.MakeLineTwoPnt(geompy.MakeVertex(0,0,0), geompy.MakeVertex(0,0,100)) +geompy.addToStudy(Line_1, "Line_1") + +#Prism creation +Prism_1 = geompy.MakePrismVecH(Face_1, Line_1, 100) +geompy.addToStudy(Prism_1, "Prism_1") + +#Sketcher_2 creation +Sketcher_2 = geompy.MakeSketcher("Sketcher:F 50 0:TT 80 0:TT 112 13:TT 112 48:TT 80 63:TT 80 90:TT 50 90:WW", [0,0,0, 1,0,0, 0,1,0]) +geompy.addToStudy(Sketcher_2, "Sketcher_2") +Face_2 = geompy.MakeFace(Sketcher_2, 1) +geompy.addToStudy(Face_2, "Face_2") + +#Revolution creation +Revolution_1 = geompy.MakeRevolution(Face_2, Line_1, 2*math.pi) +geompy.addToStudy(Revolution_1, "Revolution_1") + +#Common applying +Common_1 = geompy.MakeBoolean(Revolution_1, Prism_1, 1) +geompy.addToStudy(Common_1, "Common_1") + +#Explode Common_1 on edges +CommonExplodedListEdges = geompy.SubShapeAll(Common_1, geompy.ShapeType["EDGE"]) +for i in range(0, len(CommonExplodedListEdges)): + name = "Edge_"+str(i+1) + geompy.addToStudyInFather(Common_1, CommonExplodedListEdges[i], name) + +#Fillet applying +#ID = geompy.GetSubShapeID(Common_1, CommonExplodedListEdges[0]) +Fillet_1 = geompy.MakeFillet(Common_1, 10, geompy.ShapeType["EDGE"], [5]) +geompy.addToStudy(Fillet_1, "Fillet_1") + +#Chamfer applying +Chamfer_1 = geompy.MakeChamferEdge(Fillet_1, 10, 10, 16, 50 ) +geompy.addToStudy(Chamfer_1, "Chamfer_1") + +Chamfer_2 = geompy.MakeChamferEdge(Chamfer_1, 10, 10, 21, 31 ) +geompy.addToStudy(Chamfer_2, "Chamfer_2") + +#Import of the shape from "slots.brep" +thePath = os.getenv("DATA_DIR") +theFileName = thePath + "/Shapes/Brep/slots.brep" +theShapeForCut = geompy.ImportBREP(theFileName) +geompy.addToStudy(theShapeForCut, "slot.brep_1") + +#Cut applying +Cut_1 = geompy.MakeBoolean(Chamfer_2, theShapeForCut, 2) +geompy.addToStudy(Cut_1, "Cut_1") + +salome.sg.updateObjBrowser(1) +