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

    Taper Object

    Scheduled Pinned Locked Moved PYTHON Development
    8 Posts 0 Posters 641 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 03/02/2015 at 21:15, xxxxxxxx wrote:

      Say I have a cube with a number of segments. Is there maybe a pythonic way to taper it without using the the deformers ????

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

        On 04/02/2015 at 06:23, xxxxxxxx wrote:

        Hello,

        I guess you speak of a parametric cube object? The only way to deform parametric objects is to use deformers. These deformers can work on the object's cache.

        In contrast, polygon objects can be edited any way you like.

        best wishes,
        Sebastian

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

          On 04/02/2015 at 06:41, xxxxxxxx wrote:

          S_Bach, Sorry I should have said the cube is made editable 😊

          So how would I go around tapering a point object without a deformer ??

          I want the cube to deform to a cone shape with a slider?? (Python)

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

            On 04/02/2015 at 08:34, xxxxxxxx wrote:

            Hello,

            to edit the shape (geometry) of a polygon object you just need to change the position of it's points. To get all points of a polygon object just call GetAllPoints()[URL-REMOVED]. To set the position of a certain point use SetPoint()[URL-REMOVED]. You find some example on this in the SpherifyModifier [URL-REMOVED]example.

            You can control such deformation with a slider, but this depends on what kind of GUI you use and what kind of plugin you are creating.

            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 04/02/2015 at 21:09, xxxxxxxx wrote:

              I know about "GetAllPoints" and "SetPoint" 😉

              I have got this far with a "plane object"

                  obj = doc.SearchObject("Plane")
                  cntrl = doc.SearchObject("Null")
                  
                  Scale = cntrl[c4d.ID_USERDATA,1]/100
                  
                  pntA = [c4d.Vector(-200, 0, -200),c4d.Vector(200, 0, -200),
                               c4d.Vector(-200, 0, -160),c4d.Vector(200, 0, -160),
                               c4d.Vector(-200, 0, -120),c4d.Vector(200, 0, -120),
                               c4d.Vector(-200, 0, -80),c4d.Vector(200, 0, -80),
                               c4d.Vector(-200, 0, -40),c4d.Vector(200, 0, -40),
                               c4d.Vector(-200, 0, 0),c4d.Vector(200, 0, 0),c4d.Vector(-200, 0, 40),
                               c4d.Vector(200, 0, 40),c4d.Vector(-200, 0, 80),c4d.Vector(200, 0, 80),
                               c4d.Vector(-200, 0, 120),c4d.Vector(200, 0, 120),c4d.Vector(-200, 0, 160),
                               c4d.Vector(200, 0, 160),c4d.Vector(-200, 0, 200),c4d.Vector(200, 0, 200)]
                  
                  pntsC = len(pntA)
                  
                  obj.ResizeObject(pntsC) 
                      
                  for i in xrange(len(pntA)) :
                              
                      new_x = (i * pntA[i].x) / (pntsC-1) * Scale
                        
                      obj.SetPoint(i,c4d.Vector(new_x,pntA[i].y,pntA[i].z))
              
              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                On 05/02/2015 at 00:14, xxxxxxxx wrote:

                Hello,

                so, what exactly is your question?

                Best wishes,
                Sebastian

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

                  On 05/02/2015 at 02:45, xxxxxxxx wrote:

                  My question is still the same. This script is for a flat "Plane Object"

                  How would I do it if it is a "Cube Object"

                  😕

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

                    On 05/02/2015 at 04:12, xxxxxxxx wrote:

                    Hello,

                    if your code works for a specific case you should generalize your algorithm so it can handle different cases. With a polygon object you can never now which shape is has (if it's a cube or something different).

                    Best wishes,
                    Sebastian

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