Hi Michael.

If you have a little time, given Moi 3 finalization, this is a Request for help scripting "Project" factory.

The Curve Project command "Projects a curve onto a surface or solid."

For a 2D Top View, it will also project a point on the x-axis, onto a curve, (or curves), using point direction, Inputs 3 and 4.

I have been trying very hard to script the Project factory, to get the y values of a 2d curve, using progressive x values, without very much success.

I am using the 2D graph of a curve, in Top View, where x = si, ranges from 0 to 2PI.

The curve is attached as file KappaVersusS11.3dm. (There is also a tau curve.)

_FrenetKTCurveIncompleteDraft script is also attached, (which does not crash Moi, but has "assert failed")

The BAD subroutine function attempting to use "Project" is "function EvalKappaTau( curve, si )"

(A Demo script is attached for "Rudy's Rocker": FrenetKTCurveRocker, which works with kappa and tau equations.)

(These two curves represent curvature and torsion for a particular Moebius strip centerline.)

The green kappa curve is selected by the user, so it is an objectList, and Input 1. (EDIT, FALSE statement)

The green kappa curve has only one y value for each x value.

The y values of the curve represent kappa values, the curvature of a frenet frame,

where the x value si also represents the arc length of another curve to be created.

In the Project factory, Input 0, the BaseObject, must be an ObjectList of a point.

Point (si, 0, 0) will be used to create the point object, to be projected in the vertical direction, to obtain point (si, y, 0).

This code to create the BaseObject works, per testing with modified Moi Project.js:

/code

var x = si; // x-axis value, used 3 times per evaluation.

var y = 0.0; // used twice, for point to Project, and start direction.

var y1 = 1.0; // for Project direction.

var z = 0.0;

var xPt = moi.vectorMath.createPoint( x, y, z )

var siPt;

var siPtobjList = moi.geometryDatabase.createObjectList();

var pointfactory = moi.command.createFactory( 'point' );

pointfactory.setInput( 0, xPt );

siPt = pointfactory.calculate();

moi.geometryDatabase.addObjects( siPt );

siPtobjList.addObject( siPt.item(0) ); // Object Input 0 of Project factory.

// The above block of code produces the correct ObjectList Input of Project factory, in my opinion, per testing.

\code

For the direction,

The basept, or start point is: var basept = moi.vectorMath.createPoint( si, 0.0, 0.0 ); Input 3.

>>> This does not seem to work.

The endpt or endDir is: var endDir = moi.vectorMath.createPoint( si, 1.0, 0.0 ); Input 4.

>>> This does not seem to work.

Input 2 is Mode, and is a string 'direction', or is it direction?

>>> Not sure if this is correct.

Input 5 involves 'deleteinputs', (?)

Input 6 involves cplane, and so should not be needed. (?)

After the Project factory produces (some type of) point, ( si, y, 0.0 ),

I need to extract the y value, as a number, a value for kappa. (Similarly for tau.)

If I cannot get the Project scripting to work, I can probably use line segments, extend, and intersection.

I'll still have to extract the y value from the intersection point.

Thank you,

Brian

EDIT: bad scripts deleted, will post corrected updates, hopefully.