Skip to content

Commit 84da1c1

Browse files
authored
Merge pull request #6 from raszpl/patch-1
Add zoom option
2 parents 806cc8c + 2160058 commit 84da1c1

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

action.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ inputs:
88
output_path:
99
description: 'path to where top.png and bottom.png should be created'
1010
required: true
11+
zoom:
12+
description: 'Camera zoom, default 1'
13+
required: false
1114
background:
1215
description: 'Image background. Options: transparent, opaque. Default: transparent for PNG, opaque for JPEG'
1316
required: false
@@ -21,5 +24,5 @@ runs:
2124
args:
2225
- bash
2326
- -c
24-
- if [ -n "$INPUT_ANIMATION" ]; then render-pcb.sh -f "$INPUT_PCB_FILE" -o "$INPUT_OUTPUT_PATH" -b "$INPUT_BACKGROUND" -a "$INPUT_ANIMATION"; else render-pcb.sh -f "$INPUT_PCB_FILE" -o "$INPUT_OUTPUT_PATH" -b "$INPUT_BACKGROUND"; fi
27+
- if [ -n "$INPUT_ANIMATION" ]; then render-pcb.sh -f "$INPUT_PCB_FILE" -o "$INPUT_OUTPUT_PATH" -b "$INPUT_BACKGROUND" -z "$INPUT_ZOOM" -a "$INPUT_ANIMATION"; else render-pcb.sh -f "$INPUT_PCB_FILE" -o "$INPUT_OUTPUT_PATH" -b "$INPUT_BACKGROUND" -z "$INPUT_ZOOM"; fi
2528

render-pcb.sh

+12-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ help() {
99
echo "b Image background. Options: transparent, opaque. Default: transparent for PNG, opaque for JPEG"
1010
echo "o Directory where the images and optinally the animation should be written to."
1111
echo "a Render animation and select animation output format (mp4 or gif)."
12+
echo "z Camera zoom default 1"
1213
echo "v Print protgram version"
1314
echo "h Print this Help."
1415
echo
@@ -25,13 +26,14 @@ extract_output_path() {
2526

2627
background="transparent"
2728

28-
while getopts :f:o:a:b:hv option
29+
while getopts :f:o:a:b:z:hv option
2930
do
3031
case "${option}" in
3132
f) kicad_pcb=${OPTARG};;
3233
o) output_path=${OPTARG};;
3334
a) animation=${OPTARG};;
3435
b) background=${OPTARG};;
36+
z) zoom=${OPTARG};;
3537
h) help;;
3638
v) echo "IMAGE version: ${VERSION:-none}" && exit;;
3739
\?)
@@ -67,14 +69,20 @@ echo "$output_path"
6769

6870
mkdir -p "$output_path"
6971

72+
KICAD_CLI_OPTIONAL_ARGS=""
73+
74+
if [[ -n "$zoom" ]]; then
75+
KICAD_CLI_OPTIONAL_ARGS="$KICAD_CLI_OPTIONAL_ARGS --zoom $zoom"
76+
fi
77+
7078
echo "rendering top"
71-
$KICAD_CLI pcb render --side top --background $background -o "$output_top" "$kicad_pcb"
79+
$KICAD_CLI pcb render --side top --background $background -o "$output_top" "$kicad_pcb" $KICAD_CLI_OPTIONAL_ARGS
7280
echo "rendering bottom"
73-
$KICAD_CLI pcb render --side bottom --background $background -o "$output_bottom" "$kicad_pcb"
81+
$KICAD_CLI pcb render --side bottom --background $background -o "$output_bottom" "$kicad_pcb" $KICAD_CLI_OPTIONAL_ARGS
7482

7583
if [[ -n "$animation" ]]; then
7684
echo "rendering animation"
7785
kicad_animation.sh $animation "$kicad_pcb" "$output_animation"
7886
fi
7987

80-
ls "$output_path"
88+
ls "$output_path"

0 commit comments

Comments
 (0)