Not all numbers are exactly representable as floats


Representable numbers

The number of digits (or bits) of precision also limits the set of rational numbers that can be represented exactly. For example, the number 123456789 clearly cannot be exactly represented if only eight decimal digits of precision are available.

Inexactness

Floating-point arithmetic on digital computers is inherently inexact. The 24 bits (including the hidden bit) of mantissa in a 32-bit floating-point number represent approximately 7 significant decimal digits. Unlike the real number system, which is continuous, a floating-point system has gaps between each number. If a number is not exactly representable, then it must be approximated by one of the nearest representable values.

In Softimage, you can see the inexactness of floating point numbers with a floating point parameter on a PPG, or with the Scalar node in an ICE tree. In either case, try entering the value 123456789: you’ll end up with the value 123456792.

If you run this Python snippet in a script editor, you can try this out:

import win32com.client
from win32com.client import constants

xsi = Application

oCustomProperty = xsi.ActiveSceneRoot.AddProperty( "CustomProperty", False, "Test" )
oCustomProperty.AddParameter2("Int",constants.siInt4,0,None,None,0,None,constants.siClassifUnknown,constants.siPersistable + constants.siKeyable)
oCustomProperty.AddParameter2("Float",constants.siFloat,0,None,None,0,None,constants.siClassifUnknown,constants.siPersistable + constants.siKeyable)
oCustomProperty.AddParameter2("Double",constants.siDouble,0,None,None,0,None,constants.siClassifUnknown,constants.siPersistable + constants.siKeyable)

xsi.InspectObj( oCustomProperty )

xsi.SetValue("Test.Float", 123456789)
x = xsi.GetValue( "Test.Float" )

xsi.LogMessage( x )
# INFO : 123456792.0

Using Python for RV_Init callbacks of relational views


Want to use Python to implement an RV_Init callback in an .xsivw file? Here’s how:

<script language="Python"><![CDATA[
def RV_Init( in_rv ):
	Application.LogMessage( "RV_Init" )
	
	# COM programming ( in_rv is pointer to IUnknown ) 
	import pythoncom
	oRV = in_rv.QueryInterface( pythoncom.IID_IDispatch )
	
	import win32com.client.dynamic
	oRV = win32com.client.dynamic.Dispatch( oRV )
	
	Application.LogMessage( Application.Classname(oRV) )
	
	for i in range(0,oRV.Views.Count):
		oView = oRV.Views(i)
		Application.LogMessage( oView.Name + " " + oView.type 	)

]]></script>

Softimage 2011 and Python


On Windows, Python 2.6.4 is automatically installed with Softimage 2011. You don’t need to install Python or pywin32 yourself, unless you need to use a different version of Python.

If you need to use a different version of Python, then you can turn off the Use Python installed with Softimage preference.

What is logged in SoftimageLicense.log when Softimage cannot connect to the license server


This is what you’ll see in SoftimageLicense.log if Softimage cannot connect to the license server.
For example, if ADSKFLEX_LICENSE_FILE is pointing to the wrong server, you’ll see this sequence of errors in the log:

  • Cannot connect to server
  • License check out failed
  • The desired vendor daemon is down
  • License check out failed
6016	2010/03/15	12:40:22	Reason=Fatal error
6016	2010/03/15	12:40:22	ComputerName=MTL-EXAMPLE
6016	2010/03/15	12:40:22	OS=6.0.6001.Service Pack 1
6016	2010/03/15	12:40:22	File=AdlmIntNWFBLicense.cpp,Line=684
6016	2010/03/15	12:40:22	VendorID=3 [FLEXLM-NW]
6016	2010/03/15	12:40:22	VendorError=-15 [Cannot connect to server]
6016	2010/03/15	12:40:22	FLEXLM-NW=v11.6.1.3 build 72149 x64_n6
6016	2010/03/15	12:40:22	Reason=Fatal error
6016	2010/03/15	12:40:22	ComputerName=MTL-EXAMPLE
6016	2010/03/15	12:40:22	OS=6.0.6001.Service Pack 1
6016	2010/03/15	12:40:22	File=AdlmIntNWFBLicense.cpp,Line=667
6016	2010/03/15	12:40:22	AdlmIntError=20 [License check out failed]
6016	2010/03/15	12:40:41	Reason=Fatal error
6016	2010/03/15	12:40:41	ComputerName=MTL-EXAMPLE
6016	2010/03/15	12:40:41	OS=6.0.6001.Service Pack 1
6016	2010/03/15	12:40:41	File=AdlmIntNWFBLicense.cpp,Line=684
6016	2010/03/15	12:40:41	VendorID=3 [FLEXLM-NW]
6016	2010/03/15	12:40:41	VendorError=-97 [The desired vendor daemon is down]
6016	2010/03/15	12:40:41	FLEXLM-NW=v11.6.1.3 build 72149 x64_n6
6016	2010/03/15	12:40:41	Reason=Fatal error
6016	2010/03/15	12:40:41	ComputerName=MTL-EXAMPLE
6016	2010/03/15	12:40:41	OS=6.0.6001.Service Pack 1
6016	2010/03/15	12:40:41	File=AdlmIntNWFBLicense.cpp,Line=667
6016	2010/03/15	12:40:41	AdlmIntError=20 [License check out failed]