MCPcopy Index your code
hub / github.com/CadQuery/cadquery / testLocationAt

Method testLocationAt

tests/test_cadquery.py:4866–4908  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4864 self.assertEqual(w1.size(), 0)
4865
4866 def testLocationAt(self):
4867
4868 r = 1
4869 e = Wire.makeHelix(r, r, r).Edges()[0]
4870
4871 locs_frenet = e.locations([0, 1], frame="frenet")
4872
4873 T1 = locs_frenet[0].wrapped.Transformation()
4874 T2 = locs_frenet[1].wrapped.Transformation()
4875
4876 self.assertAlmostEqual(T1.TranslationPart().X(), r, 6)
4877 self.assertAlmostEqual(T2.TranslationPart().X(), r, 6)
4878 self.assertAlmostEqual(
4879 T1.GetRotation().GetRotationAngle(), -T2.GetRotation().GetRotationAngle(), 6
4880 )
4881
4882 ga = e._geomAdaptor()
4883
4884 locs_corrected = e.locations(
4885 [ga.FirstParameter(), ga.LastParameter()],
4886 mode="parameter",
4887 frame="corrected",
4888 )
4889
4890 T3 = locs_corrected[0].wrapped.Transformation()
4891 T4 = locs_corrected[1].wrapped.Transformation()
4892
4893 self.assertAlmostEqual(T3.TranslationPart().X(), r, 6)
4894 self.assertAlmostEqual(T4.TranslationPart().X(), r, 6)
4895
4896 w = Wire.assembleEdges(
4897 [
4898 Edge.makeLine(Vector(), Vector(0, 1)),
4899 Edge.makeLine(Vector(0, 1), Vector(1, 1)),
4900 ]
4901 )
4902 locs_wire = e.locations([0, 1])
4903
4904 T5 = locs_wire[0].wrapped.Transformation()
4905 T6 = locs_wire[1].wrapped.Transformation()
4906
4907 self.assertAlmostEqual(T5.TranslationPart().X(), r, 0)
4908 self.assertAlmostEqual(T6.TranslationPart().X(), r, 1)
4909
4910 def testNormal(self):
4911

Callers

nothing calls this directly

Calls 7

VectorClass · 0.85
EdgesMethod · 0.80
makeHelixMethod · 0.80
locationsMethod · 0.80
assembleEdgesMethod · 0.80
makeLineMethod · 0.80
_geomAdaptorMethod · 0.45

Tested by

no test coverage detected