I hope someone can shed light on this. I'm trying to create curves using the geometry.set method. To help me understand how this method functions I'm looking at what is returned with the geometry.get2 method in jscript.
most everything looks fine except the array that returns the 'knot' information.
What I get is extra blank values at the end of the array. I'm not sure what these values are. If I leave the knot array as is and generate curves the geometry.set method works fine. If I strip the blank values off the array I get an 'unexpected error' message. What I'd eventually like to do is feed in my own controlPoint and knot info to geometry.set but I guess I need to understand what the blank values in the array mean.
Here is a script that demonstrates what I'm talking about. It shows the knot count for both curves in the text object then displays the knot array with it's length. If you uncomment the * display knot info ** it will list the knot info per curve.
/////////////////begin
var oRoot = Application.ActiveProject.ActiveScene.Root;
var oText = oRoot.AddGeometry( "Text", "NurbsCurve" );
oText.text = "b";
var vbArgs = new VBArray(oText.ActivePrimitive.Geometry.Get2( siSINurbs ));
var args = vbArgs.toArray();
// Number of knots per curve
var vbArg7 = new VBArray(args[4]);
var nknots = vbArg7.toArray();
for (i = 0; i < nknots.length; i++)
{
LogMessage("number of knots for curve " + i + ": " + nknots[i] );
}
// Knots
var vbArg2 = new VBArray(args[3]);
var knots = vbArg2.toArray();
/* display knot info *****************
for ( j=0; j<knots.length; j++)
{
for (i = 0; i < nknots[j]; i++)
{
LogMessage("crv" + j + ": " + "knots" + i + ": " + knots[i]);
}
}
*/
logmessage("knots = " + knots + " " + knots.length);
///////////////// end