-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathSketchOpDlg.py
45 lines (34 loc) · 1.55 KB
/
SketchOpDlg.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
from DepthOpDlg import DepthOpDlg
from HDialog import HTypeObjectDropDown
import wx
import cad
from HDialog import ComboBoxBinded
class SketchOpDlg(DepthOpDlg):
def __init__(self, object, title = 'Sketch Operation'):
DepthOpDlg.__init__(self, object, False, title)
def AddLeftControls(self):
self.cmbSketch = HTypeObjectDropDown(self, cad.OBJECT_TYPE_SKETCH, cad.GetApp(), self.OnSketchCombo)
self.btnSketchPick = wx.Button(self, wx.ID_ANY, 'Pick')
self.MakeLabelAndControl('Sketches', self.cmbSketch, self.btnSketchPick).AddToSizer(self.sizerLeft)
self.btnSketchPick.Bind(wx.EVT_BUTTON, self.OnSketchPick )
DepthOpDlg.AddLeftControls(self)
def SetDefaultFocus(self):
self.cmbSketch.SetFocus()
def GetDataRaw(self):
self.object.sketch = self.cmbSketch.GetSelectedId()
DepthOpDlg.GetDataRaw(self)
def SetFromDataRaw(self):
self.cmbSketch.SelectById(self.object.sketch)
DepthOpDlg.SetFromDataRaw(self)
def OnSketchPick(self, event):
self.EndModal(self.btnSketchPick.GetId())
def PickSketch(self):
cad.ClearSelection()
wx.GetApp().PickObjects('Pick a sketch', cad.OBJECT_TYPE_SKETCH, True)
self.cmbSketch.Recreate()
self.Fit()
id = 0
if cad.GetNumSelected() > 0: id = cad.GetSelectedObjects()[0].GetID()
self.cmbSketch.SelectById(id)
def OnSketchCombo(self, event):
print('SketchOpDlg.OnSketchCombo')