/
setup.py
284 lines (217 loc) · 10.6 KB
/
setup.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
# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
class Setup:
def cmap(self, fname="", ext="", kywrd="", ncntr="", **kwargs):
"""Changes an existing or creates a new color mapping table.
APDL Command: /CMAP
Parameters
----------
fname
File name and directory path (248 characters maximum,
including the characters needed for the directory path).
An unspecified directory path defaults to the working
directory; in this case, you can use all 248 characters
for the file name.
ext
Filename extension (eight-character maximum).
kywrd
Keyword indicating the disposition of the color map file.
(blank)
Loads existing color map file.
CREATE
Starts the CMAP utility and modifies or creates
the specified file.
SAVE
Writes the active color map to the specified file,
which can be imported into future sessions.
ncntr
Number of contours to be defined. Default = 9 (even if an existing
file is being modified). Maximum = 128.
Notes
-----
Reads the color map file (RGB index specifications) to change
from current specifications. Only one color map may be active
at a time.
For 2-D drivers (especially Win32c), modifying the color map
can produce anomalies, including legend/contour disagreement.
When Kywrd equals CREATE, the 2-D drivers (X11c and Win32c)
display the CMAP utility with an additional contour color
picker called CONTOURS. Colors selected via the CONTOURS
picker affect result contour displays (such as stresses). No
other drivers offer the CONTOURS picker in the CMAP utility.
Changing the color map using the /CMAP command changes the
meaning of the color labels on the /COLOR command. See /COLOR
for other color controls.
This command is valid anywhere.
"""
return self.run(f"/CMAP,{fname},{ext},,{kywrd},{ncntr}", **kwargs)
def devdisp(self, label="", key="", **kwargs):
"""Controls graphics device options.
APDL Command: /DEVDISP
Parameters
----------
label
Device function label:
BBOX
Disables display information sorting for PowerGraphics displays. When activated
(KEY = 1 or ON), model rotations and replots are performed
without recalculating edge and surface data. This will speed
up the rotation (especially for 2-D displays) of large
models, although the display information will not be
resolved as quickly (you will see a bounding box instead of
the model during dynamic rotations). The default is OFF (KEY
= 0).
DITHER
Dithering. When turned on (default), dithering smooths transitions in color
intensity. Applies only to Z-buffered displays.
FONT
Font selection for the ANSYS graphics window. When Label = FONT, the command
format is: /DEVDISP,FONT,KEY,Val1,Val2,Val3,VAL4,Val5,Val6,
where KEY determines the type of font being controlled, and
values 1 through 6 control various font parameters. Note
that these values are device specific; using the same
command input file [/INPUT] on different machines may yield
different results.The following KEY values determine the
font information that will be supplied to the appropriate
driver (e.g., Postscript, X11, Win32, JPEG, ...):
KEY = 1
The command controls the LEGEND (documentation column) font.
KEY = 2
The command controls the ENTITY (node and keypoint number) font.
KEY = 3
The command controls the ANNOTATION/GRAPH font.
Linux: Values 1 through 4 are used to find a match in the X11 database of font strings. Values 1, 2, and 3 are character strings; value 4 is a nonzero integer: - Val1
Family name (e.g., ``Courier*New``). Substitute an asterisk (``*``) for any blank character that appears in a family name. If Val1 = MENU, all other values are ignored, and a font selection menu appears (GUI must be active). - Val2
Weight (e.g., medium) - Val3
Slant (e.g., r) - Val4
Pixel size (e.g., 14). Note that this value does not affect the annotation fonts (KEY = 3). Use the /TSPEC command to control the pixel size of your annotation fonts. - Val5
unused - Val6
unused - PC: The values are encoded in a PC logical font structure. Value 1 is a
character string, and the remaining values are integers:
Val1 - Family name (e.g., ``Courier*New``) Substitute an asterisk (``*``) for any blank
character that appears in a family name. If Val1 = MENU, all
other values are ignored and a font selection menu appears
(GUI must be active). A value containing all blank
characters causes ANSYS to use the first available resource
it finds.
Val2 - Weight (0 - 1000)
Val3 - Orientation (in tenths of a degree)
Val4 - Height (in logical units) Note that this value does not affect the annotation
fonts (KEY =3). Use the /TSPEC command to control the height
of your annotation fonts.
Val5 - Width (in logical units)
Val6 - Italics (0 = OFF, 1 = ON)
TEXT - Text size specification for the ANSYS Graphics window. When Label = TEXT, the
command format is: /DEVDISP,TEXT,KEY,PERCENT, where KEY
determines the type of text being controlled (1 for LEGEND,
and 2 for ENTITY), and PERCENT specifies the new text size
as a percent of the default text size. If PERCENT = 100,
the new text size is precisely the default size. If PERCENT
= 200, the new text size is twice the default text size.
key
Control key:
OFF or 0 - Turns specified function off.
ON or 1 - Turns specified function on.
"""
command = f"/DEVDISP,{label},{key}"
return self.run(command, **kwargs)
def filedisp(self, fname="", ext="", **kwargs):
"""Specifies the file containing the graphics data.
APDL Command: FILEDISP
Parameters
----------
fname
File name and directory path (248 characters maximum, including the
characters needed for the directory path). An unspecified
directory path defaults to the working directory; in this case, you
can use all 248 characters for the file name.
ext
Filename extension (eight-character maximum).
Notes
-----
Specifies the input file containing the graphics data (defaults to
File.GRPH).
"""
command = f"FILEDISP,{fname},{ext}"
return self.run(command, **kwargs)
def nocolor(self, key="", **kwargs):
"""Removes color from graphics displays.
APDL Command: NOCOLOR
Parameters
----------
key
Color key:
0
Color the displays.
1
Do not color the displays.
2
Do not shade the displays.
"""
command = f"NOCOLOR,{key}"
return self.run(command, **kwargs)
def showdisp(self, dname="", ncpl="", **kwargs):
"""Defines the display driver name.
APDL Command: /SHOWDISP
Parameters
----------
dname
Valid driver name (see Getting Started with Graphics in the Basic
Analysis Guide for details):
<device name>
Any linked terminal driver (such as X11, TEKTRONIX, etc.)
HPGL
Hewlett-Packard Graphics Language
HPGL2
Hewlett-Packard Graphics Language with enhanced
color. (See the HPGL command for options.)
Ignores the NCPL field.
INTERLEAF
Interleaf ASCII Format, OPS Version 5.0
POSTSCRIPT
PostScript, Version 1.0 Minimally Conforming
DUMP
ASCII Text Dump
ncpl
Number of color planes (4 to 8). Default is device-dependent.
"""
return self.run(f"/SHOWDISP,{dname},,,{ncpl}", **kwargs)
def trans(self, fname="", ext="", **kwargs):
"""Reformats File.GRPH for improved performance with plotters.
APDL Command: TRANS
Parameters
----------
fname
File name and directory path (248 characters maximum,
including the characters needed for the directory path).
An unspecified directory path defaults to the working
directory; in this case, you can use all 248 characters
for the file name.
ext
Filename extension (eight-character maximum).
Notes
-----
Reformats current Fname.GRPH data (based on color) for improved
performance with pen plotters.
"""
command = f"TRANS,{fname},{ext}"
return self.run(command, **kwargs)