# 为 github\_blob 引擎添加对 STL 模型的支持

**URL:** https://meta.discourse.org/t/adding-support-for-stl-models-to-github-blob-engine/113808
**Category:** Development
**Created:** [2019年四月8日 22:02 UTC](https://meta.discourse.org/t/adding-support-for-stl-models-to-github-blob-engine/113808 "2019-04-08T22:02:36Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Neotinker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neotinker/32/137805_2.png) [@Neotinker](https://meta.discourse.org/u/Neotinker)
#### Post date: [2019年四月8日 22:02 UTC](https://meta.discourse.org/t/adding-support-for-stl-models-to-github-blob-engine/113808/1 "2019-04-08T22:02:37Z")

</div>

I’ve modified the onebox github\_blob engine to display the stl model file using github’s render url.

[https://github.com/discourse/onebox/pull/401](https://github.com/discourse/onebox/pull/401)

This is my first attempt at modifying onebox. Feedback is welcome.

I’m testing with “[Mendel90/dibond/stls/x\_motor\_bracket.stl at master · nophead/Mendel90 · GitHub](https://github.com/nophead/Mendel90/blob/master/dibond/stls/x_motor_bracket.stl)” but that repo is full of stl files that you can test with.

---

<div class="post-metadata">

### Author: ![Neotinker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neotinker/32/137805_2.png) [@Neotinker](https://meta.discourse.org/u/Neotinker)
#### Post date: [2019年四月8日 22:10 UTC](https://meta.discourse.org/t/adding-support-for-stl-models-to-github-blob-engine/113808/2 "2019-04-08T22:10:10Z")

</div>

Looks like the automated tests that are failing for onebox are failing since the version bump.

[https://github.com/discourse/onebox/commit/6ab57eca8cf3d9ee8f7675bf5bd125403c00269b](https://github.com/discourse/onebox/commit/6ab57eca8cf3d9ee8f7675bf5bd125403c00269b)

---

<div class="post-metadata">

### Author: ![Neotinker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neotinker/32/137805_2.png) [@Neotinker](https://meta.discourse.org/u/Neotinker)
#### Post date: [2019年四月9日 00:41 UTC](https://meta.discourse.org/t/adding-support-for-stl-models-to-github-blob-engine/113808/3 "2019-04-09T00:41:00Z")

</div>

@zogstrip @maja Can someone take a look at travis-ci and tell me why the tests are failing?

> **[Travis CI](https://app.travis-ci.com/discourse/onebox/jobs/515606903)**
>
> Travis CI enables your team to test and ship your apps with confidence. Easily sync your projects with Travis CI and you'll be testing your code in minutes.

---

<div class="post-metadata">

### Author: ![maja](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maja/32/129533_2.png) [@maja](https://meta.discourse.org/u/maja)
#### Post date: [2019年四月9日 07:01 UTC](https://meta.discourse.org/t/adding-support-for-stl-models-to-github-blob-engine/113808/4 "2019-04-09T07:01:50Z")

</div>

Gemfile.lock wasn’t updated with a new version after version bump, it should work now: [update Gemfile.lock · discourse/onebox@d0f99c5 · GitHub](https://github.com/discourse/onebox/commit/d0f99c5e66ac3c3732805c75498d92c4d410811d)

---

<div class="post-metadata">

### Author: ![Neotinker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neotinker/32/137805_2.png) [@Neotinker](https://meta.discourse.org/u/Neotinker)
#### Post date: [2019年四月9日 15:55 UTC](https://meta.discourse.org/t/adding-support-for-stl-models-to-github-blob-engine/113808/5 "2019-04-09T15:55:36Z")

</div>

Thanks. Since my pull request is still showing a travis-ci failure, should I close it and recreate it?

---

<div class="post-metadata">

### Author: ![mcdanlj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcdanlj/32/131829_2.png) [@mcdanlj](https://meta.discourse.org/u/mcdanlj)
#### Post date: [2019年四月11日 02:55 UTC](https://meta.discourse.org/t/adding-support-for-stl-models-to-github-blob-engine/113808/6 "2019-04-11T02:55:43Z")

</div>

Thank you! I was just wishing for this today because I wanted to display as a model:

[https://github.com/johnsonm/lathe-tool-models/blob/master/square-tool.stl](https://github.com/johnsonm/lathe-tool-models/blob/master/square-tool.stl)

…and a visual model would be more compelling than the textual content! ☺

---

<div class="post-metadata">

### Author: ![Neotinker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neotinker/32/137805_2.png) [@Neotinker](https://meta.discourse.org/u/Neotinker)
#### Post date: [2019年四月12日 15:19 UTC](https://meta.discourse.org/t/adding-support-for-stl-models-to-github-blob-engine/113808/7 "2019-04-12T15:19:55Z")

</div>

The current version does nothing to set the size of the iframe window so the rendered model is fairly small.

 ![Screenshot%20from%202019-04-08%2015-31-39](https://global.discourse-cdn.com/meta/original/3X/a/6/a6fcd5db7ffa3d629517b1df7ea056360c51c545.png) I initially thought that was ok since clicking on the link will take you to a page with a larger version of the rendered model but now I’m wondering if the embedded display should be a little larger.

Looking at the youtube plugin, it uses 480x360 which seems like a good size.

 ![Screenshot%20from%202019-04-12%2010-17-33](https://global.discourse-cdn.com/meta/original/3X/5/8/587f8dad73275ac776293d3876ecceca6005dcdc.png)  
It makes me wonder if I should set the default size to 480x360 or leave it as it is.

---

<div class="post-metadata">

### Author: ![mcdanlj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcdanlj/32/131829_2.png) [@mcdanlj](https://meta.discourse.org/u/mcdanlj)
#### Post date: [2019年四月13日 20:37 UTC](https://meta.discourse.org/t/adding-support-for-stl-models-to-github-blob-engine/113808/8 "2019-04-13T20:37:53Z")

</div>

As someone who creates models and intends to use this feature, I think that the 480x360 is a more meaningful aspect ratio for interactive content like this.

---

<div class="post-metadata">

### Author: ![Neotinker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neotinker/32/137805_2.png) [@Neotinker](https://meta.discourse.org/u/Neotinker)
#### Post date: [2019年四月16日 14:44 UTC](https://meta.discourse.org/t/adding-support-for-stl-models-to-github-blob-engine/113808/9 "2019-04-16T14:44:57Z")

</div>

I closed the PR and created a new one.

[https://github.com/discourse/onebox/pull/402](https://github.com/discourse/onebox/pull/402)
