Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Get length of selected Spline

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 320 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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();   
        
        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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.🙂

          1 Reply Last reply Reply Quote 0
          • First post
            Last post