rndmc issueshttps://gitlab.cba.mit.edu/jakeread/rndmc/-/issues2018-11-20T02:39:00Zhttps://gitlab.cba.mit.edu/jakeread/rndmc/-/issues/2pasting gcode into the multiline module fails2018-11-20T02:39:00ZTina Quachpasting gcode into the multiline module failsin the lineThru function, `state.incoming.value` is treated like a string, however, it is actually an object when I paste gcode string (copied from one of the gcode files in the rndmc/files directory) fails and somehow, `state.incoming.v...in the lineThru function, `state.incoming.value` is treated like a string, however, it is actually an object when I paste gcode string (copied from one of the gcode files in the rndmc/files directory) fails and somehow, `state.incoming.value` is set to be the object (see printed output below).
### ERROR:
```
/Users/quacht/Documents/Course/htmaa/rndmc/modules/ui/multiline.js:52
var inBox = state.incoming.value.split('\n')
^
TypeError: state.incoming.value.split is not a function
at Object.lineThru [as onClick] (/Users/quacht/Documents/Course/htmaa/rndmc/modules/ui/multiline.js:52:42)
at uiRequestStateChange (/Users/quacht/Documents/Course/htmaa/rndmc/views.js:256:36)
at socketRecv (/Users/quacht/Documents/Course/htmaa/rndmc/views.js:106:13)
at WebSocket.ws.on (/Users/quacht/Documents/Course/htmaa/rndmc/views.js:53:13)
at WebSocket.emit (events.js:182:13)
at Receiver.receiverOnMessage (/Users/quacht/Documents/Course/htmaa/rndmc/node_modules/ws/lib/websocket.js:719:20)
at Receiver.emit (events.js:182:13)
at Receiver.dataMessage (/Users/quacht/Documents/Course/htmaa/rndmc/node_modules/ws/lib/receiver.js:414:14)
at Receiver.getData (/Users/quacht/Documents/Course/htmaa/rndmc/node_modules/ws/lib/receiver.js:346:17)
at Receiver.startLoop (/Users/quacht/Documents/Course/htmaa/rndmc/node_modules/ws/lib/receiver.js:133:22)
```
### MODIFIED CODE TO GET LOGGING:
```
function lineThru() {
// get all as arrays with linebreak as delimiter
var outBox = state.previously.value.split('\n')
var box = state.now.value
console.log('TINA multilinejs lineThru')
console.log(typeof(state.incoming.value))
console.log(state.incoming.value)
var inBox = state.incoming.value.split('\n')
```
### OUTPUT:
```multilinejs lineThru
object
{ type: 'multiline',
label: 'future lines',
rows: 36,
value:
'G0 Z5.0000 F100\nG0 X87.7230Y8.0230\nG1 Z0.0000 F50\nG1 X0.9540Y126.8930\nG0 Z5.0000\nG0 X0.9540Y126.8930\nG1 Z0.0000\nG1 X29.2600Y54.1250\nG1 X87.6220Y8.0230\nG1 X87.7230Y8.0230\nG0 Z5.0000\nG0 X87.7230Y8.0230\nG1 Z0.0000\nG1 X87.7320Y8.0230\nG1 X91.6956Y21.1580\nG0 Z5.0000\nG0 X91.6956Y21.1580\nG1 Z0.0000\nG1 X123.4990Y126.5520\nG1 X123.4990Y126.5606\nG0 Z5.0000\nG0 X123.4990Y126.5606\nG1 Z0.0000\nG1 X91.6956Y21.1580\nG0 Z5.0000\nG0 X91.6956Y21.1580\nG1 Z0.0000\nG1 X87.7323Y8.0228\nG0 Z5.0000\nG0 X87.7323Y8.0228\nG1 Z0.0000\nG1 X169.6749Y9.3584\nG1 X227.8618Y53.8484\nG0 Z5.0000\nG0 X227.8618Y53.8484\nG1 Z0.0000\nG1 X87.7323Y8.0228\nG0 Z5.0000\nG0 X123.4990Y126.5606\nG1 Z0.0000\nG1 X123.4997Y126.5611\nG0 Z5.0000\nG0 X123.4997Y126.5611\nG1 Z0.0000\nG1 X123.5012Y126.5600\nG0 Z5.0000\nG0 X123.5012Y126.5600\nG1 Z0.0000\nG1 X123.5000Y126.5600\nG1 X123.4997Y126.5611\nG0 Z5.0000\nG0 X123.4997Y126.5611\nG1 Z0.0000\nG1 X93.7777Y223.2278\nG0 Z5.0000\nG0 X93.7777Y223.2278\nG1 Z0.0000\nG1 X86.5717Y246.6659\nG0 Z5.0000\nG0 X86.5717Y246.6659\nG1 Z0.0000\nG1 X86.5713Y246.6656\nG0 Z5.0000\nG0 X86.5713Y246.6656\nG1 Z0.0000\nG1 X86.4979Y246.6105\nG0 Z5.0000\nG0 X86.4979Y246.6105\nG1 Z0.0000\nG1 X0.9907Y127.1050\nG0 Z5.0000\nG0 X0.9907Y127.1050\nG1 Z0.0000\nG1 X0.9906Y127.1048\nG0 Z5.0000\nG0 X0.9906Y127.1048\nG1 Z0.0000\nG1 X86.4979Y246.6105\nG0 Z5.0000\nG0 X86.4979Y246.6105\nG1 Z0.0000\nG1 X28.2465Y201.8719\nG1 X0.9907Y127.1050\nG0 Z5.0000\nG0 X0.9907Y127.1050\nG1 Z0.0000\nG1 X0.9630Y127.0220\nG1 X7.7722Y126.9995\nG0 Z5.0000\nG0 X7.7722Y126.9995\nG1 Z0.0000\nG1 X0.9630Y127.0220\nG1 X0.9350Y126.9390\nG1 X0.9540Y126.8930\nG0 Z5.0000\nG0 X7.7722Y126.9995\nG1 Z0.0000\nG1 X123.4807Y126.6170\nG0 Z5.0000\nG0 X123.4807Y126.6170\nG1 Z0.0000\nG1 X7.7722Y126.9995\nG0 Z5.0000\nG0 X123.4807Y126.6170\nG1 Z0.0000\nG1 X123.4810Y126.6170\nG0 Z5.0000\nG0 X123.4810Y126.6170\nG1 Z0.0000\nG1 X123.4990Y126.5606\nG0 Z5.0000\nG0 X123.5012Y126.5600\nG1 Z0.0000\nG1 X205.3440Y69.7019\nG0 Z5.0000\nG0 X205.3440Y69.7019\nG1 Z0.0000\nG1 X123.5100Y126.5600\nG0 Z5.0000\nG0 X123.5100Y126.5600\nG1 Z0.0000\nG1 X227.0000Y201.4800\nG0 Z5.0000\nG0 X227.0000Y201.4800\nG1 Z0.0000\nG1 X226.9900Y201.5000\nG1 X226.9018Y201.5686\nG0 Z5.0000\nG0 X226.9018Y201.5686\nG1 Z0.0000\nG1 X201.5364Y209.7327\nG0 Z5.0000\nG0 X201.5364Y209.7327\nG1 Z0.0000\nG1 X226.9000Y201.5700\nG1 X226.9018Y201.5686\nG0 Z5.0000\nG0 X226.9018Y201.5686\nG1 Z0.0000\nG1 X226.9039Y201.5680\nG1 X168.2011Y247.8725\nG0 Z5.0000\nG0 X168.2011Y247.8725\nG1 Z0.0000\nG1 X86.6730Y246.7027\nG1 X201.5364Y209.7327\nG0 Z5.0000\nG0 X201.5364Y209.7327\nG1 Z0.0000\nG1 X86.6700Y246.7000\nG1 X86.6300Y246.7000\nG1 X86.5700Y246.6700\nG0 Z5.0000\nG0 X86.5700Y246.6700\nG1 Z0.0000\nG1 X86.5713Y246.6656\nG0 Z5.0000\nG0 X86.5713Y246.6656\nG1 Z0.0000\nG1 X93.7777Y223.2278\nG0 Z5.0000\nG0 X93.7777Y223.2278\nG1 Z0.0000\nG1 X123.4807Y126.6170\nG0 Z5.0000\nG0 X123.5012Y126.5600\nG1 Z0.0000\nG1 X123.5100Y126.5600\nG0 Z5.0000\nG0 X205.3440Y69.7019\nG1 Z0.0000\nG1 X227.8979Y54.0315\nG0 Z5.0000\nG0 X227.8979Y54.0315\nG1 Z0.0000\nG1 X227.8982Y53.9686\nG0 Z5.0000\nG0 X227.8982Y53.9686\nG1 Z0.0000\nG1 X227.8982Y53.8944\nG1 X227.8892Y53.8670\nG1 X227.8618Y53.8484\nG0 Z5.0000\nG0 X227.8982Y53.9686\nG1 Z0.0000\nG1 X227.8987Y53.8944\nG1 X255.3111Y129.1221\nG1 X227.0236Y201.4114\nG0 Z5.0000\nG0 X227.0236Y201.4114\nG1 Z0.0000\nG1 X227.5750Y108.4543\nG0 Z5.0000\nG0 X227.5750Y108.4543\nG1 Z0.0000\nG1 X227.8979Y54.0332\nG0 Z5.0000\nG0 X227.8979Y54.0332\nG1 Z0.0000\nG1 X227.8979Y54.0315\nG0 Z5.0000\nG0 X227.8979Y54.0315\nG1 Z0.0000\nG1 X227.8982Y54.0312\nG0 Z5.0000\nG0 X227.8982Y54.0312\nG1 Z0.0000\nG1 X227.8982Y53.9686\nG0 Z5.0000\nG0 X227.8982Y54.0312\nG1 Z0.0000\nG1 X227.9000Y54.0300\nG1 X227.5750Y108.4543\nG0 Z5.0000\nG0 X227.5750Y108.4543\nG1 Z0.0000\nG1 X227.0200Y201.4100\nG1 X227.0000Y201.4800\nG0 Z5.0000\nG0 X205.3440Y69.7019\nG1 Z0.0000\nG1 X227.8979Y54.0332\nG0 Z5.0000\nG0 X227.8979Y54.0332\nG1 Z0.0000\nG1 X227.8987Y54.0326\nG0 Z5.0000\nG0 X227.8987Y54.0326\nG1 Z0.0000\nG1 X227.8982Y54.0312\nG0 Z5.0000\nG0 Z5.0000\nG0 X0Y0\nM05' }```https://gitlab.cba.mit.edu/jakeread/rndmc/-/issues/1trouble loading program from file in main.js2018-11-20T01:54:06ZTina Quachtrouble loading program from file in main.jshi jake, this isn't critical since i can manually load and save programs, but i thought i'd share...
When i run "node main", I get the following error message:
ERROR MESSAGE:
```
/Users/quacht/Documents/Course/htmaa/rndmc/views.js:122
...hi jake, this isn't critical since i can manually load and save programs, but i thought i'd share...
When i run "node main", I get the following error message:
ERROR MESSAGE:
```
/Users/quacht/Documents/Course/htmaa/rndmc/views.js:122
if (sckt.readyState === 1) {
^
TypeError: Cannot read property 'readyState' of null
at Object.socketSend [as send] (/Users/quacht/Documents/Course/htmaa/rndmc/views.js:122:14)
at pushState (/Users/quacht/Documents/Course/htmaa/rndmc/programs.js:173:12)
at Object.set [as isRunning] (/Users/quacht/Documents/Course/htmaa/rndmc/programs.js:133:17)
at Object.Planner.planner.init (/Users/quacht/Documents/Course/htmaa/rndmc/modules/motion/planner.js:61:25)
at Object.openProgram [as open] (/Users/quacht/Documents/Course/htmaa/rndmc/programs.js:278:17)
at Object.<anonymous> (/Users/quacht/Documents/Course/htmaa/rndmc/main.js:39:24)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
```
The last logs before the error message were
```
ADDING Multi-line Text Input-12 to new program1
ATTACHING acks to ack
ATTACHING acks to ack
ATTACHING acks to ack
ATTACHING thru to whammy
ATTACHING evt to whammy
ATTACHING req to out
ATTACHING run to out
ATTACHING trapezoid to moves
ATTACHING trapezoid to moves
ATTACHING trapezoid to moves
ATTACHING trapezoid to moves
ATTACHING req to moveComplete
```
main.js CODE:
```
//
//
// new node controller / HEAP
//
// main.js
//
//
// Jake Read at the Center for Bits and Atoms
// (c) Massachusetts Institute of Technology 2018
//
// This work may be reproduced, modified, distributed, performed, and
// displayed for any purpose, but must acknowledge the mods
// project. Copyright is retained and must be preserved. The work is
// provided as is; no warranty is provided, and users accept all
// liability.
/*
RULES:
modules are objects having inputs, outputs, and state
programs are assemblies of modules
*/
// business
const Reps = require('./reps.js')
const Programs = require('./programs.js')
// // create a new program
// var program = Programs.new('new program')
// UI
const View = require('./views.js')
View.startHttp()
View.startWs()
Programs.assignSocket(View.uiSocket)
var program = Programs.open('./programs/fourmotors-oneplanner.json')
// load modules
var input2d = Programs.loadModuleFromSource(program, './modules/input/input2d.js')
var multiline = Programs.loadModuleFromSource(program, './modules/ui/multiline.js')
var gcode = Programs.loadModuleFromSource(program, './modules/parsing/gcode.js')
var logger = Programs.loadModuleFromSource(program, './modules/util/log.js')
// connect modules
input2d.outputs.gcode.attach(gcode.inputs.lineIn)
// multiline.outputs.gcode.attach(gcode.inputs.lineIn)
// position modules
// gcode.description.position = {
// left: 100,
// top: 400
// }
View.assignProgram(program)
```