Skip to content

Commit

Permalink
Merge pull request #434 from dmurdoch/writeSTL
Browse files Browse the repository at this point in the history
Write "endsolid" at the end of writeSTL().
  • Loading branch information
dmurdoch authored Sep 28, 2024
2 parents fbedc32 + 752e825 commit b58beba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: rgl
Version: 1.3.10
Version: 1.3.11
Title: 3D Visualization Using OpenGL
Authors@R: c(person("Duncan", "Murdoch", role = c("aut", "cre"),
email = "[email protected]"),
Expand Down
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# rgl 1.3.10
# rgl 1.3.11

## Minor changes

Expand All @@ -20,6 +20,7 @@ mouse mode set to "selecting".
which makes WebGL mimic the `rgl` device when drawing transparent
objects. The default value is `TRUE` unless option
`rgl.fastTransparency` is set to `FALSE`.
* `writeSTL()` now writes `endsolid`, which is required by some apps.

# rgl 1.3.1

Expand Down
13 changes: 9 additions & 4 deletions R/stl.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ writeSTL <- function(con, ascii=FALSE, pointRadius=0.005,
writeBin(0L, con, size=4, endian="little")
}
}

finish <- function()
{ if (!ascii) {
seek(con, 80)
writeBin(as.integer(triangles), con, size=4, endian="little")
} else
cat("endsolid\n", file = con)
}

triangles <- 0

Expand Down Expand Up @@ -186,10 +194,7 @@ writeSTL <- function(con, ascii=FALSE, pointRadius=0.005,
linestrip = writeLines(ids[i])
)

if (!ascii) {
seek(con, 80)
writeBin(as.integer(triangles), con, size=4, endian="little")
}
finish()

invisible(filename)
}
Expand Down

0 comments on commit b58beba

Please sign in to comment.