Nodebundle for playing with nodes

 From:  Karsten (KMRQUS)
7777.1261 In reply to 7777.1242 
Hello James,
please try this code. It seems there is sometimes a timing problem with the copy/paste stuff. Very untested.
code:
// extractPts
 function extractPts()
 {
 this.addInput("In","objectlist");
 this.addOutput("Out","objectlist");
this.addOutput("ptarray", "pointarray");
 }

 extractPts.title = "extractPts";
 extractPts.desc = "extractPts";

 extractPts.prototype.onExecute = function()
 {
 var inObj = this.getInputData(0, moi.geometryDatabase.createObjectList());
 var output = moi.geometryDatabase.createObjectList();
 var selPts = moi.geometryDatabase.createObjectList();
    var originXYZ = moi.VectorMath.createPoint(0, 0, 0);
var temp = moi.geometryDatabase.createObjectList();
	         var pts = new pointArray(false);
//////
	 moi.geometryDatabase.selectAll();
	var existings=moi.geometryDatabase.getSelectedObjects(); //Locking the database objects
	 moi.geometryDatabase.deselectAll();
////////
	 if (inObj.length > 0 )
 {  var tempname=getUID(6);
for(var i=0;i<inObj.length;i++){temp.addObject(inObj.item(i));temp.item(i).name=tempname;};
moi.geometryDatabase.addObjects(temp);
temp.setProperty('showPoints', 1);
moi.geometryDatabase.selectAll();
temp.setProperty('selected', 0);
existings.setProperty('selected', 0);
 moi.geometryDatabase.copyToClipboardCommand(temp); 
moi.geometryDatabase.pasteFromClipboard();
//setTimeout( doNothing, 500);
 selPts=moi.geometryDatabase.getSelectedObjects();
for(var i=0;i<selPts.length;i++)pts.pushPoint(selPts.item(i).pt);
if(selPts.length>0)output = factory('copy',selPts,originXYZ,originXYZ,true);
 moi.geometryDatabase.selectNamed(tempname);
        temp=moi.geometryDatabase.getSelectedObjects();
	moi.geometryDatabase.deselectAll();
        var delfac = moi.command.createFactory( 'delete' );
	delfac.setInput( 0, temp );
	delfac.commit();
	delfac.cancel();
	existings=moi.geometryDatabase.createObjectList();
 } 
 this.setOutputData(0, output);
this.setOutputData(1, pts);
 }
 LiteGraph.registerNodeType("Objects2/extractPts", extractPts);


Have a nice day
Karsten

p.s.: For V4 Michael will give us some new features in the API that will make a lot of things easier.

EDITED: 25 Oct 2018 by KMRQUS