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_StitchWeldAverage

LScript (Modeler) works like average weld points but in selected pairs. This allows you to average weld multiple selected points in one go instead of needing to weld individually.

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 - Stitch Weld Average

    Modeler_StitchWeldAverage.ls

*/

@version 2.2
@warnings
@script modeler
@name *Stitch Weld Average

    // Title
    sTitle = "*Stitch Weld Average";

    // Version
    sVersion = "v1.0";

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

    if((iPointCount & 1) != 0) iPointCount--; // Check if odd

    editbegin();

        for(iCurrentPoint = 1; iCurrentPoint <= iPointCount; iCurrentPoint += 2)
          {
         vAverage = (pointinfo(points[iCurrentPoint]) + pointinfo(points[iCurrentPoint + 1])) * 0.5; // Average Vector
          pointmove(points[iCurrentPoint],vAverage); // Move point           
          pointmove(points[iCurrentPoint + 1],vAverage); // Move point           
          }

    editend();

    mergepoints(0.0); // Merge Points

    info(iPointCount," point(s) welded.");
}
All scripts available at my Google Drive at
https://drive.google.com/open?id=1cR_q2GVUAJHumic1-A3eXV16acQnVTWs

No comments:

Post a Comment