Repository navigation
Expand file tree
/
Copy pathSpaceclaim Script
More file actions
432 lines (338 loc) · 10.8 KB
/
Copy pathSpaceclaim Script
File metadata and controls
432 lines (338 loc) · 10.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# Python Script, API Version = V20
ClearAll()
# 设置草绘平面
sectionPlane = Plane.PlaneXY
result = ViewHelper.SetSketchPlane(sectionPlane, Info1)
# EndBlock
# 设置新草绘
result = SketchHelper.StartConstraintSketching()
# EndBlock
# 草绘圆
origin = Point2D.Create(MM(0), MM(0))
result = SketchCircle.Create(origin, MM(168.389))
baseSel = SelectionPoint.Create(CurvePoint1)
targetSel = SelectionPoint.Create(DatumPoint1)
result = Constraint.CreateCoincident(baseSel, targetSel)
# EndBlock
# 实体化草绘
mode = InteractionMode.Solid
result = ViewHelper.SetViewMode(mode, Info2)
# EndBlock
# 拉伸 1 个面
selection = Face1
secondarySelection = Axis1
options = ExtrudeFaceOptions()
options.ForceDoAsExtrude = True
options.ExtrudeType = ExtrudeType.Cut
result = ExtrudeFaces.Execute(selection, secondarySelection, MM(336.778), options, Info3)
# EndBlock
# 将‘实体’重新命名为‘Outer_domain’
selection = Body1
result = RenameObject.Execute(selection,"Outer_domain")
# EndBlock
# 创建部件
selection = Body1
result = ComponentHelper.MoveBodiesToComponent(selection, Info7)
# EndBlock
# 设置草绘平面
selection = Face2
result = ViewHelper.SetSketchPlane(selection, Info8)
# EndBlock
# 设置新草绘
result = SketchHelper.StartConstraintSketching()
# EndBlock
# 草绘圆
origin = Point2D.Create(MM(0), MM(0))
result = SketchCircle.Create(origin, MM(7.5))
baseSel = Curve1
targetSel = Curve2
result = Constraint.CreateConcentric(baseSel, targetSel)
# EndBlock
# 实体化草绘
mode = InteractionMode.Solid
result = ViewHelper.SetViewMode(mode, Info9)
# EndBlock
# 拉伸 1 个面
selection = Face3
options = ExtrudeFaceOptions()
options.ExtrudeType = ExtrudeType.ForceAdd
result = ExtrudeFaces.Execute(selection, MM(-224.518), options, Info10)
# EndBlock
# 创建部件
selection = Body3
result = ComponentHelper.MoveBodiesToComponent(selection, Info11)
# EndBlock
# 设置草绘平面
selection = Axis2
result = ViewHelper.SetSketchPlane(selection, Info12)
# EndBlock
# 设置新草绘
result = SketchHelper.StartConstraintSketching()
# EndBlock
# 草绘矩形
point1 = Point2D.Create(MM(0),MM(241.518))
point2 = Point2D.Create(MM(10),MM(241.518))
point3 = Point2D.Create(MM(10),MM(207.518))
result = SketchRectangle.Create(point1, point2, point3)
# EndBlock
# 实体化草绘
mode = InteractionMode.Solid
result = ViewHelper.SetViewMode(mode, Info13)
# EndBlock
# 旋转 1 个面
selection = Face7
axisSelection = Edge2
axis = RevolveFaces.GetAxisFromSelection(selection, axisSelection)
options = RevolveFaceOptions()
options.ExtrudeType = ExtrudeType.Add
result = RevolveFaces.Execute(selection, axis, DEG(360), options)
# EndBlock
# 创建部件
selection = Body6
result = ComponentHelper.MoveBodiesToComponent(selection, Info17)
# EndBlock
# 将‘组件2’重新命名为‘center’
selection = Part2
result = RenameObject.Execute(selection,"center")
# EndBlock
# 设置草绘平面
selection = Axis2
result = ViewHelper.SetSketchPlane(selection, Info14)
# EndBlock
# 设置新草绘
result = SketchHelper.StartConstraintSketching()
# EndBlock
# 草绘矩形
point1 = Point2D.Create(MM(-1.5),MM(236.518))
point2 = Point2D.Create(MM(-1.5),MM(212.518))
point3 = Point2D.Create(MM(1.5),MM(212.518))
result = SketchRectangle.Create(point1, point2, point3)
# EndBlock
# 实体化草绘
mode = InteractionMode.Solid
result = ViewHelper.SetViewMode(mode, Info15)
# EndBlock
# 拉伸 1 个面
selection = Face8
options = ExtrudeFaceOptions()
options.ExtrudeType = ExtrudeType.ForceAdd
result = ExtrudeFaces.Execute(selection, MM(120), options, Info16)
# EndBlock
# 旋转 X 手柄
selection = Body10
anchorPoint = Move.GetAnchorPoint(selection)
axis = Line.Create(anchorPoint, Direction.DirX)
options = MoveOptions()
result = Move.Rotate(selection, axis, DEG(45), options, Info20)
# EndBlock
# 创建阵列
selection = Body11
data = CircularPatternData()
data.CircularAxis = DatumLine3
data.RadialDirection = Direction.Create(0, 0, 0)
data.CircularCount = 4
data.CircularAngle = DEG(360)
result = Pattern.CreateCircular(selection, data, Info21)
# EndBlock
# 设置草绘平面
selection = Axis2
result = ViewHelper.SetSketchPlane(selection, Info26)
# EndBlock
# 设置新草绘
result = SketchHelper.StartConstraintSketching()
# EndBlock
# 草绘矩形
point1 = Point2D.Create(MM(0),MM(124.259))
point2 = Point2D.Create(MM(8),MM(124.259))
point3 = Point2D.Create(MM(8),MM(98.259))
result = SketchRectangle.Create(point1, point2, point3)
# EndBlock
# 实体化草绘
mode = InteractionMode.Solid
result = ViewHelper.SetViewMode(mode, Info27)
# EndBlock
# 旋转 1 个面
selection = Face10
axisSelection = DatumLine4
axis = RevolveFaces.GetAxisFromSelection(selection, axisSelection)
options = RevolveFaceOptions()
options.ExtrudeType = ExtrudeType.Add
result = RevolveFaces.Execute(selection, axis, DEG(360), options)
# EndBlock
# 移动 实体
selections = Body13
component = Part4
result = ComponentHelper.MoveBodiesToComponent(selections, component, False, Info28)
# EndBlock
# 设置草绘平面
selection = Axis2
result = ViewHelper.SetSketchPlane(selection, Info29)
# EndBlock
# 设置新草绘
result = SketchHelper.StartConstraintSketching()
# EndBlock
# 草绘矩形
point1 = Point2D.Create(MM(-1.5),MM(126.259))
point2 = Point2D.Create(MM(-1.5),MM(98.259))
point3 = Point2D.Create(MM(1.5),MM(98.259))
result = SketchRectangle.Create(point1, point2, point3)
# EndBlock
# 实体化草绘
mode = InteractionMode.Solid
result = ViewHelper.SetViewMode(mode, Info31)
# EndBlock
# 拉伸 1 个面
selection = Face11
options = ExtrudeFaceOptions()
options.ExtrudeType = ExtrudeType.ForceAdd
result = ExtrudeFaces.Execute(selection, MM(120), options, Info32)
# EndBlock
# 旋转 Z 手柄
selection = Face12
axis = Move.GetAxis(selection)
options = MoveOptions()
result = Move.Rotate(selection, axis, DEG(-0), options, Info34)
# EndBlock
# 创建阵列
selection = Body15
data = CircularPatternData()
data.CircularAxis = DatumLine8
data.RadialDirection = Direction.Create(0, 0, 0)
data.CircularCount = 4
data.CircularAngle = DEG(360)
result = Pattern.CreateCircular(selection, data, Info35)
# EndBlock
# 创建部件
selection = Selection.Create(Component5, Component6, Component7, Component8)
result = ComponentHelper.MoveBodiesToComponent(selection, Info37)
# EndBlock
# 将‘组件4’重新命名为‘Impeller’
selection = Part5
result = RenameObject.Execute(selection,"Impeller")
# EndBlock
# 设置草绘平面
sectionPlane = Plane.PlaneXY
result = ViewHelper.SetSketchPlane(sectionPlane, Info40)
# EndBlock
# 移动剖面平面
axis = HandleAxis.Z
distance = MM(80)
result = ViewHelper.TransformSectionPlaneAlongAxis(axis, distance)
# EndBlock
# 设置新草绘
result = SketchHelper.StartConstraintSketching()
# EndBlock
# 草绘圆
origin = Point2D.Create(MM(0), MM(0))
result = SketchCircle.Create(origin, MM(150))
baseSel = Curve7
targetSel = Curve8
result = Constraint.CreateConcentric(baseSel, targetSel)
# EndBlock
# 实体化草绘
mode = InteractionMode.Solid
result = ViewHelper.SetViewMode(mode, Info41)
# EndBlock
# 拉伸 1 个面
selection = Face13
options = ExtrudeFaceOptions()
options.ExtrudeType = ExtrudeType.ForceAdd
result = ExtrudeFaces.Execute(selection, MM(75), options, Info42)
# EndBlock
# 设置草绘平面
selection = Face14
result = ViewHelper.SetSketchPlane(selection, Info43)
# EndBlock
# 移动剖面平面
axis = HandleAxis.Z
distance = MM(30)
result = ViewHelper.TransformSectionPlaneAlongAxis(axis, distance)
# EndBlock
# 设置新草绘
result = SketchHelper.StartConstraintSketching()
# EndBlock
# 草绘圆
origin = Point2D.Create(MM(0), MM(0))
result = SketchCircle.Create(origin, MM(150))
baseSel = Curve9
targetSel = Curve10
result = Constraint.CreateConcentric(baseSel, targetSel)
# EndBlock
# 实体化草绘
mode = InteractionMode.Solid
result = ViewHelper.SetViewMode(mode, Info44)
# EndBlock
# 拉伸 1 个面
selection = Face15
options = ExtrudeFaceOptions()
options.ExtrudeType = ExtrudeType.Add
result = ExtrudeFaces.Execute(selection, MM(80), options, Info45)
# EndBlock
# 将‘实体’重新命名为‘Inner_domain1’
selection = Body19
result = RenameObject.Execute(selection,"Inner_domain1")
# EndBlock
# 将‘实体’重新命名为‘Inner_domain2’
selection = Body20
result = RenameObject.Execute(selection,"Inner_domain2")
# EndBlock
# 合并主体
targets = BodySelection.Create([GetRootPart().Components[1].Components[3].Components[0].Content.Bodies[0],
GetRootPart().Components[1].Components[3].Components[1].Content.Bodies[0],
GetRootPart().Components[1].Components[3].Components[2].Content.Bodies[0],
GetRootPart().Components[1].Components[3].Components[3].Content.Bodies[0]])
result = Combine.Merge(targets)
# EndBlock
# 合并主体
targets = BodySelection.Create([GetRootPart().Components[1].Components[2].Components[2].Content.Bodies[0],
GetRootPart().Components[1].Components[2].Components[3].Content.Bodies[0],
GetRootPart().Components[1].Components[2].Components[1].Content.Bodies[0],
GetRootPart().Components[1].Components[2].Components[0].Content.Bodies[0]])
result = Combine.Merge(targets)
# EndBlock
# 合并主体
targets = BodySelection.Create([GetRootPart().Bodies[3],
GetRootPart().Components[1].Components[0].Content.Bodies[0],
GetRootPart().Components[1].Components[1].Content.Bodies[1],
GetRootPart().Components[1].Components[1].Content.Bodies[0],
GetRootPart().Bodies[2]])
result = Combine.Merge(targets)
# EndBlock
# 删除对象
selection = ComponentSelection.Create(GetRootPart().Components[1])
result = Delete.Execute(selection)
# EndBlock
# 将‘实体’重新命名为‘Impeller’
selection = BodySelection.Create(GetRootPart().Bodies[2])
result = RenameObject.Execute(selection,"Impeller")
# EndBlock
# 相交主体
targets = BodySelection.Create(GetRootPart().Bodies[0])
tools = BodySelection.Create(GetRootPart().Bodies[2])
options = MakeSolidsOptions()
result = Combine.Intersect(targets, tools, options)
# EndBlock
# 相交主体
targets = BodySelection.Create(GetRootPart().Bodies[1])
tools = BodySelection.Create(GetRootPart().Bodies[2])
options = MakeSolidsOptions()
result = Combine.Intersect(targets, tools, options)
# EndBlock
# 相交主体
targets = BodySelection.Create(GetRootPart().Components[0].Content.Bodies[0])
tools = BodySelection.Create(GetRootPart().Bodies[2])
options = MakeSolidsOptions()
result = Combine.Intersect(targets, tools, options)
# EndBlock
# 相交主体
targets = BodySelection.Create(GetRootPart().Components[0].Content.Bodies[0])
tools = BodySelection.Create(GetRootPart().Bodies[1])
options = MakeSolidsOptions()
result = Combine.Intersect(targets, tools, options)
# EndBlock
# 相交主体
targets = BodySelection.Create(GetRootPart().Components[0].Content.Bodies[0])
tools = BodySelection.Create(GetRootPart().Bodies[0])
options = MakeSolidsOptions()
result = Combine.Intersect(targets, tools, options)
# EndBlock