Cylinder¶
⚙️ Spec sheet → — visual schematic and metrics measured from a real rendered STL.
Cylinders, cones, shear cylinders and pipe shapes.
-
pybosl2.shapes3d.cylinder.cylinder(height=
None, radius=None, center=None, length=None, radius1=None, radius2=None, diameter=None, diameter1=None, diameter2=None, chamfer=None, chamfer1=None, chamfer2=None, rounding=None, rounding1=None, rounding2=None, circumscribe=False, realign=False, shift=[0, 0], anchor=None, spin=0, orient=Anchor.TOP, fn=None, fa=None, fs=None, chamfer_angle=None, chamfer_angle1=None, chamfer_angle2=None, from_end=False, from_end1=None, from_end2=None, extra=0.0, extra1=None, extra2=None, teardrop=False, clip_angle=90.0, texture=None, tex_size=None, tex_reps=None, tex_depth=1.0, tex_inset=False)[source]¶ Return a cylinder with optional chamfering/rounding of its end rims, built with.
cube()/cylinder()/sphere()/rotate_extrude().
Positive rounding is built as a minkowski() of a shorter cylinder with a sphere at each rounded end (an inset fillet, not an outward bulge), matching BOSL2’s own rounded-end geometry. Chamfering builds the exact half-profile (with the requested bevel at each end) and revolves it with rotate_extrude().
Note:
texture=(VNF surface texturing) is not supported by this pure-Python port.- Parameters:¶
- length : float | None¶
length of the cylinder along its axis (default 1)
- height : float | None¶
length of the cylinder along its axis (default 1)
- radius : float | None¶
radius of the cylinder (default 1)
- diameter : float | None¶
diameter of the cylinder
- radius1 : float | None¶
radius of the negative end of the cylinder
- radius2 : float | None¶
radius of the positive end of the cylinder
- diameter1 : float | None¶
diameter of the negative end of the cylinder
- diameter2 : float | None¶
diameter of the positive end of the cylinder
- center : bool | None¶
if given, overrides anchor (True -> CENTER, False -> BOTTOM)
- chamfer : float | None¶
chamfer size on the end rims (overall/negative/positive)
- chamfer1 : float | None¶
chamfer size on the end rims (overall/negative/positive)
- chamfer2 : float | None¶
chamfer size on the end rims (overall/negative/positive)
- rounding : float | None¶
rounding radius on the end rims (overall/negative/positive)
- rounding1 : float | None¶
rounding radius on the end rims (overall/negative/positive)
- rounding2 : float | None¶
rounding radius on the end rims (overall/negative/positive)
- circumscribe : bool¶
circumscribe rather than inscribe the given radius (default False)
- realign : bool¶
shift point alignment (default False)
- shift : Sequence[float]¶
X/Y offset for the positive end (shear) (default [0,0])
- anchor : Anchor | Sequence[float] | None¶
anchor point (default BOTTOM if center=False, otherwise CENTER)
- spin : float¶
Z-axis rotation in degrees after anchor (default 0)
- orient : Anchor | Sequence[float]¶
direction to rotate the top towards, after spin (default UP)
- fn : int | None¶
arc smoothness overrides
- fa : float | None¶
arc smoothness overrides
- fs : float | None¶
arc smoothness overrides
- chamfer_angle : float | None¶
chamfer angle in degrees away from ends
- chamfer_angle1 : float | None¶
chamfer angle in degrees away from ends
- chamfer_angle2 : float | None¶
chamfer angle in degrees away from ends
- from_end : bool¶
measure chamfer along conic face (default False)
- from_end1 : bool | None¶
measure chamfer along conic face (default False)
- from_end2 : bool | None¶
measure chamfer along conic face (default False)
- extra : float¶
add extra height at ends (invisible to anchoring)
- extra1 : float | None¶
add extra height at ends (invisible to anchoring)
- extra2 : float | None¶
add extra height at ends (invisible to anchoring)
- teardrop : float | bool¶
limit rounding angle from horizontal
- clip_angle : float¶
clip rounding arc at bottom of cylinder
- texture : str | TextureType | None¶
named texture to apply to cylinder side surface
- tex_size : float | Sequence[float] | None¶
size of texture tile
- tex_reps : int | Sequence[int] | None¶
number of texture repetitions
- tex_depth : float¶
depth of the texture
- tex_inset : float | bool¶
inset the texture
- Return type:¶
Bosl2Solid
Examples
A basic cylinder:
from pybosl2.solid import cylinder cylinder(height=30, radius=10).show()Loading 3-D preview…A cylinder with chamfered ends:
from pybosl2.solid import cylinder cylinder(height=40, radius=15, chamfer=2).show()Loading 3-D preview…A cylinder with rounded ends:
from pybosl2.solid import cylinder cylinder(height=30, radius=12, rounding=2).show()Loading 3-D preview…
-
pybosl2.shapes3d.cylinder.cyl(height=
None, radius=None, center=None, length=None, radius1=None, radius2=None, diameter=None, diameter1=None, diameter2=None, chamfer=None, chamfer1=None, chamfer2=None, rounding=None, rounding1=None, rounding2=None, circumscribe=False, realign=False, shift=[0, 0], anchor=None, spin=0, orient=Anchor.TOP, fn=None, fa=None, fs=None, chamfer_angle=None, chamfer_angle1=None, chamfer_angle2=None, from_end=False, from_end1=None, from_end2=None, extra=0.0, extra1=None, extra2=None, teardrop=False, clip_angle=90.0, texture=None, tex_size=None, tex_reps=None, tex_depth=1.0, tex_inset=False)[source]¶ Return a cylinder with optional chamfering/rounding of its end rims, built with.
cube()/cylinder()/sphere()/rotate_extrude().
Positive rounding is built as a minkowski() of a shorter cylinder with a sphere at each rounded end (an inset fillet, not an outward bulge), matching BOSL2’s own rounded-end geometry. Chamfering builds the exact half-profile (with the requested bevel at each end) and revolves it with rotate_extrude().
Note: texture= (VNF surface texturing) is not supported by this pure-Python port.
- Parameters:¶
- length : float | None¶
length of the cylinder along its axis (default 1)
- height : float | None¶
length of the cylinder along its axis (default 1)
- radius : float | None¶
radius of the cylinder (default 1)
- diameter : float | None¶
diameter of the cylinder
- radius1 : float | None¶
radius of the negative end of the cylinder
- radius2 : float | None¶
radius of the positive end of the cylinder
- diameter1 : float | None¶
diameter of the negative end of the cylinder
- diameter2 : float | None¶
diameter of the positive end of the cylinder
- center : bool | None¶
if given, overrides anchor (True -> CENTER, False -> BOTTOM)
- chamfer : float | None¶
chamfer size on the end rims (overall/negative/positive)
- chamfer1 : float | None¶
chamfer size on the end rims (overall/negative/positive)
- chamfer2 : float | None¶
chamfer size on the end rims (overall/negative/positive)
- rounding : float | None¶
rounding radius on the end rims (overall/negative/positive)
- rounding1 : float | None¶
rounding radius on the end rims (overall/negative/positive)
- rounding2 : float | None¶
rounding radius on the end rims (overall/negative/positive)
- circumscribe : bool¶
circumscribe rather than inscribe the given radius (default False)
- realign : bool¶
shift point alignment (default False)
- shift : Sequence[float]¶
X/Y offset for the positive end (shear) (default [0,0])
- anchor : Anchor | Sequence[float] | None¶
anchor point (default CENTER)
- spin : float¶
Z-axis rotation in degrees after anchor (default 0)
- orient : Anchor | Sequence[float]¶
direction to rotate the top towards, after spin (default UP)
- fn : int | None¶
arc smoothness overrides
- fa : float | None¶
arc smoothness overrides
- fs : float | None¶
arc smoothness overrides
- chamfer_angle : float | None¶
chamfer angle in degrees away from ends
- chamfer_angle1 : float | None¶
chamfer angle in degrees away from ends
- chamfer_angle2 : float | None¶
chamfer angle in degrees away from ends
- from_end : bool¶
measure chamfer along conic face (default False)
- from_end1 : bool | None¶
measure chamfer along conic face (default False)
- from_end2 : bool | None¶
measure chamfer along conic face (default False)
- extra : float¶
add extra height at ends (invisible to anchoring)
- extra1 : float | None¶
add extra height at ends (invisible to anchoring)
- extra2 : float | None¶
add extra height at ends (invisible to anchoring)
- teardrop : float | bool¶
limit rounding angle from horizontal
- clip_angle : float¶
clip rounding arc at bottom of cylinder
- texture : str | TextureType | None¶
named texture to apply to cylinder side surface
- tex_size : float | Sequence[float] | None¶
size of texture tile
- tex_reps : int | Sequence[int] | None¶
number of texture repetitions
- tex_depth : float¶
depth of the texture
- tex_inset : float | bool¶
inset the texture
- Return type:¶
Bosl2Solid
Examples
A basic cylinder: .. pythonscad-example:
from pybosl2 import cyl shape = cyl(radius=10, height=30) shape.show()A cylinder with chamfered ends: .. pythonscad-example:
from pybosl2 import cyl shape = cyl(radius=15, height=40, chamfer=2) shape.show()A cylinder with rounded ends: .. pythonscad-example:
from pybosl2 import cyl shape = cyl(radius=12, height=35, rounding=3) shape.show()
-
pybosl2.shapes3d.cylinder.cyl_profile(radius1, radius2, length, rounding1=
0, rounding2=0, chamfer1=0, chamfer2=0, chamfer_angle1=None, chamfer_angle2=None, from_end1=False, from_end2=False, fn=None, fa=None, fs=None, teardrop=False, clip_angle=90.0)[source]¶ Generate a 2D cylinder profile with optional rounding and chamfering.
- Parameters:¶
- radius1 : float¶
- radius2 : float¶
- length : float¶
- rounding1 : float¶
- rounding2 : float¶
- chamfer1 : float¶
- chamfer2 : float¶
- chamfer_angle1 : float | None¶
- chamfer_angle2 : float | None¶
- from_end1 : bool¶
- from_end2 : bool¶
- fn : int | None¶
- fa : float | None¶
- fs : float | None¶
- teardrop : float | bool¶
- clip_angle : float¶
- Return type:¶
list[list[float]]
-
pybosl2.shapes3d.cylinder.xcyl(height=
None, radius=None, center=None, length=None, radius1=None, radius2=None, diameter=None, diameter1=None, diameter2=None, chamfer=None, chamfer1=None, chamfer2=None, rounding=None, rounding1=None, rounding2=None, circumscribe=False, realign=False, shift=[0, 0], anchor=None, spin=0, orient=Anchor.TOP, fn=None, fa=None, fs=None, chamfer_angle=None, chamfer_angle1=None, chamfer_angle2=None, from_end=False, from_end1=None, from_end2=None, extra=0.0, extra1=None, extra2=None, teardrop=False, clip_angle=90.0, texture=None, tex_size=None, tex_reps=None, tex_depth=1.0, tex_inset=False)[source]¶ Return a cylinder oriented along the X axis. See cyl() for argument details.
Examples
from pybosl2.shapes3d.cylinder import xcyl shape = xcyl(radius=10, height=30) shape.show()Loading 3-D preview…- Parameters:¶
- height : float | None¶
- radius : float | None¶
- center : bool | None¶
- length : float | None¶
- radius1 : float | None¶
- radius2 : float | None¶
- diameter : float | None¶
- diameter1 : float | None¶
- diameter2 : float | None¶
- chamfer : float | None¶
- chamfer1 : float | None¶
- chamfer2 : float | None¶
- rounding : float | None¶
- rounding1 : float | None¶
- rounding2 : float | None¶
- circumscribe : bool¶
- realign : bool¶
- shift : Sequence[float]¶
- anchor : Anchor | Sequence[float] | None¶
- spin : float¶
- orient : Anchor | Sequence[float]¶
- fn : int | None¶
- fa : float | None¶
- fs : float | None¶
- chamfer_angle : float | None¶
- chamfer_angle1 : float | None¶
- chamfer_angle2 : float | None¶
- from_end : bool¶
- from_end1 : bool | None¶
- from_end2 : bool | None¶
- extra : float¶
- extra1 : float | None¶
- extra2 : float | None¶
- teardrop : float | bool¶
- clip_angle : float¶
- texture : str | TextureType | None¶
- tex_size : float | Sequence[float] | None¶
- tex_reps : int | Sequence[int] | None¶
- tex_depth : float¶
- tex_inset : float | bool¶
- Return type:¶
Bosl2Solid
-
pybosl2.shapes3d.cylinder.ycyl(height=
None, radius=None, center=None, length=None, radius1=None, radius2=None, diameter=None, diameter1=None, diameter2=None, chamfer=None, chamfer1=None, chamfer2=None, rounding=None, rounding1=None, rounding2=None, circumscribe=False, realign=False, shift=[0, 0], anchor=None, spin=0, orient=Anchor.TOP, fn=None, fa=None, fs=None, chamfer_angle=None, chamfer_angle1=None, chamfer_angle2=None, from_end=False, from_end1=None, from_end2=None, extra=0.0, extra1=None, extra2=None, teardrop=False, clip_angle=90.0, texture=None, tex_size=None, tex_reps=None, tex_depth=1.0, tex_inset=False)[source]¶ Return a cylinder oriented along the Y axis. See cyl() for argument details.
Examples
from pybosl2.shapes3d.cylinder import ycyl shape = ycyl(radius=10, height=30) shape.show()Loading 3-D preview…- Parameters:¶
- height : float | None¶
- radius : float | None¶
- center : bool | None¶
- length : float | None¶
- radius1 : float | None¶
- radius2 : float | None¶
- diameter : float | None¶
- diameter1 : float | None¶
- diameter2 : float | None¶
- chamfer : float | None¶
- chamfer1 : float | None¶
- chamfer2 : float | None¶
- rounding : float | None¶
- rounding1 : float | None¶
- rounding2 : float | None¶
- circumscribe : bool¶
- realign : bool¶
- shift : Sequence[float]¶
- anchor : Anchor | Sequence[float] | None¶
- spin : float¶
- orient : Anchor | Sequence[float]¶
- fn : int | None¶
- fa : float | None¶
- fs : float | None¶
- chamfer_angle : float | None¶
- chamfer_angle1 : float | None¶
- chamfer_angle2 : float | None¶
- from_end : bool¶
- from_end1 : bool | None¶
- from_end2 : bool | None¶
- extra : float¶
- extra1 : float | None¶
- extra2 : float | None¶
- teardrop : float | bool¶
- clip_angle : float¶
- texture : str | TextureType | None¶
- tex_size : float | Sequence[float] | None¶
- tex_reps : int | Sequence[int] | None¶
- tex_depth : float¶
- tex_inset : float | bool¶
- Return type:¶
Bosl2Solid
-
pybosl2.shapes3d.cylinder.zcyl(height=
None, radius=None, center=None, length=None, radius1=None, radius2=None, diameter=None, diameter1=None, diameter2=None, chamfer=None, chamfer1=None, chamfer2=None, rounding=None, rounding1=None, rounding2=None, circumscribe=False, realign=False, shift=[0, 0], anchor=None, spin=0, orient=Anchor.TOP, fn=None, fa=None, fs=None, chamfer_angle=None, chamfer_angle1=None, chamfer_angle2=None, from_end=False, from_end1=None, from_end2=None, extra=0.0, extra1=None, extra2=None, teardrop=False, clip_angle=90.0, texture=None, tex_size=None, tex_reps=None, tex_depth=1.0, tex_inset=False)[source]¶ Return a cylinder oriented along the Z axis (same as cyl() with default orientation). See cyl() for.
argument details.
Examples
from pybosl2.shapes3d.cylinder import zcyl shape = zcyl(radius=10, height=30) shape.show()Loading 3-D preview…- Parameters:¶
- height : float | None¶
- radius : float | None¶
- center : bool | None¶
- length : float | None¶
- radius1 : float | None¶
- radius2 : float | None¶
- diameter : float | None¶
- diameter1 : float | None¶
- diameter2 : float | None¶
- chamfer : float | None¶
- chamfer1 : float | None¶
- chamfer2 : float | None¶
- rounding : float | None¶
- rounding1 : float | None¶
- rounding2 : float | None¶
- circumscribe : bool¶
- realign : bool¶
- shift : Sequence[float]¶
- anchor : Anchor | Sequence[float] | None¶
- spin : float¶
- orient : Anchor | Sequence[float]¶
- fn : int | None¶
- fa : float | None¶
- fs : float | None¶
- chamfer_angle : float | None¶
- chamfer_angle1 : float | None¶
- chamfer_angle2 : float | None¶
- from_end : bool¶
- from_end1 : bool | None¶
- from_end2 : bool | None¶
- extra : float¶
- extra1 : float | None¶
- extra2 : float | None¶
- teardrop : float | bool¶
- clip_angle : float¶
- texture : str | TextureType | None¶
- tex_size : float | Sequence[float] | None¶
- tex_reps : int | Sequence[int] | None¶
- tex_depth : float¶
- tex_inset : float | bool¶
- Return type:¶
Bosl2Solid
-
pybosl2.shapes3d.cylinder.tube(height=
None, outer_radius=None, inner_radius=None, center=None, outer_diameter=None, inner_diameter=None, wall=None, outer_radius1=None, outer_radius2=None, outer_diameter1=None, outer_diameter2=None, inner_radius1=None, inner_radius2=None, inner_diameter1=None, inner_diameter2=None, chamfer=None, chamfer1=None, chamfer2=None, rounding=None, rounding1=None, rounding2=None, realign=False, length=None, anchor=Anchor.CENTER, spin=0, orient=Anchor.TOP, fn=None, fa=None, fs=None)[source]¶ BOSL2 tube() – a hollow cylindrical tube, with optional chamfer/rounding on end rims.
Note: BOSL2’s outer-radius parameters are named
or/or1/or2, which collide with the Python keywordor; they are exposed here asouter_radius/outer_radius1/outer_radius2instead.- Parameters:¶
- height : float | None¶
height of the tube (default 1)
- length : float | None¶
height of the tube (default 1)
- outer_radius : float | None¶
outer radius of the tube (BOSL2
or) (default 1)- inner_radius : float | None¶
inner radius of the tube
- center : bool | None¶
if given, overrides anchor (True -> CENTER, False -> DOWN)
- outer_diameter : float | None¶
outer diameter of the tube
- inner_diameter : float | None¶
inner diameter of the tube
- wall : float | None¶
horizontal wall thickness (default 1)
- outer_radius1 : float | None¶
outer radius of the bottom/top
- outer_radius2 : float | None¶
outer radius of the bottom/top
- outer_diameter1 : float | None¶
outer diameter of the bottom/top
- outer_diameter2 : float | None¶
outer diameter of the bottom/top
- inner_radius1 : float | None¶
inner radius of the bottom/top
- inner_radius2 : float | None¶
inner radius of the bottom/top
- inner_diameter1 : float | None¶
inner diameter of the bottom/top
- inner_diameter2 : float | None¶
inner diameter of the bottom/top
- chamfer : float | None¶
chamfer size on end rims (overall/bottom/top)
- chamfer1 : float | None¶
chamfer size on end rims (overall/bottom/top)
- chamfer2 : float | None¶
chamfer size on end rims (overall/bottom/top)
- rounding : float | None¶
rounding radius on end rims (overall/bottom/top)
- rounding1 : float | None¶
rounding radius on end rims (overall/bottom/top)
- rounding2 : float | None¶
rounding radius on end rims (overall/bottom/top)
- realign : bool¶
rotate by half the angle of one face (default False)
- anchor : Anchor | Sequence[float]¶
anchor point (default CENTER)
- spin : float¶
Z-axis rotation in degrees after anchor (default 0)
- orient : Anchor | Sequence[float]¶
direction to rotate the top towards, after spin (default UP)
- fn : int | None¶
arc smoothness overrides
- fa : float | None¶
arc smoothness overrides
- fs : float | None¶
arc smoothness overrides
- Return type:¶
Bosl2Solid
Examples
from pybosl2 import tube shape = tube(height=20, outer_radius=15, inner_radius=10) shape.show()Loading 3-D preview…A tube with chamfered end rims:
from pybosl2 import tube shape = tube(height=20, outer_radius=15, inner_radius=10, chamfer=1) shape.show()Loading 3-D preview…
-
pybosl2.shapes3d.cylinder.cone(height=
None, radius=None, radius1=None, radius2=None, center=None, diameter=None, diameter1=None, diameter2=None, chamfer=None, chamfer1=None, chamfer2=None, rounding=None, rounding1=None, rounding2=None, length=None, anchor=None, spin=0, orient=Anchor.TOP, fn=None, fa=None, fs=None)[source]¶ Return a cone/truncated cone with optional chamfering or rounding of the end rims.
Convenience wrapper around
cyl()/cylinder()withradius2=0by default for a pointed cone, or with explicitradius2for a truncated (frustum) form.- Parameters:¶
- height : float | None¶
height of the cone (default 1)
- length : float | None¶
height of the cone (default 1)
- radius : float | None¶
base radius (default 1)
- radius1 : float | None¶
bottom radius (overrides radius)
- radius2 : float | None¶
top radius (default 0 for a pointed cone)
- center : bool | None¶
if given, overrides anchor
- diameter : float | None¶
base diameter
- diameter1 : float | None¶
bottom diameter
- diameter2 : float | None¶
top diameter
- chamfer : float | None¶
chamfer size on the end rims
- chamfer1 : float | None¶
chamfer size on the end rims
- chamfer2 : float | None¶
chamfer size on the end rims
- rounding : float | None¶
rounding radius on the end rims
- rounding1 : float | None¶
rounding radius on the end rims
- rounding2 : float | None¶
rounding radius on the end rims
- anchor : Anchor | Sequence[float] | None¶
anchor point
- spin : float¶
Z-axis rotation in degrees after anchor (default 0)
- orient : Anchor | Sequence[float]¶
direction to rotate the top towards, after spin (default UP)
- fn : int | None¶
arc smoothness overrides
- fa : float | None¶
arc smoothness overrides
- fs : float | None¶
arc smoothness overrides
- Return type:¶
Bosl2Solid
Examples
A pointed cone:
from pybosl2 import shapes3d as s3 s3.cone(height=30, radius=15).show()Loading 3-D preview…A truncated cone (frustum):
from pybosl2 import shapes3d as s3 s3.cone(height=30, radius1=15, radius2=8).show()Loading 3-D preview…A cone with chamfered base:
from pybosl2 import shapes3d as s3 s3.cone(height=30, radius1=15, radius2=3, chamfer=2).show()Loading 3-D preview…