Skip to content

Commit

Permalink
Merge branch 'main' of github.com:gridap/STLCutters.jl into main
Browse files Browse the repository at this point in the history
  • Loading branch information
pmartorell committed Apr 22, 2022
2 parents 1f79ff7 + b0ead35 commit cdafafb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
- '1.6'
os:
- ubuntu-latest
- windows-latest
arch:
- x64
steps:
Expand Down
13 changes: 11 additions & 2 deletions src/STLs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ end
# Read STL from file

function read_stl(filename::String)
F = _file_format(filename)
mesh = load(File{F}(filename))
mesh = _load(filename)
vertex_to_coordinates = MeshIO.decompose(MeshIO.Point3,mesh)
facet_to_vertices = MeshIO.decompose(MeshIO.TriangleFace,mesh)
vertex_to_normals = MeshIO.decompose_normals(mesh)
Expand All @@ -128,6 +127,15 @@ function read_stl(filename::String)
vertex_to_coordinates,facet_to_vertices,facet_to_normals
end

function _load(filename)
if Sys.islinux()
F = _file_format(filename)
load(File{F}(filename))
else
load(filename)
end
end

function _file_format(filename)
ext = lowercase(last(splitext(filename)))
stl,obj = ".stl",".obj"
Expand All @@ -139,6 +147,7 @@ function _file_format(filename)
end

function _get_encoding(filename)
@notimplementedif !Sys.islinux()
cmd = `file --mime-encoding $filename`
read(cmd,String)
end
Expand Down

0 comments on commit cdafafb

Please sign in to comment.