Taper Object



  • 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 ????



  • 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



  • 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)



  • 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(). To set the position of a certain point use SetPoint(). You find some example on this in the SpherifyModifier 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



  • 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))
    


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

    Hello,

    so, what exactly is your question?

    Best wishes,
    Sebastian



  • 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"

    😕



  • 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


Log in to reply