Skip to content

Minor bug fixes and enhancements#13

Merged
maucejo merged 2 commits intomaucejo:mainfrom
Spectrum-Tec:main
Nov 26, 2025
Merged

Minor bug fixes and enhancements#13
maucejo merged 2 commits intomaucejo:mainfrom
Spectrum-Tec:main

Conversation

@JakeZw
Copy link
Contributor

@JakeZw JakeZw commented Nov 26, 2025

I noted that uff.m writes all lines including the “ -1” line out to 80 characters. Thus I previously modified the read_write_uff.jl file for this.

However I did not modify the lines similar to this: while (r1 = readline(io)) != " -1"

which may be a bug. This has been corrected to while (r1 = readline(io))[1:6] != " -1"

This should leave r1 unaffected and will only compare the first 6 characters with “ -1”

Better Julian error handling for dataset58b.jl

Minor cosmetic change of split to splitext in read_write_uff.jl

Copy link
Owner

@maucejo maucejo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to not modify the line file_extension = , since with splittext we need to add ".unv" instead of "unv" in the function supported_file_extension.

@maucejo maucejo merged commit 6f6b064 into maucejo:main Nov 26, 2025
@JakeZw
Copy link
Contributor Author

JakeZw commented Nov 26, 2025 via email

@JakeZw
Copy link
Contributor Author

JakeZw commented Nov 26, 2025

As I am curious as to what others do with right padding the header lines in universal files. A little survey on what I have available:

NX I-deas 5 unv - does not right pad
I-DEAS Master Series 5 bunv - does not right pad
Xmodal - does not right pad
uff.m - does right pad, including " -1" delimiter and 2nd line (data type )
Simcenter Testlab Rev work-22A - only right pads delimiter and 2nd line (data type)
Simcenter Testlab Rev work-22A - right pads all header lines, sometimes to 93 characters (for 58b)

This sampling is sufficient to note that the header lines do not need to be right padded but sometimes are and that applications are inconsistent in this area. So in reading files we need to be aware of this.

To handle this inconsistency, UFFFiles in some areas uses a while loop of the following format:
while (r1 = readline(io))[1:6] != " -1" # Do Something end

The [1:6] extracts the first 6 characters of the string. This loop needs to be after any header lines that are potentially shorter than 6 characters such as "NONE". This is the case so all should be well.

@maucejo
Copy link
Owner

maucejo commented Nov 26, 2025

I think that the safer code would be while (r1 = strip(readline(io))) != "-1" as I did in the initial release of the package 😀

That being said, I think that standards must be respected (e.g. a line is 80 characters and not 93!). With this diversity and relaxed approach of the standard, I am afraid that we can't manage all the slight variations introduced by some software editors. But I may be wrong...

@JakeZw
Copy link
Contributor Author

JakeZw commented Nov 27, 2025

If we change the strip to rstrip that might work well. The strip will be problematic with @scanf style of reading. The following and do not affect @scanf statements.

So while (r1 = rstrip(readline(io))) != " -1"

And while (r1 = readline(io)) | > rstrip != " -1"

I put the first in a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants