Can primitive return SplineObject info? [SOLVED]



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



  • 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  
    


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

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



  • 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



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

    Oh cool, good to know.  Thanks guys.



  • 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 !


Log in to reply