Pymel Volume Curve


#1

Hi

I try to create simply thing via pymel.

I create a curve, than I create 3D container from Fould tab.
First I select my curve, than 3D container to get 2 selections.
Next step is click on Field/Solvers tab and select Volume Curve

the mel looks like that:

volumeAxis -pos 0 0 0 -m 5 -att 0 -ia 0 -afc 1 -afx 1 -arx 0 -alx 0 -drs 0 -dx 1 -dy 0 -dz 0 -trb 0 -trs 0.2 -tfx 1 -tfy 1 -tfz 1 -tox 0 -toy 0 -toz 0 -dtr 0  -mxd -1  -vsh "curveShape1" -vof 0 0 0 -vsw 360 -tsr 0.5 ;
// Result: volumeAxisField1 // 
connectDynamic -f volumeAxisField1  fluid1;
// Result: fluidShape1 // 
connectAttr time1.outTime volumeAxisField1.time;
// Result: Connected time1.outTime to volumeAxisField1.time. //




I know how to convert that into pymel. But does not work.

also when I copy the mel and I paste that into mel tab to run this 3 lines of code. It works but does not create what was created by clicking the tabs and using the mouse.

I need help, how to recreate a volume through the curve?

thank you


#2

Yes, indeed you are right. Maya forgets to print some actions, e.g set the volume shape of the force field or connect the curve correctly:

curve -d 3 -p -13.208059 0 5.115273 -p -6.959342 0 4.97804 -p -2.278478 0 7.34021 -p -0.323914 0 5.268556 -p -8.788131 0 -1.988922 -k 0 -k 0 -k 0 -k 1 -k 2 -k 2 -k 2 ;
volumeAxis -pos 0 0 0 -m 5 -att 0 -ia 0 -afc 1 -afx 1 -arx 0 -alx 0 -drs 0 -dx 1 -dy 0 -dz 0 -trb 0 -trs 0.2 -tfx 1 -tfy 1 -tfz 1 -tox 0 -toy 0 -toz 0 -dtr 0  -mxd -1  -vsh cube -vof 0 0 0 -vsw 360 -tsr 0.5 ;
connectAttr time1.outTime volumeAxisField1.time;
connectAttr curveShape1.worldSpace[0] volumeAxisField1.inputCurve;
setAttr "volumeAxisField1.volumeShape" 7;

To find out what’s wrong you can always check the original scripts, in this case something like “createCurveField”. Just search for it in mayas script directory with a text editor and you can see what’s happening.