1 # Copyright (C) 2014-2020 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 email : webmaster.salome@opencascade.com
20 from salome.shaper import model
23 partSet = model.moduleDocument()
24 Part_1 = model.addPart(partSet)
25 Part_1_doc = Part_1.document()
26 model.addParameter(Part_1_doc, "BHD", "8", "Base Hole Diameter")
27 model.addParameter(Part_1_doc, "BHPD", "14", "Base Hole Plate Diameter")
28 model.addParameter(Part_1_doc, "BHPS", "2", "Base Hole Plate Thickness")
29 model.addParameter(Part_1_doc, "BHPFR", "BHPS/4*3", "Base Hole Plate Fillet Radius")
30 model.addParameter(Part_1_doc, "BPS", "6", "Base Plate Thickness")
31 model.addParameter(Part_1_doc, "Draft", "100", "Bracket Draft")
32 model.addParameter(Part_1_doc, "TDI", "14", "Tube Internal Diameter")
33 model.addParameter(Part_1_doc, "TDE", "TDI+8", "Tube External Diameter")
34 model.addParameter(Part_1_doc, "TL", "86", "Tube Length")
35 model.addParameter(Part_1_doc, "Width", "112", "Full Width of Base")
36 model.addParameter(Part_1_doc, "LegThick", "5")
37 model.addParameter(Part_1_doc, "BaseLegFillet", "3")
38 model.addParameter(Part_1_doc, "LegTopFillet", "2")
39 model.addParameter(Part_1_doc, "BottomCutFillet", "2")
40 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
41 SketchLine_1 = Sketch_1.addLine(0, 84.99999999999999, 11, 85)
42 SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
43 SketchLine_2 = SketchProjection_1.createdFeature()
44 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result())
45 SketchLine_3 = Sketch_1.addLine(11, 85, 24.4927071104659, 8.479055466987994)
46 SketchLine_4 = Sketch_1.addLine(27.44713036948842, 6, 56, 6)
47 SketchLine_5 = Sketch_1.addLine(56, 6, 56, 0)
48 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
49 SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_4")
50 SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
51 SketchLine_6 = SketchProjection_2.createdFeature()
52 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result())
53 SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_5")
54 SketchLine_7 = Sketch_1.addLine(56, 0, 20.91066030079079, 0)
55 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint())
56 SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_6")
57 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_6.result())
58 SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_7")
59 SketchLine_8 = Sketch_1.addLine(20.91066030079079, 0, 17.67553693029129, 18.34729635533419)
60 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
61 SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_8")
62 SketchLine_9 = Sketch_1.addLine(15.70592142426623, 20, 0, 20)
63 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_2.result())
64 SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_10")
65 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
66 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_9.result())
67 SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_4.result())
68 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result())
69 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_4.endPoint(), SketchLine_6.result(), 6, True)
70 SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_9.endPoint(), SketchLine_6.result(), 20, True)
71 SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_2.result(), "Width/2", True)
72 SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_4.result(), SketchLine_3.result(), "Draft")
73 SketchArc_1 = Sketch_1.addArc(15.70592142426623, 18, 17.67553693029129, 18.34729635533419, 15.70592142426623, 20, False)
74 SketchPoint_1 = Sketch_1.addPoint(17.3841206866215, 20)
75 SketchPoint_1.setAuxiliary(True)
76 SketchConstraintDistance_4 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_3.result(), "LegThick", True)
77 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_8.result())
78 SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_11")
79 SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_9.result())
80 SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_12")
81 SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_8.endPoint())
82 SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_13")
83 SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_9.startPoint())
84 SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_14")
85 SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_8.result())
86 SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_9.result())
87 SketchPoint_2 = Sketch_1.addPoint(11, 85)
88 SketchPoint_2.setAuxiliary(True)
89 SketchConstraintDistance_5 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_7.result(), 85, True)
90 SketchConstraintDistance_6 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_2.result(), "TDE/2", True)
91 SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_1.result())
92 SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_15")
93 SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_3.result())
94 SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_16")
95 SketchArc_2 = Sketch_1.addArc(27.44713036950173, 9.00000000000146, 24.4927071104659, 8.479055466987994, 27.44713036948842, 6, False)
96 SketchArc_2.setName("SketchArc_3")
97 SketchArc_2.result().setName("SketchArc_3")
98 SketchArc_2.results()[1].setName("SketchArc_3_2")
99 SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_3.endPoint())
100 SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_19")
101 SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_4.startPoint())
102 SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_20")
103 SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_3.result())
104 SketchConstraintTangent_3.setName("SketchConstraintTangent_5")
105 SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_4.result())
106 SketchConstraintTangent_4.setName("SketchConstraintTangent_6")
107 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_2.results()[1], "BaseLegFillet")
108 SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_1.results()[1], "LegTopFillet")
109 SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_8.result())
110 SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchPoint_2.coordinates())
111 SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_17")
112 SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_1.endPoint())
113 SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_18")
114 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]]
115 SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_2.result(), SketchConstraintMirror_1_objects)
116 [SketchLine_10, SketchLine_11, SketchLine_12, SketchLine_13, SketchArc_3, SketchLine_14, SketchLine_15, SketchLine_16, SketchArc_4] = SketchConstraintMirror_1.mirrored()
117 SketchArc_4.setName("SketchArc_5")
118 SketchArc_4.result().setName("SketchArc_5")
119 SketchArc_4.results()[1].setName("SketchArc_5_2")
120 SketchArc_3.setName("SketchArc_4")
121 SketchArc_3.result().setName("SketchArc_4")
122 SketchArc_3.results()[1].setName("SketchArc_4_2")
124 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
125 SketchLine_17 = Sketch_2.addLine(-18, 39.99999999999999, 18, 39.99999999999999)
126 SketchLine_18 = Sketch_2.addLine(20, 37.99999999999999, 20, -5)
127 SketchLine_19 = Sketch_2.addLine(20, -5, -20, -5)
128 SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint())
129 SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_22")
130 SketchLine_20 = Sketch_2.addLine(-20, -5, -20, 37.99999999999999)
131 SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint())
132 SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_23")
133 SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_18.result())
134 SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_20.result())
135 SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_17.result())
136 SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_19.result())
137 SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False)
138 SketchLine_21 = SketchProjection_3.createdFeature()
139 SketchArc_5 = Sketch_2.addArc(18, 37.99999999999999, 20, 37.99999999999999, 18, 39.99999999999999, False)
140 SketchArc_5.setName("SketchArc_6")
141 SketchArc_5.result().setName("SketchArc_6")
142 SketchArc_5.results()[1].setName("SketchArc_6_2")
143 SketchPoint_3 = Sketch_2.addPoint(20, 40)
144 SketchPoint_3.setAuxiliary(True)
145 SketchConstraintDistance_7 = Sketch_2.setDistance(SketchPoint_3.coordinates(), SketchLine_21.result(), 40, True)
146 SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_17.result())
147 SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_25")
148 SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_18.result())
149 SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_26")
150 SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchArc_5.startPoint(), SketchLine_18.startPoint())
151 SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_27")
152 SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_17.endPoint())
153 SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_28")
154 SketchConstraintTangent_5 = Sketch_2.setTangent(SketchArc_5.results()[1], SketchLine_17.result())
155 SketchConstraintTangent_5.setName("SketchConstraintTangent_7")
156 SketchConstraintTangent_6 = Sketch_2.setTangent(SketchArc_5.results()[1], SketchLine_18.result())
157 SketchConstraintTangent_6.setName("SketchConstraintTangent_8")
158 SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_5.results()[1], "BottomCutFillet")
159 SketchArc_6 = Sketch_2.addArc(-18, 37.99999999999999, -18, 39.99999999999999, -20, 37.99999999999999, False)
160 SketchArc_6.setName("SketchArc_7")
161 SketchArc_6.result().setName("SketchArc_7")
162 SketchArc_6.results()[1].setName("SketchArc_7_2")
163 SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchArc_6.startPoint(), SketchLine_17.startPoint())
164 SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_24")
165 SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchArc_6.endPoint(), SketchLine_20.endPoint())
166 SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_29")
167 SketchConstraintTangent_7 = Sketch_2.setTangent(SketchArc_6.results()[1], SketchLine_17.result())
168 SketchConstraintTangent_7.setName("SketchConstraintTangent_9")
169 SketchConstraintTangent_8 = Sketch_2.setTangent(SketchArc_6.results()[1], SketchLine_20.result())
170 SketchConstraintTangent_8.setName("SketchConstraintTangent_10")
171 SketchConstraintRadius_4 = Sketch_2.setRadius(SketchArc_6.results()[1], "BottomCutFillet")
172 SketchConstraintDistance_8 = Sketch_2.setDistance(SketchLine_19.startPoint(), SketchLine_21.result(), 5, True)
173 SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
174 SketchLine_22 = SketchProjection_4.createdFeature()
175 SketchConstraintDistance_9 = Sketch_2.setDistance(SketchLine_19.startPoint(), SketchLine_22.result(), "(TL/2-3)-20", True)
176 SketchConstraintDistance_10 = Sketch_2.setDistance(SketchLine_19.endPoint(), SketchLine_22.result(), "(TL/2-3)-20", True)
178 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")]
179 Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
180 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")]
181 Wire_2 = model.addWire(Part_1_doc, Wire_2_objects)
182 Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_1_1")])
183 Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_2_1")])
184 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection(), 10, 0)
185 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection(), 10, 0)
186 Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], [model.selection("SOLID", "Extrusion_1_1")])
188 model.testHaveNamingSubshapes(Smash_1, model, Part_1_doc)