MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / test_aligned_text_mesh

Function test_aligned_text_mesh

test_python/test_textMesh.py:18–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16
17
18def test_aligned_text_mesh():
19 sphere = mrmesh.makeSphere(mrmesh.SphereParams())
20 params = mrmesh.TextAlignParams()
21 # find representatice point on mesh
22 params.startPoint = mrmesh.findProjection(mrmesh.Vector3f(0, 0, 1), sphere).mtp
23 params.direction = mrmesh.Vector3f(1, 0, 0)
24 params.text = "Hello World"
25 params.fontHeight = 0.02
26 params.pathToFontFile = os.path.join(
27 os.path.dirname(os.path.abspath(__file__)),
28 "../thirdparty/Noto_Sans/NotoSans-Regular.ttf",
29 )
30 # how deep to engrave
31 params.surfaceOffset = 0.1
32 alignedMesh = mrmesh.alignTextToMesh(sphere, params)
33 booleanRes = mrmesh.boolean(
34 sphere, alignedMesh, mrmesh.BooleanOperation.Intersection
35 )
36 assert booleanRes.valid(), booleanRes.errorString
37 gravedPart = booleanRes.mesh
38 volume = gravedPart.volume()
39 assert volume > 0
40 assert volume < alignedMesh.volume()

Callers

nothing calls this directly

Calls 3

joinMethod · 0.45
validMethod · 0.45
volumeMethod · 0.45

Tested by

no test coverage detected