-
Notifications
You must be signed in to change notification settings - Fork 2
/
sg2DLaminateEraseDB.py
100 lines (69 loc) · 3.79 KB
/
sg2DLaminateEraseDB.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
from abaqusConstants import *
from abaqusGui import *
from kernelAccess import mdb, session
import os
thisPath = os.path.abspath(__file__)
thisDir = os.path.dirname(thisPath)
###########################################################################
# Class definition
###########################################################################
class SG2DLaminateEraseDB(AFXDataDialog):
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def __init__(self, form):
self.form = form
# Construct the base class.
#
AFXDataDialog.__init__(self, form, 'Erase Layups',
self.OK|self.APPLY|self.CANCEL, DIALOG_ACTIONS_SEPARATOR)
okBtn = self.getActionButton(self.ID_CLICKED_OK)
okBtn.setText('OK')
# layout_m = FXMatrix(p=self, n=2, opts=MATRIX_BY_COLUMNS)
# ----------------------------------------------------------------------
pickHf = FXHorizontalFrame(p=self, opts=0, x=0, y=0, w=0, h=0,
pl=0, pr=0, pt=0, pb=0, hs=DEFAULT_SPACING, vs=DEFAULT_SPACING)
# Note: Set the selector to indicate that this widget should not be
# colored differently from its parent when the 'Color layout managers'
# button is checked in the RSG Dialog Builder dialog.
pickHf.setSelector(99)
label = FXLabel(p=pickHf, text='Pick a baseline: ' + ' (None)', ic=None, opts=LAYOUT_CENTER_Y|JUSTIFY_LEFT)
pickHandler = Erase_layupsDBPickHandler(form, form.baselineKw, 'Pick an entity', EDGES, ONE, label)
icon = afxGetIcon('select', AFX_ICON_SMALL )
FXButton(p=pickHf, text='\tPick Items in Viewport', ic=icon, tgt=pickHandler, sel=AFXMode.ID_ACTIVATE,
opts=BUTTON_NORMAL|LAYOUT_CENTER_Y, x=0, y=0, w=0, h=0, pl=2, pr=2, pt=1, pb=1)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def show(self):
AFXDataDialog.show(self)
# Register a query on sections
#
self.currentModelName = getCurrentContext()['modelName']
self.form.model_nameKw.setValue(self.currentModelName)
# mdb.models[self.currentModelName].sections.registerQuery(self.updateComboBox_1Sections)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def hide(self):
AFXDataDialog.hide(self)
# mdb.models[self.currentModelName].sections.unregisterQuery(self.updateComboBox_1Sections)
###########################################################################
# Class definition
###########################################################################
class Erase_layupsDBPickHandler(AFXProcedure):
count = 0
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def __init__(self, form, keyword, prompt, entitiesToPick, numberToPick, label):
self.form = form
self.keyword = keyword
self.prompt = prompt
self.entitiesToPick = entitiesToPick # Enum value
self.numberToPick = numberToPick # Enum value
self.label = label
self.labelText = label.getText()
AFXProcedure.__init__(self, form.getOwner())
Erase_layupsDBPickHandler.count += 1
self.setModeName('Erase_layupsDBPickHandler%d' % (Erase_layupsDBPickHandler.count) )
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def getFirstStep(self):
return AFXPickStep(self, self.keyword, self.prompt,
self.entitiesToPick, self.numberToPick, sequenceStyle=TUPLE)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def getNextStep(self, previousStep):
self.label.setText( self.labelText.replace('None', 'Picked') )
return None