/
test_visual_stl.py
61 lines (37 loc) · 1.56 KB
/
test_visual_stl.py
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
import k3d
import numpy as np
import pytest
from .plot_compare import *
from k3d.helpers import download
def test_stl():
prepare()
filename = download(
'https://github.com/To-Fujita/Babylon.js_3D_Graphics/raw/master/scenes/stl/Cute%20Darth%20Vader.stl')
mesh = k3d.stl(open(filename, 'rb').read(), color=0x222222, flat_shading=True,
transform=k3d.transform(rotation=[np.pi / 2, 1, 0, 0]))
pytest.plot += mesh
compare('stl')
def test_stl_color():
prepare()
filename = download(
'https://github.com/To-Fujita/Babylon.js_3D_Graphics/raw/master/scenes/stl/Cute%20Darth%20Vader.stl')
mesh = k3d.stl(open(filename, 'rb').read(), color=0xff00ff,
transform=k3d.transform(rotation=[np.pi / 2, 1, 0, 0]))
pytest.plot += mesh
compare('stl_color')
def test_stl_wireframe():
prepare()
filename = download(
'https://github.com/To-Fujita/Babylon.js_3D_Graphics/raw/master/scenes/stl/Cute%20Darth%20Vader.stl')
mesh = k3d.stl(open(filename, 'rb').read(), wireframe=True,
transform=k3d.transform(rotation=[np.pi / 2, 1, 0, 0]))
pytest.plot += mesh
compare('stl_wireframe')
def test_stl_smooth():
prepare()
filename = download(
'https://github.com/To-Fujita/Babylon.js_3D_Graphics/raw/master/scenes/stl/Cute%20Darth%20Vader.stl')
mesh = k3d.stl(open(filename, 'rb').read(), flat_shading=False, color=0x222222,
transform=k3d.transform(rotation=[np.pi / 2, 1, 0, 0]))
pytest.plot += mesh
compare('stl_smooth')