Skip to content

Commit

Permalink
Merge pull request #388 from Larbino1/master
Browse files Browse the repository at this point in the history
Update registry.jl
  • Loading branch information
SimonDanisch authored Mar 16, 2024
2 parents d30fbd7 + 9ffb6e7 commit b7259eb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/registry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,7 @@ function detect_stlbinary(io)
number_of_triangle_blocks = read(io, UInt32)
#1 normal, 3 vertices in Float32 + attrib count, usually 0
len != (number_of_triangle_blocks*size_triangleblock)+size_header && (seekstart(io); return false)
skip(io, number_of_triangle_blocks*size_triangleblock-sizeof(UInt16))
attrib_byte_count = read(io, UInt16) # read last attrib_byte
attrib_byte_count != zero(UInt16) && (seekstart(io); return false) # should be zero as not used
skip(io, number_of_triangle_blocks*size_triangleblock)
result = eof(io) # if end of file, we have a stl!
return result
end
Expand Down
Binary file not shown.
3 changes: 3 additions & 0 deletions test/query.jl
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ let file_dir = joinpath(@__DIR__, "files"), file_path = Path(file_dir)
@test typeof(q) <: File{format"STL_ASCII"}
q = query(joinpath(file_dir, "binary_stl_from_solidworks.STL"))
@test typeof(q) <: File{format"STL_BINARY"}
# See Pull Request # 388
q = query(joinpath(file_dir, "binary_stl_with_nonzero_attribute_byte_count.stl"))
@test typeof(q) <: File{format"STL_BINARY"}
open(q) do io
@test position(io) == 0
skipmagic(io)
Expand Down

0 comments on commit b7259eb

Please sign in to comment.