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

    Join command result offset

    Cinema 4D SDK
    r20 c++ python
    2
    3
    621
    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.
    • rsodreR
      rsodre
      last edited by rsodre

      Hello,

      I've received a problem from a user with an object that our modifier is not translating correctly. What's unique about this setup is that contains "a spline wrap using an external spline to modify a sweep's input spline". Sounds ugly, better to open the attached project. The object we need to cache is Reep, and somewhere inside it there's the Reep-Wrap-03 modifier ( a Spline Wrap). It's strength is 100%, and it cancels out the generator's transform. Any translation and rotation have no effect on the final polygon.

      I'using the MCOMMAND_JOIN modeling command to get a copy of Reep of an object for later processing but the resulting polygon is always offset by the original generator's current transform. If I execute the Make Editable or Current State To Object commands on it, the result is correct, but not using the Join command.

      As an example, I'm using this script in Python that gives me the same result as the C++ API. Running it the joined polygon will be offset from the original generator cache. The same script using MCOMMAND_CURRENTSTATETOOBJECT does not generate the offset.

      import c4d
      
      def main() :
          olist = [ doc.SearchObject("Reep") ]
          settings = c4d.BaseContainer()
          res = c4d.utils.SendModelingCommand(command = c4d.MCOMMAND_JOIN, list = olist,  bc = settings, doc = doc)                      
          doc.InsertObject(res[0].GetClone())    
          c4d.EventAdd()
          
      if __name__=='__main__':
          main()
      

      Is there anything I can do to get the same result from the JOIN command, without that offset?

      Ediatble_isolated.c4d

      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by m_adam

        Hi @rsodre thanks for contacting us, I will inform development team. However, there is no workaround for that except either offset back the point or offset the whole object. Note that in R21 the behavior changed and now points are in the correct world location (it actually resets the position of the axis) but the axis of the generated object is not into the same world pos.

        So here the workaround with the axis offset that will end with the same behavior from R20 and R21 and where points are in the correct World Position but not the axis.

        import c4d
        
        def main() :
            sweep = doc.SearchObject("Reep")
            
            olist = [sweep]
            settings = c4d.BaseContainer()
            res = c4d.utils.SendModelingCommand(command = c4d.MCOMMAND_JOIN, list = olist,  bc = settings, doc = doc)
            
            if c4d.GetC4DVersion() < 21000:
                res[0].SetAbsPos(c4d.Vector())
                
            doc.InsertObject(res[0].GetClone())
            c4d.EventAdd()
            
        if __name__=='__main__':
            main()
        

        just FYI, I'm still investigating the issue anyway is there a reason to not use MCOMMAND_CURRENTSTATETOOBJECT?

        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        rsodreR 1 Reply Last reply Reply Quote 1
        • rsodreR
          rsodre @m_adam
          last edited by

          @m_adam Hi Maxime,

          Thanks for this workaround, indeed puts the polygon on the right place.

          Best,
          roger

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