1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
4 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 #==============================================================================
26 # Bug (from script, bug) : tube_geom_corrected.py, PAL5243
27 # Modified : 25/11/2004
28 # Author : Kovaltchuk Alexey
29 # Project : PAL/SALOME
30 #==============================================================================
31 # Geometrie du cas test
36 from salome.geom import geomBuilder
37 geompy = geomBuilder.New(salome.myStudy)
40 # base de l'assemblage
47 base_bot = geompy.MakeBox(0.,0.,0.,L_base,l_base,e_base)
48 base_top = geompy.MakeTranslation(base_bot,0.,0.,h_base-e_base)
49 base_front = geompy.MakeBox(0,0,0,L_base,e_base,h_base)
50 base_rear = geompy.MakeTranslation(base_front,0.,l_base,0.)
52 tmp = geompy.MakeBoolean(base_top,base_rear,3)
53 tmp = geompy.MakeBoolean(tmp,base_bot,3)
54 base = geompy.MakeBoolean(tmp,base_front,3)
56 geompy.addToStudy(base,"base")
65 flange_left = geompy.MakeBox(0.,0.,0,e_trav,L_trav,h_trav)
66 flange_right = geompy.MakeTranslation(flange_left,L_trav-e_trav,0.,0.)
67 flange_front = geompy.MakeBox(0.,0.,0,L_trav,e_trav,h_trav)
68 flange_rear = geompy.MakeTranslation(flange_front,0.,L_trav-e_trav,0.)
70 tmp = geompy.MakeBoolean(flange_left,flange_rear,3)
71 tmp = geompy.MakeBoolean(tmp,flange_right,3)
72 flange = geompy.MakeBoolean(tmp,flange_front,3)
77 length = e_trav/math.sin(math.pi/4.)
78 p1 = geompy.MakeVertex(0,0,0)
79 p2 = geompy.MakeVertex(0,1,0)
80 yaxis = geompy.MakeVector(p1, p2)
81 cut_left = geompy.MakeBox(0.,-marge,0.,-length,L_trav+marge,length)
82 cut_left = geompy.MakeRotation(cut_left,yaxis,-math.pi/4.)
83 cut_left = geompy.MakeTranslation(cut_left,e_trav,0.,0.)
87 symPlaneYZ = geompy.MakePlane(
88 geompy.MakeVertex(L_trav/2.,0.,0.),
89 geompy.MakeVector(p1,geompy.MakeVertex(1.,0.,0.)), 10000. )
90 cut_right = geompy.MakeMirrorByPlane(cut_left,symPlaneYZ)
94 xaxis = geompy.MakeVector(p1,geompy.MakeVertex(1.,0.,0.))
95 cut_front = geompy.MakeBox(-marge,0.,0.,L_trav+marge,length,length)
96 cut_front = geompy.MakeRotation(cut_front,xaxis,3.*math.pi/4.)
97 cut_front = geompy.MakeTranslation(cut_front,0.,e_trav,0.)
101 symPlaneXZ = geompy.MakePlane(
102 geompy.MakeVertex(0.,L_trav/2.,0.),
103 geompy.MakeVector(p1,geompy.MakeVertex(0.,1.,0.)), 10000. )
104 cut_rear = geompy.MakeMirrorByPlane(cut_front,symPlaneXZ)
108 trav = geompy.MakeBoolean(flange,cut_left,2)
109 trav = geompy.MakeBoolean(trav,cut_right,2)
110 trav = geompy.MakeBoolean(trav,cut_front,2)
111 trav = geompy.MakeBoolean(trav,cut_rear,2)
112 trav = geompy.MakeTranslation(trav,
116 geompy.addToStudy(trav,"trav")
120 ground = geompy.MakeBox(-1000.,-1000.,0.,1000.,1000.,-1000.)
121 weld_left = geompy.MakeBoolean(cut_left,ground,2)
122 weld_right = geompy.MakeBoolean(cut_right,ground,2)
123 weld_front = geompy.MakeBoolean(cut_front,ground,2)
124 weld_rear = geompy.MakeBoolean(cut_rear,ground,2)
128 coarse_weld = geompy.MakeBoolean(weld_left,weld_rear,3)
129 coarse_weld = geompy.MakeBoolean(coarse_weld,weld_right,3)
130 coarse_weld = geompy.MakeBoolean(coarse_weld,weld_front,3)
134 left_cleaner = geompy.MakeBox(0.,-10*marge,0.,-10.*marge,10.*marge,10.*marge)
135 left_cleaner = geompy.MakeRotation(left_cleaner,yaxis,math.pi/4.)
136 left_cleaner = geompy.MakeTranslation(left_cleaner,-e_trav-2.*marge,0.,-2.*marge)
138 right_cleaner = geompy.MakeMirrorByPlane(left_cleaner,symPlaneYZ)
140 front_cleaner = geompy.MakeBox(-10*marge,0.,0.,10.*marge,10.*marge,10.*marge)
141 front_cleaner = geompy.MakeRotation(front_cleaner,xaxis,3.*math.pi/4.)
142 front_cleaner = geompy.MakeTranslation(front_cleaner,0.,2.*marge-e_trav,2.*marge)
144 rear_cleaner = geompy.MakeMirrorByPlane(front_cleaner,symPlaneXZ)
148 weld = geompy.MakeBoolean(coarse_weld,left_cleaner,2)
149 weld = geompy.MakeBoolean(weld,rear_cleaner,2)
150 weld = geompy.MakeBoolean(weld,right_cleaner,2)
151 weld = geompy.MakeBoolean(weld,front_cleaner,2)
152 weld = geompy.MakeTranslation(weld,
156 weldId = geompy.addToStudy(weld,"weld")
160 assemblage = geompy.Partition([base ,weld ,trav])
161 assemblageId = geompy.addToStudy(assemblage, "assemblage")
162 salome.sg.updateObjBrowser(1)
166 ## gg.createAndDisplayGO(assemblageId)
167 ## gg.createAndDisplayGO(baseId)
168 ## gg.setTransparency(baseId,0.5)
169 ## gg.setDisplayMode(baseId,1)
170 ## gg.setColor(baseId,255,0,0)
171 ## gg.createAndDisplayGO(travId)
172 ## gg.setTransparency(travId,0.5)
173 ## gg.setDisplayMode(travId,1)
174 ## gg.setColor(travId,0,255,0)