get object size?



  • On 12/10/2013 at 12:40, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   r14 
    Platform:      
    Language(s) :     C++  ;

    ---------
    hi, 
    to retrieve the size of a group of objects i had the idea to use the following code.
    however, it seems to not work. i searched the forum, but found only things i dont understand.

    Vector Handrail::getSize(BaseObject* o)
    {
    	Vector size = Vector(0);
    	BaseObject* temp = BaseObject::Alloc(Oconnector);
    	if (temp)
    	{
    		o->InsertUnder(temp);
    		size = temp->GetRad();
    		GePrint("Size:"+RealToString(size.y));
    	}
    	return size;
    }
    

    any help would be great :) i am just looking for an easy way to get the dimension of a user defined object (and this object could be anything)

    thanks in advance,
    ello



  • On 12/10/2013 at 13:30, xxxxxxxx wrote:

    GetRad() only works for objects that override that method in their NodeData, to return a proper bounding box dimension.

    If GetRad() doesn't work for you, you could also use the PolygonObject or PointObject of the generator, iterate over all points and use the MinMax class to calculate its extends.



  • On 12/10/2013 at 13:38, xxxxxxxx wrote:

    you mean creating a clone of the provided object link and get the points of that one??



  • On 17/10/2013 at 06:27, xxxxxxxx wrote:

    Howdy,

    Generator objects store a polygonal cache object which you can accessed with BaseObject::GetCache().
    There is a detailed description in the SDK Documentation on how caches work.

    Adios,
    Cactus Dan



  • On 17/10/2013 at 12:40, xxxxxxxx wrote:

    thank you! that helps a lot...


Log in to reply