-
Notifications
You must be signed in to change notification settings - Fork 5
/
InitGui.py
87 lines (65 loc) · 3.22 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# -*- coding: utf-8 -*-
#***************************************************************************
#* *
#* Copyright (c) 2017 *
#* Maurice [email protected] *
#* *
# *
# Defeaturing WB *
# *
# (C) Maurice easyw-fc 2018 *
# This program is free software; you can redistribute it and/or modify *
# it under the terms of the GNU Library General Public License (LGPL) *
# as published by the Free Software Foundation; either version 2 of *
# the License, or (at your option) any later version. *
# for detail see the LICENCE text file. *
#****************************************************************************
DWB_wb_version='v 1.2.2'
global myurlDWB
myurlDWB='https://github.com/easyw/Defeaturing_WB'
global mycommitsDWB
mycommitsDWB=71 #v 1.2.2
import FreeCAD, FreeCADGui, Part, os, sys
import re, time
if (sys.version_info > (3, 0)): #py3
import urllib
from urllib import request, error #URLError, HTTPError
else: #py2
import urllib2
from urllib2 import Request, urlopen, URLError, HTTPError
import dft_locator
from DefeaturingCMD import *
DefeaturingWBpath = os.path.dirname(dft_locator.__file__)
DefeaturingWB_icons_path = os.path.join( DefeaturingWBpath, 'Resources', 'icons')
global main_DWB_Icon
main_DWB_Icon = os.path.join( DefeaturingWB_icons_path , 'Defeaturing-icon.svg')
#try:
# from FreeCADGui import Workbench
#except ImportError as e:
# FreeCAD.Console.PrintWarning("error")
class DefeaturingWB ( Workbench ):
global main_DWB_Icon, DWB_wb_version
"Defeaturing WB object"
Icon = main_DWB_Icon
#Icon = ":Resources/icons/kicad-StepUp-tools-WB.svg"
MenuText = "Defeaturing"
ToolTip = "Defeaturing workbench"
def GetClassName(self):
return "Gui::PythonWorkbench"
def Initialize(self):
self.appendToolbar("Defeaturing Tools", ["DefeaturingTools","DF_SelectLoop","refineFeatureTool","DefeatShapeFeature"])
#self.appendMenu("ksu Tools", ["ksuTools","ksuToolsEdit"])
self.appendMenu("Defeaturing Tools", ["refineFeatureTool","DefeaturingTools","DF_SelectLoop"])
self.appendToolbar("Fuzzy Tools", ["FuzzyCut","FuzzyUnion","FuzzyCommon"])
self.appendMenu("Fuzzy Tools", ["FuzzyCut","FuzzyUnion","FuzzyCommon"])
Log ("Loading Defeaturing Module... done\n")
def Activated(self):
# do something here if needed...
Msg ("Defeaturing WB Activated("+DWB_wb_version+")\n")
from PySide import QtGui
import time
def Deactivated(self):
# do something here if needed...
Msg ("Defeaturing WB Deactivated()\n")
###
FreeCADGui.addWorkbench(DefeaturingWB)