w-mesh-tecplot 1.0.9 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/index.html CHANGED
@@ -29,7 +29,7 @@
29
29
  <nav >
30
30
 
31
31
 
32
- <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#WMeshTecplot">WMeshTecplot</a></li><li><a href="global.html#readTecplot">readTecplot</a></li><li><a href="global.html#writeTecplot">writeTecplot</a></li></ul>
32
+ <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#WMeshTecplot">WMeshTecplot</a></li><li><a href="global.html#convertColumn">convertColumn</a></li><li><a href="global.html#convertLay">convertLay</a></li><li><a href="global.html#eachSliceValue">eachSliceValue</a></li><li><a href="global.html#execExportPng">execExportPng</a></li><li><a href="global.html#parseSliceData">parseSliceData</a></li><li><a href="global.html#parseViewData">parseViewData</a></li><li><a href="global.html#readTecplot">readTecplot</a></li><li><a href="global.html#writeTecplot">writeTecplot</a></li></ul>
33
33
 
34
34
  </nav>
35
35
 
@@ -71,7 +71,7 @@
71
71
  <br class="clear">
72
72
 
73
73
  <footer>
74
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Tue Oct 07 2025 10:57:17 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
74
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Thu Jul 02 2026 17:41:31 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
75
75
  </footer>
76
76
 
77
77
  <script>prettyPrint();</script>
@@ -0,0 +1,173 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+
5
+ <meta charset="utf-8">
6
+ <title>parseSliceData.mjs - Documentation</title>
7
+
8
+
9
+ <script src="scripts/prettify/prettify.js"></script>
10
+ <script src="scripts/prettify/lang-css.js"></script>
11
+ <!--[if lt IE 9]>
12
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
13
+ <![endif]-->
14
+ <link type="text/css" rel="stylesheet" href="styles/prettify.css">
15
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
16
+ <script src="scripts/nav.js" defer></script>
17
+
18
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
19
+ </head>
20
+ <body>
21
+
22
+ <input type="checkbox" id="nav-trigger" class="nav-trigger" />
23
+ <label for="nav-trigger" class="navicon-button x">
24
+ <div class="navicon"></div>
25
+ </label>
26
+
27
+ <label for="nav-trigger" class="overlay"></label>
28
+
29
+ <nav >
30
+
31
+
32
+ <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#WMeshTecplot">WMeshTecplot</a></li><li><a href="global.html#convertColumn">convertColumn</a></li><li><a href="global.html#convertLay">convertLay</a></li><li><a href="global.html#eachSliceValue">eachSliceValue</a></li><li><a href="global.html#execExportPng">execExportPng</a></li><li><a href="global.html#parseSliceData">parseSliceData</a></li><li><a href="global.html#parseViewData">parseViewData</a></li><li><a href="global.html#readTecplot">readTecplot</a></li><li><a href="global.html#writeTecplot">writeTecplot</a></li></ul>
33
+
34
+ </nav>
35
+
36
+ <div id="main">
37
+
38
+ <h1 class="page-title">parseSliceData.mjs</h1>
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+ <section>
47
+ <article>
48
+ <pre class="prettyprint source linenums"><code>import fs from 'fs'
49
+ import get from 'lodash-es/get.js'
50
+ import each from 'lodash-es/each.js'
51
+ import sep from 'wsemi/src/sep.mjs'
52
+
53
+
54
+ /**
55
+ * 走訪Tecplot的lay內slice區段之每個可移植數值(切片起訖點座標與中間切片數),對每個值呼叫回調函數
56
+ *
57
+ * @param {Array} vs 輸入lay逐行字串陣列
58
+ * @param {Function} fun 輸入回調函數,簽章為fun(key, k, val),key如'SLICE2_START_X'或'SLICE2_NUMINTER',k為該數值所在行索引,val為trim後字串
59
+ * @example
60
+ *
61
+ * eachSliceValue(vs, (key, k, val) => { ... })
62
+ *
63
+ */
64
+ //座標塊結構: keyword在k, { 在k+1, X/Y/Z在k+2/k+3/k+4 (與parseViewData之prXYZ同構)
65
+ let eachSliceValue = (vs, fun) => {
66
+
67
+ let g = 0
68
+ each(vs, (v, k) => {
69
+
70
+ //切片群組起始, 記住組號
71
+ let m = v.match(/^\$!SLICEATTRIBUTES\s+(\d+)/)
72
+ if (m) {
73
+ g = parseInt(m[1], 10)
74
+ return
75
+ }
76
+
77
+ //離開slice區段
78
+ if (v.indexOf('$!SLICELAYERS') >= 0) {
79
+ g = 0
80
+ return
81
+ }
82
+ if (g === 0) {
83
+ return
84
+ }
85
+
86
+ let t = v.trim()
87
+
88
+ //三種座標塊(PRIMARY/START/END)
89
+ let pos = ''
90
+ if (t === 'PRIMARYPOSITION') {
91
+ pos = 'PRIMARY'
92
+ }
93
+ else if (t === 'STARTPOSITION') {
94
+ pos = 'START'
95
+ }
96
+ else if (t === 'ENDPOSITION') {
97
+ pos = 'END'
98
+ }
99
+ if (pos !== '') {
100
+ each(['X', 'Y', 'Z'], (ax, i) => {
101
+ let li = k + 2 + i
102
+ let lv = get(vs, li, '')
103
+ if (lv.indexOf(`${ax} = `) >= 0) {
104
+ fun(`SLICE${g}_${pos}_${ax}`, li, get(sep(lv, '='), 1, '').trim())
105
+ }
106
+ })
107
+ return
108
+ }
109
+
110
+ //中間切片數
111
+ if (t.indexOf('NUMINTERMEDIATESLICES = ') === 0) {
112
+ fun(`SLICE${g}_NUMINTER`, k, get(sep(v, '='), 1, '').trim())
113
+
114
+ }
115
+
116
+ })
117
+
118
+ }
119
+
120
+
121
+ /**
122
+ * 解析Tecplot的lay,提取slice切片起訖點座標與中間切片數
123
+ *
124
+ * 容錯設計:僅回傳實際解析到的鍵,來源lay未設定者不納入(與parseViewData之嚴格throw不同)。
125
+ *
126
+ * @param {String} fpLay 輸入Tecplot的lay檔案位置字串
127
+ * @return {Object} 回傳切片設定物件,各值為trim後字串,鍵如SLICE2_START_X、SLICE2_NUMINTER
128
+ * @example
129
+ *
130
+ * let kpSlice = parseSliceData('./ttt.lay')
131
+ * // => { SLICE1_START_X: '251615.668889', ..., SLICE2_NUMINTER: '3' }
132
+ *
133
+ */
134
+ let parseSliceData = (fpLay) => {
135
+ let c = fs.readFileSync(fpLay, 'utf8')
136
+ let vs = sep(c, '\n')
137
+ let r = {}
138
+ eachSliceValue(vs, (key, k, val) => {
139
+ r[key] = val
140
+ })
141
+ return r
142
+ }
143
+
144
+
145
+ export {
146
+ eachSliceValue
147
+ }
148
+ export default parseSliceData
149
+ </code></pre>
150
+ </article>
151
+ </section>
152
+
153
+
154
+
155
+
156
+
157
+
158
+ </div>
159
+
160
+ <br class="clear">
161
+
162
+ <footer>
163
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Thu Jul 02 2026 17:41:30 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
164
+ </footer>
165
+
166
+ <script>prettyPrint();</script>
167
+ <script src="scripts/polyfill.js"></script>
168
+ <script src="scripts/linenumber.js"></script>
169
+
170
+
171
+
172
+ </body>
173
+ </html>
@@ -0,0 +1,328 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+
5
+ <meta charset="utf-8">
6
+ <title>parseViewData.mjs - Documentation</title>
7
+
8
+
9
+ <script src="scripts/prettify/prettify.js"></script>
10
+ <script src="scripts/prettify/lang-css.js"></script>
11
+ <!--[if lt IE 9]>
12
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
13
+ <![endif]-->
14
+ <link type="text/css" rel="stylesheet" href="styles/prettify.css">
15
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
16
+ <script src="scripts/nav.js" defer></script>
17
+
18
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
19
+ </head>
20
+ <body>
21
+
22
+ <input type="checkbox" id="nav-trigger" class="nav-trigger" />
23
+ <label for="nav-trigger" class="navicon-button x">
24
+ <div class="navicon"></div>
25
+ </label>
26
+
27
+ <label for="nav-trigger" class="overlay"></label>
28
+
29
+ <nav >
30
+
31
+
32
+ <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#WMeshTecplot">WMeshTecplot</a></li><li><a href="global.html#convertColumn">convertColumn</a></li><li><a href="global.html#convertLay">convertLay</a></li><li><a href="global.html#eachSliceValue">eachSliceValue</a></li><li><a href="global.html#execExportPng">execExportPng</a></li><li><a href="global.html#parseSliceData">parseSliceData</a></li><li><a href="global.html#parseViewData">parseViewData</a></li><li><a href="global.html#readTecplot">readTecplot</a></li><li><a href="global.html#writeTecplot">writeTecplot</a></li></ul>
33
+
34
+ </nav>
35
+
36
+ <div id="main">
37
+
38
+ <h1 class="page-title">parseViewData.mjs</h1>
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+ <section>
47
+ <article>
48
+ <pre class="prettyprint source linenums"><code>import fs from 'fs'
49
+ import get from 'lodash-es/get.js'
50
+ import each from 'lodash-es/each.js'
51
+ import isestr from 'wsemi/src/isestr.mjs'
52
+ import isnum from 'wsemi/src/isnum.mjs'
53
+ import sep from 'wsemi/src/sep.mjs'
54
+ import strleft from 'wsemi/src/strleft.mjs'
55
+
56
+
57
+ /**
58
+ * 解析Tecplot的lay,提取展示相關之視角與模型設定
59
+ *
60
+ * 提取三軸範圍與網格間距(XDETAIL/YDETAIL/ZDETAIL之RANGEMIN、RANGEMAX、GRSPACING)、旋轉原點(ROTATEORIGIN_X/Y/Z)、視角位置(VIEWERPOSITION_X/Y/Z)、視角角度(PSIANGLE、THETAANGLE、ALPHAANGLE)與視距(VIEWWIDTH)共19項;任一欄位非數字即throw。
61
+ *
62
+ * @param {String} fpLay 輸入Tecplot的lay檔案位置字串
63
+ * @return {Object} 回傳視角設定物件,各值為等號後含前導空白之原字串,鍵含XDETAIL_RANGEMIN至VIEWWIDTH共19項
64
+ * @example
65
+ *
66
+ * let kp = parseViewData('./ttt.lay')
67
+ * // => { XDETAIL_RANGEMIN: ' 159817.886...', ..., VIEWWIDTH: ' 71875.7' }
68
+ *
69
+ */
70
+ let parseViewData = (fpLay) => {
71
+
72
+ let c = fs.readFileSync(fpLay, 'utf8')
73
+ // console.log('c', c)
74
+
75
+ let vs = sep(c, '\n')
76
+
77
+ // 1212 XDETAIL
78
+ // > RANGEMIN
79
+ // > RANGEMAX
80
+ // RANGEMIN = 159817.88602534533
81
+ // RANGEMAX = 205356.40393181637
82
+ let XDETAIL_RANGEMIN = ''
83
+ let XDETAIL_RANGEMAX = ''
84
+ let XDETAIL_GRSPACING = ''
85
+
86
+ // 1229 YDETAIL
87
+ // > RANGEMIN
88
+ // > RANGEMAX
89
+ // RANGEMIN = 2574735.1261037174
90
+ // RANGEMAX = 2616753.0523926793
91
+ let YDETAIL_RANGEMIN = ''
92
+ let YDETAIL_RANGEMAX = ''
93
+ let YDETAIL_GRSPACING = ''
94
+
95
+ // 1246 ZDETAIL
96
+ // > RANGEMIN
97
+ // > RANGEMAX
98
+ // > GRSPACING
99
+ // RANGEMIN = -97.900000000000006
100
+ // RANGEMAX = 141.90000000000001
101
+ // GRSPACING = 200
102
+ let ZDETAIL_RANGEMIN = ''
103
+ let ZDETAIL_RANGEMAX = ''
104
+ let ZDETAIL_GRSPACING = ''
105
+
106
+ // 1817 ROTATEORIGIN
107
+ // > X
108
+ // > Y
109
+ // > Z
110
+ // X = 182587.1449785809
111
+ // Y = 2595744.089248198
112
+ // Z = 22
113
+ let ROTATEORIGIN_X = ''
114
+ let ROTATEORIGIN_Y = ''
115
+ let ROTATEORIGIN_Z = ''
116
+
117
+ // 1845 VIEWERPOSITION
118
+ // > X
119
+ // > Y
120
+ // > Z
121
+ // X = 270910.659136992
122
+ // Y = 2355777.253922889
123
+ // Z = 8604.826640145473
124
+ let VIEWERPOSITION_X = ''
125
+ let VIEWERPOSITION_Y = ''
126
+ let VIEWERPOSITION_Z = ''
127
+
128
+ // PSIANGLE = 60.2371
129
+ let PSIANGLE = ''
130
+
131
+ // THETAANGLE = -24.4741
132
+ let THETAANGLE = ''
133
+
134
+ // ALPHAANGLE = -1.00689E-020
135
+ let ALPHAANGLE = ''
136
+
137
+ // 1851 VIEWWIDTH
138
+ // VIEWWIDTH = 71875.7
139
+ let VIEWWIDTH = ''
140
+
141
+ let prMinMaxSpac = (vs, k) => {
142
+ let cmin = ''
143
+ let cmax = ''
144
+ let cspac = ''
145
+ //下2行須為RANGEMIN, 下3行須為RANGEMAX, 下4行須為GRSPACING
146
+ let l2 = get(vs, k + 2, '')
147
+ let l3 = get(vs, k + 3, '')
148
+ let l4 = get(vs, k + 4, '')
149
+ let b2 = l2.indexOf('RANGEMIN = ') >= 0
150
+ let b3 = l3.indexOf('RANGEMAX = ') >= 0
151
+ let b4 = l4.indexOf('GRSPACING = ') >= 0
152
+ if (b2 &amp;&amp; b3 &amp;&amp; b4) {
153
+ let ss2 = sep(l2, '=')
154
+ let ss3 = sep(l3, '=')
155
+ let ss4 = sep(l4, '=')
156
+ cmin = get(ss2, 1, '')
157
+ cmax = get(ss3, 1, '')
158
+ cspac = get(ss4, 1, '')
159
+ }
160
+ return {
161
+ b: isestr(cmin) &amp;&amp; isestr(cmax) &amp;&amp; isestr(cspac),
162
+ cmin,
163
+ cmax,
164
+ cspac,
165
+ }
166
+ }
167
+
168
+ let prXYZ = (vs, k) => {
169
+ let cx = ''
170
+ let cy = ''
171
+ let cz = ''
172
+ //下2行須為X, 下3行須為Y, 下4行須為Z
173
+ let l2 = get(vs, k + 2, '')
174
+ let l3 = get(vs, k + 3, '')
175
+ let l4 = get(vs, k + 4, '')
176
+ let b2 = l2.indexOf('X = ') >= 0
177
+ let b3 = l3.indexOf('Y = ') >= 0
178
+ let b4 = l4.indexOf('Z = ') >= 0
179
+ if (b2 &amp;&amp; b3 &amp;&amp; b4) {
180
+ let ss2 = sep(l2, '=')
181
+ let ss3 = sep(l3, '=')
182
+ let ss4 = sep(l4, '=')
183
+ cx = get(ss2, 1, '')
184
+ cy = get(ss3, 1, '')
185
+ cz = get(ss4, 1, '')
186
+ }
187
+ return {
188
+ b: isestr(cx) &amp;&amp; isestr(cy) &amp;&amp; isestr(cz),
189
+ cx,
190
+ cy,
191
+ cz,
192
+ }
193
+ }
194
+
195
+ each(vs, (v, k) => {
196
+ // console.log(k, v)
197
+
198
+ if (v === 'XDETAIL') {
199
+ let r = prMinMaxSpac(vs, k)
200
+ if (r.b) {
201
+ XDETAIL_RANGEMIN = r.cmin
202
+ XDETAIL_RANGEMAX = r.cmax
203
+ XDETAIL_GRSPACING = r.cspac
204
+ }
205
+ }
206
+
207
+ if (v === 'YDETAIL') {
208
+ let r = prMinMaxSpac(vs, k)
209
+ if (r.b) {
210
+ YDETAIL_RANGEMIN = r.cmin
211
+ YDETAIL_RANGEMAX = r.cmax
212
+ YDETAIL_GRSPACING = r.cspac
213
+ }
214
+ }
215
+
216
+ if (v === 'ZDETAIL') {
217
+ let r = prMinMaxSpac(vs, k)
218
+ if (r.b) {
219
+ ZDETAIL_RANGEMIN = r.cmin
220
+ ZDETAIL_RANGEMAX = r.cmax
221
+ ZDETAIL_GRSPACING = r.cspac
222
+ }
223
+ }
224
+
225
+ if (v === 'ROTATEORIGIN') {
226
+ let r = prXYZ(vs, k)
227
+ if (r.b) {
228
+ ROTATEORIGIN_X = r.cx
229
+ ROTATEORIGIN_Y = r.cy
230
+ ROTATEORIGIN_Z = r.cz
231
+ // console.log('ROTATEORIGIN_X', ROTATEORIGIN_X)
232
+ // console.log('ROTATEORIGIN_Y', ROTATEORIGIN_Y)
233
+ // console.log('ROTATEORIGIN_Z', ROTATEORIGIN_Z)
234
+ }
235
+ }
236
+
237
+ if (v === 'VIEWERPOSITION') {
238
+ let r = prXYZ(vs, k)
239
+ if (r.b) {
240
+ VIEWERPOSITION_X = r.cx
241
+ VIEWERPOSITION_Y = r.cy
242
+ VIEWERPOSITION_Z = r.cz
243
+ // console.log('VIEWERPOSITION_X', VIEWERPOSITION_X)
244
+ // console.log('VIEWERPOSITION_Y', VIEWERPOSITION_Y)
245
+ // console.log('VIEWERPOSITION_Z', VIEWERPOSITION_Z)
246
+ }
247
+ }
248
+
249
+ if (strleft(v, 8) === 'PSIANGLE') {
250
+ let ss = sep(v, '=')
251
+ PSIANGLE = get(ss, 1, '')
252
+ }
253
+
254
+ if (strleft(v, 10) === 'THETAANGLE') {
255
+ let ss = sep(v, '=')
256
+ THETAANGLE = get(ss, 1, '')
257
+ }
258
+
259
+ if (strleft(v, 10) === 'ALPHAANGLE') {
260
+ let ss = sep(v, '=')
261
+ ALPHAANGLE = get(ss, 1, '')
262
+ }
263
+
264
+ if (strleft(v, 9) === 'VIEWWIDTH') {
265
+ let ss = sep(v, '=')
266
+ VIEWWIDTH = get(ss, 1, '')
267
+ }
268
+
269
+ })
270
+
271
+ let r = {
272
+ XDETAIL_RANGEMIN,
273
+ XDETAIL_RANGEMAX,
274
+ XDETAIL_GRSPACING,
275
+ YDETAIL_RANGEMIN,
276
+ YDETAIL_RANGEMAX,
277
+ YDETAIL_GRSPACING,
278
+ ZDETAIL_RANGEMIN,
279
+ ZDETAIL_RANGEMAX,
280
+ ZDETAIL_GRSPACING,
281
+ ROTATEORIGIN_X,
282
+ ROTATEORIGIN_Y,
283
+ ROTATEORIGIN_Z,
284
+ PSIANGLE,
285
+ THETAANGLE,
286
+ ALPHAANGLE,
287
+ VIEWERPOSITION_X,
288
+ VIEWERPOSITION_Y,
289
+ VIEWERPOSITION_Z,
290
+ VIEWWIDTH,
291
+ }
292
+
293
+ each(r, (v, k) => {
294
+ if (!isnum(v)) {
295
+ throw new Error(`invalid ${k}[${v}]`)
296
+ }
297
+ })
298
+
299
+ return r
300
+ }
301
+
302
+
303
+ export default parseViewData
304
+ </code></pre>
305
+ </article>
306
+ </section>
307
+
308
+
309
+
310
+
311
+
312
+
313
+ </div>
314
+
315
+ <br class="clear">
316
+
317
+ <footer>
318
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Thu Jul 02 2026 17:41:30 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
319
+ </footer>
320
+
321
+ <script>prettyPrint();</script>
322
+ <script src="scripts/polyfill.js"></script>
323
+ <script src="scripts/linenumber.js"></script>
324
+
325
+
326
+
327
+ </body>
328
+ </html>
package/g.read.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  //尚待開發
2
2
 
3
- //node --no-warnings --max-old-space-size=120000 g.read.mjs
3
+ //node --max-old-space-size=120000 g.read.mjs
4
4
 
package/g.write.mjs CHANGED
@@ -24,4 +24,4 @@ wmt.writeTecplot(m, fpOut)
24
24
  console.log(err)
25
25
  })
26
26
 
27
- //node --no-warnings --max-old-space-size=120000 g.write.mjs
27
+ //node --max-old-space-size=120000 g.write.mjs
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "w-mesh-tecplot",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "main": "dist/w-mesh-tecplot.umd.js",
5
5
  "dependencies": {
6
- "lodash-es": "^4.17.21",
7
- "wsemi": "^1.8.22"
6
+ "lodash-es": "^4.18.1",
7
+ "wsemi": "^1.8.62"
8
8
  },
9
9
  "devDependencies": {
10
- "w-package-tools": "^1.1.2"
10
+ "w-package-tools": "^1.1.10"
11
11
  },
12
12
  "scripts": {
13
13
  "test": "mocha --parallel --timeout 60000",