-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsample_03.py
More file actions
86 lines (59 loc) · 1.74 KB
/
sample_03.py
File metadata and controls
86 lines (59 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#####################################################################################
#
# Sample 03 - This sample presents the Event processing.
#
# Python 3.5.2
#
# SDK 3dRudder
#
# Copyright (C) 2016-2017 3dRudder
#
#####################################################################################
import platform
# 32 or 64 bit
val_max=platform.architecture()
print(val_max[0])
if (val_max[0]=='32bit') :
from win32.Python363.ns3DRudder import * #import SDk 3dRudder
else:
from x64.Python363.ns3DRudder import * #import SDk 3dRudder
import time
#-------------------------------------
#-------------------------------------
class CEvent(IEvent):
def __init__(self) :
IEvent.__init__(self)
print("Create Event")
def OnConnect(self,nDeviceNumber):
print("-> 3dRudder is Connected")
def OnDisconnect(self,nDeviceNumber):
print("-> 3dRudder is DisConnected")
#-------------------------------------
# my code here
#-------------------------------------
def main():
print("----------------------------")
print("3dRudder")
print("----------------------------")
print("Start Sample 03")
# 3dRudder settings
nPortNumber=0
myevent = CEvent()
try:
# Init SDk 3dRudder
sdk=GetSDK()
sdk.Init()
sdk.SetEvent(myevent)
while True:
time.sleep(1)
except KeyboardInterrupt as e:
print ("->Stop by User")
except ValueError as err:
print ("Error : ",err )
finally:
print("End Sample 03")
print("----------------------------")
#-------------------------------------
#-------------------------------------
if(__name__ == "__main__"):
main()