Get the size of a spline object?



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

    On 29/07/2008 at 10:09, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   10.111 
    Platform:   Windows  ;   
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    What I'm trying to do is programmatically (with COFFEE, preferably) grab the "size" of a path/spline. I can do this through xpresso with a bounding box (which really may be all the size is) but the bounding box functions documented (GetRad) don't seem to work. What I'm trying to do is create spheres, size them to the same size as a set path and put them into that position. I can create the spheres and move them... it's getting the proper size of the path that I'm having trouble with. And we're talking about doing this for a few thousand paths (imported from another program) so doing it by hand isn't really an option. (for the curious, I'm importing a flat 2D design and trying to make it into 3D) I can dig into C++ if I have to, but I thought I'd see if there's a way to grab the very simple readout that I can see and change on my screen via COFFEE, because I know I can do the rest of the programming on the COFFEE side.

    Here's a step by step way to see what I'm talking about.

    Objects->Spline Primitive->Circle
    With that circle selected, do Functions->Make Editable to turn it into a spline/path.

    Down in the Coordinates panel, there's a size listed that you can edit. For the default circle, it's 400 cm in the X and 400 cm in the Y (if your units are set to cm, anyway) -- you can then change that to whatever you'd like.

    Now do Objects->Primitive->Sphere
    Select the Sphere
    Change the size in the X or the Y (or the Z) to 400 cm and the sphere resizes to the proper size, a radius of 200 cm giving it a full "size" of 400 cm.

    What I need is a way to grab the "size" coordinate -- I don't even have to change it. I can do a bounding box, but calculating the bounding box on my own is going to be complicated because it's *not* just a matter of finding out which points are farthest in each direction, since it's a spline we're dealing with and not a poly object, so I don't *think* a calculated-by-me bounding box is the answer.

    Any help is appreciated. Thanks in advance.



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

    On 29/07/2008 at 10:33, xxxxxxxx wrote:

    And for the record, yes, I've searched the forum and read the messages of the people in the past who've tried this... but they were dealing with polygon objects, not splines. I'm hoping there some other way.



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

    On 29/07/2008 at 12:17, xxxxxxxx wrote:

    Issue solved -- Per-Anders was kind enough to direct me to (and I presume, write) this script for the solution: Wiki: COFFEE_Bounding_Box

    I don't know if posting links to threads on other sites is allowed, so I'm just linking to the script itself.

    thanks


Log in to reply