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

    Can't set segments on a spline

    Scheduled Pinned Locked Moved SDK Help
    8 Posts 0 Posters 658 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 04/07/2008 at 23:04, xxxxxxxx wrote:

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

      ---------
      I created a spline object (set to Linear) to which I added the following COFFEE code, through a COFFEE tag:

      > <code>
      > main(doc,op)
      > {
      > var points,segments,current1,current2,vc1,vc2;
      > points=new(array,5);
      > points[0]=vector(-100,-100,0);
      > points[1]=vector(0,100,0);
      > points[2]=vector(100,-100,0);
      > points[3]=vector(-50,0,0);
      > points[4]=vector(50,0,0);
      >
      > segments=new(array,2);
      >
      > segments[0]=3;
      > segments[1]=2;
      >
      > vc1=new(VariableChanged);
      > if(!vc1)
      >      {
      >      println("Error 1");     
      >      return;
      >      }
      >
      > vc2=new(VariableChanged);
      > if(!vc2)
      >      {
      >      println("Error 2");
      >      return;
      >      }
      >
      > current1=op->GetPointCount();
      > if(!vc1->Init(current1,5))
      >      {
      >      println("Error 3");
      >      return;
      >      }
      >
      > current2=op->GetSegmentCount();
      >
      > println(current2);
      >
      > if(!vc2->Init(current2,2))
      >      {
      >      println("Error 4");
      >      return;
      >      }
      >
      > if(!op->MultiMessage(MSG_POINTS_CHANGED,vc1))
      >      {
      >      println("Error 5");
      >      return;
      >      }
      >
      > if(!op->MultiMessage(MSG_SEGMENTS_CHANGED,vc2))
      >      {
      >      println("Error 6");
      >      return;
      >      }
      >
      > if(!op->SetPoints(points))
      >      {
      >      println("Error 7");
      >      return;
      >      }
      >
      > if(!op->SetSegments(segments))
      >      {
      >      println("Error 8");
      >      }
      > op->Message(MSG_UPDATE);
      > }
      > </code>

      I always get a report of "Error 8" in the console. Why is it failing to set the segments? Is it a bug or am I making a mistake?

      Rui Batista

      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 05/07/2008 at 03:58, xxxxxxxx wrote:

        Do you actually need to set segments?
        The little spline making I do, I only set the points w/o problems.

        Cheers
        Lennart

        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 05/07/2008 at 04:13, xxxxxxxx wrote:

          My example creates a letter A. It has an inverted V shape and a crossed line. So, segments are the obvious way to do it, if I only want a single spline.
          Anyways, I really would like to know if it is possible to create multi-segment splines in COFFEE. And, if it is, how... because this seems not to be working.

          Rui Batista

          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 05/07/2008 at 05:26, xxxxxxxx wrote:

            Ah, I see, of coarse. Should be good to see a solution as I haven't
            used multi-segments myself yet..

            Cheers
            Lennart

            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 07/07/2008 at 02:23, xxxxxxxx wrote:

              It's a bug in Cinema's spline segment handling.

              cheers,
              Matthias

              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 07/07/2008 at 03:09, xxxxxxxx wrote:

                Must be fixed!!!
                While it is being fixed, some more improvements could be added to COFFEE 😉 (hint! hint!)

                Rui Batista

                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 07/07/2008 at 15:35, xxxxxxxx wrote:

                  Hi folks.
                  The work around for this bug is to work the code on an existing (or duplicated) spline that is segmented already. Then the segment array will work, once the sum of the points for the new segment equals the new point count.
                  Lar

                  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/07/2008 at 03:01, xxxxxxxx wrote:

                    Turned out it's not a bug but you were missing to check for a SegmentTag. The segment information is stored the SegmentTag. YOu have to allocate a new SegmentTag before sending the VariableChanged message.

                    Fixed code

                    > \> var points,segments,current1,current2,vc1,vc2; \> points=new(array,5); \> points[0]=vector(-100,-100,0); \> points[1]=vector(0,100,0); \> points[2]=vector(100,-100,0); \> points[3]=vector(-50,0,0); \> points[4]=vector(50,0,0); \> segments=new(array,2); \> segments[0]=3; \> segments[1]=2; \> vc1=new(VariableChanged); \> \> if(!vc1) \> { \>      println("Error 1"); \> return; \> } \> \> vc2=new(VariableChanged); \> if(!vc2) \> { \>      println("Error 2"); \>      return; \> } \> \> current1=op->GetPointCount(); \> if(!vc1->Init(current1,5)) \> { \>      println("Error 3"); \>      return; \> } \> \> current2=op->GetSegmentCount(); \> println(current2); \> if(!vc2->Init(current2,2)) \> { \>      println("Error 4"); \>      return; \> } \> \> var stag=new(SegmentTag); \> op->InsertTag(stag); \> \> if(!op->MultiMessage(MSG_SEGMENTS_CHANGED,vc2)) \> { \>      println("Error 6"); \>      return; \> } \> \> if(!op->MultiMessage(MSG_POINTS_CHANGED,vc1)) \> { \>      println("Error 5"); \>      return; \> } \> \> if(!op->SetPoints(points)) \> { \>      println("Error 7"); \>      return; \> } \> \> if(!op->SetSegments(segments)) \> { \>      println("Error 8"); \> } \> \> op->Message(MSG_UPDATE); \>

                    cheers,
                    Matthias

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