Thank you very much Michael, it's exactly what i wanted.
Here's my code :
code:
function extractCurveSharpControlPoints() {
var gd = moi.geometryDatabase;
var obj = gd.getObjects(); // get all the objs
var selCurves = gd.getSelectedObjects().getCurves(); // get all the selected curves
if (selCurves.numStandaloneCurves != 1) {
moi.UI.alert("Select alone Stand Alone Curve!");
return;
}
// 1 - deselect everything and turn off all control points
obj.setProperty('selected', 0);
obj.setProperty('showPoints', 0);
var factory = moi.command.createFactory( 'fillet' );
factory.setInput( 0, selCurves );
// 2 - get corner points
factory.generateVertices();
var points = factory.getCreatedObjects();
factory.cancel();
// 3 - add the points to the geometry database
gd.addObjects(points);
// 4 - select the points
points.setProperty('selected', 1);
}
extractCurveSharpControlPoints();
When possible i will integrate this code into the other code i want to write.
Thanks again!!!
P.S. I noticed that putting this code in a .js file copied into "script" folder, the job is done, but at the end i need to press "escape" key
in order to get the viewports reactive to the further user selection.
Instead, if I put this code into "commands" folder ALL is ok.
Marco (mkdm).
|