MCPcopy
hub / github.com/CadQuery/cadquery / test_project

Function test_project

tests/test_free_functions.py:1164–1190  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1162
1163
1164def test_project():
1165
1166 base = cylinder(1, 2).faces("%CYLINDER")
1167 e = circle(0.1).moved(rx=90).moved(y=0.5, z=1)
1168
1169 # project single edge
1170 res = project(e, base)
1171
1172 assert res.isValid()
1173 assert res.IsClosed()
1174 assert isinstance(res, Edge)
1175
1176 # project multiple edges at once
1177 res = project(e.moved([(0, -0.1), (0, 0.1)]), base)
1178 assert isinstance(res, Compound)
1179 for el in res:
1180 assert el.isValid()
1181 assert el.IsClosed()
1182
1183 # project using cylindrical projection
1184 res = project(e, base, (0, 1, 0))
1185
1186 assert len(res.Edges()) == 2
1187 assert isinstance(res, Compound)
1188 for el in res:
1189 assert el.isValid()
1190 assert el.IsClosed()
1191
1192
1193# %% export

Callers

nothing calls this directly

Calls 8

cylinderFunction · 0.85
circleFunction · 0.85
projectFunction · 0.85
isValidMethod · 0.80
IsClosedMethod · 0.80
EdgesMethod · 0.80
facesMethod · 0.45
movedMethod · 0.45

Tested by

no test coverage detected