Template:Jscad: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| Line 15: | Line 15: | ||
[[Category:Template]] | [[Category:Template]] | ||
</noinclude><includeonly> | </noinclude><includeonly> | ||
{{#tag:html| | {{#tag:html| | ||
<script src="/extensions/OpenJsCad/lightgl.js"></script> | <script src="/extensions/OpenJsCad/lightgl.js"></script> | ||
<script src="/extensions/OpenJsCad/csg.js"></script> | <script src="/extensions/OpenJsCad/csg.js"></script> | ||
<script src="/extensions/OpenJsCad/openjscad.js"></script> | <script src="/extensions/OpenJsCad/openjscad.js"></script> | ||
<style> | <style> | ||
pre, code, textarea { | pre, code, textarea { | ||
font: 12px/20px Monaco, monospace; | font: 12px/20px Monaco, monospace; | ||
| Line 46: | Line 38: | ||
outline: none; | outline: none; | ||
} | } | ||
canvas { cursor: move; } | canvas { cursor: move; } | ||
</style> | |||
<link rel="stylesheet" href="/extensions/OpenJsCad/openjscad.css" type="text/css"> | <link rel="stylesheet" href="/extensions/OpenJsCad/openjscad.css" type="text/css"> | ||
<script> | <script> | ||
var gProcessor=null; | |||
// Show all exceptions to the user: | |||
OpenJsCad.AlertUserOfUncaughtExceptions(); | |||
function onload() | |||
{ | |||
let viewer = document.getElementById("viewer"); | |||
gProcessor = new OpenJsCad.Processor(viewer); | |||
updateSolid(); | |||
} | |||
function updateSolid() | |||
{ | |||
gProcessor.setJsCad(document.getElementById('code').value); | |||
} | |||
function updateSolid() | |||
{ | |||
} | |||
</script> | </script> | ||
<body onload="onload()"> | <body onload="onload()"> | ||
<input type="submit" value="Update" onclick="updateSolid(); return false;"> | <input type="submit" value="Update" onclick="updateSolid(); return false;"> | ||
<textarea id='code'>{{{code|}}}</textarea> | |||
}} | }} | ||
</includeonly> | </includeonly> | ||
Revision as of 07:18, 10 June 2019
Usage
Put your JSCAD code inside a source tag and add a call of this template
<source lang='javascript'></source>
{{jscad|code=function main() {
}
}}
Example