BasicOperations/LockProperty.py
 
 
 
BasicOperations/LockProperty.py
# Copyright 2012 Autodesk, Inc.  All rights reserved.
# Use of this software is subject to the terms of the Autodesk license agreement 
# provided at the time of installation or download, or which otherwise accompanies
# this software in either electronic or hard copy form.
#
# Script description:
# Shows how locked properties can be used.
#

from pyfbsdk import *

# Create a simple cube on which properties will be manipulated.
cube = FBModelCube( "Cube" )
cube.Show = True

# Get the scaling property which we will manipulate.
scaling = cube.PropertyList.Find( 'Lcl Scaling' )
scaling.Data = FBVector3d( 2 , 2 , 2 )
print "After setting to (2,2,2) : " + str(scaling.Data)

# Lock the property and change it.
scaling.SetLocked( True )
scaling.Data = FBVector3d( 3 , 3 , 3 )
print "After locking and setting to (3,3,3) : " + str(scaling.Data)

# Query to check if the property is locked.
print "Is the property locked : " + str(scaling.IsLocked())

# Unlock the property and change it.
scaling.SetLocked( False )
scaling.Data = FBVector3d( 4 , 4 , 4 )
print "After unlocking and setting to (4,4,4) : " + str(scaling.Data)

# Query to check if the property is locked.
print "Is the property locked : " + str(scaling.IsLocked())

# Lock Y and change the whole property.
scaling.SetMemberLocked( 1 , True )
scaling.Data = FBVector3d( 5 , 5 , 5 )
print "After locking Y and setting to (5,5,5) : " + str(scaling.Data)

# Query to check if members are locked.
print "Is X locked : " + str(scaling.IsMemberLocked( 0 ))
print "Is Y locked : " + str(scaling.IsMemberLocked( 1 ))
print "Is Z locked : " + str(scaling.IsMemberLocked( 2 ))

# Unlock Y and change the whole property.
scaling.SetMemberLocked( 1 , False )
scaling.Data = FBVector3d( 6 , 6 , 6 )
print "After unlocking Y and setting to (6,6,6) : " + str(scaling.Data)

# Clean-up
del( cube )