You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When importing an LS-DYNA inputdeck to a deck from a file, keywords that contain more than 80 characters per line are not recognized as keyword classes and end up in deck.string_keywords.
Trailing characters should be ignored. This is very common as people end up editing the files manually.
📝 Steps to reproduce
test_trailing_spaces.txt test_trailing_spaces.txt
contains identical keywords with the exception of a few trailing spaces (here marked with [...):]
from ansys.dyna.core.lib.deck import Deck
from ansys.dyna.core.keywords import keywords as kwd
test= Deck()
test.import_file('test_trailing_spaces.txt')
test.string_keywords
test.keywords
Both keywords should end up in test.keywords. Currently the one with trailing spaces ends up in test.string_keywords
@RaphaelHeiniger I don't see anything in the manual that says that characters after the limit are ignored. Is this something that is consistently done for all keywords or are there special cases? Do you want pydyna to always ignore characters after the limit? Or would the user have to opt-into a mode where those characters are ignored? Should a warning be issued?
@koubaa it was just somewhere in my head so I could not answer straight away. But I found the section in the manual in the Getting Started chapter:
GENERAL CARD FORMAT
The following sections specify, for each keyword command, the cards that must be defined and those cards that are optional. Each card is described in its fixed format form and is shown as a number of fields in an 80 character string. With the exception of “long format input” as described later in this section, most input cards consist of 8 fields with a field length of 10 characters. A sample card is shown below. The card format is clearly stated if the format is different than 8 fields of 10 characters. See also notes on a special “I10 format” at the end of this section. As an alternative to fixed format, a card may be in free format with the values of the variables separated by commas. When using comma-delimited values on a card, the number of characters used to specify a value must not exceed the field length for fixed format. For example, an I8 number is limited to a value of 99999999 and a larger number with more than 8 characters is unacceptable. A further restriction is that characters beyond column 80 of each line are ignored by the code. Fixed format and free, comma delimited format can be mixed throughout the deck and even within different cards of a single command but not within a card.
So one has to handle the long format correctly but otherwise I would simply ignore the extra characters by default and output a warning e.g. "Detected outbound card length while reading. Ignoring outbound characters "bla bla"."
🔍 Before submitting the issue
🐞 Description of the bug
When importing an LS-DYNA inputdeck to a deck from a file, keywords that contain more than 80 characters per line are not recognized as keyword classes and end up in deck.string_keywords.
Trailing characters should be ignored. This is very common as people end up editing the files manually.
📝 Steps to reproduce
test_trailing_spaces.txt test_trailing_spaces.txt
contains identical keywords with the exception of a few trailing spaces (here marked with [...):]
Both keywords should end up in test.keywords. Currently the one with trailing spaces ends up in test.string_keywords
💻 Which operating system are you using?
Windows
📀 Which ANSYS version are you using?
No response
🐍 Which Python version are you using?
3.12
📦 Installed packages
The text was updated successfully, but these errors were encountered: