Tasks/StopDevice.py
Main Page
Groups
Classes
Examples
Tasks/StopDevice.py
1
# Copyright 2009 Autodesk, Inc. All rights reserved.
2
# Use of this software is subject to the terms of the Autodesk license agreement
3
# provided at the time of installation or download, or which otherwise accompanies
4
# this software in either electronic or hard copy form.
5
#
6
# Script description:
7
# Find a Device (from its name) in the scene and stop it
8
#
9
# Topic: FBDevice, FBPlayerControl
10
#
11
12
from
pyfbsdk
import
*
13
14
#Change the name of the following constant to match your device name
15
DeviceName =
"My Device"
16
17
def
FindDevice( pName ):
18
lResult =
None
19
lDeviceList =
FBSystem
().Scene.Devices
20
21
if
lDeviceList:
22
#print "get camera device"
23
for
lDevice
in
lDeviceList:
24
#print "Device Name = %s" % lDevice.Name
25
if
lDevice.Name == pName:
26
lResult = lDevice
27
break
28
else
:
29
print
'No device found'
30
31
return
lResult
32
33
34
#Actual script
35
lDevice = FindDevice( DeviceName )
36
if
lDevice:
37
lPlayer =
FBPlayerControl
()
38
lPlayer.Stop()
39
40
lDevice.RecordMode =
False
41
lDevice.Live =
False
42
else
:
43
print
'No device found'
44