Package Docs 0.8.17¶
-
class
taperable_helix.
HelixLocation
(radius=None, horz_offset=0, vert_offset=0)[source]¶ -
radius
: Optional[float] = None¶ radius of helix if none h.radius
-
horz_offset
: float = 0¶ horizontal offset added to radius then x and y calculated
-
vert_offset
: float = 0¶ vertical added to z of radius
-
-
class
taperable_helix.
Helix
(radius, pitch, height, taper_out_rpos=0, taper_in_rpos=1, inset_offset=0, first_t=0, last_t=1)[source]¶ This class represents a taperable Helix.
The required attributes are radius, pitch and height. Thse attributes create simple single line helix. But the primary purpose for Helix is to create a set of helical “wires” using non-zero values for taper_rpos, horz_offset and vert_offset to define solid helixes that can taper at each end to a point.
This is useful for creating internal and external threads for nuts and bolts. This is accomplished by invoking helix() multiple times with same radius, pitch, taper_rpos, inset_offset, first_t, and last_t. But with different HelixLocation radius, horz_offset and vert_offset.
Each returned function will then generate a helix defining an edge of the thread. The edges can be used to make faces and subsequently a solid of the thread. This can then be combined with the “core” objects which the threads are “attached” using a “union” operator.
-
radius
: float¶ radius of the basic helix.
-
pitch
: float¶ pitch of the helix per revolution. I.e the distance between the height of a single “turn” of the helix.
-
height
: float¶ height of the cyclinder containing the helix.
-
taper_out_rpos
: float = 0¶ taper_out_rpos is a decimal number with an inclusive range of 0..1 such that (taper_out_rpos * t_range) defines the t value where tapering out ends, it begins at t == first_t. A ValueError exception is raised if taper_out_rpos < 0 or > 1 or taper_out_rpos > taper_in_rpos. Default is 0 which is no out taper.
-
taper_in_rpos
: float = 1¶ taper_in_rpos: is a decimal number with an inclusive range of 0..1 such that (taper_in_rpos * t_range) defines the t value where tapering in begins, it ends at t == last_t. A ValueError exception is raised if taper_out_rpos < 0 or > 1 or taper_out_rpos > taper_in_rpos. Default is 1 which is no in taper.
-
inset_offset
: float = 0¶ inset_offset: the helix will start at z = inset_offset and will end at z = height - (2 * inset_offset). Default 0.
-
first_t
: float = 0¶ first_t is the first t value passed to the returned function. Default 0
-
last_t
: float = 1¶ last_t is the last t value passed to the returned function. Default 1
-
helix
(hl=None)[source]¶ This function returns a Function that is used to generates points on a helix.
It takes an optional HelixLocation which refines the location of the final helix when its tapered. If HelixLocation is None then the radius is Helix.radius and horz_offset and vert_offset will be 0. If its not None HelixLocation.radius maybe None, in which case Helix.radius will be used. and HelixLocation.horz_offset will be added to the radius and used to calculate x and y. The HelixLocation.vert_offset will be added to z.
This function returns a function, f. The funciton f that takes one parameter, an inclusive value between first_t and last_t. We then define t_range=last_t-first_t and the rel_height=(last_t-t)/t_range. The rel_height is the relative position along the “z-axis” which is used to calculate function functions returned tuple(x, y, z) for a point on the helix.
Credit: Adam Urbanczyk from cadquery [forum post](https://groups.google.com/g/cadquery/c/5kVRpECcxAU/m/7no7_ja6AAAJ)
- Parameters
hl (
Optional
[HelixLocation
]) – Defines a refinded location when the helix is tapered- Return type
Callable
[[float
],Tuple
[float
,float
,float
]]- Returns
A function which is passed “t”, an inclusive value between first_t and last_t and returns a 3D point (x, y, z) on the helix as a function of t.
-