GetRad and Nurbs?

  • On 30/04/2013 at 13:55, xxxxxxxx wrote:

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

    Hey there,
    i am using GetRad to get the Boundingbox of an object. This works fine until i try to get it from a NurbsObject. Then only 0,0,0 is returned. How do i get the Boundingbox for NurbsObjects?

    thanks in advance,

  • On 30/04/2013 at 14:23, xxxxxxxx wrote:

    GetRad() does work fine for me in python (also on NURBS objects). This has to be a cpp specific
    problem or, as things working in python but do not working in cpp are really rare, you are doing
    something wrong. Are you sure your nurbs generator has a properly build cache ? Or in other
    words - GetRad() won't work for most objects if you have not inserted them into a document.

  • On 30/04/2013 at 15:16, xxxxxxxx wrote:

    hm, i am using it like this:

    BaseList2D myObjectLink = bc->GetLink(OBJECTLINK,doc);
    myObject = static_cast<BaseObject*>(myObjectLink->GetClone(COPYFLAGS_0, NULL));
    if (myObject )
    Vector baseSize = myObject ->GetRad();

  • On 30/04/2013 at 15:46, xxxxxxxx wrote:

    i am not really sure about all that cpp stuff but GetClone() might be the culprit, i think the
    cloned object does not inherit the cache from its parent and as long you do not insert the
    clone into the document there won't be build a new one.

    a solution might be to try to cast the BaseList2D from GetLink directly into a BaseObject,
    so that you can invoke GetRad() on the object in your document, but again i do have almost
    no clue whats going on in cpp and this barely more than brain farting ;)

  • On 02/05/2013 at 08:25, xxxxxxxx wrote:

    The bounding box is returned if I do CurrentStateToObject on the clone before calling GetRad(). The ModelingCommandData result isn't used.

    Presumably this is due to the cache being rebuilt. I wasn't able to find a more elegant way of doing this.

  • On 02/05/2013 at 09:48, xxxxxxxx wrote:

    thank you!

Log in to reply