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

    Trouble with MCOMMAND_JOIN [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 387 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 19/11/2014 at 14:39, xxxxxxxx wrote:

      I'm trying to create a spline that is made up of many segments.
      In the first generation, it creates a simple spline. In the following generations, I was trying to perform a "Connect" command between the first spline created and the newly created ones.
      It is not working. I only get a single spline 😞
      Here is my code:

      **
      first=True

      set an empty spline

      old_branch_spline=c4d.BaseObject(c4d.Ospline)
      old_branch_spline.ResizeObject(0)

      for br in range(branches) :
           # my spline calculation routine. It returns a list of vectors
           spline_points=Calculate_Spline()
           n_points=len(spline_points)

      branch_spline=c4d.BaseObject(c4d.Ospline)
           branch_spline.ResizeObject(n_points)

      for i,pt in enumerate(spline_points) :
                branch_spline.SetPoint(i,pt)

      branch_spline.Message(c4d.MSG_UPDATE)

      if first==True:
                old_branch_spline=branch_spline.GetClone()
                first=False
           else:
      result=utils.SendModelingCommand(command=c4d.MCOMMAND_JOIN,list=[branch_spline,old_branch_spline],mode=c4d.MODIFY_ALL,bc=c4d.BaseContainer())
                if result is not False:
                     old_branch_spline=result[0]
      **

      What could be wrong. Any help would be great.

      Rui Batista

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

        On 20/11/2014 at 10:38, xxxxxxxx wrote:

        Hello,

        the list argument is not used by MCOMMAND_JOIN. To define the objects you want to merge you have to create a parent/child hierarchy:

          
          nullObject = c4d.BaseObject(c4d.Onull)  
            
          spline_a.InsertUnder(nullObject)    
          spline_b.InsertUnder(nullObject)  
          
          res = c4d.utils.SendModelingCommand(command=c4d.MCOMMAND_JOIN,list=[nullObject])  
        

        best wishes,
        Sebastian

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

          On 20/11/2014 at 13:48, xxxxxxxx wrote:

          Thank you very much, Sebastian.
          That should be stated clearly in the SDK.
          I ended up doing the creation of the splines and segments by hand.
          But I will have that information into account, next time.

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