forked from yorikvanhavre/BIM_Workbench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBimSetup.py
488 lines (449 loc) · 24 KB
/
BimSetup.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
#***************************************************************************
#* *
#* Copyright (c) 2017 Yorik van Havre <[email protected]> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser 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. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************
"""This module contains FreeCAD commands for the BIM workbench"""
import os,sys
import FreeCAD
from BimTranslateUtils import *
class BIM_Setup:
def GetResources(self):
return {'Pixmap' : ":icons/preferences-system.svg",
'MenuText': QT_TRANSLATE_NOOP("BIM_Setup", "BIM Setup..."),
'ToolTip' : QT_TRANSLATE_NOOP("BIM_Setup", "Set some common FreeCAD preferences for BIM workflow")}
def Activated(self):
import FreeCADGui
TECHDRAWDIMFACTOR = 0.16 # How many times TechDraw dim arrows are smaller than Draft
# load dialog
from PySide import QtGui
self.form = FreeCADGui.PySideUic.loadUi(os.path.join(os.path.dirname(__file__),"dialogSetup.ui"))
# center the dialog over FreeCAD window
mw = FreeCADGui.getMainWindow()
self.form.move(mw.frameGeometry().topLeft() + mw.rect().center() - self.form.rect().center())
# connect signals / slots
self.form.comboPresets.currentIndexChanged[int].connect(self.setPreset)
self.form.labelIfcOpenShell.linkActivated.connect(self.handleLink)
# fill default values
self.setPreset(None)
# check missing addons
self.form.labelMissingWorkbenches.hide()
self.form.labelIfcOpenShell.hide()
self.form.labelSnapTip.hide()
m = []
try:
import RebarTools
except ImportError:
m.append("Reinforcement")
try:
import BIMServer
except ImportError:
m.append("WebTools")
if sys.version_info.major < 3:
try:
import CommandsFrame
except ImportError:
m.append("Flamingo")
else:
try:
import CFrame
except ImportError:
m.append("Dodo")
try:
import FastenerBase
except ImportError:
m.append("Fasteners")
try:
import report
except ImportError:
m.append("Reporting")
try:
import ifcopenshell
except ImportError:
ifcok = False
else:
ifcok = True
libok = False
librarypath = FreeCAD.ParamGet('User parameter:Plugins/parts_library').GetString('destination','')
if librarypath and os.path.exists(librarypath):
libok = True
else:
# check if the library is at the standard addon location
librarypath = os.path.join(FreeCAD.getUserAppDataDir(),"Mod","parts_library")
if os.path.exists(librarypath):
FreeCAD.ParamGet('User parameter:Plugins/parts_library').SetString('destination',librarypath)
libok = True
if not libok:
m.append("Parts Library")
if m:
t = translate("BIM","Some additional workbenches are not installed, that extend BIM functionality:")+" <b>"+",".join(m)+"</b>. "+translate("BIM","You can install them from menu Tools -> Addon manager.")
self.form.labelMissingWorkbenches.setText(t)
self.form.labelMissingWorkbenches.show()
if not ifcok:
self.form.labelIfcOpenShell.show()
if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetString("snapModes","111111111101111") == "111111111101111":
self.form.labelSnapTip.show()
# show dialog and exit if cancelled
FreeCADGui.BIMSetupDialog = True # this is there to be easily detected by the BIM tutorial
result = self.form.exec_()
del FreeCADGui.BIMSetupDialog
if not result:
return
# set preference values
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/BIM").SetBool("FirstTime",False)
unit = self.form.settingUnits.currentIndex()
unit = [0,4,1,3,7,5][unit] # less choices in our simplified dialog
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Units").SetInt("UserSchema",unit)
if hasattr(FreeCAD.Units,"setSchema"):
FreeCAD.Units.setSchema(unit)
decimals = self.form.settingDecimals.value()
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Units").SetInt("Decimals",decimals)
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/TechDraw/Dimensions").SetBool("UseGlobalDecimals",True)
grid = self.form.settingGrid.text()
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Sketcher/General").SetString("GridSize",str(grid)) # Also set sketcher grid
grid = FreeCAD.Units.Quantity(grid).Value
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").SetFloat("gridSpacing",grid)
squares = self.form.settingSquares.value()
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").SetInt("gridEvery",squares)
wp = self.form.settingWP.currentIndex()
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").SetInt("defaultWP",wp)
tsize = self.form.settingText.text()
tsize = FreeCAD.Units.Quantity(tsize).Value
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").SetFloat("textheight",tsize)
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/TechDraw/Dimensions").SetFloat("FontSize",tsize) # TODO - check if this needs a mult factor?
font = self.form.settingFont.currentFont().family()
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").SetString("textfont",font)
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/TechDraw/Labels").SetString("LabelFont",font)
linewidth = self.form.settingLinewidth.value()
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View").SetInt("DefautShapeLineWidth",linewidth)
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").SetInt("linewidth",linewidth)
# TODO - TechDraw default line styles
dimstyle = self.form.settingDimstyle.currentIndex()
ddimstyle = [0,2,3,4][dimstyle] # less choices in our simplified dialog
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").SetInt("dimsymbol",ddimstyle)
tdimstyle = [3,0,2,2][dimstyle] # TechDraw has different order than Draft
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/TechDraw/Dimensions").SetInt("dimsymbol",tdimstyle)
asize = self.form.settingArrowsize.text()
asize = FreeCAD.Units.Quantity(asize).Value
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").SetFloat("arrowsize",asize)
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/TechDraw/Dimensions").SetFloat("ArrowSize",asize*TECHDRAWDIMFACTOR)
author = self.form.settingAuthor.text()
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Document").SetString("prefAuthor",author)
lic = self.form.settingLicense.currentIndex()
lic = [0,1,2,4,5][lic] # less choices in our simplified dialog
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Document").SetInt("prefLicenseType",lic)
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Document").SetString("prefLicenseUrl","") # TODO - set correct license URL
bimdefault = self.form.settingWorkbench.currentIndex()
if bimdefault == 1:
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/General").SetString("AutoloadModule","BIMWorkbench")
elif bimdefault == 2:
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/General").SetString("AutoloadModule","StartWorkbench")
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Start").SetString("AutoloadModule","BIMWorkbench")
newdoc = self.form.settingNewdocument.isChecked()
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Document").SetBool("CreateNewDoc",newdoc)
bkp = self.form.settingBackupfiles.value()
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Document").SetInt("CountBackupFiles",bkp)
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View").SetUnsigned("BackgroundColor2",self.form.colorButtonTop.property("color").rgb()<<8)
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View").SetUnsigned("BackgroundColor3",self.form.colorButtonBottom.property("color").rgb()<<8)
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View").SetUnsigned("DefaultShapeColor",self.form.colorButtonFaces.property("color").rgb()<<8)
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").SetUnsigned("color",self.form.colorButtonFaces.property("color").rgb()<<8)
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View").SetUnsigned("DefaultShapeLineColor",self.form.colorButtonLines.property("color").rgb()<<8)
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").SetUnsigned("ColorHelpers",self.form.colorButtonHelpers.property("color").rgb()<<8)
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").SetUnsigned("constructioncolor",self.form.colorButtonConstruction.property("color").rgb()<<8)
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View").SetUnsigned("ConstructionColor",self.form.colorButtonConstruction.property("color").rgb()<<8)
height = self.form.settingCameraHeight.value()
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").SetInt("defaultCameraHeight",height)
# set the orbit mode to turntable
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View").SetInt("OrbitStyle",0)
# turn thumbnails on
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Document").SetBool("SaveThumbnail",True)
# set the working plane
if hasattr(FreeCAD,"DraftWorkingPlane") and hasattr(FreeCADGui,"draftToolBar"):
if wp == 1:
FreeCAD.DraftWorkingPlane.alignToPointAndAxis(Vector(0,0,0), Vector(0,0,1), 0)
FreeCADGui.draftToolBar.wplabel.setText("Top(XY)")
elif wp == 2:
FreeCAD.DraftWorkingPlane.alignToPointAndAxis(Vector(0,0,0), Vector(0,1,0), 0)
FreeCADGui.draftToolBar.wplabel.setText("Front(XZ)")
elif wp == 3:
FreeCAD.DraftWorkingPlane.alignToPointAndAxis(Vector(0,0,0), Vector(1,0,0), 0)
FreeCADGui.draftToolBar.wplabel.setText("Side(YZ)")
else:
FreeCADGui.draftToolBar.wplabel.setText("Auto")
# set Draft toolbar
if hasattr(FreeCADGui,"draftToolBar"):
FreeCADGui.draftToolBar.widthButton.setValue(linewidth)
FreeCADGui.draftToolBar.fontsizeButton.setValue(tsize)
# set the grid
if hasattr(FreeCADGui,"Snapper"):
FreeCADGui.Snapper.setGrid()
# set the status bar widgets
mw = FreeCADGui.getMainWindow()
if mw:
st = mw.statusBar()
statuswidget = st.findChild(QtGui.QToolBar,"BIMStatusWidget")
if statuswidget:
statuswidget.unitLabel.setText(statuswidget.unitsList[self.form.settingUnits.currentIndex()])
# change the unit of the nudge button
nudgeactions = statuswidget.nudge.menu().actions()
if unit in [2,3,5,7]:
nudgelabels = statuswidget.nudgeLabelsI
else:
nudgelabels = statuswidget.nudgeLabelsM
for i in range(len(nudgelabels)):
nudgeactions[i].setText(nudgelabels[i])
if not "auto" in statuswidget.nudge.text().replace("&","").lower():
statuswidget.nudge.setText(FreeCAD.Units.Quantity(statuswidget.nudge.text().replace("&","")).UserString)
def setPreset(self,preset=None):
from PySide import QtCore,QtGui
unit = None
decimals = None
grid = None
squares = None
wp = None
tsize = None
font = None
linewidth = None
dimstyle = None
asize = None
author = None
lic = None
bimdefault = None
newdoc = None
bkp = None
colTop = None
colBottom = None
colFace = None
colLine = None
colHelp = None
colConst = None
height = None
if preset == 0:
# the "Choose..." item from the presets box. Do nothing
return
elif preset == 1:
# centimeters
unit = 1
decimals = 2
grid = "10cm"
squares = 10
tsize = "20cm"
linewidth = 1
dimstyle = 0
asize = "4cm"
bkp = 2
bimdefault = 2
newdoc = False
height = 4500
elif preset == 2:
# meters
unit = 2
decimals = 2
grid = "0.1m"
squares = 10
tsize = "0.2m"
linewidth = 1
dimstyle = 0
asize = "0.04m"
bkp = 2
bimdefault = 2
newdoc = False
height = 4500
elif preset == 3:
# US
unit = 5
decimals = 2
grid = "1in"
squares = 12
tsize = "8in"
linewidth = 1
dimstyle = 3
asize = "2in"
bkp = 2
bimdefault = 2
newdoc = False
height = 4500
elif preset is None:
# get values from settings
unit = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Units").GetInt("UserSchema",0)
unit = [0,2,3,3,1,5,0,4][unit] # less choices in our simplified dialog
decimals = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Units").GetInt("Decimals",2)
grid = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetFloat("gridSpacing",10)
grid = FreeCAD.Units.Quantity(grid,FreeCAD.Units.Length).UserString
squares = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetInt("gridEvery",10)
wp = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetInt("defaultWP",0)
tsize = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetFloat("textheight",10)
tsize = FreeCAD.Units.Quantity(tsize,FreeCAD.Units.Length).UserString
font = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetString("textfont","Sans")
linewidth = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View").GetInt("DefautShapeLineWidth",2)
dimstyle = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetInt("dimsymbol",0)
dimstyle = [0,0,1,2,3][dimstyle] # less choices in our simplified dialog
asize = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetFloat("arrowsize",5)
asize = FreeCAD.Units.Quantity(asize,FreeCAD.Units.Length).UserString
author = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Document").GetString("prefAuthor","")
lic = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Document").GetInt("prefLicenseType",0)
lic = [0,1,2,1,3,4,1,0,0,0][lic] # less choices in our simplified dialog
bimdefault = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/General").GetString("AutoloadModule","")
if bimdefault == "BIMWorkbench":
bimdefault = 1
elif bimdefault == "StartWorkbench" and FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Start").GetString("AutoloadModule","") == "BIMWorkbench":
bimdefault = 2
else:
bimdefault = 0
newdoc = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Document").GetBool("CreateNewDoc",False)
bkp = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Document").GetInt("CountBackupFiles",2)
colTop = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View").GetUnsigned("BackgroundColor2",775244287)
colBottom = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View").GetUnsigned("BackgroundColor3",1905041919)
colFace = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View").GetUnsigned("DefaultShapeColor",4294967295)
colLine = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View").GetUnsigned("DefaultShapeLineColor",255)
colHelp = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetUnsigned("ColorHelpers",674321151)
colConst = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetUnsigned("constructioncolor",746455039)
height = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetInt("defaultCameraHeight",5)
if unit != None:
self.form.settingUnits.setCurrentIndex(unit)
if decimals != None:
self.form.settingDecimals.setValue(decimals)
if grid != None:
self.form.settingGrid.setText(grid)
if squares != None:
self.form.settingSquares.setValue(squares)
if wp != None:
self.form.settingWP.setCurrentIndex(wp)
if tsize != None:
self.form.settingText.setText(tsize)
if font != None:
self.form.settingFont.setCurrentFont(QtGui.QFont(font))
if linewidth != None:
self.form.settingLinewidth.setValue(linewidth)
if dimstyle != None:
self.form.settingDimstyle.setCurrentIndex(dimstyle)
if asize != None:
self.form.settingArrowsize.setText(asize)
if author != None:
self.form.settingAuthor.setText(author)
if lic != None:
self.form.settingLicense.setCurrentIndex(lic)
if bimdefault != None:
self.form.settingWorkbench.setCurrentIndex(bimdefault)
if newdoc != None:
self.form.settingNewdocument.setChecked(newdoc)
if bkp != None:
self.form.settingBackupfiles.setValue(bkp)
if colTop != None:
self.form.colorButtonTop.setProperty("color",getPrefColor(colTop))
if colBottom != None:
self.form.colorButtonBottom.setProperty("color",getPrefColor(colBottom))
if colFace != None:
self.form.colorButtonFaces.setProperty("color",getPrefColor(colFace))
if colLine != None:
self.form.colorButtonLines.setProperty("color",getPrefColor(colLine))
if colHelp != None:
self.form.colorButtonHelpers.setProperty("color",getPrefColor(colHelp))
if colConst != None:
self.form.colorButtonConstruction.setProperty("color",getPrefColor(colConst))
if height:
self.form.settingCameraHeight.setValue(height)
# TODO - antialiasing?
def handleLink(self,link):
if hasattr(self,"form"):
if "#install" in link:
getIfcOpenShell()
else:
#print("Opening link:",link)
from PySide import QtCore,QtGui
url = QtCore.QUrl(link)
QtGui.QDesktopServices.openUrl(url)
def getPrefColor(color):
r = ((color>>24)&0xFF)/255.0
g = ((color>>16)&0xFF)/255.0
b = ((color>>8)&0xFF)/255.0
from PySide import QtGui
return QtGui.QColor.fromRgbF(r,g,b)
def getIfcOpenShell(force=False):
"""downloads and installs IfcOpenShell"""
ifcok = False
if not force:
try:
import ifcopenshell
except:
ifcok = False
else:
ifcok = True
if not ifcok:
# ifcopenshell not installed
import re,json
from PySide import QtGui
import zipfile
import addonmanager_utilities
if force or (not FreeCAD.GuiUp):
reply = QtGui.QMessageBox.Yes
else:
reply = QtGui.QMessageBox.question(None,
translate("BIM","IfcOpenShell not found"),
translate("BIM","IfcOpenShell is needed to import and export IFC files. It appears to be missing on your system. Would you like to download and install it now? It will be installed in FreeCAD's Macros directory."),
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes:
print("Loading list of latest IfcOpenBot builds from https://github.com/IfcOpenBot/IfcOpenShell...")
url1 = "https://api.github.com/repos/IfcOpenBot/IfcOpenShell/comments?per_page=100"
u = addonmanager_utilities.urlopen(url1)
if u:
r = u.read()
u.close()
d = json.loads(r)
l = d[-1]['body']
links = re.findall("http.*?zip",l)
pyv = "python-"+str(sys.version_info.major)+str(sys.version_info.minor)
if sys.platform.startswith("linux"):
plat = "linux"
elif sys.platform.startswith("win"):
plat = "win"
elif sys.platform.startswith("darwin"):
plat = "macos"
else:
print("Error - unknown platform")
return
if sys.maxsize > 2**32:
plat += "64"
else:
plat += "32"
print("Looking for",plat,pyv)
for link in links:
if ("ifcopenshell-"+pyv in link) and (plat in link):
print("Downloading "+link+"...")
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macro")
fp = p.GetString("MacroPath",os.path.join(FreeCAD.getUserAppDataDir(),"Macros"))
u = addonmanager_utilities.urlopen(link)
if u:
if sys.version_info.major < 3:
import StringIO as io
_stringio = io.StringIO
else:
import io
_stringio = io.BytesIO
zfile = _stringio()
zfile.write(u.read())
zfile = zipfile.ZipFile(zfile)
zfile.extractall(fp)
u.close()
zfile.close()
print("Successfully installed IfcOpenShell to",fp)
break
else:
print("Unable to find a build for your version")