-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
StartOpenSCAD.m
29 lines (27 loc) · 940 Bytes
/
StartOpenSCAD.m
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
function status = StartOpenSCAD(file_name, varargin)
%StartOpenSCAD - open GUI of openSCAD with selected file (only for viewing
%structure, not necessary for convertion structure in .stl and etc)
%%
scadfolder = GetParamFromFile('path');
while ~isempty(varargin)
switch lower(varargin{1})
case 'scadfolder'
scadfolder = varargin{2};
otherwise
end
varargin(1:2) = [];
end
file_name = FileExtController(file_name, 'scad');
% path_cd = cd; % get current folder (where function was started)
if ~contains(file_name, ':') % if contain ':' that mean file name include path
file_name = [ char(cd) '\' char(file_name) ];
else
file_name = char(file_name);
end
if ~isfile(file_name)
fileID = fopen(file_name,'a');
fclose(fileID);
end
cmd = ['start "' scadfolder 'openscad.exe" "' file_name '"'];
status = system(cmd); % cmd OpenSCAD can't be used because here is extra parameter "start"
end