PointPicker scripting
Hi Michael,
I have been studying hard about pointpicker and frames and cplanes and world and local coordinates, and CPlane.evaluate, distancex, etc.
The MoI API of Dave Morril shows 26 properties, and 34 methods for pointpicker WaitableObject.
MoI4 added about 4 properties, and about 1 method.
*****My question is how to create cPlane2 from cPlane1?*****
***** probably using pointpicker method .setBasePt(newBasePt);*****
Remark: cPlane1 is not a CPlane, it is actually a ptframe. 2D or 3d or pseudo 2D ???
also, cPlane2 is actually a ptframe.
cPlane2 will be used as the Frame for a rotate factory.
cPlane2 has base point a small X distance away from base point of cPlane1.
cPlane2 is to have the same "grid plane" as cPlane1, (or slightly moved???)
Note: "grid plane" is different in Top, Front, and Right Views, but shows up as local (X,Y) axes in cPlane1.
code:
function DoElastica()
{
// User selects a point in any one of MoI's seven Views.
var pointpicker = moi.ui.createPointPicker();
if ( !GetPoint( pointpicker ) ) return;
var refPt = pointpicker.pt; // World coordinates. (refPt is not used)
var cPlane1 = pointpicker.ptframe; // GOOD code, cPlane1 works for Mirror.
// var vpName = moi.ui.getActiveViewport().name;
// moi.ui.alert( 'viewportName = ' + vpName );
// ...More code here...
var curvefactory = Update(cPlane1, pointpicker); // Call Update function.
// More code in the Update(cPlane1, pointpicker) function:
// In a loop, Calculate multiple 2d points using mathematics. (z = 0)
var pt = cPlane1.evaluate( x, y, z ); // World coordinates.
// locallastPt would = above (x,y,z) in local coordinates.
curvefactory.createInput( 'point' );
curvefactory.setInput( curvefactory.numInputs - 1, pt );
} //End of Loop.
var lastPt = pt; // World coordinates.
curvefactory.update(); // Probably delete this.
// initialCurve is the initial halfLobe curve.
var initialCurve = curvefactory.calculate();
**********What is the correct code for the next code line???*********
var cPlane2 = pointpicker.ptframe.setBasePt(lastPt); //This code throws error, Not a constructor.<<<<<<<<<<<
// Maybe an alert message: 'New Base Pt' = pointpicker.ptframe.relocatedBasePt
// Or should the setBasePt point be in local coordinates???
Thank you,
-Brian