refactor(Solvespace): Loads js at the end

This commit is contained in:
sovanna 2019-07-22 12:34:26 +02:00
parent ec5175d9d1
commit 62aaa02d32
1 changed files with 65 additions and 75 deletions

View File

@ -44,14 +44,6 @@ Of course, most vacuum chambers would have some standard flanges. These can be e
<img class="img-fluid" src="/images/kf25-section.png" width="400" height="100%"> <img class="img-fluid" src="/images/kf25-section.png" width="400" height="100%">
<div id="kf25"></div> <div id="kf25"></div>
<script src="/js/models/kf25.js"></script>
<script>
(function () {
var node = document.getElementById("kf25");
var params = {width: 400, height: 300, scale: 10, offset: new THREE.Vector3(-8, 0, 0)};
node.parentNode.replaceChild(solvespace(solvespace_model_kf25, params), node);
})();
</script>
{% end %} {% end %}
*(The illustration on the right is "live"; it can be panned, rotated and scaled.)* *(The illustration on the right is "live"; it can be panned, rotated and scaled.)*
@ -62,24 +54,7 @@ In a similar way, an NW160 viewport and an adapter with an NW160 flange, a KF40,
{% layout_treejs(two=true) %} {% layout_treejs(two=true) %}
<div id="viewport"></div> <div id="viewport"></div>
<script src="/js/models/viewport.js"></script>
<script>
(function () {
var node = document.getElementById("viewport");
var params = {width: 400, height: 300, scale: 3};
node.parentNode.replaceChild(solvespace(solvespace_model_viewport, params), node);
})();
</script>
<div id="multiport"></div> <div id="multiport"></div>
<script src="/js/models/multiport.js"></script>
<script>
(function () {
var node = document.getElementById("multiport");
var params = {width: 400, height: 300, scale: 3};
node.parentNode.replaceChild(solvespace(solvespace_model_multiport, params), node);
})();
</script>
{% end %} {% end %}
@ -92,14 +67,6 @@ The fittings above were designed to be used with a cylindrical vacuum chamber, 2
{% layout_treejs() %} {% layout_treejs() %}
<div id="chamber"></div> <div id="chamber"></div>
<script src="/js/models/chamber.js"></script>
<script>
(function () {
var node = document.getElementById("chamber");
var params = {width: 800, height: 600, scale: 3};
node.parentNode.replaceChild(solvespace(solvespace_model_chamber, params), node);
})();
</script>
{% end %} {% end %}
@ -114,24 +81,7 @@ First, the cryocooler and its cold head were modelled to verify fits:
{% layout_treejs(two=true) %} {% layout_treejs(two=true) %}
<div id="k526s-body"></div> <div id="k526s-body"></div>
<script src="/js/models/k526s-body.js"></script>
<script>
(function () {
var node = document.getElementById("k526s-body");
var params = {width: 400, height: 300, scale: 6, offset: new THREE.Vector3(-10, -15, 0)};
node.parentNode.replaceChild(solvespace(solvespace_model_k526s_body, params), node);
})();
</script>
<div id="k526s-head"></div> <div id="k526s-head"></div>
<script src="/js/models/k526s-head.js"></script>
<script>
(function () {
var node = document.getElementById("k526s-head");
var params = {width: 400, height: 300, scale: 8, offset: new THREE.Vector3(25, 0, 0)};
node.parentNode.replaceChild(solvespace(solvespace_model_k526s_head, params), node);
})();
</script>
{% end %} {% end %}
@ -140,14 +90,6 @@ Then, a fixture was designed, shown below with a cutout (blue). It consists of a
{% layout_treejs() %} {% layout_treejs() %}
<div id="k526s-fixture"></div> <div id="k526s-fixture"></div>
<script src="/js/models/k526s-fixture.js"></script>
<script>
(function () {
var node = document.getElementById("k526s-fixture");
var params = {width: 800, height: 400, scale: 12};
node.parentNode.replaceChild(solvespace(solvespace_model_k526s_fixture, params), node);
})();
</script>
{% end %} {% end %}
@ -156,24 +98,7 @@ The KF25 adapter for the cold head is a much simpler device:
{% layout_treejs(two=true) %} {% layout_treejs(two=true) %}
<div id="k526s-adapter"></div> <div id="k526s-adapter"></div>
<script src="/js/models/k526s-adapter.js"></script>
<script>
(function () {
var node = document.getElementById("k526s-adapter");
var params = {width: 400, height: 300, scale: 8, offset: new THREE.Vector3(-8, 0, 0)};
node.parentNode.replaceChild(solvespace(solvespace_model_k526s_adapter, params), node);
})();
</script>
<div id="k526s-adapter-assy"></div> <div id="k526s-adapter-assy"></div>
<script src="/js/models/k526s-adapter-assy.js"></script>
<script>
(function () {
var node = document.getElementById("k526s-adapter-assy");
var params = {width: 400, height: 300, scale: 8};
node.parentNode.replaceChild(solvespace(solvespace_model_k526s_adapter_assy, params), node);
})();
</script>
{% end %} {% end %}
@ -199,3 +124,68 @@ Currently, the focus of development is to improve SolveSpace's handling of compl
**For commercial support and licensing**, please contact sales@m-l***s.hk. **For commercial support and licensing**, please contact sales@m-l***s.hk.
{% div() %}
<script src="/js/models/kf25.js"></script>
<script src="/js/models/viewport.js"></script>
<script src="/js/models/multiport.js"></script>
<script src="/js/models/chamber.js"></script>
<script src="/js/models/k526s-body.js"></script>
<script src="/js/models/k526s-head.js"></script>
<script src="/js/models/k526s-fixture.js"></script>
<script src="/js/models/k526s-adapter.js"></script>
<script src="/js/models/k526s-adapter-assy.js"></script>
<script>
(function () {
var nodes = [{
id: 'kf25',
model: solvespace_model_kf25,
params: {width: 400, height: 300, scale: 10, offset: new THREE.Vector3(-8, 0, 0)},
}, {
id: 'viewport',
model: solvespace_model_viewport,
params: {width: 400, height: 300, scale: 3},
}, {
id: 'multiport',
model: solvespace_model_multiport,
params: {width: 400, height: 300, scale: 3},
}, {
id: 'chamber',
model: solvespace_model_chamber,
params: {width: 800, height: 600, scale: 3},
}, {
id: 'k526s-body',
model: solvespace_model_k526s_body,
params: {width: 400, height: 300, scale: 6, offset: new THREE.Vector3(-10, -15, 0)},
}, {
id: 'k526s-head',
model: solvespace_model_k526s_head,
params: {width: 400, height: 300, scale: 8, offset: new THREE.Vector3(25, 0, 0)},
}, {
id: 'k526s-fixture',
model: solvespace_model_k526s_fixture,
params: {width: 800, height: 400, scale: 12},
}, {
id: 'k526s-adapter',
model: solvespace_model_k526s_adapter,
params: {width: 400, height: 300, scale: 8, offset: new THREE.Vector3(-8, 0, 0)},
}, {
id: 'k526s-adapter-assy',
model: solvespace_model_k526s_adapter_assy,
params: {width: 400, height: 300, scale: 8},
}];
var node;
for (var i = nodes.length - 1; i >= 0; i--) {
node = document.getElementById(nodes[i].id);
node.parentNode.replaceChild(solvespace(nodes[i].model, nodes[i].params), node);
}
})();
</script>
{% end %}