How can I set the size of an object?



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

    On 08/06/2004 at 09:27, xxxxxxxx wrote:

    Hi,
    unfortunately this does not work with my objects. May it be the Problem that I use unmodified primitive Objects?
    Do I have to convert them into some special Type? I already casted them to PolygonObject, but this does not seem to help.
    Now I tried to convert it with SendModelingCommand(COMMAND_MAKEEDITABLE, md); to turn them into editable Polygon Objects
    But this unfortunately crashes Cinema. Here's the code:
    ModelingCommandData md;
    md.op = object;
    md.doc = GetActiveDocument();
    md.mode = MODIFY_ALL;
    md.bc = NULL;
    md.result1 = NULL;
    md.flags = MODELINGCOMMANDFLAG_CREATEUNDO;
    Bool test = SendModelingCommand(MCOMMAND_MAKEEDITABLE, md);
    it exactly crashes in the function call.
    My Object was previously created via

    PluginObject * object = ToPoly(BaseObject::Alloc(Onull));



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

    On 08/06/2004 at 10:25, xxxxxxxx wrote:

    1. ToPoint is a convenience function for casting. It´s the same as static_cast<PointObject*>(obj); But of course, this only works if the object actually is of type PointObject. The cast will not "convert" the primitive to a pointobject.
    2. You cannot cast a Null Object to a PolygonObject. See 1. And if you try to make it editable to receive a pointobject this does only work for these primitives that are converted to Polygonobjects in Cinema 4D too (with this command).



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

    On 08/06/2004 at 12:59, xxxxxxxx wrote:

    Hello,
    I excluded the case that null objects would be resized. Unfortunately it still doesn't work. Cinema crashes when executing the makeeditable command.
    Can anyone tell me how to really resize primitive objects?



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

    On 08/06/2004 at 14:36, xxxxxxxx wrote:

    I would use CurrentStateToObject instead of MakeEditable.
    Taken from the docs

        
        
        
        
        ModelingCommandData cd;  
          cd.doc = doc;  
          cd.op = op;  
          if (!SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT, cd)) return FALSE;  
          res = static_cast<BaseObject*>(cd.result1);  
        
    

    res is then a BaseObject
    then you can cast it to a PointObject, then you can do your sizing



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

    On 09/06/2004 at 03:02, xxxxxxxx wrote:

    Yeah that worked. Now I have another problem:
    when doing
    LONG vnum = object->GetPointCount();
    Vector * v = object->GetPoint();
    for (LONG i; i < vnum-1; i++)
    {
    v->x = v->x *x;
    ... till z
    v += sizeof(Vector);
    }
    I get a stupid result where only some points are set to a new position and others are not. Also Cinema crashes when I set the factors of x y z to 10.0 or so.... what's happening here? any idea?



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

    On 09/06/2004 at 03:08, xxxxxxxx wrote:

    I have not tested this, but I see no reason why this code wont work

        
        
        
        
        LONG vnum = object->GetPointCount();  
        Vector * v = object->GetPoint();  
        for (LONG i=0; i < vnum; i++)  
        {  
        v[i]->x *= x;  
        v[i]->y *= y;
        
        
        
        
        v[i]->z *= z;  
        }
        
        
        
    


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

    On 09/06/2004 at 03:17, xxxxxxxx wrote:

    trust me it doesnt ;-)
    here is a shot of the result of this operation:
    home.arcor.de/lawnmower/1.jpg
    Any Idea why this happens?



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

    On 09/06/2004 at 03:33, xxxxxxxx wrote:

    It must be something else in your code that causes that then.
    I just tried it myself in my current plugin, and it worked fine.
     
    http://www.spot4d.co.uk/0x47/scale.jpg
     
    The cylinder on the left is the original, the one on the right is the result of the code in my previous post.



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

    On 09/06/2004 at 12:28, xxxxxxxx wrote:

    Hi
    thank you that was it,
    I used
    Vector * v = ....
    v-> *= x
    ...
    v += sizeof(Vector);
    This obviously didnt work although it should have been.



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

    On 10/06/2004 at 05:09, xxxxxxxx wrote:

    v[i]- >x *= x;
    ??? The compiler shouldn´t even compile this. it´s v[i].x *= X;
    Samir



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

    On 10/06/2004 at 05:26, xxxxxxxx wrote:

    err yes sorry, it was that what you wrote, my fault...


Log in to reply