openscad-evaluator 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openscad_evaluator/__init__.py +36 -0
- openscad_evaluator/_css_colors.py +173 -0
- openscad_evaluator/evaluator.py +5733 -0
- openscad_evaluator/resources/fonts/LICENSE +102 -0
- openscad_evaluator/resources/fonts/LiberationSans-Regular.ttf +0 -0
- openscad_evaluator-1.0.0.dist-info/METADATA +116 -0
- openscad_evaluator-1.0.0.dist-info/RECORD +8 -0
- openscad_evaluator-1.0.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""openscad_evaluator: an AST evaluator for the OpenSCAD language, producing
|
|
2
|
+
Manifold CSG geometry from a parsed AST (see `openscad_lalr_parser`)."""
|
|
3
|
+
|
|
4
|
+
from openscad_evaluator.evaluator import (
|
|
5
|
+
Evaluator,
|
|
6
|
+
EvalContext,
|
|
7
|
+
EvalError,
|
|
8
|
+
CSGNode,
|
|
9
|
+
ColoredBody,
|
|
10
|
+
ManifoldCache,
|
|
11
|
+
OscObject,
|
|
12
|
+
OscRange,
|
|
13
|
+
CallSiteProfile,
|
|
14
|
+
ProfileResult,
|
|
15
|
+
to_renderable_bodies,
|
|
16
|
+
flatten_csg_tree,
|
|
17
|
+
format_csg_tree,
|
|
18
|
+
resolve_use_scopes,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
__all__ = [
|
|
22
|
+
"Evaluator",
|
|
23
|
+
"EvalContext",
|
|
24
|
+
"EvalError",
|
|
25
|
+
"CSGNode",
|
|
26
|
+
"ColoredBody",
|
|
27
|
+
"ManifoldCache",
|
|
28
|
+
"OscObject",
|
|
29
|
+
"OscRange",
|
|
30
|
+
"CallSiteProfile",
|
|
31
|
+
"ProfileResult",
|
|
32
|
+
"to_renderable_bodies",
|
|
33
|
+
"flatten_csg_tree",
|
|
34
|
+
"format_csg_tree",
|
|
35
|
+
"resolve_use_scopes",
|
|
36
|
+
]
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"""Static CSS/SVG named-color table, replacing a runtime QColor(name) lookup
|
|
2
|
+
so this package has no GUI-toolkit dependency.
|
|
3
|
+
|
|
4
|
+
Generated (not hand-transcribed) from a live PySide6 install:
|
|
5
|
+
|
|
6
|
+
from PySide6.QtGui import QColor
|
|
7
|
+
names = sorted(QColor.colorNames())
|
|
8
|
+
table = {n: QColor(n).getRgbF()[:3] for n in names}
|
|
9
|
+
|
|
10
|
+
Qt's list is 148 names, not the "standard" 147-entry CSS3/SVG set -- it
|
|
11
|
+
includes British-spelling aliases (`grey`, `darkgrey`, `lightgrey`, etc.)
|
|
12
|
+
alongside their American-spelling equivalents (`gray`, `darkgray`,
|
|
13
|
+
`lightgray`, ...) at identical RGB values, and it does *not* include
|
|
14
|
+
`rebeccapurple` (a CSS Color Module Level 4 addition Qt never adopted).
|
|
15
|
+
Generating this table programmatically rather than transcribing an external
|
|
16
|
+
"CSS3 color list" reference guarantees exact behavioral parity with the
|
|
17
|
+
QColor-based lookup this replaces, including those two edge cases.
|
|
18
|
+
|
|
19
|
+
To regenerate (e.g. after a PySide6 upgrade that might change the list):
|
|
20
|
+
run the snippet above in a Python environment with PySide6 installed and
|
|
21
|
+
replace CSS_COLORS below with the result.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
CSS_COLORS: dict[str, tuple[float, float, float]] = {
|
|
25
|
+
"aliceblue": (0.9411764740943909, 0.9725490212440491, 1.0),
|
|
26
|
+
"antiquewhite": (0.9803921580314636, 0.9215686321258545, 0.843137264251709),
|
|
27
|
+
"aqua": (0.0, 1.0, 1.0),
|
|
28
|
+
"aquamarine": (0.49803921580314636, 1.0, 0.8313725590705872),
|
|
29
|
+
"azure": (0.9411764740943909, 1.0, 1.0),
|
|
30
|
+
"beige": (0.9607843160629272, 0.9607843160629272, 0.8627451062202454),
|
|
31
|
+
"bisque": (1.0, 0.8941176533699036, 0.7686274647712708),
|
|
32
|
+
"black": (0.0, 0.0, 0.0),
|
|
33
|
+
"blanchedalmond": (1.0, 0.9215686321258545, 0.8039215803146362),
|
|
34
|
+
"blue": (0.0, 0.0, 1.0),
|
|
35
|
+
"blueviolet": (0.5411764979362488, 0.16862745583057404, 0.886274516582489),
|
|
36
|
+
"brown": (0.6470588445663452, 0.16470588743686676, 0.16470588743686676),
|
|
37
|
+
"burlywood": (0.8705882430076599, 0.7215686440467834, 0.529411792755127),
|
|
38
|
+
"cadetblue": (0.37254902720451355, 0.6196078658103943, 0.6274510025978088),
|
|
39
|
+
"chartreuse": (0.49803921580314636, 1.0, 0.0),
|
|
40
|
+
"chocolate": (0.8235294222831726, 0.4117647111415863, 0.11764705926179886),
|
|
41
|
+
"coral": (1.0, 0.49803921580314636, 0.3137255012989044),
|
|
42
|
+
"cornflowerblue": (0.3921568691730499, 0.5843137502670288, 0.929411768913269),
|
|
43
|
+
"cornsilk": (1.0, 0.9725490212440491, 0.8627451062202454),
|
|
44
|
+
"crimson": (0.8627451062202454, 0.0784313753247261, 0.23529411852359772),
|
|
45
|
+
"cyan": (0.0, 1.0, 1.0),
|
|
46
|
+
"darkblue": (0.0, 0.0, 0.545098066329956),
|
|
47
|
+
"darkcyan": (0.0, 0.545098066329956, 0.545098066329956),
|
|
48
|
+
"darkgoldenrod": (0.7215686440467834, 0.5254902243614197, 0.04313725605607033),
|
|
49
|
+
"darkgray": (0.6627451181411743, 0.6627451181411743, 0.6627451181411743),
|
|
50
|
+
"darkgreen": (0.0, 0.3921568691730499, 0.0),
|
|
51
|
+
"darkgrey": (0.6627451181411743, 0.6627451181411743, 0.6627451181411743),
|
|
52
|
+
"darkkhaki": (0.7411764860153198, 0.7176470756530762, 0.41960784792900085),
|
|
53
|
+
"darkmagenta": (0.545098066329956, 0.0, 0.545098066329956),
|
|
54
|
+
"darkolivegreen": (0.3333333432674408, 0.41960784792900085, 0.18431372940540314),
|
|
55
|
+
"darkorange": (1.0, 0.5490196347236633, 0.0),
|
|
56
|
+
"darkorchid": (0.6000000238418579, 0.19607843458652496, 0.800000011920929),
|
|
57
|
+
"darkred": (0.545098066329956, 0.0, 0.0),
|
|
58
|
+
"darksalmon": (0.9137254953384399, 0.5882353186607361, 0.47843137383461),
|
|
59
|
+
"darkseagreen": (0.5607843399047852, 0.7372549176216125, 0.5607843399047852),
|
|
60
|
+
"darkslateblue": (0.2823529541492462, 0.239215686917305, 0.545098066329956),
|
|
61
|
+
"darkslategray": (0.18431372940540314, 0.30980393290519714, 0.30980393290519714),
|
|
62
|
+
"darkslategrey": (0.18431372940540314, 0.30980393290519714, 0.30980393290519714),
|
|
63
|
+
"darkturquoise": (0.0, 0.8078431487083435, 0.8196078538894653),
|
|
64
|
+
"darkviolet": (0.5803921818733215, 0.0, 0.8274509906768799),
|
|
65
|
+
"deeppink": (1.0, 0.0784313753247261, 0.5764706134796143),
|
|
66
|
+
"deepskyblue": (0.0, 0.7490196228027344, 1.0),
|
|
67
|
+
"dimgray": (0.4117647111415863, 0.4117647111415863, 0.4117647111415863),
|
|
68
|
+
"dimgrey": (0.4117647111415863, 0.4117647111415863, 0.4117647111415863),
|
|
69
|
+
"dodgerblue": (0.11764705926179886, 0.5647059082984924, 1.0),
|
|
70
|
+
"firebrick": (0.6980392336845398, 0.13333334028720856, 0.13333334028720856),
|
|
71
|
+
"floralwhite": (1.0, 0.9803921580314636, 0.9411764740943909),
|
|
72
|
+
"forestgreen": (0.13333334028720856, 0.545098066329956, 0.13333334028720856),
|
|
73
|
+
"fuchsia": (1.0, 0.0, 1.0),
|
|
74
|
+
"gainsboro": (0.8627451062202454, 0.8627451062202454, 0.8627451062202454),
|
|
75
|
+
"ghostwhite": (0.9725490212440491, 0.9725490212440491, 1.0),
|
|
76
|
+
"gold": (1.0, 0.843137264251709, 0.0),
|
|
77
|
+
"goldenrod": (0.8549019694328308, 0.6470588445663452, 0.125490203499794),
|
|
78
|
+
"gray": (0.501960813999176, 0.501960813999176, 0.501960813999176),
|
|
79
|
+
"green": (0.0, 0.501960813999176, 0.0),
|
|
80
|
+
"greenyellow": (0.6784313917160034, 1.0, 0.18431372940540314),
|
|
81
|
+
"grey": (0.501960813999176, 0.501960813999176, 0.501960813999176),
|
|
82
|
+
"honeydew": (0.9411764740943909, 1.0, 0.9411764740943909),
|
|
83
|
+
"hotpink": (1.0, 0.4117647111415863, 0.7058823704719543),
|
|
84
|
+
"indianred": (0.8039215803146362, 0.3607843220233917, 0.3607843220233917),
|
|
85
|
+
"indigo": (0.29411765933036804, 0.0, 0.5098039507865906),
|
|
86
|
+
"ivory": (1.0, 1.0, 0.9411764740943909),
|
|
87
|
+
"khaki": (0.9411764740943909, 0.9019607901573181, 0.5490196347236633),
|
|
88
|
+
"lavender": (0.9019607901573181, 0.9019607901573181, 0.9803921580314636),
|
|
89
|
+
"lavenderblush": (1.0, 0.9411764740943909, 0.9607843160629272),
|
|
90
|
+
"lawngreen": (0.48627451062202454, 0.9882352948188782, 0.0),
|
|
91
|
+
"lemonchiffon": (1.0, 0.9803921580314636, 0.8039215803146362),
|
|
92
|
+
"lightblue": (0.6784313917160034, 0.8470588326454163, 0.9019607901573181),
|
|
93
|
+
"lightcoral": (0.9411764740943909, 0.501960813999176, 0.501960813999176),
|
|
94
|
+
"lightcyan": (0.8784313797950745, 1.0, 1.0),
|
|
95
|
+
"lightgoldenrodyellow": (0.9803921580314636, 0.9803921580314636, 0.8235294222831726),
|
|
96
|
+
"lightgray": (0.8274509906768799, 0.8274509906768799, 0.8274509906768799),
|
|
97
|
+
"lightgreen": (0.5647059082984924, 0.9333333373069763, 0.5647059082984924),
|
|
98
|
+
"lightgrey": (0.8274509906768799, 0.8274509906768799, 0.8274509906768799),
|
|
99
|
+
"lightpink": (1.0, 0.7137255072593689, 0.7568627595901489),
|
|
100
|
+
"lightsalmon": (1.0, 0.6274510025978088, 0.47843137383461),
|
|
101
|
+
"lightseagreen": (0.125490203499794, 0.6980392336845398, 0.6666666865348816),
|
|
102
|
+
"lightskyblue": (0.529411792755127, 0.8078431487083435, 0.9803921580314636),
|
|
103
|
+
"lightslategray": (0.46666666865348816, 0.5333333611488342, 0.6000000238418579),
|
|
104
|
+
"lightslategrey": (0.46666666865348816, 0.5333333611488342, 0.6000000238418579),
|
|
105
|
+
"lightsteelblue": (0.6901960968971252, 0.7686274647712708, 0.8705882430076599),
|
|
106
|
+
"lightyellow": (1.0, 1.0, 0.8784313797950745),
|
|
107
|
+
"lime": (0.0, 1.0, 0.0),
|
|
108
|
+
"limegreen": (0.19607843458652496, 0.8039215803146362, 0.19607843458652496),
|
|
109
|
+
"linen": (0.9803921580314636, 0.9411764740943909, 0.9019607901573181),
|
|
110
|
+
"magenta": (1.0, 0.0, 1.0),
|
|
111
|
+
"maroon": (0.501960813999176, 0.0, 0.0),
|
|
112
|
+
"mediumaquamarine": (0.4000000059604645, 0.8039215803146362, 0.6666666865348816),
|
|
113
|
+
"mediumblue": (0.0, 0.0, 0.8039215803146362),
|
|
114
|
+
"mediumorchid": (0.729411780834198, 0.3333333432674408, 0.8274509906768799),
|
|
115
|
+
"mediumpurple": (0.5764706134796143, 0.43921568989753723, 0.8588235378265381),
|
|
116
|
+
"mediumseagreen": (0.23529411852359772, 0.7019608020782471, 0.4431372582912445),
|
|
117
|
+
"mediumslateblue": (0.48235294222831726, 0.40784314274787903, 0.9333333373069763),
|
|
118
|
+
"mediumspringgreen": (0.0, 0.9803921580314636, 0.6039215922355652),
|
|
119
|
+
"mediumturquoise": (0.2823529541492462, 0.8196078538894653, 0.800000011920929),
|
|
120
|
+
"mediumvioletred": (0.7803921699523926, 0.08235294371843338, 0.5215686559677124),
|
|
121
|
+
"midnightblue": (0.09803921729326248, 0.09803921729326248, 0.43921568989753723),
|
|
122
|
+
"mintcream": (0.9607843160629272, 1.0, 0.9803921580314636),
|
|
123
|
+
"mistyrose": (1.0, 0.8941176533699036, 0.8823529481887817),
|
|
124
|
+
"moccasin": (1.0, 0.8941176533699036, 0.7098039388656616),
|
|
125
|
+
"navajowhite": (1.0, 0.8705882430076599, 0.6784313917160034),
|
|
126
|
+
"navy": (0.0, 0.0, 0.501960813999176),
|
|
127
|
+
"oldlace": (0.9921568632125854, 0.9607843160629272, 0.9019607901573181),
|
|
128
|
+
"olive": (0.501960813999176, 0.501960813999176, 0.0),
|
|
129
|
+
"olivedrab": (0.41960784792900085, 0.5568627715110779, 0.13725490868091583),
|
|
130
|
+
"orange": (1.0, 0.6470588445663452, 0.0),
|
|
131
|
+
"orangered": (1.0, 0.2705882489681244, 0.0),
|
|
132
|
+
"orchid": (0.8549019694328308, 0.43921568989753723, 0.8392156958580017),
|
|
133
|
+
"palegoldenrod": (0.9333333373069763, 0.9098039269447327, 0.6666666865348816),
|
|
134
|
+
"palegreen": (0.5960784554481506, 0.9843137264251709, 0.5960784554481506),
|
|
135
|
+
"paleturquoise": (0.686274528503418, 0.9333333373069763, 0.9333333373069763),
|
|
136
|
+
"palevioletred": (0.8588235378265381, 0.43921568989753723, 0.5764706134796143),
|
|
137
|
+
"papayawhip": (1.0, 0.9372549057006836, 0.8352941274642944),
|
|
138
|
+
"peachpuff": (1.0, 0.8549019694328308, 0.7254902124404907),
|
|
139
|
+
"peru": (0.8039215803146362, 0.5215686559677124, 0.24705882370471954),
|
|
140
|
+
"pink": (1.0, 0.7529411911964417, 0.7960784435272217),
|
|
141
|
+
"plum": (0.8666666746139526, 0.6274510025978088, 0.8666666746139526),
|
|
142
|
+
"powderblue": (0.6901960968971252, 0.8784313797950745, 0.9019607901573181),
|
|
143
|
+
"purple": (0.501960813999176, 0.0, 0.501960813999176),
|
|
144
|
+
"red": (1.0, 0.0, 0.0),
|
|
145
|
+
"rosybrown": (0.7372549176216125, 0.5607843399047852, 0.5607843399047852),
|
|
146
|
+
"royalblue": (0.2549019753932953, 0.4117647111415863, 0.8823529481887817),
|
|
147
|
+
"saddlebrown": (0.545098066329956, 0.2705882489681244, 0.07450980693101883),
|
|
148
|
+
"salmon": (0.9803921580314636, 0.501960813999176, 0.4470588266849518),
|
|
149
|
+
"sandybrown": (0.95686274766922, 0.6431372761726379, 0.3764705955982208),
|
|
150
|
+
"seagreen": (0.18039216101169586, 0.545098066329956, 0.34117648005485535),
|
|
151
|
+
"seashell": (1.0, 0.9607843160629272, 0.9333333373069763),
|
|
152
|
+
"sienna": (0.6274510025978088, 0.32156863808631897, 0.1764705926179886),
|
|
153
|
+
"silver": (0.7529411911964417, 0.7529411911964417, 0.7529411911964417),
|
|
154
|
+
"skyblue": (0.529411792755127, 0.8078431487083435, 0.9215686321258545),
|
|
155
|
+
"slateblue": (0.4156862795352936, 0.3529411852359772, 0.8039215803146362),
|
|
156
|
+
"slategray": (0.43921568989753723, 0.501960813999176, 0.5647059082984924),
|
|
157
|
+
"slategrey": (0.43921568989753723, 0.501960813999176, 0.5647059082984924),
|
|
158
|
+
"snow": (1.0, 0.9803921580314636, 0.9803921580314636),
|
|
159
|
+
"springgreen": (0.0, 1.0, 0.49803921580314636),
|
|
160
|
+
"steelblue": (0.27450981736183167, 0.5098039507865906, 0.7058823704719543),
|
|
161
|
+
"tan": (0.8235294222831726, 0.7058823704719543, 0.5490196347236633),
|
|
162
|
+
"teal": (0.0, 0.501960813999176, 0.501960813999176),
|
|
163
|
+
"thistle": (0.8470588326454163, 0.7490196228027344, 0.8470588326454163),
|
|
164
|
+
"tomato": (1.0, 0.38823530077934265, 0.27843138575553894),
|
|
165
|
+
"transparent": (0.0, 0.0, 0.0),
|
|
166
|
+
"turquoise": (0.250980406999588, 0.8784313797950745, 0.8156862854957581),
|
|
167
|
+
"violet": (0.9333333373069763, 0.5098039507865906, 0.9333333373069763),
|
|
168
|
+
"wheat": (0.9607843160629272, 0.8705882430076599, 0.7019608020782471),
|
|
169
|
+
"white": (1.0, 1.0, 1.0),
|
|
170
|
+
"whitesmoke": (0.9607843160629272, 0.9607843160629272, 0.9607843160629272),
|
|
171
|
+
"yellow": (1.0, 1.0, 0.0),
|
|
172
|
+
"yellowgreen": (0.6039215922355652, 0.8039215803146362, 0.19607843458652496),
|
|
173
|
+
}
|