From: Barry-H
Hi,
I'm working on a Globoid worm & wheel using the nodeditor.
To check if the worm & wheel are not colliding I made a animation nod file
that checks by doing a boolean operation every step of the animation.
It would be better if I could log the steps and boolean results rather than manually checking every step.
is it possible to record and log boolean event with the nodeditor.
Cheers
Barry
Image Attachments:
Animation.gif
From: wayne hill (WAYNEHILL5202)
Hi Barry,
This is what I use to record variables to a log within the Node Editor. It writes to a file, but is not accessible until exiting the node editor.
Wayne
code:
datapop = moi.filesystem.openFileStream('c:\\temp\\datapop.txt', 'w');
// Usage;
for (var i = 0; i < 10; i++) {
datapop.writeLine("Title " + i);
}
;
// Exit node editor to view results.
From: Barry-H
Hi Wayne,
thanks for the code but how do I implement it.
Cheers
Barry
From: wayne hill (WAYNEHILL5202)
Hi Barry,
Create or verify this directory exists on your PC:
'c:\temp'
Here is a simple node to record the XYZ values of points.
Save this file as '_PointDetails.js' in the ext file of the node editor.
Start the node editor and load the PointDetails node that was just registered.
Attach a node with a point array output.
Run the node. (No output node required.)
Exit the node editor and exit MoI3d.
Look in the directory for the file 'c:\temp\datapop.txt'. It should be populated with the points detail.
Wayne
code:
(function () {
var datapop = moi.filesystem.openFileStream('c:\\temp\\datapop.txt', 'w');
function PointDetails() {
this.boxcolor = "#F05";
this.addInput("Pts", "pointarray");
this.addOutput("", "pointarray");
}
PointDetails.title = "PointDetails";
PointDetails.prototype.onExecute = function () {
if (!this.isInputConnected(0)) {
this.local.errMsg = 'No Data Connection!';
this.boxcolor = "#F05"
return;
};
this.boxcolor = "#0F5"
var ptArray = new pointArray(false);
var i = 0,
pt = 0,
inp = this.getInputData(0, new pointArray());
for (i = 0; i < inp.getLength(); i++) {
pt = inp.getElement(i);
x1 = pt.data[0];
y1 = pt.data[1];
z1 = pt.data[2];
datapop.writeLine("X " + x1 +" Y " + y1 +" Z " + z1);
ptArray.push(x1, y1, z1, 0, 0, 0, 1);
}
this.setOutputData(0, ptArray);
}
LiteGraph.registerNodeType("WidgetSample/PointDetails", PointDetails)
})();
Attachments:
_PointDetails.js