-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathjsoncad_example_12.html
117 lines (103 loc) · 7.2 KB
/
jsoncad_example_12.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<html>
<head>
<title>JSONCad Parser Example 1</title>
<script type="text/javascript" src="three70.js" ></script>
<script type="text/javascript" src="OrthographicTrackballControls.js" ></script>
<script type="text/javascript" src="potree.js" ></script>
<script type="text/javascript" src="BinaryLoader.js" ></script>
<script type="text/javascript" src="csg.js" ></script>
<script type="text/javascript" src="threecsg.js" ></script>
<script type="text/javascript" src="Arial Narrow_Regular.js" ></script>
<script type="text/javascript" src="openscad.js" ></script>
<script type="text/javascript" src="jsoncad_base.js" ></script>
<script type="text/javascript" src="jsoncad_parser.js" ></script>
<script type="text/javascript" src="jsoncad_annotate.js" ></script>
<script type="text/javascript" >
// Examples similar to Example 11 but using cylinders instead of cubes to generate the lines
//.
// The SPHERES were used to ensure that the lines were rotated and located correctly.
// Note that each line is delineated by two sets of coordinates [x0,y0,z0,x1,y1,z1] and can
// be relocated as any instance.
// In contrast the line segments (LSG3 verbs) use the first paramater [x0,y0,z0] as the starting
// Point then uses the instances for each additional point.
//
// Linked cylinders are a good start for making piping layouts. They can be used in conjunction with
// libraries of fittings (once they are available).
//
var nodes = {
'TEST_LIST': {
// //center,panels, size,color ]
'SPHERES': ['SPHR', [-1 ,32, 2,null], [ //0
{x: -10 ,y: -20 ,z: -20 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [0, 0,1, 1],size: [1, 1, 1]}
, {x: -10 ,y: -20 ,z: 20 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [0, 0,1, 1],size: [1, 1, 1]}
, {x: -10 ,y: 20 ,z: -20 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [0, 0,1, 1],size: [1, 1, 1]}
, {x: -10 ,y: 20 ,z: 20 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [0, 0,1, 1],size: [1, 1, 1]}
, {x: 10 ,y: -20 ,z: -20 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [1, 0,1, 1],size: [1, 1, 1]}
, {x: 10 ,y: -20 ,z: 20 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [1, 0,1, 1],size: [1, 1, 1]}
, {x: 10 ,y: 20 ,z: -20 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [1, 0,1, 1],size: [1, 1, 1]}
, {x: 10 ,y: 20 ,z: 20 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [1, 0,1, 1],size: [1, 1, 1]}
, {x: 10 ,y: -20 ,z: 0 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [1, 0,1, 1],size: [1, 1, 1]}
, {x: -10 ,y: -20 ,z: 0 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [1, 0,0, 1],size: [1, 1, 1]}
, {x: 10 ,y: 20 ,z: 0 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [1, 0,1, 1],size: [1, 1, 1]}
, {x: -10 ,y: 20 ,z: 0 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [1, 0,0, 1],size: [1, 1, 1]}
]
]
// x0, y0, z0, x1 y1 z1 size color, pipe radius (optional parm that can be used to make thin lines or thick pipes)
, 'TRYLine00' : ['PIN3', [ 0, 0, 0, -10, -20, -20, 1,null, 1.25], [ {x: 0 ,y: 0 ,z: 0 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [0, 0,1, 1],size: [1, 1, 1]}] ]
, 'TRYLine10' : ['PIN3', [ 0, 0, 0, -10, -20, 20, 1,null, 1.25], [ {x: 0 ,y: 0 ,z: 0 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [1, 0,0, 1],size: [1, 1, 1]}] ]
, 'TRYLine20' : ['PIN3', [ 0, 0, 0, -10, 20, -20, 1,null, 1.25], [ {x: 0 ,y: 0 ,z: 0 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [0, 0,1, 1],size: [1, 1, 1]}] ]
, 'TRYLine30' : ['PIN3', [ 0, 0, 0, -10, 20, 20, 1,null, 1.25], [ {x: 0 ,y: 0 ,z: 0 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [0, 0,1, 1],size: [1, 1, 1]}] ]
, 'TRYLine40' : ['PIN3', [ 0, 0, 0, 10, -20, -20, 1,null, 1.25], [ {x: 0 ,y: 0 ,z: 0 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [1, 0,0, 1],size: [1, 1, 1]}] ]
, 'TRYLine50' : ['PIN3', [ 0, 0, 0, 10, -20, 20, 1,null, 1.25], [ {x: 0 ,y: 0 ,z: 0 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [1, 0,1, 1],size: [1, 1, 1]}] ]
, 'TRYLine60' : ['PIN3', [ 0, 0, 0, 10, 20, -20, 1,null, 1.25], [ {x: 0 ,y: 0 ,z: 0 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [1, 0,1, 1],size: [1, 1, 1]}] ]
, 'TRYLine70' : ['PIN3', [ 0, 0, 0, 10, 20, 20, 1,null, 1.25], [ {x: 0 ,y: 0 ,z: 0 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [1, 0,1, 1],size: [1, 1, 1]}] ]
// x0,y0, z0 size, color, radius(optional)
,'TRYLsegs': ['PSG3', [0, 0, 0, 1,null, 1.25], [ // x1 y1 z1 ...
{x: -10 ,y: -20 ,z: -20 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [0, 0,1, 1],size: [1, 1, 1]}
, {x: -10 ,y: -20 ,z: 20 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [1, 0,0, 1],size: [1, 1, 1]}
, {x: -10 ,y: 20 ,z: -20 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [0, 0,1, 1],size: [1, 1, 1]}
, {x: -10 ,y: 20 ,z: 20 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [1, 0,0, 1],size: [1, 1, 1]}
, {x: 10 ,y: -20 ,z: -20 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [1, 0,1, 1],size: [1, 1, 1]}
, {x: 10 ,y: -20 ,z: 20 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [1, 0,1, 1],size: [1, 1, 1]}
, {x: 10 ,y: 20 ,z: -20 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [1, 0,1, 1],size: [1, 1, 1]}
, {x: 10 ,y: 20 ,z: 20 ,r1: {axis: 0,degrees: 0},r2: {axis: 0,degrees: 0},color: [1, 0,1, 1],size: [1, 1, 1]}
]
]
}
}
//
// The entire set of options sent to JSCad/Three.js/SVG to render and view online
//
var options ={
this_ : null
,containerElm_ : document.getElementById("viewer")
,widthDefault_ : "1600px"
,heightDefault_ : "900px"
,width_ : "1600px"
,height_ : "900px"
,heightRatio_ : 16/9
,perspective_ : 45
,drawOptions_ : { lines : false, faces : true}
,defaultColor_ : [ 0, 0, 1 ,1]
,bgColor_ : [.93,.93,.93,1]
,drawFaces_ : true
,background_ : true
,drawLines_ : false
,csgScript_ : "jscad.jscad"
,headsUpDisplay_ : null
,pointcloudName_ : null
,threeJSEnvObjs_ : null
,threeJSAnnotate_ : null
,axisxyz_ : true
,camera_ : 'persp'
,renderer_ : 'webgl'
,controls_ : 'ortho'
};
var gViewer = null;
function document_ready(){ gViewer = new OpenJSONCad.Viewer( options); };
</script>
<script id="jscad.jscad" >function main() { return makeVirtualObject(nodes['TEST_LIST'] );}</script>
</head>
<body onload="document_ready()" >
</body>
</html>