LScript (Modeler) to offset points based on total offset by compounding across selected points.
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 - Compound
Modeler_Compound.ls
*/
@version 2.2
@warnings
@script modeler
@name *Compound
// Title
sTitle = "*Compound";
// Version
sVersion = "v1.0";
ctrl_c0, ctrl_c1, ctrl_c2, ctrl_c3;
main
{
// Store
bAxisX = recall("bAxisX",true);
bAxisY = recall("bAxisY",false);
bAxisZ = recall("bAxisZ",false);
fDistance = recall("fDistance",0.0);
reqbegin(sTitle + " " + sVersion);
// Reset
ctrl_res0 = ctlbutton("Reset",50,"button_reset"); // Button Reset
ctlsep();
// Control
ctrl_c0 = ctlcheckbox("X", bAxisX);
ctrl_c1 = ctlcheckbox("Y", bAxisY);
ctrl_c2 = ctlcheckbox("Z", bAxisZ);
ctrl_c3 = ctldistance("Distance",fDistance);
// Developer
ctlsep();
ctrl_dev0 = ctltext("","developer: Stephen Culley","http://www.stephenculley.co.uk");
return if !reqpost();
bAxisX = getvalue(ctrl_c0); // X
bAxisY = getvalue(ctrl_c1); // Y
bAxisZ = getvalue(ctrl_c2); // Z
fDistance = getvalue(ctrl_c3); // Distance
// Store
store("bAxisX",bAxisX); // X
store("bAxisY",bAxisY); // Y
store("bAxisZ",bAxisZ); // Z
store("fDistance",fDistance); // Distance
// Selection - Point (DIRECT)
selmode(DIRECT);
iPointCount = pointcount();
if(iPointCount <= 1) error("None or not enough points selected.");
undogroupbegin(); // Undo
moninit(iPointCount,"Processing..."); // Progress Monitor
vStep = <fDistance / (iPointCount - 1),fDistance / (iPointCount - 1),fDistance / (iPointCount - 1)>;
vCompound = <0.0,0.0,0.0>; // Compound
editbegin();
for(iCurrentPoint = 1; iCurrentPoint <= iPointCount; iCurrentPoint++)
{
vPoint = pointinfo(points[iCurrentPoint]);
if(bAxisX) vPoint.x = vPoint.x + vCompound.x; // X
if(bAxisY) vPoint.y = vPoint.y + vCompound.y; // Y
if(bAxisZ) vPoint.z = vPoint.z + vCompound.z; // Z
pointmove(points[iCurrentPoint],vPoint); // Move point
// Compound
vCompound += vStep;
monstep(); // Progress Monitor
}
editend();
undogroupend(); // Undo
}
button_reset
{
setvalue(ctrl_c0,true); // X
setvalue(ctrl_c1,false); // Y
setvalue(ctrl_c2,false); // Z
setvalue(ctrl_c3,0.0); // Distance
}
https://drive.google.com/open?id=1cR_q2GVUAJHumic1-A3eXV16acQnVTWs