extprogs.cpp

Tue, 07 May 2013 01:16:58 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Tue, 07 May 2013 01:16:58 +0300
changeset 171
36165e58e457
parent 168
96691a009dff
child 174
963697b36118
permissions
-rw-r--r--

Forgot the icon

166
72ec7b60da54 add missing license headers from new files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
1 /*
72ec7b60da54 add missing license headers from new files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
2 * LDForge: LDraw parts authoring CAD
72ec7b60da54 add missing license headers from new files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
3 * Copyright (C) 2013 Santeri Piippo
72ec7b60da54 add missing license headers from new files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
4 *
72ec7b60da54 add missing license headers from new files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
5 * This program is free software: you can redistribute it and/or modify
72ec7b60da54 add missing license headers from new files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
6 * it under the terms of the GNU General Public License as published by
72ec7b60da54 add missing license headers from new files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
72ec7b60da54 add missing license headers from new files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
8 * (at your option) any later version.
72ec7b60da54 add missing license headers from new files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
9 *
72ec7b60da54 add missing license headers from new files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
10 * This program is distributed in the hope that it will be useful,
72ec7b60da54 add missing license headers from new files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
72ec7b60da54 add missing license headers from new files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
72ec7b60da54 add missing license headers from new files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
13 * GNU General Public License for more details.
72ec7b60da54 add missing license headers from new files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
14 *
72ec7b60da54 add missing license headers from new files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
15 * You should have received a copy of the GNU General Public License
72ec7b60da54 add missing license headers from new files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
72ec7b60da54 add missing license headers from new files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
17 */
72ec7b60da54 add missing license headers from new files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 165
diff changeset
18
167
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
19 #include <qprocess.h>
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
20 #include <qtemporaryfile.h>
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
21 #include <qeventloop.h>
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
22 #include <qdialog.h>
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
23 #include <qdialogbuttonbox.h>
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
24 #include <qspinbox.h>
165
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 #include "common.h"
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 #include "config.h"
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 #include "misc.h"
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 #include "extprogs.h"
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 #include "gui.h"
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 #include "file.h"
167
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
31 #include "radiobox.h"
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
32 #include "history.h"
165
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 // =============================================================================
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 cfg (str, prog_isecalc, "");
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 cfg (str, prog_intersector, "");
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 cfg (str, prog_coverer, "");
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 cfg (str, prog_ytruder, "");
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 cfg (str, prog_datheader, "");
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 strconfig* g_extProgPaths[] = {
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 &prog_isecalc,
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43 &prog_intersector,
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 &prog_coverer,
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45 &prog_ytruder,
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 &prog_datheader,
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 };
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49 const char* g_extProgNames[] = {
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 "Isecalc",
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 "Intersector",
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52 "Coverer",
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 "Ytruder",
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 "DATHeader",
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55 };
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 // =============================================================================
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 static void noPathConfigured (const extprog prog) {
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59 const char* name = g_extProgNames[prog];
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61 critical (fmt ("Couldn't run %s as no path has "
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62 "been defined for it. Use the configuration dialog's External Programs "
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63 "tab to define a path for %s.", name, name));
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64 }
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
65
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
66 // =============================================================================
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 static void processError (const extprog prog, QProcess& proc) {
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
68 const char* name = g_extProgNames[prog];
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
69 str errmsg;
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
70
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71 switch (proc.error ()) {
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
72 case QProcess::FailedToStart:
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73 errmsg = fmt ("Failed to launch %s. Check that you have set the proper path "
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
74 "to %s and that you have the proper permissions to launch it.", name, name);
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
75 break;
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
76
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
77 case QProcess::Crashed:
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
78 errmsg = fmt ("%s crashed.", name);
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79 break;
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81 case QProcess::WriteError:
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82 case QProcess::ReadError:
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
83 errmsg = fmt ("I/O error while interacting with %s.", name);
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84 break;
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
86 case QProcess::UnknownError:
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87 errmsg = fmt ("Unknown error occurred while executing %s.", name);
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
88 break;
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90 case QProcess::Timedout:
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
91 errmsg = fmt ("%s timed out.", name);
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
92 break;
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
93 }
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
94
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
95 critical (errmsg);
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
96 }
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
97
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
98 // =============================================================================
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
99 static bool mkTempFile (QTemporaryFile& tmp, str& fname) {
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
100 if (!tmp.open ())
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
101 return false;
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
102
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
103 fname = tmp.fileName ();
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
104 tmp.close ();
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
105 return true;
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
106 }
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
107
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
108 // =============================================================================
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
109 void writeSelection (str fname) {
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
110 // Write the input file
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
111 FILE* fp = fopen (fname, "w");
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
112 if (!fp) {
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
113 critical (fmt ("Couldn't open temporary file %s for writing.\n", fname.chars ()));
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
114 return;
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
115 }
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
116
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
117 for (LDObject* obj : g_win->sel ()) {
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
118 str line = fmt ("%s\r\n", obj->getContents ().chars ());
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
119 fwrite (line.chars(), 1, ~line, fp);
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
120 }
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
121
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
122 fclose (fp);
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
123 }
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
124
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
125 // =============================================================================
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
126 void runUtilityProcess (extprog prog, QStringList argv) {
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
127 QTemporaryFile input, output;
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
128 str inputname, outputname;
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
129
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
130 if (!mkTempFile (input, inputname) || !mkTempFile (output, outputname))
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
131 return;
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
132
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
133 QProcess proc;
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
134
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
135 // Init stdin
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
136 FILE* stdinfp = fopen (inputname, "w");
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
137
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
138 // Begin!
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
139 proc.setStandardInputFile (inputname);
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
140 proc.start (prog_ytruder.value, argv);
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
141
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
142 // Write an enter - one is expected
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
143 char enter[2] = "\n";
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
144 enter[1] = '\0';
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
145 fwrite (enter, 1, sizeof enter, stdinfp);
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
146 fflush (stdinfp);
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
147
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
148 // Wait while it runs
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
149 proc.waitForFinished ();
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
150
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
151 if (proc.exitStatus () == QProcess::CrashExit) {
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
152 processError (prog, proc);
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
153 return;
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
154 }
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
155 }
165
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
156
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
157 // =============================================================================
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
158 void insertOutput (str fname, bool replace) {
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
159 // Read the output file
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
160 FILE* fp = fopen (fname, "r");
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
161 if (!fp) {
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
162 critical (fmt ("Couldn't open temporary file %s for reading.\n", fname.chars ()));
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
163 return;
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
164 }
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
165
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
166 ComboHistory* cmb = new ComboHistory ({});
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
167 std::vector<LDObject*> objs = loadFileContents (fp, null),
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
168 copies;
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
169 std::vector<ulong> indices;
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
170
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
171 ulong idx = g_win->getInsertionPoint ();
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
172
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
173 // If we replace the objects, delete the selection now.
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
174 if (replace) {
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
175 vector<ulong> indices;
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
176 vector<LDObject*> cache,
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
177 sel = g_win->sel ();
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
178
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
179 for (LDObject* obj : sel) {
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
180 indices.push_back (obj->getIndex (g_curfile));
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
181 cache.push_back (obj->clone ());
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
182
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
183 g_curfile->forgetObject (obj);
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
184 delete obj;
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
185 }
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
186 }
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
187
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
188 // Insert the new objects
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
189 g_win->sel ().clear ();
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
190 for (LDObject* obj : objs) {
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
191 if (!obj->isSchemantic ()) {
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
192 delete obj;
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
193 continue;
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
194 }
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
195
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
196 g_curfile->insertObj (idx, obj);
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
197 indices.push_back (idx);
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
198 copies.push_back (obj->clone ());
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
199 g_win->sel ().push_back (obj);
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
200
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
201 ++idx;
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
202 }
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
203
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
204 if (indices.size() > 0)
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
205 cmb->paEntries.push_back (new AddHistory ({indices, copies}));
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
206
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
207 if (cmb->paEntries.size () > 0)
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
208 History::addEntry (cmb);
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
209 else
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
210 delete cmb;
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
211
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
212 fclose (fp);
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
213 g_win->refresh ();
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
214 }
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
215
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
216 // =============================================================================
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
217 MAKE_ACTION (ytruder, "Ytruder", "ytruder", "Extrude selected lines to a given plane", KEY (F8)) {
165
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
218 if (prog_ytruder.value.len () == 0) {
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
219 noPathConfigured (Ytruder);
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
220 return;
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
221 }
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
222
167
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
223 QDialog* dlg = new QDialog (g_win);
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
224
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
225 RadioBox* rb_mode = new RadioBox ("Extrusion mode", {"Distance", "Symmetry", "Projection", "Radial"}, 0, Qt::Horizontal, dlg);
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
226 RadioBox* rb_axis = new RadioBox ("Axis", {"X", "Y", "Z"}, 0, Qt::Horizontal, dlg);
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
227 LabeledWidget<QDoubleSpinBox>* dsb_depth = new LabeledWidget<QDoubleSpinBox> ("Plane depth", dlg),
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
228 *dsb_condAngle = new LabeledWidget<QDoubleSpinBox> ("Conditional line threshold", dlg);
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
229 QDialogButtonBox* bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
230
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
231 QWidget::connect (bbx_buttons, SIGNAL (accepted ()), dlg, SLOT (accept ()));
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
232 QWidget::connect (bbx_buttons, SIGNAL (rejected ()), dlg, SLOT (reject ()));
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
233
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
234 rb_axis->setValue (Y);
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
235 dsb_depth->w ()->setMinimum (-10000.0);
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
236 dsb_depth->w ()->setMaximum (10000.0);
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
237 dsb_depth->w ()->setDecimals (3);
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
238 dsb_condAngle->w ()->setValue (30.0f);
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
239
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
240 QVBoxLayout* layout = new QVBoxLayout (dlg);
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
241 layout->addWidget (rb_mode);
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
242 layout->addWidget (rb_axis);
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
243 layout->addWidget (dsb_depth);
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
244 layout->addWidget (dsb_condAngle);
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
245 layout->addWidget (bbx_buttons);
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
246
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
247 dlg->setWindowIcon (getIcon ("extrude"));
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
248
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
249 if (!dlg->exec ())
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
250 return;
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
251
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
252 const enum modetype { Distance, Symmetry, Projection, Radial } mode = (modetype) rb_mode->value ();
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
253 const Axis axis = (Axis) rb_axis->value ();
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
254 const double depth = dsb_depth->w ()->value (),
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
255 condAngle = dsb_condAngle->w ()->value ();
df78c894ae24 Further ytruder support
Santeri Piippo <crimsondusk64@gmail.com>
parents: 166
diff changeset
256
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
257 QTemporaryFile indat, outdat;
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
258 str inDATName, outDATName;
165
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
259
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
260 if (!mkTempFile (indat, inDATName) || !mkTempFile (outdat, outDATName))
165
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
261 return;
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
262
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
263 QStringList argv ({(axis == X) ? "-x" : (axis == Y) ? "-y" : "-z",
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
264 (mode == Distance) ? "-d" : (mode == Symmetry) ? "-s" : (mode == Projection) ? "-p" : "-r",
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
265 fmt ("%f", depth), "-a", fmt ("%f", condAngle), inDATName, outDATName
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
266 });
165
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
267
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
268 writeSelection (inDATName);
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
269 runUtilityProcess (Ytruder, argv);
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 167
diff changeset
270 insertOutput (outDATName, false);
165
88a03c1a52d9 Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
271 }

mercurial