Closed Eistee1024 closed 2 years ago
Hi @Eistee1024
Thank you very much for the feedback.
This issue is a bit difficult, to solve. Because there is not a procedure to account for the empty args "--
" in APDL commands. When we parse the documentation #1239 we will be able to solve this properly.
In the meantime, I will implement an exception, so the commands with --
are mapped directly mapdl.run
.
Hi @Eistee1024 @germa89 Eistee1024 the conversion looks correct to me. I'm not sure why one of the 'blanks' should be dropped in the conversion. Mike
Hi @Eistee1024 @germa89 Eistee1024 the conversion looks correct to me. I'm not sure why one of the 'blanks' should be dropped in the conversion. Mike
Because of PyMAPDL implementation. In python you cannot have "empty" arguments, it doesn't make sense.
If you check the mapdl.latt
implementation:
def latt(self, mat="", real="", type_="", kb="", ke="", secnum="", **kwargs):
"""Associates element attributes with the selected, unmeshed lines.
APDL Command: LATT
Parameters
----------
mat, real, type\_
Material number, real constant set number, and type number
to be associated with selected, unmeshed lines.
kb, ke
Beginning and ending orientation keypoints to be
associated with selected, unmeshed lines. ANSYS uses the
location of these keypoints to determine how to orient
beam cross sections during beam meshing. Beam elements
may be created along a line with a constant orientation by
specifying only one orientation keypoint (KB), or a
pre-twisted beam may be created by selecting different
orientation keypoints at each end of the line (KB and KE).
(For a line bounded by two keypoints (KP1 and KP2), the
orientation vector at the beginning of the line extends
from KP1 to KB, and the orientation vector at the end of
the line extends from KP2 to KE. The orientation vectors
are used to compute the orientation nodes of the
elements.)
secnum
Section identifier to be associated with selected,
unmeshed lines. For details, see the description of the
SECTYPE and SECNUM commands.
Notes
-----
...
"""
command = f"LATT,{mat},{real},{type_},,{kb},{ke},{secnum}"
return self.run(command, **kwargs)
There is no empty argument.
If you look at the python function signature, there is only 6 args (self
, and kwargs
apart).
Whereas the MAPDL LATT is:
Hence, translating:
LATT,1, 2, 3, 4, 5, 6,7
(4th argument is the empty one)
In Python, it should be:
mapdl.latt(1,2,3,5,6,7)
# More verbose:
mapdl.latt(mat=1, real=2, type_=3, kb=5, ke=6, secnum=7)
because the empty argument is already removed.
However the converter is agnostic to that, hence, it is going to take the arguments of the MAPDL command and put them in order into the Python function meaning:
mapdl.latt(mat=1, real=2, type_=3, kb=4, ke=5, secnum=6, kwargs=7)
This shift the numbers after the empty argument by one, which is not desirable.
@germa89 Ah! I see, it looks correct but does not process correctly.
The ansys.mapdl.core.converter_script needs to be updated - it translates APDL:
LATT,1, ,1, , , ,1
to:mapdl.latt(1, "", 1, "", "", "", 1)
It should result in:mapdl.latt(1, "", 1, "", "", 1)
related: https://github.com/pyansys/pymapdl/issues/52