
Returns a complete data description of a nurbs surface trim. A
trim is a nurbs curve list that is projected on a nurbs surface.
The data is returned in a 1-dimension array and is ordered the same
as for the NurbsSurface.GetTrim method output
arguments.
Note: This method must be used with scripting languages that don't
support arguments passed by reference such as JScript and
PerlScript. For more information on getting output arguments, see
About Output Argument
Arrays.
oArray = NurbsSurface.GetTrim2( TrimIndex, [NurbsFormat] ); |
Array of values ordered as IsBoundary, ProjectionType, Count, ControlPoints, NbControlPoints, Knots, NbKnots, Closed, Degree, Parameterization
| Parameter | Type | Description |
|---|---|---|
| TrimIndex | Long | Specifies which trim must be described. |
| NurbsFormat | siNurbsFormat | Specifies how the data is formatted.
Default Value: siSINurbs |
// JScript example : shows how to retrieve the output arguments returned by NurbsSurface.GetTrim2
// Create a sphere with some trims first
CreatePrim("Sphere", "NurbsSurface", null, null);
CreatePrim("Square", "NurbsCurve", null, null);
Scale(null, -0.325581395348837, 1, 1, siRelative, siLocal, siObj, siXYZ, null, null, null, null, null, null, null, 0);
Scale(null, 1, 0.732558139534884, 1, siRelative, siLocal, siObj, siXYZ, null, null, null, null, null, null, null, 0);
SelectObj("sphere", null, true);
ApplyTopoOp("TrimByProjection", "sphere;square", 3, siPersistentOperation, null);
// get the trimmed surface
var surfs = Application.Selection(0).ActivePrimitive.Geometry.Surfaces;
// get the first trim parameters and convert VB array to JScript array
var vbArgs = new VBArray(surfs(0).GetTrim2( 0, siSINurbs ));
var args = vbArgs.toArray();
// get the bondary flag of curves
LogMessage("trim is boundary?: " + args[0] );
// get the projection type
LogMessage("projection type: " + args[1] );
// get the number of curves
LogMessage("number of curves: " + args[2] );
// get the number of control points per curve
var vbArg4 = new VBArray(args[4]);
var ncpoints = vbArg4.toArray();
for (i = 0; i < args[2]; i++)
{
LogMessage("number of control points for curve " + i + ": " + ncpoints[i] );
}
// get the control points
var vbArg3 = new VBArray(args[3]);
var cpts = vbArg3.toArray();
for ( i=0; i<ncpoints.length; i++ )
{
for ( j=0, k=0; k<ncpoints[i]; k++, j+=4 )
{
LogMessage("crv" + i + "[" + k + "]: " + cpts[j] + ", " + cpts[j+1] + ", " + cpts[j+2] + ", " + cpts[j+3] );
}
}
// get the number knots per curve
var vbArg6 = new VBArray(args[6]);
var nknots = vbArg6.toArray();
for (i = 0; i < nknots.length; i++)
{
LogMessage("number of knots for curve " + i + ": " + nknots[i] );
}
// get the knots
var vbArg5 = new VBArray(args[5]);
var knots = vbArg5.toArray();
for ( j=0; j<nknots.length; j++)
{
for (i = 0; i < nknots[j]; i++)
{
LogMessage("crv" + j + ": " + "knots" + i + ": " + knots[i] );
}
}
// get nurbs curves closeness state
var vbArg7 = new VBArray(args[7]);
var closes = vbArg7.toArray();
for (i = 0; i < closes.length; i++)
{
LogMessage("curve" + i + " closeness: " + closes[i] );
}
// get nurbs degree
var vbArg8 = new VBArray(args[8]);
var degrees = vbArg8.toArray();
for (i = 0; i < degrees.length; i++)
{
LogMessage("curve" + i + " degree: " + degrees[i] );
}
// get nurbs parameterization factor
var vbArg9 = new VBArray(args[9]);
var params = vbArg9.toArray();
for (i = 0; i < params.length; i++)
{
LogMessage("curve" + i + " parameterization: " + params[i] );
}
|