1 ## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
3 ## This library is free software; you can redistribute it and/or
4 ## modify it under the terms of the GNU Lesser General Public
5 ## License as published by the Free Software Foundation; either
6 ## version 2.1 of the License, or (at your option) any later version.
8 ## This library is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 ## Lesser General Public License for more details.
13 ## You should have received a copy of the GNU Lesser General Public
14 ## License along with this library; if not, write to the Free Software
15 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 ## See http:##www.salome-platform.org/ or
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 # -*- coding: utf-8 -*-
23 from salome.shaper import model
26 partSet = model.moduleDocument()
27 Part_1 = model.addPart(partSet)
28 Part_1_doc = Part_1.document()
29 model.addParameter(Part_1_doc, "BHD", "8", "Base Hole Diameter")
30 model.addParameter(Part_1_doc, "BHPD", "14", "Base Hole Plate Diameter")
31 model.addParameter(Part_1_doc, "BHPS", "2", "Base Hole Plate Thickness")
32 model.addParameter(Part_1_doc, "BHPFR", "BHPS/4*3", "Base Hole Plate Fillet Radius")
33 model.addParameter(Part_1_doc, "BPS", "6", "Base Plate Thickness")
34 model.addParameter(Part_1_doc, "Draft", "100", "Bracket Draft")
35 model.addParameter(Part_1_doc, "TDI", "14", "Tube Internal Diameter")
36 model.addParameter(Part_1_doc, "TDE", "TDI+8", "Tube External Diameter")
37 model.addParameter(Part_1_doc, "TL", "86", "Tube Length")
38 model.addParameter(Part_1_doc, "Width", "112", "Full Width of Base")
39 model.addParameter(Part_1_doc, "LegThick", "5")
40 model.addParameter(Part_1_doc, "BaseLegFillet", "3")
41 model.addParameter(Part_1_doc, "LegTopFillet", "2")
42 model.addParameter(Part_1_doc, "BottomCutFillet", "2")
43 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
44 SketchLine_1 = Sketch_1.addLine(0, 84.99999999999999, 11, 85)
45 SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
46 SketchLine_2 = SketchProjection_1.createdFeature()
47 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result())
48 SketchLine_3 = Sketch_1.addLine(11, 85, 24.4927071104659, 8.479055466987994)
49 SketchLine_4 = Sketch_1.addLine(27.44713036948842, 6, 56, 6)
50 SketchLine_5 = Sketch_1.addLine(56, 6, 56, 0)
51 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
52 SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_4")
53 SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
54 SketchLine_6 = SketchProjection_2.createdFeature()
55 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result())
56 SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_5")
57 SketchLine_7 = Sketch_1.addLine(56, 0, 20.91066030079079, 0)
58 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint())
59 SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_6")
60 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_6.result())
61 SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_7")
62 SketchLine_8 = Sketch_1.addLine(20.91066030079079, 0, 17.67553693029129, 18.34729635533419)
63 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
64 SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_8")
65 SketchLine_9 = Sketch_1.addLine(15.70592142426623, 20, 0, 20)
66 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_2.result())
67 SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_10")
68 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
69 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_9.result())
70 SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_4.result())
71 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result())
72 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_4.endPoint(), SketchLine_6.result(), 6, True)
73 SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_9.endPoint(), SketchLine_6.result(), 20, True)
74 SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_2.result(), "Width/2", True)
75 SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_4.result(), SketchLine_3.result(), "Draft")
76 SketchArc_1 = Sketch_1.addArc(15.70592142426623, 18, 17.67553693029129, 18.34729635533419, 15.70592142426623, 20, False)
77 SketchPoint_1 = Sketch_1.addPoint(17.3841206866215, 20)
78 SketchPoint_1.setAuxiliary(True)
79 SketchConstraintDistance_4 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_3.result(), "LegThick", True)
80 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_8.result())
81 SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_11")
82 SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_9.result())
83 SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_12")
84 SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_8.endPoint())
85 SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_13")
86 SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_9.startPoint())
87 SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_14")
88 SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_8.result())
89 SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_9.result())
90 SketchPoint_2 = Sketch_1.addPoint(11, 85)
91 SketchPoint_2.setAuxiliary(True)
92 SketchConstraintDistance_5 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_7.result(), 85, True)
93 SketchConstraintDistance_6 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_2.result(), "TDE/2", True)
94 SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_1.result())
95 SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_15")
96 SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_3.result())
97 SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_16")
98 SketchArc_2 = Sketch_1.addArc(27.44713036950173, 9.00000000000146, 24.4927071104659, 8.479055466987994, 27.44713036948842, 6, False)
99 SketchArc_2.setName("SketchArc_3")
100 SketchArc_2.result().setName("SketchArc_3")
101 SketchArc_2.results()[1].setName("SketchArc_3_2")
102 SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_3.endPoint())
103 SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_19")
104 SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_4.startPoint())
105 SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_20")
106 SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_3.result())
107 SketchConstraintTangent_3.setName("SketchConstraintTangent_5")
108 SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_4.result())
109 SketchConstraintTangent_4.setName("SketchConstraintTangent_6")
110 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_2.results()[1], "BaseLegFillet")
111 SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_1.results()[1], "LegTopFillet")
112 SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_8.result())
113 SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchPoint_2.coordinates())
114 SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_17")
115 SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_1.endPoint())
116 SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_18")
117 SketchConstraintMirror_1_objects = [SketchLine_3.result(), SketchLine_1.result(), SketchLine_4.result(), SketchLine_7.result(), SketchArc_2.results()[1], SketchLine_5.result(), SketchLine_8.result(), SketchLine_9.result(), SketchArc_1.results()[1]]
118 SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_2.result(), SketchConstraintMirror_1_objects)
119 [SketchLine_10, SketchLine_11, SketchLine_12, SketchLine_13, SketchArc_3, SketchLine_14, SketchLine_15, SketchLine_16, SketchArc_4] = SketchConstraintMirror_1.mirrored()
120 SketchArc_4.setName("SketchArc_5")
121 SketchArc_4.result().setName("SketchArc_5")
122 SketchArc_4.results()[1].setName("SketchArc_5_2")
123 SketchArc_3.setName("SketchArc_4")
124 SketchArc_3.result().setName("SketchArc_4")
125 SketchArc_3.results()[1].setName("SketchArc_4_2")
127 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
128 SketchLine_17 = Sketch_2.addLine(-18, 39.99999999999999, 18, 39.99999999999999)
129 SketchLine_18 = Sketch_2.addLine(20, 37.99999999999999, 20, -5)
130 SketchLine_19 = Sketch_2.addLine(20, -5, -20, -5)
131 SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint())
132 SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_22")
133 SketchLine_20 = Sketch_2.addLine(-20, -5, -20, 37.99999999999999)
134 SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint())
135 SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_23")
136 SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_18.result())
137 SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_20.result())
138 SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_17.result())
139 SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_19.result())
140 SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False)
141 SketchLine_21 = SketchProjection_3.createdFeature()
142 SketchArc_5 = Sketch_2.addArc(18, 37.99999999999999, 20, 37.99999999999999, 18, 39.99999999999999, False)
143 SketchArc_5.setName("SketchArc_6")
144 SketchArc_5.result().setName("SketchArc_6")
145 SketchArc_5.results()[1].setName("SketchArc_6_2")
146 SketchPoint_3 = Sketch_2.addPoint(20, 40)
147 SketchPoint_3.setAuxiliary(True)
148 SketchConstraintDistance_7 = Sketch_2.setDistance(SketchPoint_3.coordinates(), SketchLine_21.result(), 40, True)
149 SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_17.result())
150 SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_25")
151 SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_18.result())
152 SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_26")
153 SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchArc_5.startPoint(), SketchLine_18.startPoint())
154 SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_27")
155 SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_17.endPoint())
156 SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_28")
157 SketchConstraintTangent_5 = Sketch_2.setTangent(SketchArc_5.results()[1], SketchLine_17.result())
158 SketchConstraintTangent_5.setName("SketchConstraintTangent_7")
159 SketchConstraintTangent_6 = Sketch_2.setTangent(SketchArc_5.results()[1], SketchLine_18.result())
160 SketchConstraintTangent_6.setName("SketchConstraintTangent_8")
161 SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_5.results()[1], "BottomCutFillet")
162 SketchArc_6 = Sketch_2.addArc(-18, 37.99999999999999, -18, 39.99999999999999, -20, 37.99999999999999, False)
163 SketchArc_6.setName("SketchArc_7")
164 SketchArc_6.result().setName("SketchArc_7")
165 SketchArc_6.results()[1].setName("SketchArc_7_2")
166 SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchArc_6.startPoint(), SketchLine_17.startPoint())
167 SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_24")
168 SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchArc_6.endPoint(), SketchLine_20.endPoint())
169 SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_29")
170 SketchConstraintTangent_7 = Sketch_2.setTangent(SketchArc_6.results()[1], SketchLine_17.result())
171 SketchConstraintTangent_7.setName("SketchConstraintTangent_9")
172 SketchConstraintTangent_8 = Sketch_2.setTangent(SketchArc_6.results()[1], SketchLine_20.result())
173 SketchConstraintTangent_8.setName("SketchConstraintTangent_10")
174 SketchConstraintRadius_4 = Sketch_2.setRadius(SketchArc_6.results()[1], "BottomCutFillet")
175 SketchConstraintDistance_8 = Sketch_2.setDistance(SketchLine_19.startPoint(), SketchLine_21.result(), 5, True)
176 SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
177 SketchLine_22 = SketchProjection_4.createdFeature()
178 SketchConstraintDistance_9 = Sketch_2.setDistance(SketchLine_19.startPoint(), SketchLine_22.result(), "(TL/2-3)-20", True)
179 SketchConstraintDistance_10 = Sketch_2.setDistance(SketchLine_19.endPoint(), SketchLine_22.result(), "(TL/2-3)-20", True)
181 Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_11"), model.selection("EDGE", "Sketch_1/SketchLine_10"), model.selection("EDGE", "Sketch_1/SketchArc_4_2"), model.selection("EDGE", "Sketch_1/SketchLine_12"), model.selection("EDGE", "Sketch_1/SketchLine_14"), model.selection("EDGE", "Sketch_1/SketchLine_13"), model.selection("EDGE", "Sketch_1/SketchLine_15"), model.selection("EDGE", "Sketch_1/SketchArc_5_2"), model.selection("EDGE", "Sketch_1/SketchLine_16"), model.selection("EDGE", "Sketch_1/SketchLine_9"), model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_1/SketchLine_8"), model.selection("EDGE", "Sketch_1/SketchLine_7"), model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchArc_3_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_1")]
182 Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
183 Wire_2_objects = [model.selection("EDGE", "Sketch_2/SketchLine_17"), model.selection("EDGE", "Sketch_2/SketchArc_7_2"), model.selection("EDGE", "Sketch_2/SketchLine_20"), model.selection("EDGE", "Sketch_2/SketchLine_19"), model.selection("EDGE", "Sketch_2/SketchLine_18"), model.selection("EDGE", "Sketch_2/SketchArc_6_2")]
184 Wire_2 = model.addWire(Part_1_doc, Wire_2_objects)
185 Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_1_1")])
186 Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_2_1")])
187 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection(), 10, 0)
188 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection(), 10, 0)
189 Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], [model.selection("SOLID", "Extrusion_1_1")])
191 model.testHaveNamingSubshapes(Smash_1, model, Part_1_doc)