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

    moving the axes and let the polygon stay [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 320 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 13:59, xxxxxxxx wrote:

      Hi all,
      I want to move a polygon with his axis to Y=0 and let the polygon
      stay above it?
      To move the axis to 0 is no Problem.
      But what do I have to do that the polygon will stay above?

      Any ideas.

      Thanks a lot

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

        On 20/11/2014 at 08:39, xxxxxxxx wrote:

        Hello,

        it seems there is no dedicated function to do this. You can edit the axis of an point object by moving the object and then transform the points of the object:

          
          if op == None:  
              return  
            
          if op.IsInstanceOf(c4d.Opoint) == False:  
              return  
            
          # the offset of the axis  
          offset = c4d.Vector(100,0,0)  
            
          # move object  
          m = op.GetMg()  
          m.off = m.off + offset  
          op.SetMg(m)  
            
          # transform points  
          padr = op.GetAllPoints()  
          pcnt = op.GetPointCount()  
            
          for i, point in enumerate(padr) :  
              point = point - offset  
              op.SetPoint(i,point)  
                
          op.Message(c4d.MSG_UPDATE)  
        

        In a more complex situation you may have to work with a offset matrix[URL-REMOVED].

        best wishes,
        Sebastian


        [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

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

          On 21/11/2014 at 00:56, xxxxxxxx wrote:

          Hey you arre my hero 🙂

          Thanks for your code.
          Ronald

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