LScript (Modeler) to offset the position of selected point based on a the position of a second selected point.
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 - Offset Modeler_Offset.ls */ @version 2.2 @warnings @script modeler @name *Offset // Title sTitle = "*Offset"; // Version sVersion = "v1.0"; bDone = false; // Done nX,nY,nZ; vOffset; ctrl_c0,ctrl_c1,ctrl_c2; ctrl_res0; main { // Selection - Point (DIRECT) selmode(DIRECT); iPointCount = pointcount(); if(iPointCount < 2) error("Select two points."); editbegin(); vOffset = pointinfo(points[1]) - pointinfo(points[2]); editend(); nX = vOffset.x; nY = vOffset.y; nZ = vOffset.z; process(); // Process reqbegin(sTitle + " " + sVersion); // Reset ctrl_res0 = ctlbutton("Reset",50,"button_reset"); // Button Reset ctlsep(); // Control ctrl_c0 = ctldistance("X",nX); ctrl_c1 = ctldistance("Y",nY); ctrl_c2 = ctldistance("Z",nZ); // Developer ctlsep(); ctrl_dev0 = ctltext("","developer: Stephen Culley","http://www.stephenculley.co.uk"); // Refresh ctlrefresh(ctrl_c0,"refresh"); ctlrefresh(ctrl_c1,"refresh"); ctlrefresh(ctrl_c2,"refresh"); if (!reqpost()) { // Cancel if(bDone){undo();} // Undo return; } else { // Ok if(!bDone || bChange) // Process { values(); // Values process(); // Process } } reqend(); } refresh:value { bChange = true; // Change values(); // Values process(); // Process } values { nX = getvalue(ctrl_c0); // X nY = getvalue(ctrl_c1); // Y nZ = getvalue(ctrl_c2); // Z } button_reset { setvalue(ctrl_c0,vOffset.x); // X setvalue(ctrl_c1,vOffset.y); // Y setvalue(ctrl_c2,vOffset.z); // Z } process { // Undo if(bDone){undo();} undogroupbegin(); // Process // Selection - Point (DIRECT) selmode(DIRECT); iPointCount = pointcount(); if(iPointCount < 2) error("Select two points."); editbegin(); vPosition = pointinfo(points[2]); pointmove(points[1],vPosition +); // Move point editend(); // Undo undogroupend(); bChange = false; // Change // Done bDone = true; }
https://drive.google.com/open?id=1cR_q2GVUAJHumic1-A3eXV16acQnVTWs
No comments:
Post a Comment