Difference between revisions of "Template:Jscad"

From BITPlan Wiki
Jump to navigation Jump to search
Line 2: Line 2:
 
[[Category:Template]]
 
[[Category:Template]]
 
</noinclude>
 
</noinclude>
<includeonly><source lang='javascript'>{{{code|}}}</source></includeonly>
+
<includeonly>
 +
<html><head>
 +
  <script src="/extensions/OpenJsCad/lightgl.js"></script>
 +
  <script src="/extensions/OpenJsCad/csg.js"></script>
 +
  <script src="/extensions/OpenJsCad/openjscad.js"></script>
 +
  <style>
 +
 
 +
body {
 +
  font: 14px/20px 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif;
 +
  max-width: 820px;
 +
  margin: 0 auto;
 +
  padding: 10px;
 +
}
 +
 
 +
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>
 +
<link rel="stylesheet" href="/extensions/OpenJsCad/openjscad.css" type="text/css">
 +
 
 +
<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);
 +
}
 +
</script>
 +
<title>OpenJsCad demo: Parametric Lamp Shade</title>
 +
</head>
 +
<body onload="onload()">
 +
<input type="submit" value="Update" onclick="updateSolid(); return false;">
 +
<html>
 +
</includeonly>

Revision as of 07:36, 10 June 2019