-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFRCTools.py
56 lines (41 loc) · 1.89 KB
/
FRCTools.py
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
# Assuming you have not changed the general structure of the template no modification is needed in this file.
import adsk.core
from . import commands
from .lib import fusionAddInUtils as futil
from . import config
app = adsk.core.Application.get()
ui = app.userInterface
def run(context):
try:
# ******** Add a button into the UI so the user can run the command. ********
# Get the target workspace the button will be created in.
workspace = ui.workspaces.itemById(config.WORKSPACE_ID)
# Get the panel the button will be created in.
panel = workspace.toolbarPanels.itemById(config.PANEL_ID)
sketchpanel = workspace.toolbarPanels.itemById(config.SKETCH_CREATE_ID)
# Create the the FRCTool submenu.
submenu = panel.controls.addDropDown( "FRCTools", "", config.DROPDOWN_ID )
submenu = sketchpanel.controls.addDropDown( "FRCTools", "", config.DROPDOWN_ID )
# This will run the start function in each of your commands as defined in commands/__init__.py
commands.start()
except:
futil.handle_error('run')
def stop(context):
try:
# Remove all of the event handlers your app has created
futil.clear_handlers()
# This will run the stop function in each of your commands as defined in commands/__init__.py
commands.stop()
workspace = ui.workspaces.itemById(config.WORKSPACE_ID)
panel = workspace.toolbarPanels.itemById(config.PANEL_ID)
submenu = panel.controls.itemById( config.DROPDOWN_ID )
# Delete the FRCTools submenu
if submenu:
submenu.deleteMe()
sketchpanel = workspace.toolbarPanels.itemById(config.SKETCH_CREATE_ID)
submenu = sketchpanel.controls.itemById( config.DROPDOWN_ID )
# Delete the FRCTools submenu
if submenu:
submenu.deleteMe()
except:
futil.handle_error('stop')