-
Notifications
You must be signed in to change notification settings - Fork 47
/
InitGui.py
72 lines (66 loc) · 2.83 KB
/
InitGui.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
import drawingDimensioning #QtCore.QResource.registerResource happens in there
class DrawingDimensioningWorkbench (Workbench):
Icon = ':/dd/icons/linearDimension.svg'
MenuText = 'Drawing Dimensioning'
def Initialize(self):
from drawingDimensioning import newpageShortcuts
self.appendToolbar('Drawing Workbench shortcuts', newpageShortcuts + [
'dd_new_drawing_page_preferences',
'dd_Drawing_OrthoViews',
] )
# copy the Drawing toolbar
import DrawingGui
self.appendToolbar('Drawing Workbench Commands',[
"Drawing_NewPage",
"Drawing_NewView",
"Drawing_OrthoViews",
"Drawing_OpenBrowserView",
"Drawing_Annotation",
"Drawing_Clip",
"Drawing_Symbol",
"Drawing_DraftView",
"Drawing_ExportPage"
])
commandslist = [
'dd_linearDimension', #where dd is short-hand for drawing dimensioning
'dd_linearDimensionStack',
'dd_circularDimension',
'dd_radiusDimension',
'dd_angularDimension',
'dd_centerLines',
'dd_centerLine',
'dd_noteCircle',
'dd_grabPoint',
'dd_addText',
# 'dd_editText', # no longer available to user, else to complicated! In particular multiple avenues available to user to change text properties
# 'dd_moveText', # therefore sticking with the FreeCAD way of doing things
'dd_addTolerance',
'dd_addTable',
'dd_deleteDimension',
'dd_escapeDimensioning',
'dd_recomputeDimensions',
]
self.appendToolbar('Drawing Dimensioning', commandslist)
unfold_cmds = [
'dd_unfold',
'dd_bendingNote',
'dd_centerView',
'dd_exportToDxf'
]
self.appendToolbar( 'Drawing Dimensioning Folding', unfold_cmds )
from drawingDimensioning import weldingSymbols
freecad_version = float( FreeCAD.Version()[1] )
try:
git_commit_no = int( FreeCAD.Version()[2].split()[0] )
except:
git_commit_no = -1
# freecad_version = int( FreeCAD.Version()[1] )
if git_commit_no > 5166 or freecad_version > 15:
weldingCommandList = ['dd_weldingGroupCommand']
else:
weldingCommandList = weldingSymbols.weldingCmds
self.appendToolbar('Drawing Dimensioning Welding Symbols', weldingCommandList)
self.appendToolbar('Drawing Dimensioning Help', [ 'dd_help' ])
FreeCADGui.addIconPath(':/dd/icons')
FreeCADGui.addPreferencePage( ':/dd/ui/drawing_dimensioing_prefs-base.ui','Drawing Dimensioning' )
Gui.addWorkbench(DrawingDimensioningWorkbench())