Message 1 of 5
Issues in Creating a Simple angular array dialog
Not applicable
12-19-2008
05:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
As a beginner i have been trying to write a mel script to perform a simple angular array generated from a dialog where i can enter the variables. The problem i have now is trying to combine the function of the array and its variable to the UI dialog.
i am able to create a UI dialog on its own with no functionality attached as follows:
// control box
window
-title "Array Parameters"
-widthHeight 500 200;
columnLayout;
string $hyp= `intFieldGrp -label "Distance from origin:"`;
string $total= `intFieldGrp -label "Total number of objects:"`;
string $height= `intFieldGrp -label "Height from Origin:"`;
button -label "Create";
showWindow;
//i am also able to create an angular array as a pure MEL script with a simple prompt Dialog for the basename of the arrayed objects
//radial array01
float $hyp=10;
int $total=20;
int $height=5;
float $startAngle = 0;
float $incAngle = 360/$total;
float $rad=3.141592654/180;
string $baseName;
string $result3 = `promptDialog
-title "Enter Object Name"
-message "Object Name:"
-button "OK"
-button "Cancel"
-defaultButton "OK"
-cancelButton "Cancel"
-dismissString "Cancel"`;
if ($result3 == "OK")
{
$baseName = `promptDialog -q`;
string $sel[] = `ls -sl`;
for($z=0;$z<$total;$z++)
{
float $transX = $hyp*cos(($startAngle+($incAngle*$z))*$rad);
float $transZ = $hyp*sin(($startAngle+($incAngle*$z))*$rad);
string $dup[] = `duplicate -rr $sel`;
string $name = ($baseName+"_"+$z);
rename $dup $name;
move -r $transX $height $transZ $name;
}
}
to the world of experts out there, how am i able to complete my goal?
Thank you very much
i am able to create a UI dialog on its own with no functionality attached as follows:
// control box
window
-title "Array Parameters"
-widthHeight 500 200;
columnLayout;
string $hyp= `intFieldGrp -label "Distance from origin:"`;
string $total= `intFieldGrp -label "Total number of objects:"`;
string $height= `intFieldGrp -label "Height from Origin:"`;
button -label "Create";
showWindow;
//i am also able to create an angular array as a pure MEL script with a simple prompt Dialog for the basename of the arrayed objects
//radial array01
float $hyp=10;
int $total=20;
int $height=5;
float $startAngle = 0;
float $incAngle = 360/$total;
float $rad=3.141592654/180;
string $baseName;
string $result3 = `promptDialog
-title "Enter Object Name"
-message "Object Name:"
-button "OK"
-button "Cancel"
-defaultButton "OK"
-cancelButton "Cancel"
-dismissString "Cancel"`;
if ($result3 == "OK")
{
$baseName = `promptDialog -q`;
string $sel[] = `ls -sl`;
for($z=0;$z<$total;$z++)
{
float $transX = $hyp*cos(($startAngle+($incAngle*$z))*$rad);
float $transZ = $hyp*sin(($startAngle+($incAngle*$z))*$rad);
string $dup[] = `duplicate -rr $sel`;
string $name = ($baseName+"_"+$z);
rename $dup $name;
move -r $transX $height $transZ $name;
}
}
to the world of experts out there, how am i able to complete my goal?
Thank you very much