-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvert_png.yml
61 lines (58 loc) · 2.08 KB
/
convert_png.yml
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
---
- hosts: localhost
vars:
ansible_python_interpreter: /usr/bin/python3
project_directory: "{{ playbook_dir }}"
project_directories:
- intake
- processing
- output
## resize units are in mm
## rotate units are in degrees
## if converting directly from svg, input_png and output_pnm are optional parameters
items_to_convert:
- output_stl: demo/output/calvin_accomplishment.stl
input_png: demo/intake/apouik1v7lf01.jpg
output_pnm: demo/processing/calvin_accomplishment.pnm
output_svg: demo/processing/calvin_accomplishment.svg
stl_height: .2
object_outline_diameter: .05
x_resize: 80
y_resize: 0
z_resize: .2
z_rotate: 90
- output_stl: output/test.stl
# input_png: intake/test_text.png
# output_pnm: processing/test.pnm
output_svg: processing/test.svg
stl_height: .2
object_outline_diameter: .1
x_resize: 100
y_resize: 0
z_resize: .2
z_rotate: 90
model_dpi: 300
tasks:
- name: create project directory
file:
path: "{{item}}"
state: directory
with_items: "{{project_directories}}"
- name: convert png to pnm
command:
cmd: "convert {{project_directory}}/{{item.input_png}} {{item.output_pnm}}"
with_items:
- "{{ items_to_convert}}"
when: item.input_png is defined
- name: convert pnm to svg
command:
cmd: "potrace {{item.output_pnm}} -s -o {{project_directory}}/{{item.output_svg}}"
with_items:
- "{{ items_to_convert}}"
when: item.output_pnm is defined
- name: convert svg to stl
command:
cmd: "openscad -o {{item.output_stl}} -D 'model_height={{item.stl_height}}' -D 'object_outline_diameter={{item.object_outline_diameter}}' -D 'model_dpi={{model_dpi}}' -D 'model_path=\"{{item.output_svg}}\"' -D 'x_resize={{item.x_resize}}' -D 'y_resize={{item.y_resize}}' -D 'z_resize={{item.z_resize}}' -D 'z_rotate={{item.z_rotate}}' svg_extrude.scad"
with_items:
- "{{ items_to_convert}}"
when: item.output_svg is defined