/*
SEGMENTS A CURVE FROM KNOT TO KNOT
*/
var oSel = Application.Selection(0);
if(oSel.Type != "crvlist")
{
fTrace("Select a curve");
}
else
{
if(Application.Selection.Count > 1)
{
fTrace("Select only one curve.");
}
else
{
fSegmentCurve(oSel);
}
}
/*-----------
FUNCTIONS
------------*/
function fTrace(m){
Application.LogMessage(m);
}
function fSegmentCurve(oSel){
var oSelName = oSel.FullName;
var oType = oSel.Type;
var oGeometry = oSel.ActivePrimitive.Geometry;
var oNumKnots = oGeometry.Curves(0).Knots.Count;
fTrace(oNumKnots + " - Knots");
//FOR CUBIC CURVES - DEGREE 3
if(oGeometry.Curves(0).Degree == 3){
fTrace(oSelName + " is a cubic cv curve.")
for(i=0; i < oNumKnots-1; i++)
{
//SKIP FIRST THREE KNOTS & LAST THREE KNOTS
if(i < oNumKnots-5){
ApplyGenOp("CrvExtractSeg", "", oSelName +".knot[" +i+ ","+ (i+1) +" ];"+ oSelName +".knot["+ (i+1) +"]");
}
}
}
//FOR LINEAR CURVES - DEGREE 1
if(oGeometry.Curves(0).Degree == 1){
fTrace(oSelName + " is a linear curve.")
for(i=0; i < oNumKnots-1; i++)
{
ApplyGenOp("CrvExtractSeg", "", oSelName +".knot[" +i+ ","+ (i+1) +" ];"+ oSelName +".knot["+ (i+1) +"]");
}
}
}
Segment Curve From Knot To Knot
Stoehr
#1
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.