Nodeditor Gears
All  1-3  4

Previous
 From:  wayne hill (WAYNEHILL5202)
11007.4 In reply to 11007.3 
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:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages: All  1-3  4