Code Monkey home page Code Monkey logo

Comments (4)

eliascarv avatar eliascarv commented on August 21, 2024 1

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:

Captura de tela de 2024-06-04 14-25-22

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

from geoio.jl.

eliascarv avatar eliascarv commented on August 21, 2024 1

@roflmaostc, in v1.13.4, you can load the original file without modifications.

from geoio.jl.

roflmaostc avatar roflmaostc commented on August 21, 2024 1

Cool, great :)!

from geoio.jl.

roflmaostc avatar roflmaostc commented on August 21, 2024

The file I used in the standard Benchy, so nothing very fancy:
https://www.3dbenchy.com/download/

from geoio.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.