Skip to content

Instantly share code, notes, and snippets.

@calebhsu
Last active November 6, 2015 07:01
Show Gist options
  • Save calebhsu/24b114d3edc97c6874b7 to your computer and use it in GitHub Desktop.
Save calebhsu/24b114d3edc97c6874b7 to your computer and use it in GitHub Desktop.
Button using CraftML tags
<craft name="button">
<info>
<title> Shirt Button </title>
</info>
<style>
* { color: teal; }
</style>
<param name="width" type="int" default="6"/>
<param name="height" type="int" default="1"/>
<g layout="centerXYZ()">
<g layout="centerXYZ()" cut=".holes">
<col spacing="{{width/6}}" class="holes">
<repeat n="2">
<row spacing="{{width/6}}">
<repeat n="2">
<cylinder radius="{{width / 12}}" height="{{height}}"></cylinder>
</repeat>
</row>
</repeat>
</col>
<cylinder radius="{{width / 2}}" height="{{height}}"/>
</g>
<script type="text/openjscad">
function main() {
// Border
return torus({
ri: 1,
ro: params.width / 2,
fni: 6
}).translate([0, 0, 0.5]).scale([1, 1, params.height]);
}
</script>
</g>
</craft>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment