Skip to content

Commit 17dec25

Browse files
committed
Cleanup after rebase.
1 parent bad9e48 commit 17dec25

11 files changed

Lines changed: 34 additions & 44 deletions

solid/examples/animation_example.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#! /usr/bin/env python3
2-
import os
32
import sys
43
from math import cos, sin
54
from typing import Optional
65

76
from solid import scad_render_animated_file
8-
from solid.solidpython import OpenSCADObject
97
from solid.objects import square, translate
8+
from solid.solidpython import OpenSCADObject
109

1110

1211
def my_animate(_time: Optional[float] = 0) -> OpenSCADObject:
@@ -29,16 +28,15 @@ def my_animate(_time: Optional[float] = 0) -> OpenSCADObject:
2928
# at the bottom of the OpenSCAD window
3029
# - FPS & Steps are flexible. For a start, set both to 20
3130
# play around from there
32-
file_out = scad_render_animated_file(my_animate, # A function that takes a float argument
33-
# called '_time' in [0,1)
34-
# and returns an OpenSCAD object
35-
steps=20, # Number of steps to create one complete motion
36-
back_and_forth=True, # If true, runs the complete motion
37-
# forward and then in reverse,
38-
# to avoid discontinuity
31+
file_out = scad_render_animated_file(my_animate, # A function that takes a float argument
32+
# called '_time' in [0,1)
33+
# and returns an OpenSCAD object
34+
steps=20, # Number of steps to create one complete motion
35+
back_and_forth=True, # If true, runs the complete motion
36+
# forward and then in reverse,
37+
# to avoid discontinuity
3938
out_dir=out_dir,
40-
include_orig_code=True ) # Append SolidPython code
41-
# to the end of the generated
42-
# OpenSCAD code.
39+
include_orig_code=True) # Append SolidPython code
40+
# to the end of the generated
41+
# OpenSCAD code.
4342
print(f"{__file__}: SCAD file written to: \n{file_out}")
44-

solid/examples/append_solidpython_code.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#! /usr/bin/env python3
2-
# -*- coding: utf-8 -*-
3-
import os
42
import sys
53

64
from solid import scad_render_to_file
@@ -25,5 +23,5 @@ def show_appended_python_code():
2523
# = bottom of the generated OpenSCAD code, so the final document
2624
# = contains the easy-to-read python code as well as the SCAD.
2725
# = ------------------------------------------------------------ =
28-
file_out = scad_render_to_file(a, out_dir=out_dir, include_orig_code=True)
26+
file_out = scad_render_to_file(a, out_dir=out_dir, include_orig_code=True)
2927
print(f"{__file__}: SCAD file written to: \n{file_out}")

solid/examples/basic_geometry.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#! /usr/bin/env python3
2-
import os
32
import sys
43

54
from solid import scad_render_to_file

solid/examples/basic_scad_include.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def demo_scad_use():
2222
scad_path = Path(__file__).parent / 'scad_to_include.scad'
2323
# `This adds the SCAD module `steps()` to the global namespace
2424
use(scad_path)
25-
25+
2626
return steps(5)
2727

2828

solid/examples/bom_scad.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#
1818
# -ETJ 08 Mar 2011
1919

20-
import os
2120
import sys
2221

2322
from solid import scad_render_to_file

solid/examples/hole_example.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#! /usr/bin/env python3
2-
import os
32
import sys
43

54
from solid import scad_render_to_file
@@ -92,6 +91,5 @@ def multipart_hole():
9291
b = up(40)(multipart_hole())
9392
a += b
9493

95-
file_out = scad_render_to_file(a, out_dir=out_dir, file_header=f'$fn = {SEGMENTS};',
96-
include_orig_code=True)
94+
file_out = scad_render_to_file(a, out_dir=out_dir, file_header=f'$fn = {SEGMENTS};', include_orig_code=True)
9795
print(f"{__file__}: SCAD file written to: \n{file_out}")

solid/examples/koch.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /usr/bin/env python3
2-
import os
32
import sys
3+
from pathlib import Path
44

55
from euclid3 import LineSegment2, LineSegment3, Point2, Point3
66

@@ -138,9 +138,9 @@ def main_3d(out_dir):
138138
# Do the SCAD
139139
edges = [list(range(len(points)))]
140140
all_polys.add(
141-
up(h)(
142-
polyhedron(points=points, faces=faces)
143-
)
141+
up(h)(
142+
polyhedron(points=points, faces=faces)
143+
)
144144
)
145145

146146
file_out = Path(out_dir) / 'koch_3d.scad'

solid/examples/path_extrude_example.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#! /usr/bin/env python3
2-
import os
32
import sys
43
from math import cos, radians, sin
54

solid/examples/run_all_examples.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
#!/usr/bin/env bash
22

33
# Set CWD to this script's directory
4-
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
4+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
55
cd "$DIR" || exit 1
66

77
COMPILED_EXAMPLES=${PWD}/Compiled_examples
88

99
echo
1010
# if COMPILED_EXAMPLES doesn't exist, create it.
11-
if [ ! -e "$COMPILED_EXAMPLES" ];
12-
then mkdir "$COMPILED_EXAMPLES";
13-
fi
14-
15-
function run_example {
16-
echo "===================================================";
17-
python "$1" "$2";
18-
echo "===================================================";
11+
if [ ! -e "$COMPILED_EXAMPLES" ]; then
12+
mkdir "$COMPILED_EXAMPLES"
13+
fi
14+
15+
function run_example() {
16+
echo "==================================================="
17+
python "$1" "$2"
18+
echo "==================================================="
1919
}
2020

21-
for py in *.py;
22-
do run_example "$py" "$COMPILED_EXAMPLES";
23-
done
21+
for py in *.py; do
22+
run_example "$py" "$COMPILED_EXAMPLES"
23+
done
2424

25-
run_example mazebox/mazebox.py "$COMPILED_EXAMPLES";
25+
run_example mazebox/mazebox.py "$COMPILED_EXAMPLES"
2626

2727
# revert to original dir
28-
cd - || exit 1
28+
cd - || exit 1

solid/examples/screw_thread_example.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#! /usr/bin/env python3
2-
import os
32
import sys
43

54
from solid import scad_render_to_file
@@ -29,5 +28,5 @@ def assembly():
2928
if __name__ == '__main__':
3029
out_dir = sys.argv[1] if len(sys.argv) > 1 else None
3130
a = assembly()
32-
file_out = scad_render_to_file(a, out_dir = out_dir, include_orig_code=True)
31+
file_out = scad_render_to_file(a, out_dir=out_dir, include_orig_code=True)
3332
print(f"{__file__}: SCAD file written to: \n{file_out}")

0 commit comments

Comments
 (0)