@@ -3800,6 +3800,59 @@ def sphere(
3800
3800
else :
3801
3801
return self .union (spheres , clean = clean )
3802
3802
3803
+ def cone (
3804
+ self : T ,
3805
+ height : float ,
3806
+ radius : float = 0 ,
3807
+ radius1 : float = None ,
3808
+ radius2 : float = None ,
3809
+ direct : Vector = Vector (0 , 0 , 1 ),
3810
+ angle : float = 360 ,
3811
+ combine : bool = True ,
3812
+ clean : bool = True ,
3813
+ ) -> T :
3814
+ """
3815
+ Returns a cone with the specified radius and height for each point on the stack
3816
+ A truncated cone can be created by specifying parameters radius1 and radius2 instead of radius.
3817
+ :param height: The height of the cone
3818
+ :type height: float > 0
3819
+ :param radius: The radius of the cone
3820
+ :type radius: float > 0
3821
+ :param radius1: The radius of the bottom of the cone
3822
+ :type radius1: float > 0
3823
+ :param radius2: The radius of the top of the cone
3824
+ :type radius2: float > 0
3825
+ :param direct: The direction axis for the creation of the cone
3826
+ :type direct: A three-tuple
3827
+ :param angle: The angle to sweep the cone arc through
3828
+ :type angle: float > 0
3829
+ :param combine: Whether the results should be combined with other solids on the stack
3830
+ (and each other)
3831
+ :type combine: true to combine shapes, false otherwise
3832
+ :param clean: call :py:meth:`clean` afterwards to have a clean shape
3833
+ :return: A cone object for each point on the stack
3834
+ One cone is created for each item on the current stack. If no items are on the stack, one
3835
+ cone is created using the current workplane center.
3836
+ If combine is true, the result will be a single object on the stack. If a solid was found
3837
+ in the chain, the result is that solid with all cones produced fused onto it otherwise,
3838
+ the result is the combination of all the produced cones.
3839
+ If combine is false, the result will be a list of the cones produced.
3840
+ """
3841
+
3842
+ r1 = radius if radius1 is None or radius1 == 0 else radius1
3843
+ r2 = 0 if radius2 is None else radius2
3844
+ offset = Vector ()
3845
+ s = Solid .makeCone (r1 , r2 , height , offset , direct , angle )
3846
+
3847
+ # We want a cone for each point on the workplane
3848
+ cones = self .eachpoint (lambda loc : s .moved (loc ), True )
3849
+
3850
+ # If we don't need to combine everything, just return the created cones
3851
+ if not combine :
3852
+ return cones
3853
+ else :
3854
+ return self .union (cones , clean = clean )
3855
+
3803
3856
def cylinder (
3804
3857
self : T ,
3805
3858
height : float ,
0 commit comments