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 primitive return SplineObject info? [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    6 Posts 0 Posters 480 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

      On 26/03/2015 at 13:51, xxxxxxxx wrote:

      Hello friends,

      I was curious: is it possible to return/turn a BaseObject (such as a Helix primitive) into a SplineObject without inserting it into the active document and using a CallCommand to make it editable?

      Using helix.GetCache() (for example) returns a LineObject, which is helpful since that's a PointObject, but I was really hoping to use SplineObject's GetSegment() and GetTangent() functions.

      I guess every time its GetDirty() changes I could clone it, insert it into the doc, make it editable, grab the info I need, then remove it, but that seems, well, wrong.  I'm only bothering to ask (I could probably get away with just point positions) because the Thinking Particles' Follow Spline preset, which uses COFFEE and calls GetSplineTangent at some point, works on a primitive.

      Thanks a million.

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

        On 26/03/2015 at 16:27, xxxxxxxx wrote:

        Hello,

        in this case current state to object will give you a spline object, like:
        a helix with a python tag...

          
        import c4d  
        from c4d import utils  
          
          
        def main() :  
            
          helix = op.GetObject()  
          splist = utils.SendModelingCommand(command = c4d.MCOMMAND_CURRENTSTATETOOBJECT,  
                                                 list = [helix.GetClone()],  
                                                 doc = doc)  
          spline = splist[0]                                         
          print spline  
        
        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 27/03/2015 at 07:02, xxxxxxxx wrote:

          Ooohhh, that's so obvious, now--thanks monkey!  Sorry for the... dumb question 😪

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

            On 27/03/2015 at 07:43, xxxxxxxx wrote:

            Hello,

            you can get the spline created by a spline generator with GetRealSpline(). Please notice that the returned spline is still owned by the generator so you have to handle a copy of that spline.

            Best wishes,
            Sebastian

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

              On 27/03/2015 at 08:00, xxxxxxxx wrote:

              Oh cool, good to know.  Thanks guys.

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

                On 27/03/2015 at 08:42, xxxxxxxx wrote:

                a question never can be dumb, we both learned something about GetRealSpline().
                Well, thanks guys for the question and the answer !

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