StasiewiczJacob
StasiewiczJacob

Reputation: 71

Is there anyway to view a STL file in a github readme similar to an image?

Howdy I am trying to show a preview of an STL file from my github repo in the README file is there anyway to do this? So far I have tried using
<script src="https://embed.github.com/view/3d/<username>/<repo>/<ref>/<path_to_file>"></script>
For example my file would be
<script src="https://github.com/view/3d/UNCG-DAISY/SediNetCam/blob/main/hardware/cameracover.stl"></script>

Upvotes: 4

Views: 1178

Answers (3)

Gaucho
Gaucho

Reputation: 1

if you add a stl file in your repo and add the link to that file in your readme, then in your readme a link to the file is generated and by clicking on it, the stl is correctly rendered in a dedicated page of github. It is not clear how to embed in the readme the stl file, without inserting the ascii strings as suggested in the previous answer in this page.

Upvotes: 0

Y.S.
Y.S.

Reputation: 317

Download MeshLab, Import your stl file, Export it as an stl file when you uncheck binary encoding

OR

Download FreeCAD, Import your stl file, Export it as an ast file

Open the exported file with a text editor, and copy it to your README.md file, inside:

```stl
```

For more information:

Upvotes: 0

cychitivav
cychitivav

Reputation: 13

Now, Github renderize STLs inserting the ASCII code in code blocks wit syntax highlighting

https://docs.github.com/en/enterprise-cloud@latest/get-started/writing-on-github/working-with-advanced-formatting/creating-diagrams

```stl
solid cube_corner
  facet normal 0.0 -1.0 0.0
    outer loop
      vertex 0.0 0.0 0.0
      vertex 1.0 0.0 0.0
      vertex 0.0 0.0 1.0
    endloop
  endfacet
  facet normal 0.0 0.0 -1.0
    outer loop
      vertex 0.0 0.0 0.0
      vertex 0.0 1.0 0.0
      vertex 1.0 0.0 0.0
    endloop
  endfacet
  facet normal -1.0 0.0 0.0
    outer loop
      vertex 0.0 0.0 0.0
      vertex 0.0 0.0 1.0
      vertex 0.0 1.0 0.0
    endloop
  endfacet
  facet normal 0.577 0.577 0.577
    outer loop
      vertex 1.0 0.0 0.0
      vertex 0.0 1.0 0.0
      vertex 0.0 0.0 1.0
    endloop
  endfacet
endsolid
```

Upvotes: 1

Related Questions