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

Method radiusArc

cadquery/cq.py:2154–2188  ·  view source on GitHub ↗

Draw an arc from the current point to endPoint with an arc defined by the radius. :param endPoint: end point for the arc :type endPoint: 2-tuple, in workplane coordinates :param radius: the radius of the arc :type radius: float, the radius of the arc between

(
        self: T, endPoint: VectorLike, radius: float, forConstruction: bool = False,
    )

Source from the content-addressed store, hash-verified

2152 return self.threePointArc(sagPoint, endPoint, forConstruction)
2153
2154 def radiusArc(
2155 self: T, endPoint: VectorLike, radius: float, forConstruction: bool = False,
2156 ) -> T:
2157 """
2158 Draw an arc from the current point to endPoint with an arc defined by the radius.
2159
2160 :param endPoint: end point for the arc
2161 :type endPoint: 2-tuple, in workplane coordinates
2162 :param radius: the radius of the arc
2163 :type radius: float, the radius of the arc between start point and end point.
2164 :return: a workplane with the current point at the end of the arc
2165
2166 Given that a closed contour is drawn clockwise;
2167 A positive radius means convex arc and negative radius means concave arc.
2168 """
2169
2170 startPoint = self._findFromPoint(useLocalCoords=True)
2171 endPoint = Vector(endPoint)
2172
2173 # Calculate the sagitta from the radius
2174 length = endPoint.sub(startPoint).Length / 2.0
2175 try:
2176 sag = abs(radius)
2177 r_2_l_2 = radius ** 2 - length ** 2
2178 # Float imprecision can lead slightly negative values: consider them as zeros
2179 if abs(r_2_l_2) >= TOL:
2180 sag -= math.sqrt(r_2_l_2)
2181 except ValueError:
2182 raise ValueError("Arc radius is not large enough to reach the end point.")
2183
2184 # Return a sagittaArc
2185 if radius > 0:
2186 return self.sagittaArc(endPoint, sag, forConstruction)
2187 else:
2188 return self.sagittaArc(endPoint, -sag, forConstruction)
2189
2190 def tangentArcPoint(
2191 self: T,

Callers 4

test_arcMethod · 0.80
test2DDrawingMethod · 0.80
testTangengAtMethod · 0.80

Calls 4

_findFromPointMethod · 0.95
subMethod · 0.95
sagittaArcMethod · 0.95
VectorClass · 0.85

Tested by 3

test_arcMethod · 0.64
test2DDrawingMethod · 0.64
testTangengAtMethod · 0.64