"Flatten Splines"



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

    On 01/04/2010 at 11:44, xxxxxxxx wrote:

    Hello all...my first post here.  The forum looks like a terrific resource.  I'm looking forward to following along.

    The reason I've landed here today is because of my quest to script something that seems so simple, but I can't figure it out on my own.  I'd call my programming knowledge "intermediate".  I suspect it is simple because it is literally one-click on a single spline object.  But, in my current project, I have hundreds of splines I need to "flatten" in the y-axis (i.e., the XZ plane).

    Of course, the way to do this in the GUI is to simply set the spline object's Y SIZE to zero in the coordinate manager and apply.  This essentially averages the Y coordinates for all the spline's points and forces the spline's points to lie within the XZ plane.

    It would be a great time saver for me to be able to select numerous spline objects in the object manager and execute a script to "flatten" them all to the XZ plane.

    What do you guys think?  Maybe I'm missing some obscure function that does this already?

    Thanks



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

    On 13/12/2010 at 12:01, xxxxxxxx wrote:

    Maybe a bit late, but i wrote a script for you. Maybe you have another case for using it. ;)

    var obj = doc->GetActiveObject();
      if (!obj) {
          TextDialog("Select an object.", DLG_OK);
          return false;
      }
    var i = 1;

    while (obj) {

    obj#ID_BASEOBJECT_SCALE:VECTOR_Y = 0;
      println(obj->GetName() + " is flat.");

    obj = obj->GetNext();
          if (!obj) {
              TextDialog((tostring(i) + " Object/s flattened."), DLG_OK);
              return false;
          }
      i++;
    }

    Greets, nux



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

    On 21/12/2010 at 05:01, xxxxxxxx wrote:

    Thank you, nux.  Works great.



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

    On 01/07/2011 at 13:37, xxxxxxxx wrote:

    hey, this is not a code related solution, but using the melt deferrer, settings its strength to zero, and moving to the top of your splines should flatten them in the local Y direction of your deformer. obviously not a coded solution, but still very useful nonetheless.


Log in to reply