|
| 1 | +# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates. |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +# |
| 4 | +# |
| 5 | +# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 6 | +# of this software and associated documentation files (the "Software"), to deal |
| 7 | +# in the Software without restriction, including without limitation the rights |
| 8 | +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 9 | +# copies of the Software, and to permit persons to whom the Software is |
| 10 | +# furnished to do so, subject to the following conditions: |
| 11 | +# |
| 12 | +# The above copyright notice and this permission notice shall be included in all |
| 13 | +# copies or substantial portions of the Software. |
| 14 | +# |
| 15 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 18 | +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 20 | +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 21 | +# SOFTWARE. |
| 22 | + |
| 23 | + |
| 24 | +def secmodif( |
| 25 | + self, |
| 26 | + secid, |
| 27 | + keyword, |
| 28 | + nx="", |
| 29 | + ny="", |
| 30 | + nz="", |
| 31 | + kcn="", |
| 32 | + name="", |
| 33 | + name_new="", |
| 34 | + option="", |
| 35 | + dispPnltVal="", |
| 36 | + RotPnltVal="", |
| 37 | + **kwargs, |
| 38 | +): |
| 39 | + """Modifies a pretension section |
| 40 | +
|
| 41 | + APDL Command: SECMODIF |
| 42 | +
|
| 43 | + .. warning:: |
| 44 | +
|
| 45 | + This command have specific signature depending on the values of the given |
| 46 | + arguments ``keyword``. |
| 47 | +
|
| 48 | + Parameters |
| 49 | + ---------- |
| 50 | +
|
| 51 | + secid : int |
| 52 | + Unique section number. This number must already be assigned to a |
| 53 | + section. |
| 54 | +
|
| 55 | + keyword : str |
| 56 | + - If `Keyword = NORM`: |
| 57 | + SECMODIF,SECID, NORM, NX, NY, NZ, KCN |
| 58 | + - If `Keyword = NAME`: |
| 59 | + SECMODIF,SECID, NAME, Name |
| 60 | + - If `Keyword = JOIN`: |
| 61 | + SECMODIF,SECID, JOIN, Option, dispPnltVal, RotPnltVal |
| 62 | +
|
| 63 | + norm : str |
| 64 | + Keyword specifying that the command will modify the pretension |
| 65 | + section normal direction. |
| 66 | +
|
| 67 | + nx, ny, nz : str |
| 68 | + Specifies the individual normal components to modify. |
| 69 | +
|
| 70 | + kcn : str |
| 71 | + Coordinate system number. This can be either 0 (Global Cartesian), |
| 72 | + 1 (Global Cylindrical) 2 (Global Spherical), 4 (Working Plane), 5 |
| 73 | + (Global Y Axis Cylindrical) or an arbitrary reference number |
| 74 | + assigned to a coordinate system. |
| 75 | +
|
| 76 | + name : str |
| 77 | + Change the name of the specified pretension section. |
| 78 | +
|
| 79 | + name_new : str |
| 80 | + The new name to be assigned to the pretension section. |
| 81 | +
|
| 82 | + join : str |
| 83 | + Set command actions to apply to joint sections only. |
| 84 | +
|
| 85 | + option : str |
| 86 | + PNLT -- Modify penalty factors for the specified section. |
| 87 | +
|
| 88 | + dispPnltVal : str |
| 89 | + Penalty value for displacement-based constraints: |
| 90 | + - `> 0` -- The number is used as a scaling factor to scale the |
| 91 | + internally calculated penalty values. |
| 92 | + - `< 0` -- The absolute value of the number is used as the penalty |
| 93 | + factor in calculations. |
| 94 | +
|
| 95 | + RotPnltVal : str |
| 96 | + Penalty value for rotation-based constraints. |
| 97 | + - `> 0` -- The number is used as a scaling factor to scale the |
| 98 | + internally calculated penalty values. |
| 99 | + - `< 0` -- The absolute value of the number is used as the penalty |
| 100 | + factor in calculations. |
| 101 | +
|
| 102 | +
|
| 103 | + Notes |
| 104 | + ----- |
| 105 | + The SECMODIF command either modifies the normal for a specified |
| 106 | + pretension section, or changes the name of the specified pretension |
| 107 | + surface. |
| 108 | + """ |
| 109 | + # Sanity checks |
| 110 | + if keyword.upper() not in ["NORM", "NAME", "JOIN"]: |
| 111 | + raise ValueError(f"The given argument 'keyword' ({keyword}) is not valid.") |
| 112 | + |
| 113 | + if keyword == "NORM": |
| 114 | + cmd = f"SECMODIF, {secid}, NORM, {nx}, {ny}, {nz}, {kcn}" |
| 115 | + elif keyword == "NAME": |
| 116 | + cmd = f"SECMODIF, {secid}, NAME, {name or nx}, {name_new or ny}" |
| 117 | + elif keyword == "JOIN": |
| 118 | + cmd = f"SECMODIF, {secid}, JOIN, {option or nx},{dispPnltVal or ny},{RotPnltVal or nz}" |
| 119 | + else: |
| 120 | + raise ValueError("We couldn't map the arguments given....") |
| 121 | + |
| 122 | + self.run(cmd, **kwargs) |
0 commit comments