-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathSolidsDlg.py
More file actions
47 lines (37 loc) · 1.62 KB
/
SolidsDlg.py
File metadata and controls
47 lines (37 loc) · 1.62 KB
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
from HeeksObjDlg import HeeksObjDlg
from NiceTextCtrl import ObjectIdsCtrl
import wx
import cad
class SolidsDlg(HeeksObjDlg):
def __init__(self, object, title, add_picture = True):
HeeksObjDlg.__init__(self, object, title, add_picture)
def AddLeftControls(self):
self.idsSolids = ObjectIdsCtrl(self)
self.btnSolidsPick = wx.Button(self, wx.ID_ANY, 'Pick')
self.MakeLabelAndControl('Solids', self.idsSolids, self.btnSolidsPick).AddToSizer(self.sizerLeft)
self.Bind(wx.EVT_BUTTON, self.OnSolidsPick, self.btnSolidsPick)
HeeksObjDlg.AddLeftControls(self)
def SetDefaultFocus(self):
self.idsSolids.SetFocus()
def GetDataRaw(self):
self.object.solids = self.idsSolids.GetIdList()
HeeksObjDlg.GetDataRaw(self)
def SetFromDataRaw(self):
self.idsSolids.SetFromIdList(self.object.solids)
HeeksObjDlg.SetFromDataRaw(self)
def OnSolidsPick(self, event):
self.EndModal(self.btnSolidsPick.GetId())
def PickSolids(self):
cad.ClearSelection(True)
filter = cad.Filter()
filter.AddType(cad.OBJECT_TYPE_STL_SOLID)
if wx.GetApp().IsSolidApp():
import step
filter.AddType(step.GetSolidType())
wx.GetApp().PickObjects('Pick solids', filter, False)
solids = []
for object in cad.GetSelectedObjects():
if object.GetIDGroupType() == cad.OBJECT_TYPE_STL_SOLID:
solids.append(object.GetID())
self.idsSolids.SetFromIdList(solids)
self.Fit()