-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathshowNode_plugin.py
98 lines (80 loc) · 2.89 KB
/
showNode_plugin.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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
from abaqusGui import *
from abaqusConstants import ALL
import osutils, os
from myIcons import showNodeIcon
import i18n
###########################################################################
# Class definition
###########################################################################
class ShowNode_plugin(AFXForm):
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def __init__(self, owner):
# Construct the base class.
#
AFXForm.__init__(self, owner)
self.radioButtonGroups = {}
self.cmd = AFXGuiCommand(mode=self, method='showPickedNode',
objectName='myPluginFunctions', registerQuery=False)
pickedDefault = ''
self.myNodeKw = AFXObjectKeyword(self.cmd, 'myNode', TRUE, pickedDefault)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def getFirstDialog(self):
import showNodeDB
return showNodeDB.ShowNodeDB(self)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def doCustomChecks(self):
# Try to set the appropriate radio button on. If the user did
# not specify any buttons to be on, do nothing.
#
for kw1,kw2,d in self.radioButtonGroups.values():
try:
value = d[ kw1.getValue() ]
kw2.setValue(value)
except:
pass
return True
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def okToCancel(self):
# No need to close the dialog when a file operation (such
# as New or Open) or model change is executed.
#
return False
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Register the plug-in
#
thisPath = os.path.abspath(__file__)
thisDir = os.path.dirname(thisPath)
toolset = getAFXApp().getAFXMainWindow().getPluginToolset()
pluginDesc = i18n.tr( \
'A simple Node Extractor')
# Register a GUI plug-in in the Plug-ins menu.
#
toolset.registerGuiMenuButton(
object=ShowNode_plugin(toolset),
buttonText=i18n.tr('My Plugins|Get a Node Label'),
messageId=AFXMode.ID_ACTIVATE,
icon=None,
kernelInitString='import myPluginFunctions',
applicableModules=ALL,
#applicableModules = ['Visualization'],
version='1.0',
author='Johannes Huber',
description=pluginDesc,
helpUrl='N/A'
)
# Register a GUI plug-in in a toolbox.
#
icon = FXXPMIcon(getAFXApp(), showNodeIcon)
toolset.registerGuiToolButton('My Toolbox',
object=ShowNode_plugin(toolset),
buttonText=i18n.tr('\tFind a Node\nand show Label'),
kernelInitString='import myPluginFunctions',
icon=icon,
applicableModules=ALL,
#applicableModules = ['Part', 'Property', 'Assembly', 'Step',
# 'Interaction', 'Load', 'Mesh', 'Job'],
version='1.0',
author='Johannes Huber',
description=pluginDesc,
helpUrl='N/A'
)