-
Notifications
You must be signed in to change notification settings - Fork 16
/
retr3d.FCMacro
47 lines (41 loc) · 1.75 KB
/
retr3d.FCMacro
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2015 Matthew Rogge and Michael Uttmark
#
# This file is part of Retr3d.
#
# Retr3d is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Retr3d 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Retr3d. If not, see <http://www.gnu.org/licenses/>.
import sys, os, FreeCAD
from PySide import QtGui
# retriving stored paths in FreeCAD preferences
param = FreeCAD.ParamGet('User parameter:Plugins/retr3d')
retr3d_path = param.GetString('destination','')
output_path = param.GetString('output','')
if retr3d_path:
print "Using retr3d path: ",retr3d_path," from Tools->Edit parameters->Plugins->retr3d->destination"
else:
retr3d_path = QtGui.QFileDialog.getExistingDirectory(None,"Please indicate the location of your Retr3D folder")
if output_path:
print "Using output path: ",retr3d_path," from Tools->Edit parameters->Plugins->retr3d->output"
else:
output_path = QtGui.QFileDialog.getExistingDirectory(None,"Please choose a folder to save output files")
if retr3d_path and output_path:
param.SetString('destination',retr3d_path)
param.SetString('output',output_path)
sys.path.append(retr3d_path)
import globalVars as gv
gv.printerDir = output_path + os.sep
import makePrinter
else:
print "Retr3d or output path not set. Aborting."