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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    MCOMMAND_JOIN

    PYTHON Development
    0
    5
    1.1k
    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
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 09/03/2011 at 10:01, xxxxxxxx wrote:

      Hi there,

      I'll post this here again, because it's only about Python now.

      I want to join the hierarchy of the selected Object to one.
      But The next objects are added, too, even they are NOT in the list ?! 🤢🤢😠

      import c4d  
      from c4d import utils  
        
      def GetHNext(op, start = None) :  
        if not op: return  
        if op.GetDown() :  
            return op.GetDown()  
        while (not op.GetNext()) and (op.GetUp()) :  
            op = op.GetUp()  
        if start == op:   
            return  
        
        return op.GetNext()  
        return  
        
      def GetHierarchyInList(op) :  
        lst = list()  
        sop = op  
        while op:  
            lst.append(op)  
            op = GetHNext(op,sop)  
        return lst  
        
      def main() :  
        lst = GetHierarchyInList(op)    ## Get the Hierarchy of op  
        if not lst[0]: return  
        for i in lst:                   ## print all Objects in the list  
            print i.GetName()  
        obj = utils.SendModelingCommand(## Use modeling command  
                                command = c4d.MCOMMAND_JOIN,  
                                doc = doc,  
                                list = lst )  
        obj[0].SetAbsPos(c4d.Vector(0,250,0))  
        doc.InsertObject(obj[0])        ## Insert new Object  
        doc.SetActiveObject(obj[0])  
        obj[0][c4d.ID_BASEOBJECT_COLOR] = c4d.Vector(130/255.0,255/255.0,100/255.0)  
        c4d.EventAdd()  
        
      if __name__=='__main__':  
        main()
      

      I have the following Hierarchy:

      I select the Cube and in the list obtained by GetHierarchyInList(op) there is only the Cube and the Sphere, as wanted.

      But at the end, all objects are collapsed by MCOMMAND_JOIN.
      Any Idea ?

      Here an example scene, so you don't have to set up your own.
      click

      Thanks, nux

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 13/03/2011 at 05:06, xxxxxxxx wrote:

        *push*

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 14/03/2011 at 08:37, xxxxxxxx wrote:

          Unfortunately I can't give you an answer on this right now. I have to check whats going on here.

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 14/03/2011 at 10:00, xxxxxxxx wrote:

            There seems to be some SendModelingCommand options that are broken.

            https://developers.maxon.net/forum/topic/5538/5558_mcommandjoin-bug

            -ScottA

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 16/03/2011 at 08:46, xxxxxxxx wrote:

              Thanks, i hope you can figure the problem out.

              Unfortunately I can't use the CallCommand in my Plugin. 😵

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