-
Notifications
You must be signed in to change notification settings - Fork 2
/
vabsToolsetGui.py
182 lines (145 loc) · 7.35 KB
/
vabsToolsetGui.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# -*- coding: utf-8 -*-
# ******************************************************************************
# This script creates a persistent toolset (toolbox buttons next to the viewport)
# which will remain visible no matter which module it in
# ******************************************************************************
from abaqusGui import *
from sessionGui import CanvasToolsetGui
from workplaneV5Form import WorkplaneV5Form
from layupsForm import LayupsForm
from sG1D_v3Form import SG1D_v3Form
from sG2DV5Form import SG2DV5Form
from sg2DLaminateForm import SG2DLaminateForm
from sg2DLaminateEraseForm import SG2DLaminateEraseForm
from sg2DReadFileForm import SG2DReadFileForm
from node9Form import Node9Form
from sG3DV5Form import SG3DV5Form
from scHomoForm import HomoForm
from scMacroForm import MacroForm
from scLocalForm import LocalForm
# from scVisualForm import VisualForm
from vabsForm import VabsForm
from vabsVisualForm import VisualForm
import os
thisPath = os.path.abspath(__file__)
thisDir = os.path.dirname(thisPath)
thisDir = os.path.join(thisDir, 'Icon')
class VABSToolsetGui(AFXToolsetGui):
[
ID_YZview,
ID_LAST
] = range(AFXToolsetGui.ID_LAST, AFXToolsetGui.ID_LAST + 2)
def __init__(self):
# Construct base class.
AFXToolsetGui.__init__(self, 'VABS')
# Toolbox buttons
toolbar_group_1 = AFXToolbarGroup(self, title='VABS Toolset')
ic = afxCreateIcon(os.path.join(thisDir, 'sc_wp_small.png'))
AFXToolButton(p = toolbar_group_1,
label = '\tSet sketch plane for 1D/2D customized SG',
icon = ic,
tgt = WorkplaneV5Form(self),
sel = AFXMode.ID_ACTIVATE)
ic = afxCreateIcon(os.path.join(thisDir, 'view_yz_small.png'))
AFXToolButton(p = toolbar_group_1,
label = '\tApply YZ view',
icon = ic,
tgt = self,
sel = self.ID_YZview)
FXMAPFUNC(self, SEL_COMMAND, self.ID_YZview, VABSToolsetGui.setYZview)
ic = afxCreateIcon(os.path.join(thisDir, 'add_layups_small.png'))
AFXToolButton(p = toolbar_group_1,
label = '\tNew layups',
icon = ic,
tgt = LayupsForm(self),
sel = AFXMode.ID_ACTIVATE)
# FXVerticalSeparator(p=toolbar_group_1, x=0, y=0, w=0, h=0, pl=2, pr=2, pt=2, pb=2)
# ic = afxCreateIcon(os.path.join(thisDir, 'sg_1d_small.png'))
# AFXToolButton(p = toolbar_group_1,
# label = '\tCreate 1D SG',
# icon = ic,
# tgt = SG1D_v3Form(self),
# sel = AFXMode.ID_ACTIVATE)
FXVerticalSeparator(p=toolbar_group_1, x=0, y=0, w=0, h=0, pl=2, pr=2, pt=2, pb=2)
# ic = afxCreateIcon(os.path.join(thisDir, 'sg_2d_uc_small.png'))
# AFXToolButton(p = toolbar_group_1,
# label = '\tCreate 2D SG: Unit cell',
# icon = ic,
# tgt = SG2DV5Form(self),
# sel = AFXMode.ID_ACTIVATE)
ic = afxCreateIcon(os.path.join(thisDir, 'sg_2d_laminate_small.png'))
AFXToolButton(p = toolbar_group_1,
label = '\tCreate 2D SG: Assign layups',
icon = ic,
tgt = SG2DLaminateForm(self),
sel = AFXMode.ID_ACTIVATE)
ic = afxCreateIcon(os.path.join(thisDir, 'sg_2d_laminate_erase_small.png'))
AFXToolButton(p = toolbar_group_1,
label = '\tCreate 2D SG: Erase layups',
icon = ic,
tgt = SG2DLaminateEraseForm(self),
sel = AFXMode.ID_ACTIVATE)
ic = afxCreateIcon(os.path.join(thisDir, 'sg_2d_file_small.png'))
AFXToolButton(p = toolbar_group_1,
label = '\tCreate 2D SG: Read file',
icon = ic,
tgt = SG2DReadFileForm(self),
sel = AFXMode.ID_ACTIVATE)
ic = afxCreateIcon(os.path.join(thisDir, 'node_9_small.png'))
AFXToolButton(p = toolbar_group_1,
label = '\tGenerate 9-node 2D elements',
icon = ic,
tgt = Node9Form(self),
sel = AFXMode.ID_ACTIVATE)
# FXVerticalSeparator(p=toolbar_group_1, x=0, y=0, w=0, h=0, pl=2, pr=2, pt=2, pb=2)
# ic = afxCreateIcon(os.path.join(thisDir, 'sg_3d_small.png'))
# AFXToolButton(p = toolbar_group_1,
# label = '\tCreate 3D SG',
# icon = ic,
# tgt = SG3DV5Form(self),
# sel = AFXMode.ID_ACTIVATE)
FXVerticalSeparator(p=toolbar_group_1, x=0, y=0, w=0, h=0, pl=2, pr=2, pt=2, pb=2)
# ic = afxCreateIcon(os.path.join(thisDir, 'sc_homo_small.png'))
# AFXToolButton(p = toolbar_group_1,
# label = '\tHomogenization',
# icon = ic,
# tgt = HomoForm(self),
# sel = AFXMode.ID_ACTIVATE)
# ic = afxCreateIcon(os.path.join(thisDir, 'sc_import_k_small.png'))
# AFXToolButton(p = toolbar_group_1,
# label = '\tImport homogenized properties',
# icon = ic,
# tgt = MacroForm(self),
# sel = AFXMode.ID_ACTIVATE)
# ic = afxCreateIcon(os.path.join(thisDir, 'sc_dehomo_small.png'))
# AFXToolButton(p = toolbar_group_1,
# label = '\tDehomogenization',
# icon = ic,
# tgt = LocalForm(self),
# sel = AFXMode.ID_ACTIVATE)
ic = afxCreateIcon(os.path.join(thisDir, 'vabs_small.png'))
AFXToolButton(p = toolbar_group_1,
label = '\tVABS',
icon = ic,
tgt = VabsForm(self),
sel = AFXMode.ID_ACTIVATE)
ic = afxCreateIcon(os.path.join(thisDir, 'sc_visual_small.png'))
AFXToolButton(p = toolbar_group_1,
label = '\tVisualization',
icon = ic,
tgt = VisualForm(self),
sel = AFXMode.ID_ACTIVATE)
# FXVerticalSeparator(p=toolbar_group_1, x=0, y=0, w=0, h=0, pl=2, pr=2, pt=2, pb=2)
def getKernelInitializationCommand(self):
h = 'import'
h += ' userDataSG, scHomoMain, scMacroMat, scLocalMain'
h += ', scVisualMain, workplaneMain, layupsMain'
h += ', sg1DMain, sg2DV5Main, sg2DLaminateMain'
h += ', sg2DLaminateErase, sg2DReadFileMain, node9, sg3DV5Main'
h += ', vabsMain, vabsVisualMain'
return h
def setYZview(self, sender, sel, ptr):
cmd = 'session.viewports[session.currentViewportName]'
cmd += '.view.setViewpoint(viewVector = (1, 0, 0), cameraUpVector = (0, 0, 1))'
sendCommand(cmd)
return 1