Template:Jscad: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| (13 intermediate revisions by 2 users not shown) | |||
| Line 2: | Line 2: | ||
= Usage = | = Usage = | ||
<pre> | <pre> | ||
{{jscad|title=OpenJSCAD example|code=function main() | {{jscad|title=OpenJSCAD example|code=function main() { | ||
{ | return CSG.cube(); | ||
} | } | ||
}} | }} | ||
</pre> | </pre> | ||
= Example = | = Example = | ||
{{jscad|title=OpenJSCAD example|code=function main() | {{jscad|title=OpenJSCAD example|code=function main() { | ||
{ | return CSG.cube(); | ||
} | |||
} | |||
}} | }} | ||
<pre> | |||
< | |||
<style> | <style> | ||
pre { | pre, code, textarea { | ||
font: 12px/20px Monaco, monospace; | font: 12px/20px Monaco, monospace; | ||
border: 1px solid #CCC; | border: 1px solid #CCC; | ||
| Line 51: | Line 21: | ||
padding: 0 3px; | padding: 0 3px; | ||
color: #555; | color: #555; | ||
} | |||
pre, textarea { | |||
padding: 10px; | |||
width: 100%; | width: 100%; | ||
} | |||
textarea { | |||
height: 200px; | |||
} | |||
textarea:focus { | |||
outline: none; | |||
} | } | ||
canvas { cursor: move; } | canvas { cursor: move; } | ||
</style> | </style> | ||
< | </pre> | ||
[[Category:Template]] | |||
</noinclude><includeonly> | |||
= {{{title|}}} = | |||
The preview below currently only works for older JSCad code using the CSG syntax. See [https://github.com/jscad/OpenJSCAD.org/issues/448 OpenJsCad Issue 448] | |||
{{#tag:jscad|{{{code|}}}}} | |||
= Source code = | |||
Just cut&paste the source code below to https://www.openjscad.org/ | |||
}} | |||
= Source | |||
{{#tag:source|{{{code|}}}|lang=javascript}} | {{#tag:source|{{{code|}}}|lang=javascript}} | ||
[[Category:OpenJSCAD]] | |||
</includeonly> | </includeonly> | ||
Latest revision as of 08:37, 18 June 2019
Usage
{{jscad|title=OpenJSCAD example|code=function main() {
return CSG.cube();
}
}}
Example
OpenJSCAD example
The preview below currently only works for older JSCad code using the CSG syntax. See OpenJsCad Issue 448 <jscad>function main() {
return CSG.cube();
}</jscad>
Source code
Just cut&paste the source code below to https://www.openjscad.org/
function main() {
return CSG.cube();
}
<style>
pre, code, textarea {
font: 12px/20px Monaco, monospace;
border: 1px solid #CCC;
border-radius: 3px;
background: #F9F9F9;
padding: 0 3px;
color: #555;
}
pre, textarea {
padding: 10px;
width: 100%;
}
textarea {
height: 200px;
}
textarea:focus {
outline: none;
}
canvas { cursor: move; }
</style>