Feedback

Please leave feedback and comments. I am always interested to hear how people get on using these LScripts!

Tuesday 21 June 2011

LScript - Modeler_RestOnGround

LScript (Modeler) for a single click rest on ground which only translates selected points so that they rest on the Y plane.

Compatible with Newtek LightWave 9.6 and above.

// LScript Modeler - www.StephenCulley.co.uk
//
// web   address: http://www.stephenculley.co.uk
// email address: email@stephenculley.co.uk

/*  
    LScript Modeler - Rest On Ground

    Modeler_RestOnGround.ls

*/

@version 2.2
@warnings
@script modeler
@name *Rest On Ground

    // Title
    sTitle = "*Rest On Ground";

    // Version
    sVersion = "v1.0";

main
{
    // Selection - Point (DIRECT)
    selmode(DIRECT);
    iPointCount = pointcount();
    if(iPointCount < 1) error("No points selected.");

    editbegin();

    vOffset = pointinfo(points[1]);

    if(iPointCount > 1)
      {   
      for(iCurrentPoint = 2; iCurrentPoint <= iPointCount; iCurrentPoint++)
        {
        vPoint = pointinfo(points[iCurrentPoint]);
        if(vPoint.y < vOffset.y) vOffset = vPoint;  
        }
      }

    vOffset = <0.0,-vOffset.y,0.0>;

    for(iCurrentPoint = 1; iCurrentPoint <= iPointCount; iCurrentPoint++)
      {
      pointmove(points[iCurrentPoint],pointinfo(points[iCurrentPoint]) + vOffset); // Move point           
      }

    editend();
}
All scripts available at my Google Drive at
https://drive.google.com/open?id=1cR_q2GVUAJHumic1-A3eXV16acQnVTWs

No comments:

Post a Comment