Hi, I'm working on a free Nut_Bolt script but I'm getting an error. Let's say I'm Importing the Bolt_01 it's snapping to the selected face but again when I run this script on a new selected face it's taking back Bolt_01 to the origin. It shouldn't happen like that. For more REFER VIDEO.
{
// create a window
window -title "jay" -menuBar true -w 220 -h 200 "";
// define the layout of controls added
// to the window.
columnLayout;
// create a collapsible frame layout
frameLayout -collapsable true -label "Nuts";
// add the other controls
flowLayout -columnSpacing 1 -w 220 -h 30;
symbolButton -image "commandButton.png" -command "sample_Proc";
setParent ..;
// show the window we last created
showWindow;;
}
proc Pipe_01_Proc()
{
string $sel_faces[] = `ls -sl `;
string $file_Path = (`internalVar -userPrefDir`) + "icons/3DG_Nut/Mesh/Pipe_01.fbx";
file -import $file_Path;
rename "Pipe_01" "Pipe_01_Placed";
select $sel_faces[0] "Pipe_01_Placed";
float $rsScale = size($sel_faces);
scale -r $rsScale $rsScale $rsScale "Pipe_01_Placed";
string $rspointOnPolyConstraint[] = `pointOnPolyConstraint -offset 0 0 0 -weight 1 `;
delete $rspointOnPolyConstraint;
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1;
makeIdentity -apply false -t 1 -r 1 -s 1;
CenterPivot;
xform -cpc;
}
https://www.youtube.com/watch?v=B9ao8VO8beI
Replies