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

Method locationAt

cadquery/occ_impl/shapes.py:2414–2461  ·  view source on GitHub ↗

Generate a location along the underlying curve. :param d: distance or parameter value :param mode: position calculation mode (default: length) :param frame: moving frame calculation method (default: frenet) :param planar: planar mode :return: A Locat

(
        self: Mixin1DProtocol,
        d: float,
        mode: ParamMode = "length",
        frame: FrameMode = "frenet",
        planar: bool = False,
    )

Source from the content-addressed store, hash-verified

2412 return pnts, params
2413
2414 def locationAt(
2415 self: Mixin1DProtocol,
2416 d: float,
2417 mode: ParamMode = "length",
2418 frame: FrameMode = "frenet",
2419 planar: bool = False,
2420 ) -> Location:
2421 """
2422 Generate a location along the underlying curve.
2423
2424 :param d: distance or parameter value
2425 :param mode: position calculation mode (default: length)
2426 :param frame: moving frame calculation method (default: frenet)
2427 :param planar: planar mode
2428 :return: A Location object representing local coordinate system at the specified distance.
2429 """
2430
2431 curve, param = self._curve_and_param(d, mode)
2432
2433 law: GeomFill_TrihedronLaw
2434 if frame == "frenet":
2435 law = GeomFill_Frenet()
2436 else:
2437 law = GeomFill_CorrectedFrenet()
2438
2439 law.SetCurve(curve)
2440
2441 tangent, normal, binormal = gp_Vec(), gp_Vec(), gp_Vec()
2442
2443 law.D0(param, tangent, normal, binormal)
2444 pnt = curve.Value(param)
2445
2446 T = gp_Trsf()
2447 if planar:
2448 T.SetTransformation(
2449 gp_Ax3(
2450 pnt,
2451 gp_Dir(0, 0, 1),
2452 gp_Dir(Vector(0, 0, 1).cross(Vector(tangent)).normalized().wrapped),
2453 ),
2454 gp_Ax3(),
2455 )
2456 else:
2457 T.SetTransformation(
2458 gp_Ax3(pnt, gp_Dir(tangent.XYZ()), gp_Dir(normal.XYZ())), gp_Ax3()
2459 )
2460
2461 return Location(TopLoc_Location(T))
2462
2463 def locations(
2464 self: Mixin1DProtocol,

Callers 1

locationsMethod · 0.95

Calls 5

_curve_and_paramMethod · 0.95
VectorClass · 0.85
LocationClass · 0.85
normalizedMethod · 0.80
crossMethod · 0.80

Tested by

no test coverage detected