-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSaveAsOpenSCAD.m
35 lines (33 loc) · 1.22 KB
/
SaveAsOpenSCAD.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
29
30
31
32
33
34
function status = SaveAsOpenSCAD(scad_file_name, varargin)
%SaveAsOpenSCAD - output specified file instead of running the GUI, the
%file extension specifies the type: stl, off, amf, 3mf, csg, dxf, svg, png,
%echo, ast, term, nef3, nefdbg
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
output_file_extention = 'stl';
scad_file_name = FileExtController(scad_file_name, 'scad');
output_filename = scad_file_name;
extra_params = {};
rend1 = '';
while ~isempty(varargin)
switch lower(varargin{1})
case 'scadfolder'
extra_params{end+1} = 'scadfolder';
extra_params{end+1} = FileExtController(varargin{2}, "/");
case 'output_filename'
output_filename = varargin{2};
case {'ofe','output_file_extention'}
output_file_extention = varargin{2};
case {'render'}
rend1 = ['"--backend"="' varargin{2} '" '];
otherwise
end
varargin(1:2) = [];
end
output_filename = FileExtController(output_filename, output_file_extention);
quality = 'production';
cmd = ['-o ' ...
output_filename ...
' -D ' '"quality=""' quality '""" ' rend1 ...
scad_file_name ];
status = cmdOpenSCAD(cmd, extra_params{:});
end