-
Notifications
You must be signed in to change notification settings - Fork 1
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
Opening a .stl file #86
Comments
The file I used in the standard Benchy, so nothing very fancy: |
You file is an "edge case", because according to the description of the STL format, binary files cannot begin with the word "solid" in their header: Reading the file we can see that its header starts with the word "solid": julia> io = open("3DBenchy.stl");
julia> String(read(io, 80))
"solid Shape0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
julia> close(io) I think we can support this edge case in future versions of GeoIO.jl. However, for now, you can run this code to generate a new, valid version of your file: open("3DBenchyFIXED.stl", write=true) do io_new
foreach(_ -> write(io_new, 0x00), 1:80) # empty header
open("3DBenchy.stl") do io_old
skip(io_old, 80) # skip header
write(io_new, read(io_old))
end
end julia> GeoIO.load("3DBenchyFIXED.stl")
225706×2 GeoTable over 225706 SimpleMesh
┌────────────────────────────────────────────┬──────────────────────────────────
│ NORMAL │ ⋯
│ Unknown │ ⋯
│ [NoUnits] │ ⋯
├────────────────────────────────────────────┼──────────────────────────────────
│ (-0.996917 m, 0.0 m, 0.0784591 m) │ Triangle((x: 6.622 m, y: -1.25 ⋯
│ (-0.996917 m, 0.0 m, 0.0784591 m) │ Triangle((x: 6.622 m, y: -1.25 ⋯
│ (-0.996917 m, 1.34498f-15 m, 0.0784591 m) │ Triangle((x: 6.597 m, y: -1.20 ⋯
│ (-0.996917 m, -1.1773f-15 m, 0.0784591 m) │ Triangle((x: 6.605 m, y: -1.23 ⋯
│ (-0.996917 m, 2.22926f-16 m, 0.0784591 m) │ Triangle((x: 6.622 m, y: 0.0 m ⋯
│ (-0.996917 m, -1.61398f-15 m, 0.0784591 m) │ Triangle((x: 6.575 m, y: -1.099 ⋯
│ (-0.996917 m, -1.75022f-15 m, 0.0784591 m) │ Triangle((x: 6.582 m, y: -1.143 ⋯
│ (-0.996917 m, 1.87249f-15 m, 0.0784591 m) │ Triangle((x: 6.622 m, y: 0.0 m ⋯
│ (-0.996917 m, -4.26202f-15 m, 0.0784591 m) │ Triangle((x: 6.556 m, y: -0.927 ⋯
│ (-0.996917 m, -2.16594f-16 m, 0.0784591 m) │ Triangle((x: 6.562 m, y: -0.99 ⋯
│ (-0.996917 m, 2.3476f-15 m, 0.0784591 m) │ Triangle((x: 6.622 m, y: 0.0 m, ⋯
│ (-0.996917 m, -2.44542f-16 m, 0.0784591 m) │ Triangle((x: 6.541 m, y: -0.702 ⋯
│ (-0.996917 m, 1.18079f-15 m, 0.0784591 m) │ Triangle((x: 6.546 m, y: -0.782 ⋯
│ (-0.996917 m, 4.91879f-15 m, 0.0784591 m) │ Triangle((x: 6.622 m, y: 0.0 m, ⋯
│ (-0.996917 m, -6.60613f-15 m, 0.0784591 m) │ Triangle((x: 6.53 m, y: -0.438 ⋯
│ (-0.996917 m, -1.04105f-15 m, 0.0784591 m) │ Triangle((x: 6.533 m, y: -0.53 ⋯
│ ⋮ │ ⋱
└────────────────────────────────────────────┴──────────────────────────────────
1 column and 225690 rows omitted |
@roflmaostc, in v1.13.4, you can load the original file without modifications. |
Cool, great :)! |
Hi,
with Julia 1.10.3 and 1.13.0 I get the following error for opening a
.stl
file:I wanted to open the common Benchy STL.
Best,
Felix
The text was updated successfully, but these errors were encountered: