While I was experimenting with ways to make a tapered bearing I made a beveled nut and thought it would be handy to have a module that you can make regular nuts or beveled nuts with, you can also make cone shaped washers, flat washers or stoppers with the same code.

Here is the code just copy and paste it into the editor in Openscad:

sides =6; //[3:1:200]
height = 5; //[4:.1:100] 
bevel = 4; //[4:1:20]
diameter = 1; //[0:.1:100]
inside_hole_shape = 100; //[3:1:100]
inside_hole_size = 4; //[0:.01:100]
Rotate = 30; //[0:.1:360]
  
 module outside(){ 
 hull(){
  for(i=[0:1:360])
	rotate(i)
	translate([diameter,0,90])
	rotate([0,90,0])
	rotate_extrude(angle=3)
	translate([90,0,10])
	circle(height,$fn=bevel);
}}                                
                           
module bevel(){
  intersection(){
   outside();
   rotate([0,0,Rotate])
   cylinder(h=height,r=diameter+6,$fn=sides);
}}                            

module bevel_nut(){
difference(){
 bevel();
 translate([0,0,-1])
 cylinder(height+2,r=inside_hole_size/2,$fn=inside_hole_shape);
 }}

 
bevel_nut();
 

Here are the results from adjusting the variables:

There's still some work to be done, while the inside hole is the correct diameter with the slider, the outside diameter wouldn't work right with the bevel without adding 6, so I just added a way to rotate the nut so it can be sized with the scale marks.

By adding a slider to change radius 2 of the cylinder you can make stoppers for different shaped bottle necks, corks or cable glands for cable connectors: