/
conn.py
349 lines (262 loc) · 11.1 KB
/
conn.py
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
class Conn:
def cat5in(
self,
name="",
extension="",
path="",
entity="",
fmt="",
nocl="",
noan="",
**kwargs,
):
"""Transfers a .CATPart file into the ANSYS program.
APDL Command: ~CAT5IN
Parameters
----------
name
The name of a valid .CATPart file, created with CATIA Version 5.0.
The first character of the file name must be an alphanumeric.
extension
The extension for the file. The default extension is .CATPart.
path
The path name of the directory in which the file resides enclosed
in single quotes. The default path name is the current working
directory.
entity
Entity to be imported.
SOLIDS - Solids only, imported as ANSYS volumes (default).
SURFACES - Surfaces only, imported as ANSYS areas.
ALL - All entities. Use this option when the file contains different types of
entities.
fmt
The format in which ANSYS will store the model.
0 - Neutral format (default). Defeaturing after import is restricted.
1 - Solid format; this allows defeaturing after import.
nocl
Remove tiny objects.
0 - Remove tiny objects without checking model validity (default).
1 - Do not remove tiny objects.
noan
Perform an analysis of the model.
0 - Analyze the model (default).
1 - Do not analyze the model.
Notes
-----
If defeaturing is specified (FMT = 1), this command must be the last
line of any file, script, or other interactive input.
More information on importing CATIA Version 5 parts is available in
CATIA V5 in the Connection User's Guide.
"""
command = f"~CAT5IN,{name},{extension},{path},{entity},{fmt},{nocl},{noan}"
return self.run(command, **kwargs)
def catiain(self, name="", extension="", path="", blank="", **kwargs):
"""Transfers a CATIA model into the ANSYS program.
APDL Command: ~CATIAIN
Parameters
----------
name
The name of a valid CATIA model, created with CATIA 4.x or
lower. The first character of the file name must be an
alphanumeric. Special characters such as & - and * and
spaces are not permitted in the part name.
extension
The extension for the file. The default extension is .model.
path
The path name of the directory in which the file resides, enclosed
in single quotes. The default path name is the current working
directory.
blank
Sets whether to import "blanked" entities.
0 - Does not import "blanked" (suppressed) CATIA entities (default).
1 - Imports "blanked" entities. The portions of CATIA data
that were suppressed will be included in the import.
Notes
-----
More information on importing CATIA parts is available in CATIA V4 in
the Connection User's Guide.
"""
return self.run(f"~CATIAIN,{name},{extension},{path},,,{blank}", **kwargs)
def parain(
self,
name="",
extension="",
path="",
entity="",
fmt="",
scale="",
**kwargs,
):
"""Transfers a Parasolid file into the ANSYS program.
APDL Command: ~PARAIN
Parameters
----------
name
The name of a valid Parasolid file. The first character of the file
name must be an alphanumeric.
extension
The extension for the file. The default extension is .x_t on a PC
or .xmt_txt on a Linux system. Parasolid files are compatible
across systems, and do not need to be renamed to be used on another
platform.
path
The path name of the directory in which the file resides, enclosed
in single quotes. The default path name is the current working
directory.
entity
Entity to be imported:
SOLIDS - Solids only, imported as ANSYS volumes (default)
SURFACES - Surfaces only, imported as ANSYS areas.
WIREFRAME - Wireframe only, imported as ANSYS lines.
ALL - All entities. Use this option when the file contains
more than one type of entity.
fmt
Sets the format in which ANSYS will store the model
0 - Neutral format (default). Defeaturing after import is
restricted. Use this option if you need to scale a model
to a specific unit of measure (other than meters).
1 - Solid format; this allows defeaturing after import.
scale
Allows scaling for the model
0 - Do not rescale the model; retain the default Parasolid
setting of meters (default).
1 - Scale the model if warranted by the model size.
Notes
-----
More information on importing Parasolid parts is available in Parasolid
in the Connection User's Guide.
"""
command = f"~PARAIN,{name},{extension},{path},{entity},{fmt},{scale}"
return self.run(command, **kwargs)
def proein(self, name="", extension="", path="", proecomm="", **kwargs):
"""APDL Command: ~PROEIN
Transfers a Creo Parametric part into the ANSYS program.
Parameters
----------
name
The name of the Creo Parametric part to be imported, which cannot
exceed 64 characters in length and must begin with an alphanumeric
character. Special characters such as & - and * and spaces are not
permitted in the part name.
extension
The general Creo Parametric extension format is prt for parts and
asm for assemblies.
path
Full path name to the directory containing the part. The default is
the current working directory.
proecomm
The start command for the version of Creo Parametric you are using.
proe1 is the default command. Note that the full path name to the
Creo Parametric command need not be used here if the path had been
included in the PATH variable. The Creo Parametric command name is
set by the PROE_START_CMD162 environment variable.
Notes
-----
More information on importing Creo Parametric parts is available in
Creo Parametric (formerly Pro/ENGINEER) in the Connection User's Guide.
"""
command = f"~PROEIN,{name},{extension},{path},{proecomm}"
return self.run(command, **kwargs)
def satin(
self,
name="",
extension="",
path="",
entity="",
fmt="",
nocl="",
noan="",
**kwargs,
):
"""Transfers a .SAT file into the ANSYS program.
APDL Command: ~SATIN
Parameters
----------
name
The name of a valid .SAT file, created with a supported version of
ACIS. The first character of the file name must be an alphanumeric.
Special characters such as & - and * and spaces are not permitted
in the part name. See File Names in the Command Reference for more
information about ANSYS file naming conventions.
extension
The extension for the file. The default extension is .sat.
path
The path name of the directory in which the file resides enclosed
in single quotes. The default path name is the current working
directory.
entity
Entity to be imported.
SOLIDS - Solids only, imported as ANSYS volumes (Not implemented, imports All).
SURFACES - Surfaces only, imported as ANSYS areas (Not implemented, imports All).
WIREFRAME - Wireframe only, imported as ANSYS lines (Not implemented, imports All).
ALL - All entities. Use this option when the file contains different types of
entities.
fmt
The format in which ANSYS will store the model.
0 - Neutral format (default). Defeaturing after import is restricted.
1 - Solid format; this allows defeaturing after import.
nocl
Remove tiny objects.
0 - Remove tiny objects without checking model validity (default).
1 - Do not remove tiny objects.
noan
Perform an ACIS analysis of the model.
0 - Analyze the model (default).
1 - Do not analyze the model.
Notes
-----
More information on importing ACIS parts is available in ACIS in the
Connection User's Guide.
"""
command = f"~SATIN,{name},{extension},{path},{entity},{fmt},{nocl},{noan}"
return self.run(command, **kwargs)
def ugin(
self,
name="",
extension="",
path="",
entity="",
layer="",
fmt="",
**kwargs,
):
"""Transfers an NX part into the ANSYS program.
APDL Command: ~UGIN
Parameters
----------
name
The file name of the NX part to be imported, which cannot exceed 64
characters in length. The path name must begin with an alphanumeric
character. Special characters such as &, -, and * are not
permitted in the part name.
extension
The NX part file extension. The default is .prt.
path
The full path name to the directory containing the part, enclosed
in single quotes; for example, '/ug_parts'. The default is the
current working directory.
entity
Entity to be imported.
0 or Solid - Solids only, imported as ANSYS volumes (the
default).
1 or Surface - Surfaces only, imported as ANSYS areas.
2 or Wireframe - Wireframe only, imported as ANSYS lines.
3 or All - All entities. Use this option when the part
contains entities that may not be attached to each
other, such as a solid in one location and a
surface in another.
layer
The number(s) assigned to the layer(s) to be imported. You can
import one layer or a range of layers (designated by hyphens).
Defaults to 1-256 (all layers).
fmt
The format in which ANSYS will store the model.
0 - Neutral format (default). Defeaturing after import is restricted.
1 - Solid format; this allows defeaturing after import.
Notes
-----
More information on importing NX parts is available in UG/NX in the
Connection User's Guide.
"""
command = f"~UGIN,{name},{extension},{path},{entity},{layer},{fmt}"
return self.run(command, **kwargs)