PDA

View Full Version : code only works in stages??


jenny077
10-01-2007, 01:09 AM
hi,
here a segment of my code. Can someone please tell me why the last bit only works when run seperately from the top?
The make planar only works after running the top first?? it should all work in the one go yeah?
whats wrong here?

//note in the in the script..




///SECTION 1



nurbsSquare -c 18.5 23 0 -nr 0 0 1 -sl1 46 -sl2 37 -sps 1 -d 3 -ch 1 ;
loft -ch 1 -u 1 -c 0 -ar 1 -d 3 -ss 1 -rn 0 -po 1 -rsn true "topnurbsSquare1" "bottomnurbsSquare1";
select -r loftedSurface1 ;
rename FF2_P1 ;
duplicate -n Facade2section1 ;
polyExtrudeFacet -ch 0 -kft 0 -pvx 2 -pvy 23 -pvz 0 -tx 0 -ty 0 -tz 0 -rx 0 -ry 0 -rz 0 -sx 1 -sy 1 -sz 1 -ran 0 -divisions 1 -twist 0 -taper 0 -off 0 -ltz -2 -ws 0 -ltx 0 -lty 0 -lrx 0 -lry 0 -lrz 0 -lsx 1 -lsy 1 -lsz 1 -ldx 1 -ldy 1 -ldz 1 -w 0 -gx 0 -gy -1 -gz 0 -att 0 -mx 0 -my 0 -mz 0 Facade2section1.f[0];


select -r bottomnurbsSquare1 rightnurbsSquare1 ;
delete -ch bottomnurbsSquare1;
delete -ch rightnurbsSquare1;
attachCurve -ch 0 -rpo 1 -kmk 1 -m 0 -bb 1 -bki 0 -p 0.1 "bottomnurbsSquare1" "rightnurbsSquare1" ;
delete rightnurbsSquare1;

select -r topnurbsSquare1 leftnurbsSquare1 ;
delete -ch topnurbsSquare1;
delete -ch leftnurbsSquare1;
attachCurve -ch 0 -rpo 1 -kmk 1 -m 0 -bb 1 -bki 0 -p 0.1 "topnurbsSquare1" "leftnurbsSquare1" ;
delete leftnurbsSquare1;

select -cl ;
select -r bottomnurbsSquare1 ;
select -tgl topnurbsSquare1 ;
attachCurve -ch 0 -rpo 1 -kmk 1 -m 0 -bb 1 -bki 0 -p 0.1 "bottomnurbsSquare1" "topnurbsSquare1" ;
delete topnurbsSquare1;

select -r bottomnurbsSquare1 ;
rename FF2_C1;


///SECTION 2



nurbsSquare -c 41 24.5 0 -nr 0 0 1 -sl1 49 -sl2 8 -sps 1 -d 3 -ch 1 ;
loft -ch 1 -u 1 -c 0 -ar 1 -d 3 -ss 1 -rn 0 -po 1 -rsn true "topnurbsSquare1" "bottomnurbsSquare1";
select -r loftedSurface1 ;
rename FF2_P2 ;
duplicate -n Facade2section2 ;
polyExtrudeFacet -ch 0 -kft 0 -pvx 2 -pvy 23 -pvz 0 -tx 0 -ty 0 -tz 0 -rx 0 -ry 0 -rz 0 -sx 1 -sy 1 -sz 1 -ran 0 -divisions 1 -twist 0 -taper 0 -off 0 -ltz -2 -ws 0 -ltx 0 -lty 0 -lrx 0 -lry 0 -lrz 0 -lsx 1 -lsy 1 -lsz 1 -ldx 1 -ldy 1 -ldz 1 -w 0 -gx 0 -gy -1 -gz 0 -att 0 -mx 0 -my 0 -mz 0 Facade2section2.f[0];


select -r bottomnurbsSquare1 rightnurbsSquare1 ;
delete -ch bottomnurbsSquare1;
delete -ch rightnurbsSquare1;
attachCurve -ch 0 -rpo 1 -kmk 1 -m 0 -bb 1 -bki 0 -p 0.1 "bottomnurbsSquare1" "rightnurbsSquare1" ;
delete rightnurbsSquare1;

select -r topnurbsSquare1 leftnurbsSquare1 ;
delete -ch topnurbsSquare1;
delete -ch leftnurbsSquare1;
attachCurve -ch 0 -rpo 1 -kmk 1 -m 0 -bb 1 -bki 0 -p 0.1 "topnurbsSquare1" "leftnurbsSquare1" ;
delete leftnurbsSquare1;

select -cl ;
select -r bottomnurbsSquare1 ;
select -tgl topnurbsSquare1 ;
attachCurve -ch 0 -rpo 1 -kmk 1 -m 0 -bb 1 -bki 0 -p 0.1 "bottomnurbsSquare1" "topnurbsSquare1" ;
delete topnurbsSquare1;

select -r bottomnurbsSquare1 ;
rename FF2_C2 ;



///SECTION 3



nurbsSquare -c 49.5 23 0 -nr 0 0 1 -sl1 46 -sl2 9 -sps 1 -d 3 -ch 1 ;
loft -ch 1 -u 1 -c 0 -ar 1 -d 3 -ss 1 -rn 0 -po 1 -rsn true "topnurbsSquare1" "bottomnurbsSquare1";
select -r loftedSurface1 ;
rename FF2_P3 ;
duplicate -n Facade2section3 ;
polyExtrudeFacet -ch 0 -kft 0 -pvx 2 -pvy 23 -pvz 0 -tx 0 -ty 0 -tz 0 -rx 0 -ry 0 -rz 0 -sx 1 -sy 1 -sz 1 -ran 0 -divisions 1 -twist 0 -taper 0 -off 0 -ltz -2 -ws 0 -ltx 0 -lty 0 -lrx 0 -lry 0 -lrz 0 -lsx 1 -lsy 1 -lsz 1 -ldx 1 -ldy 1 -ldz 1 -w 0 -gx 0 -gy -1 -gz 0 -att 0 -mx 0 -my 0 -mz 0 Facade2section3.f[0];


select -r bottomnurbsSquare1 rightnurbsSquare1 ;
delete -ch bottomnurbsSquare1;
delete -ch rightnurbsSquare1;
attachCurve -ch 0 -rpo 1 -kmk 1 -m 0 -bb 1 -bki 0 -p 0.1 "bottomnurbsSquare1" "rightnurbsSquare1" ;
delete rightnurbsSquare1;

select -r topnurbsSquare1 leftnurbsSquare1 ;
delete -ch topnurbsSquare1;
delete -ch leftnurbsSquare1;
attachCurve -ch 0 -rpo 1 -kmk 1 -m 0 -bb 1 -bki 0 -p 0.1 "topnurbsSquare1" "leftnurbsSquare1" ;
delete leftnurbsSquare1;

select -cl ;
select -r bottomnurbsSquare1 ;
select -tgl topnurbsSquare1 ;
attachCurve -ch 0 -rpo 1 -kmk 1 -m 0 -bb 1 -bki 0 -p 0.1 "bottomnurbsSquare1" "topnurbsSquare1" ;
delete topnurbsSquare1;

select -r bottomnurbsSquare1 ;
rename FF2_C3 ;


///SECTION 4



nurbsSquare -c 78 49.5 0 -nr 0 0 1 -sl1 99 -sl2 8 -sps 1 -d 3 -ch 1 ;
loft -ch 1 -u 1 -c 0 -ar 1 -d 3 -ss 1 -rn 0 -po 1 -rsn true "topnurbsSquare1" "bottomnurbsSquare1";
select -r loftedSurface1 ;
rename FF2_P4 ;
duplicate -n Facade2section4 ;
polyExtrudeFacet -ch 0 -kft 0 -pvx 2 -pvy 23 -pvz 0 -tx 0 -ty 0 -tz 0 -rx 0 -ry 0 -rz 0 -sx 1 -sy 1 -sz 1 -ran 0 -divisions 1 -twist 0 -taper 0 -off 0 -ltz -2 -ws 0 -ltx 0 -lty 0 -lrx 0 -lry 0 -lrz 0 -lsx 1 -lsy 1 -lsz 1 -ldx 1 -ldy 1 -ldz 1 -w 0 -gx 0 -gy -1 -gz 0 -att 0 -mx 0 -my 0 -mz 0 Facade2section4.f[0];


select -r bottomnurbsSquare1 rightnurbsSquare1 ;
delete -ch bottomnurbsSquare1;
delete -ch rightnurbsSquare1;
attachCurve -ch 0 -rpo 1 -kmk 1 -m 0 -bb 1 -bki 0 -p 0.1 "bottomnurbsSquare1" "rightnurbsSquare1" ;
delete rightnurbsSquare1;

select -r topnurbsSquare1 leftnurbsSquare1 ;
delete -ch topnurbsSquare1;
delete -ch leftnurbsSquare1;
attachCurve -ch 0 -rpo 1 -kmk 1 -m 0 -bb 1 -bki 0 -p 0.1 "topnurbsSquare1" "leftnurbsSquare1" ;
delete leftnurbsSquare1;

select -cl ;
select -r bottomnurbsSquare1 ;
select -tgl topnurbsSquare1 ;
attachCurve -ch 0 -rpo 1 -kmk 1 -m 0 -bb 1 -bki 0 -p 0.1 "bottomnurbsSquare1" "topnurbsSquare1" ;
delete topnurbsSquare1;

select -r bottomnurbsSquare1 ;
rename FF2_C4 ;






///FACADE 2 DATA



select -r FF2_P1 FF2_P2 FF2_P3 FF2_P4 FF2_C1 FF2_C2 FF2_C3 FF2_C4 ;
$dupeGroupF2 = `duplicate -rr`;

for($x=0;$x<34;$x++){
$randX=rand(-4,46);
$randY=rand(-4,46);
$randZ=rand(-4,46);
move -r $randX $randY $randZ $dupeGroupF2[$x];
move -r $randX $randY $randZ $dupeGroupF2[$x+4];
setKeyframe -t 1 -v 0 -at "visibility" $dupeGroupF2[$x];
setKeyframe -t 10 -v 1 -at "visibility" $dupeGroupF2[$x];
select $dupeGroupF2[$x];

ConvertSelectionToEdges;
ConvertSelectionToShellBorder;
polyExtrudeEdge -constructionHistory 1;
ConvertSelectionToVertices;
$cluster = `newCluster " -envelope 1"`;
int $i = 10;
setKeyframe -t $i -v 0 -at "translateZ" $cluster;
setKeyframe -t ($i+10) -v -56 -at "translateZ" $cluster;
}



///WHY DOES THIS BOTTOM CODE ONLY WORK WHEN RUN SEPERATELY FROM THE ABOVE???

for($c=5;$x<8;$c++){
select -add ("FF2_C" + $c);
planarSrf ;
}

r4inm4ker
10-01-2007, 01:58 AM
for($c=5;$x<8;$c++){
select -add ("FF2_C" + $c);
planarSrf ;
}

is that a bug or intended one? (not really trace your code, just a quick glance)

jenny077
10-01-2007, 02:08 AM
is that a bug or intended one? (not really trace your code, just a quick glance)


oh yeah it should be 'c' but it doesnt matter, it still doesnt work as it should.

this script should run and finish with planes added, however it only does this after I run the code above this and then this code?

why is this?

Robert Bateman
10-01-2007, 09:40 AM
because your script is causing a runtime error, and so maya decides to give up running it.... size($dupeGroupF2) reports 8, you are indexing it up to 38.....


for($x=0;$x<4;$x++){
$randX=rand(-4,46);
$randY=rand(-4,46);
$randZ=rand(-4,46);
move -r $randX $randY $randZ $dupeGroupF2[$x];
move -r $randX $randY $randZ $dupeGroupF2[$x+4];
setKeyframe -t 1 -v 0 -at "visibility" $dupeGroupF2[$x];
setKeyframe -t 10 -v 1 -at "visibility" $dupeGroupF2[$x];
select $dupeGroupF2[$x];

ConvertSelectionToEdges;
ConvertSelectionToShellBorder;
polyExtrudeEdge -constructionHistory 1;
ConvertSelectionToVertices;
$cluster = `newCluster " -envelope 1"`;
int $i = 10;
setKeyframe -t $i -v 0 -at "translateZ" $cluster;
setKeyframe -t ($i+10) -v -56 -at "translateZ" $cluster;
}

will make it run, but why you think there will be 34 items there i'm not really sure what you are doing??

CGTalk Moderation
10-01-2007, 09:40 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.