-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test to ensure binary STL files from SOLIDWORKS get imported correctly #917
Conversation
…out a warning Signed-off-by: Kenji Brameld <kenjibrameld@gmail.com>
"a binary STL file. Trying to interpret it as a binary " | ||
"STL file instead."); | ||
if (buffer_str.substr(0, 5) == std::string("solid") && | ||
buffer_str.find("endsolid", 5) != std::string::npos) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't say I love this; it means that for every solidworks STL file that is binary, we have to spend the time searching through the whole thing just to determine that it is not ASCII and doesn't contain endsolid
. That could be slow, especially on large STL files.
Is there anything more efficient we can do here? The specification for STL is at http://www.fabbers.com/tech/STL_Format , maybe there are some clues on how we can do this more efficiently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't changed the search method in this PR, the efficiency is exactly the same. The only thing that has changed is that now STL files starting with a "solid" but without an "endsolid", get through the checks without a warning.
I agree with the existing code being inefficient, but I suggest that should be addressed in another PR or tracked in an issue for the time being.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fair, can you please open an issue about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done - #919
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Will run CI next.
Had a quick look at CI output, but I can't tell where the failure is coming from. |
It's a CMake warning from Fast-DDS, which should be solved now. With that, this looks good so I'll go ahead and merge it. Thanks for the contribution! |
Thanks @clalancette ! May I ask for a backport of this? I believe this is a backport-worthy bug fix that removes unnecessary warnings for anyone using SOLIDWORKS stl files in older distros. |
Ping @clalancette |
Another gentle ping @clalancette |
https://github.com/Mergifyio backport humble galactic foxy |
✅ Backports have been created
|
Thanks @ahcorde ! |
This fixes a commonly faced issue with binary STL files from SOLIDWORKS, where they start with the word "solid", which suggests that its an ascii stl file, but really its a binary stl file.
This PR works around the problem by looking for "endsolid" too, as the files from SOLIDWORKS seem to not contain "endsolid".
Resolves: #888
Signed-off-by: Kenji Brameld kenjibrameld@gmail.com