-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
69 lines (53 loc) · 1.83 KB
/
main.py
File metadata and controls
69 lines (53 loc) · 1.83 KB
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
62
63
64
65
66
67
68
69
# VS Code smoke test for the generated AlibreScript IDE stubs.
# This file is for editor/runtime checking outside Alibre Design.
from __future__ import print_function
import os
import sys
from math import cos, radians, sin
StubPackage = os.path.join(
os.path.dirname(__file__),
'Alibre-Script-Stub-Files',
'generated',
'package'
)
if os.path.isdir(StubPackage) and StubPackage not in sys.path:
sys.path.insert(0, StubPackage)
from AlibreScript import (
CurrentAssemblies,
CurrentAssembly,
CurrentPart,
CurrentParts,
ScriptFileName,
ScriptFolder,
)
def create_two_angle_fixture_references():
p = CurrentPart()
angle16 = 16.0
angle30 = -30.0
axis_length = 100.0
xy_plane = p.GetPlane('XY-Plane')
yz_plane = p.GetPlane('YZ-Plane')
x_axis = p.GetAxis('X-Axis')
plane16 = p.AddPlane('16 degree', xy_plane, x_axis, angle16)
angle16_rad = radians(angle16)
axis_start = [0.0, 0.0, 0.0]
axis_end = [
0.0,
-sin(angle16_rad) * axis_length,
cos(angle16_rad) * axis_length
]
axis2 = p.AddAxis('Axis<2>', axis_start, axis_end)
plane30 = p.AddPlane('30 degree', yz_plane, axis2, angle30)
return p, plane16, axis2, plane30
if __name__ == '__main__':
part, plane16, axis2, plane30 = create_two_angle_fixture_references()
assembly = CurrentAssembly()
parts = CurrentParts()
assemblies = CurrentAssemblies()
print('AlibreScript stub smoke test complete.')
print('ScriptFileName mock:', repr(ScriptFileName))
print('ScriptFolder mock:', repr(ScriptFolder))
print('CurrentPart mock type:', type(part).__name__)
print('CurrentAssembly mock type:', type(assembly).__name__)
print('CurrentParts first mock type:', type(parts[0]).__name__)
print('CurrentAssemblies first mock type:', type(assemblies[0]).__name__)