Get length of selected Spline



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/08/2011 at 09:40, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   11 
    Platform:      
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    Hello,
    How do I get the Length of a selected Spline?

    I found this code...but it seems not to give me the length.
    Anybody can help me here?

    var defaultSpline = doc->GetActiveObject();
    var realspline= defaultSpline->GetRealSpline();
    var sldata=realspline(SplineLengthData);

    Thank you.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/08/2011 at 11:41, xxxxxxxx wrote:

    It's a bit cumbersum in pre R12 as PointObject splines
    and Primitiv splines are treated different.
    All sorted to the better in R12.021+

    Cheers
    Lennart

      
    // R11.5 and lower   
    var splinetype = op->GetType();   
    if(splinetype == 5101) // PointObject Spline   
        {   
         if(!op->InitLength(0))   
            op->InitLength(0);   
         println(op->GetLength());   
         println("PointSpline");   
         return;   
        }   
      
    if(splinetype > 5101 && splinetype < 5190) // Primitiv Spline   
        {   
         var prim = op->GetSplineObject();   
            prim->InitLength(0);   
         println(prim->GetLength());   
         println("PrimitivSpline");   
         return;   
         }   
    println("Not a Spline");   
    
      
    // R12.021+ Get length of any spline   
    if(!op || !op->GetRealSpline()) return;   
    var rs = op->GetRealSpline();   
    var sld   = new(SplineLengthData);   
        sld->Init(rs,0);   
    var splinelength = sld->GetLength();   
      
    println(splinelength);   
    sld->Free();   
    


  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/08/2011 at 10:00, xxxxxxxx wrote:

    Hey Lennart, Thanks again.🙂


Log in to reply