# Creating a locator
import maya.cmds as mc;
sloc= mc.spaceLocator()[0];
# Set small decimal values to ty and sz attributes
ty= sloc+".ty";
sz= sloc+".sz";
mc.setAttr(ty, 0.0000000001);
mc.setAttr(sz, 1.000000000001);
# Translate value
tval= mc.getAttr(ty);
print tval; # This prints "1e-10"
if tval==0:
print "test: translate value"; # This won't print
# Scale value
sval= mc.getAttr(sz);
print sval; # This prints "1.0"
if sval==1:
print "test: scale value"; # This won't print
# Using the decimal module
from decimal import Decimal;
print Decimal(tval);
# This prints "1.0000000000000000364321973154977415791655470655996396089904010295867919921875E-10"
print Decimal(sval);
# This prints "1.0000000000010000889005823410116136074066162109375"
# PI
from math import pi as PI;
print PI; #output: 3.14159265359
from decimal import Decimal;
print Decimal(PI); #output: 3.141592653589793115997963468544185161590576171875
Comments
Post a Comment