discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Replacement control knob for gas hob

LM
Leonard Martin Struttmann
Tue, Feb 8, 2022 12:44 AM

Ha ha! "It’s a maze of twisty little passages, all different."  Colossal
Cave Adventure!

On Mon, Feb 7, 2022 at 6:29 PM Bob Carlson bob@rjcarlson.com wrote:

Having spent a LOT of time with the path_sweep documentation, I think it
needs a lot of work. It needs to start with a much simpler explanation of
simple cases before it dives into various normals and twisting and so on.
It’s a maze of twisty little passages, all different.

-Bob
Tucson AZ

On Feb 7, 2022, at 17:25, Bob Carlson bob@rjcarlson.com wrote:

That fixed it thanks. The behavior was quite bizarre in the old version.
If I hit F6 with only 1 such object, it would render in BLUE, not the
normal greenish, with no error message. The error messages would show up
and there would be no render at all if there were 2 such objects.

-Bob
Tucson AZ

On Feb 7, 2022, at 15:29, Adrian Mariano avm4@cornell.edu wrote:

Works for me too.  You could try updating to the current BOSL2.  There
was a bug sort of recently where some faces were reversed in polyhedra
that would lead to failed renders, though I don't know if it affected
sweeps.

On Mon, Feb 7, 2022 at 5:16 PM Bob Carlson bob@rjcarlson.com wrote:

I didn’t show it, but there is an include of BOSL2.

-Bob
Tucson AZ

On Feb 7, 2022, at 11:35, Jordan Brown openscad@jordan.maileater.net

wrote:

I don't really speak BOSL2, but it works OK for me once I add

include <BOSL2/std.scad>

to the top.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Ha ha! "It’s a maze of twisty little passages, all different." Colossal Cave Adventure! On Mon, Feb 7, 2022 at 6:29 PM Bob Carlson <bob@rjcarlson.com> wrote: > Having spent a LOT of time with the path_sweep documentation, I think it > needs a lot of work. It needs to start with a much simpler explanation of > simple cases before it dives into various normals and twisting and so on. > It’s a maze of twisty little passages, all different. > > -Bob > Tucson AZ > > > > On Feb 7, 2022, at 17:25, Bob Carlson <bob@rjcarlson.com> wrote: > > That fixed it thanks. The behavior was quite bizarre in the old version. > If I hit F6 with only 1 such object, it would render in BLUE, not the > normal greenish, with no error message. The error messages would show up > and there would be no render at all if there were 2 such objects. > > -Bob > Tucson AZ > > > > On Feb 7, 2022, at 15:29, Adrian Mariano <avm4@cornell.edu> wrote: > > Works for me too. You could try updating to the current BOSL2. There > was a bug sort of recently where some faces were reversed in polyhedra > that would lead to failed renders, though I don't know if it affected > sweeps. > > > On Mon, Feb 7, 2022 at 5:16 PM Bob Carlson <bob@rjcarlson.com> wrote: > > > > I didn’t show it, but there is an include of BOSL2. > > > > -Bob > > Tucson AZ > > > > > > > > On Feb 7, 2022, at 11:35, Jordan Brown <openscad@jordan.maileater.net> > wrote: > > > > I don't really speak BOSL2, but it works OK for me once I add > > > > include <BOSL2/std.scad> > > > > to the top. > > > > > > > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
J
jon
Tue, Feb 8, 2022 1:05 AM

We are all showing our age!

On 2/7/2022 7:44 PM, Leonard Martin Struttmann wrote:

Ha ha! "It’s a maze of twisty little passages, all different." 
Colossal Cave Adventure!

On Mon, Feb 7, 2022 at 6:29 PM Bob Carlson bob@rjcarlson.com wrote:

 Having spent a LOT of time with the path_sweep documentation, I
 think it needs a lot of work. It needs to start with a much
 simpler explanation of simple cases before it dives into various
 normals and twisting and so on. It’s a maze of twisty little
 passages, all different.

 -Bob
 Tucson AZ
We are all showing our age! On 2/7/2022 7:44 PM, Leonard Martin Struttmann wrote: > Ha ha! "It’s a maze of twisty little passages, all different."  > Colossal Cave Adventure! > > On Mon, Feb 7, 2022 at 6:29 PM Bob Carlson <bob@rjcarlson.com> wrote: > > Having spent a LOT of time with the path_sweep documentation, I > think it needs a lot of work. It needs to start with a much > simpler explanation of simple cases before it dives into various > normals and twisting and so on. It’s a maze of twisty little > passages, all different. > > -Bob > Tucson AZ >
MM
Michael Marx
Tue, Feb 8, 2022 1:14 AM

If there is only one object (polyhedron or atomic object - cube/sphere/cylinder) then CGAL does not get called, it just makes a mesh, in your case a bad one, I'm guessing the blue represents the inside, as Adrian mentioned some inverted triangles.
With two objects CGAL gets called, sees the bad triangles and produces the error.

-----Original Message-----
From: Bob Carlson [mailto:bob@rjcarlson.com]
Sent: Tue, 8 Feb 2022 11:25
To: OpenSCAD general discussion
Subject: [OpenSCAD] Re: path_sweep problem

That fixed it thanks. The behavior was quite bizarre in the old version. If I hit F6 with
only 1 such object, it would render in BLUE, not the normal greenish, with no error
message. The error messages would show up and there would be no render at all if there
were 2 such objects.

-Bob
Tucson AZ

On Feb 7, 2022, at 15:29, Adrian Mariano avm4@cornell.edu wrote:

Works for me too.  You could try updating to the current BOSL2.  There
was a bug sort of recently where some faces were reversed in polyhedra
that would lead to failed renders, though I don't know if it affected
sweeps.

On Mon, Feb 7, 2022 at 5:16 PM Bob Carlson bob@rjcarlson.com wrote:

I didn’t show it, but there is an include of BOSL2.

-Bob
Tucson AZ

On Feb 7, 2022, at 11:35, Jordan Brown openscad@jordan.maileater.net wrote:

I don't really speak BOSL2, but it works OK for me once I add

include <BOSL2/std.scad>

to the top.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

--
This email has been checked for viruses by AVG.
https://www.avg.com

If there is only one object (polyhedron or atomic object - cube/sphere/cylinder) then CGAL does not get called, it just makes a mesh, in your case a bad one, I'm guessing the blue represents the inside, as Adrian mentioned some inverted triangles. With two objects CGAL gets called, sees the bad triangles and produces the error. > -----Original Message----- > From: Bob Carlson [mailto:bob@rjcarlson.com] > Sent: Tue, 8 Feb 2022 11:25 > To: OpenSCAD general discussion > Subject: [OpenSCAD] Re: path_sweep problem > > That fixed it thanks. The behavior was quite bizarre in the old version. If I hit F6 with > only 1 such object, it would render in BLUE, not the normal greenish, with no error > message. The error messages would show up and there would be no render at all if there > were 2 such objects. > > -Bob > Tucson AZ > > > > On Feb 7, 2022, at 15:29, Adrian Mariano <avm4@cornell.edu> wrote: > > Works for me too. You could try updating to the current BOSL2. There > was a bug sort of recently where some faces were reversed in polyhedra > that would lead to failed renders, though I don't know if it affected > sweeps. > > > On Mon, Feb 7, 2022 at 5:16 PM Bob Carlson <bob@rjcarlson.com> wrote: > > > > I didn’t show it, but there is an include of BOSL2. > > > > -Bob > > Tucson AZ > > > > > > > > On Feb 7, 2022, at 11:35, Jordan Brown <openscad@jordan.maileater.net> wrote: > > > > I don't really speak BOSL2, but it works OK for me once I add > > > > include <BOSL2/std.scad> > > > > to the top. > > > > > > > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org -- This email has been checked for viruses by AVG. https://www.avg.com
JB
Jordan Brown
Tue, Feb 8, 2022 2:01 AM

I've wondered whether it mightn't be better to have F6 render always
use CGAL, so that faulty models are identified as faulty immediately and
we don't get "it renders OK, but then fails when I add something else"
questions.

I tried some experiments to see if I could force OpenSCAD to use CGAL,
and failed.  I tried simple cases like wrapping the object in a union,
and more complex ones like unioning it with an intersection of two
objects that produced no content.  The goal was to have a sequence that
uses CGAL but that does not actually change the model.

Alas, no joy.  Still, maybe somebody else can come up with something.

I've wondered whether it mightn't be better to have F6 render *always* use CGAL, so that faulty models are identified as faulty immediately and we don't get "it renders OK, but then fails when I add something else" questions. I tried some experiments to see if I could force OpenSCAD to use CGAL, and failed.  I tried simple cases like wrapping the object in a union, and more complex ones like unioning it with an intersection of two objects that produced no content.  The goal was to have a sequence that uses CGAL but that does not actually change the model. Alas, no joy.  Still, maybe somebody else can come up with something.
W
Whosawhatsis
Tue, Feb 8, 2022 2:02 AM

Did you try enclosing it in render()?
On Feb 7, 2022, 18:01 -0800, Jordan Brown openscad@jordan.maileater.net, wrote:

I've wondered whether it mightn't be better to have F6 render always use CGAL, so that faulty models are identified as faulty immediately and we don't get "it renders OK, but then fails when I add something else" questions.

I tried some experiments to see if I could force OpenSCAD to use CGAL, and failed.  I tried simple cases like wrapping the object in a union, and more complex ones like unioning it with an intersection of two objects that produced no content.  The goal was to have a sequence that uses CGAL but that does not actually change the model.

Alas, no joy.  Still, maybe somebody else can come up with something.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Did you try enclosing it in render()? On Feb 7, 2022, 18:01 -0800, Jordan Brown <openscad@jordan.maileater.net>, wrote: > I've wondered whether it mightn't be better to have F6 render *always* use CGAL, so that faulty models are identified as faulty immediately and we don't get "it renders OK, but then fails when I add something else" questions. > > I tried some experiments to see if I could force OpenSCAD to use CGAL, and failed.  I tried simple cases like wrapping the object in a union, and more complex ones like unioning it with an intersection of two objects that produced no content.  The goal was to have a sequence that uses CGAL but that does not actually change the model. > > Alas, no joy.  Still, maybe somebody else can come up with something. > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
JB
Jordan Brown
Tue, Feb 8, 2022 2:07 AM

On 2/7/2022 6:02 PM, Whosawhatsis wrote:

Did you try enclosing it in render()?

Does not help.

points = [ [0,0,0], [0,1,0], [1,0,0] ];
faces = [ [0,1,2] ];
render() polyhedron(points=points, faces=faces);

translate([5,5,5]) cube(1);

gives a CGAL error if the cube is included, and not if not.

Note that the "polyhedron" is malformed; it has only one face.

On 2/7/2022 6:02 PM, Whosawhatsis wrote: > Did you try enclosing it in render()? Does not help. points = [ [0,0,0], [0,1,0], [1,0,0] ]; faces = [ [0,1,2] ]; render() polyhedron(points=points, faces=faces); translate([5,5,5]) cube(1); gives a CGAL error if the cube is included, and not if not. Note that the "polyhedron" is malformed; it has only one face.
RP
Ronaldo Persiano
Tue, Feb 8, 2022 3:48 AM

The union of the model with itself works but F6 will take a lot longer.

A better solution might be:

module model() {
points = [ [0,0,0], [0,1,0], [1,0,0] ];
faces = [ [0,1,2] ];
polyhedron(points=points, faces=faces);
}

module model2() sphere(10,$fn=100);

module check_model() {
difference() { // it doesn`t work when this is replaced by union()
children();
difference() {
cube(10,center=true);
cube(20,center=true);
}
}
}

check_model() model();
//check_model2() model();

However, that check will also take longer to render than the original model.

Em seg., 7 de fev. de 2022 às 23:17, Jordan Brown <
openscad@jordan.maileater.net> escreveu:

On 2/7/2022 6:02 PM, Whosawhatsis wrote:

Did you try enclosing it in render()?

Does not help.

points = [ [0,0,0], [0,1,0], [1,0,0] ];
faces = [ [0,1,2] ];
render() polyhedron(points=points, faces=faces);

translate([5,5,5]) cube(1);

gives a CGAL error if the cube is included, and not if not.

Note that the "polyhedron" is malformed; it has only one face.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

The union of the model with itself works but F6 will take a lot longer. A better solution might be: module model() { points = [ [0,0,0], [0,1,0], [1,0,0] ]; faces = [ [0,1,2] ]; polyhedron(points=points, faces=faces); } module model2() sphere(10,$fn=100); module check_model() { difference() { // it doesn`t work when this is replaced by union() children(); difference() { cube(10,center=true); cube(20,center=true); } } } check_model() model(); //check_model2() model(); However, that check will also take longer to render than the original model. Em seg., 7 de fev. de 2022 às 23:17, Jordan Brown < openscad@jordan.maileater.net> escreveu: > On 2/7/2022 6:02 PM, Whosawhatsis wrote: > > Did you try enclosing it in render()? > > > Does not help. > > points = [ [0,0,0], [0,1,0], [1,0,0] ]; > faces = [ [0,1,2] ]; > render() polyhedron(points=points, faces=faces); > > translate([5,5,5]) cube(1); > > gives a CGAL error if the cube is included, and not if not. > > Note that the "polyhedron" is malformed; it has only one face. > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jordan Brown
Tue, Feb 8, 2022 5:53 AM

On 2/7/2022 7:48 PM, Ronaldo Persiano wrote:

A better solution might be: [ model minus difference resulting in a
null object ]

Great!

However, that check will also take longer to render than the original
model.

The question is how much longer - and, if we're doing this inside
OpenSCAD itself, we could do it only when there's only one object to
process, which starts out as nearly zero time.

The result would definitely be slower than what we do now, but if it's a
negligible penalty on cases that are already really fast, the
understandability benefit is probably worth it.

On 2/7/2022 7:48 PM, Ronaldo Persiano wrote: > A better solution might be: [ model minus difference resulting in a > null object ] Great! > However, that check will also take longer to render than the original > model. The question is how much longer - and, if we're doing this inside OpenSCAD itself, we could do it only when there's only one object to process, which starts out as nearly zero time. The result would definitely be slower than what we do now, but if it's a negligible penalty on cases that are already really fast, the understandability benefit is probably worth it.
NH
nop head
Tue, Feb 8, 2022 10:22 AM

It wouldn't be good if it was a noticeable slowdown but perhaps it only
needs a conversion from Polyset to Nef Polyhedron to find the error, rather
than an actual CSG op. I don't know how slow that is though.

On Tue, 8 Feb 2022 at 05:53, Jordan Brown openscad@jordan.maileater.net
wrote:

On 2/7/2022 7:48 PM, Ronaldo Persiano wrote:

A better solution might be: [ model minus difference resulting in a null
object ]

Great!

However, that check will also take longer to render than the original
model.

The question is how much longer - and, if we're doing this inside OpenSCAD
itself, we could do it only when there's only one object to process, which
starts out as nearly zero time.

The result would definitely be slower than what we do now, but if it's a
negligible penalty on cases that are already really fast, the
understandability benefit is probably worth it.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

It wouldn't be good if it was a noticeable slowdown but perhaps it only needs a conversion from Polyset to Nef Polyhedron to find the error, rather than an actual CSG op. I don't know how slow that is though. On Tue, 8 Feb 2022 at 05:53, Jordan Brown <openscad@jordan.maileater.net> wrote: > On 2/7/2022 7:48 PM, Ronaldo Persiano wrote: > > A better solution might be: [ model minus difference resulting in a null > object ] > > > Great! > > However, that check will also take longer to render than the original > model. > > > The question is how much longer - and, if we're doing this inside OpenSCAD > itself, we could do it only when there's only one object to process, which > starts out as nearly zero time. > > The result would definitely be slower than what we do now, but if it's a > negligible penalty on cases that are already really fast, the > understandability benefit is probably worth it. > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
T
Terry
Tue, Feb 8, 2022 5:19 PM

Did I get that right? Code below, screenshot attached, or here:
https://www.dropbox.com/s/t94m08knrv4tb97/Douglas.jpg?raw=1

difference()
{

//////////////////////////
// Customizable settings
//////////////////////////

// Diameter of the hole on the bottom (in mm).
HoleDiameter = 6;

// Depth of the hole in the bottom (in mm).  If you want the hole to go all the
way through then set this to a number larger than the total height of the
object.
HoleDepth = 10;

// If you want a D-shaped hole, set this to the thickness of the flat side (in
mm).  Larger values for the flat make the hole smaller.
HoleFlatThickness = 1.3;

// Height (in mm).  If dome cap is selected, it is not included in height.  The
shaft length is also not counted.
KnobHeight = 16;

// Diameter of base of round part of knob (in mm).  (Knurled ridges are not
included in this measurement.)
KnobDiameter = 28;

// Shape of top of knob.  "Recessed" type can be painted.
CapType = 0; // [0:Flat, 1:Recessed, 2:Dome]

// Do you want a large timer-knob style pointer?
TimerKnob=0; // [0:No, 1:Yes]

// Would you like a divot on the top to indicate direction?
Pointer1 = 0; // [0:No, 1:Yes]

// Would you like a line (pointer) on the front to indicate direction?
Pointer2 = 0; // [0:No, 1:Yes]

// Do you want finger ridges around the knob?
Knurled = 0; // [0:No, 1:Yes]

// 0 = A cylindrical knob, any other value will taper the knob.
TaperPercentage = 0; // [0:0%, 10:10%, 20:20%, 30:30%, 40:40%, 50:50%]

// Width of "dial" ring (in mm).  Set to zero if you don't want the ring.
RingWidth = 3;

// The number of markings on the dial.  Set to zero if you don't want markings.
(RingWidth must be non-zero.)
RingMarkings = 0;

// diameter of the hole for the setscrew (in mm).  If you don't need a hole, set
this to zero.
ScrewHoleDiameter = 0;

// Length of the shaft on the bottom of the knob (in mm).  If you don't want a
shaft, set this value to zero.
ShaftLength = 0;

// Diameter of the shaft on the bottom of the knob (in mm).  (ShaftLength must
be non-zero.)
ShaftDiameter = 10;

// Would you like a notch in the shaft?  It can be used for a press-on type knob
(rather than using a setscrew).  (ShaftLength must be non-zero.)
NotchedShaft = 1; // [0:No, 1:Yes]

//////////////////////////
//Advanced settings
//////////////////////////

RingThickness = 51;
DivotDepth = 1.5
1;
MarkingWidth = 1.51;
DistanceBetweenKnurls = 3
1;
TimerKnobConst = 1.8*1;

//////////////////////////
//Calculations
//////////////////////////

PI=3.141592651;
KnobMajorRadius = KnobDiameter/2;
KnobMinorRadius = KnobDiameter/2 * (1 - TaperPercentage/100);
KnobRadius = KnobMinorRadius + (KnobMajorRadius-KnobMinorRadius)/2;
KnobCircumference = PI
KnobDiameter;
Knurls = round(KnobCircumference/DistanceBetweenKnurls);
Divot=CapType;

TaperAngle=asin(KnobHeight / (sqrt(pow(KnobHeight, 2) +
pow(KnobMajorRadius-KnobMinorRadius,2)))) - 90;

DivotRadius = KnobMinorRadius*.4;

union()
{
translate([0, 0, (ShaftLength==0)? 0 : ShaftLength-0.001])
difference()
{
union()
{
// Primary knob cylinder
cylinder(h=KnobHeight, r1=KnobMajorRadius, r2=KnobMinorRadius,
$fn=50);

if (Knurled)
	for (i=[0 : Knurls-1])
		rotate([0, 0, i * (360/Knurls)])
			translate([KnobRadius, 0, KnobHeight/2])
				rotate([0, TaperAngle, 0]) rotate([0, 0, 45])
					cube([2, 2, KnobHeight+.001], center=true);

if (RingMarkings>0)
	for (i=[0 : RingMarkings-1])
		rotate([0, 0, i * (360/RingMarkings)])
			translate([KnobMajorRadius + RingWidth/2, 0, 1])
				cube([RingWidth*.5, MarkingWidth, 2], center=true); 	
if (Pointer2==1)
	translate([KnobRadius, 0, KnobHeight/2-2])
		rotate([0, TaperAngle, 0])
			cube([8, 3, KnobHeight], center=true);		

if (RingWidth>0)
	translate([0, 0, RingThickness/2])
		cylinder(r1=KnobMajorRadius + RingWidth, r2=KnobMinorRadius,
				h=RingThickness, $fn=50, center=true);

if (Divot==2)
	translate([0, 0, KnobHeight])
		difference()
		{
			scale([1, 1, 0.5])
				sphere(r=KnobMinorRadius, $fn=50, center=true);

			translate([0, 0, 0-(KnobMinorRadius+.001)])
				cube([KnobMinorRadius*2.5, KnobMinorRadius*2.5,
						KnobMinorRadius*2], center=true);
		}

if (TimerKnob==1) intersection()
	{
		translate([0, 0, 0-(KnobDiameter*TimerKnobConst) + KnobHeight])
		sphere(r=KnobDiameter*TimerKnobConst, $fn=50, center=true);		

		translate([0-(KnobDiameter*TimerKnobConst)*0.1, 0,
				KnobHeight/2])
			scale([1, 0.5, 1])
				cylinder(h=KnobHeight, r=(KnobDiameter*TimerKnobConst)
  •   					0.8, $fn=3, center=true);
      }
    

}

// Pointer1: Offset hemispherical divot
if (Pointer1==1)
translate([KnobMinorRadius*.55, 0, KnobHeight + DivotRadius*.6])
sphere(r=DivotRadius, $fn=40);

// Divot1: Centered cylynrical divot
if (Divot==1)
translate([0, 0, KnobHeight])
cylinder(h=DivotDepth*2, r=KnobMinorRadius-1.5, $fn=50,
center=true);

if (ShaftLength==0)
{
// Hole for shaft
translate([0, 0, HoleDepth/2 - 0.001])
difference()
{
cylinder(r=HoleDiameter/2, h=HoleDepth, $fn=20,
center=true);

		// Flat for D-shaped hole
		translate([(0-HoleDiameter)+HoleFlatThickness, 0, 0])
			cube([HoleDiameter, HoleDiameter, HoleDepth+.001],
					center=true);
	}

// Hole for setscrew
if (ScrewHoleDiameter>0)
	translate([0 - (KnobMajorRadius+RingWidth+1)/2, 0,
			HoleDepth/2])
		rotate([0, 90, 0])
		cylinder(h=(KnobMajorRadius+RingWidth+1),
				r=ScrewHoleDiameter/2, $fn=20, center=true);

}

// Make sure bottom ends at z=0
translate([0, 0, -10])
cube([(KnobMajorRadius+RingWidth) * 3,
(KnobMajorRadius+RingWidth) * 3, 20], center=true);
}

if (ShaftLength>0)
difference()
{
translate([0, 0, ShaftLength/2])
cylinder(h=ShaftLength, r=ShaftDiameter/2, $fn=20,
center=true);

	if (NotchedShaft==1)
	{
		cube([HoleDiameter/2, ShaftDiameter*2, ShaftLength],
				center=true);
	}

	// Hole for shaft
	translate([0, 0, HoleDepth/2 - 0.001])
		difference()
		{
			cylinder(r=HoleDiameter/2, h=HoleDepth, $fn=20,
					center=true);
	
			// Flat for D-shaped hole
			translate([(0-HoleDiameter)+HoleFlatThickness, 0, 0])
				cube([HoleDiameter, HoleDiameter, HoleDepth+.001],
						center=true);
		}
	
	// Hole for setscrew
	if (ScrewHoleDiameter>0)
		translate([0 - (KnobMajorRadius+RingWidth+1)/2, 0,
				HoleDepth/2])
			rotate([0, 90, 0])
			cylinder(h=(KnobMajorRadius+RingWidth+1),
					r=ScrewHoleDiameter/2, $fn=20, center=true);
}

}

rotate_extrude() polygon([[0,0],[0,8],[14,8],[17,0]]);
}

On Mon, 7 Feb 2022 10:25:40 -0500, you wrote:

As a starter, try

difference() {
    // everything you have now
    rotate_extrude() polygon([[0,0],[0,8],[14,8],[17,0]]);
}

adjusting corners of the polygon as needed.

On 2/6/2022 11:33 AM, Terry wrote:

We've somehow lost one of the four knobs on our 30 year old Candy gas hob. I'm
not surprised there's no match from the Candy site's (expensive) 13 offerings.
Ebay have sets of four which are more sensibly priced but I'm going to make my
own button. However I'm immersed in another (non-OpenSCAD) project, so although
I'd ideally like to try making it from scratch myself, as a refresher exercise
after a long gap, I've instead found this handy parameterised design.
https://www.thingiverse.com/thing:54024

That made it trivially simple to get to the first draft I've shown. But I'm
struggling with the next steps, to get the interior 'recessed' and looking
roughly like the original.
https://www.dropbox.com/s/8h6dt9sylmijjxh/ButtonGroup.jpg?raw=1

The bottom of the spindle hole is 5mm above the bottom of the button. When in
place the button is about 3mm above the surface, and has to be pressed before
turning. The original button has a small metal insert which flexes, so the
button be pulled off for cleaning. But I may simply use a screw against the flat
spindle section instead, and avoid a D shaped spindle hole,

Meanwhile I'm using a temporary fix from my shed workshop 'old knobs' box. But
any help in getting the button printed quickly would be much appreciated please.

Terry


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Did I get that right? Code below, screenshot attached, or here: https://www.dropbox.com/s/t94m08knrv4tb97/Douglas.jpg?raw=1 difference() { ////////////////////////// // Customizable settings ////////////////////////// // Diameter of the hole on the bottom (in mm). HoleDiameter = 6; // Depth of the hole in the bottom (in mm). If you want the hole to go all the way through then set this to a number larger than the total height of the object. HoleDepth = 10; // If you want a D-shaped hole, set this to the thickness of the flat side (in mm). Larger values for the flat make the hole smaller. HoleFlatThickness = 1.3; // Height (in mm). If dome cap is selected, it is not included in height. The shaft length is also not counted. KnobHeight = 16; // Diameter of base of round part of knob (in mm). (Knurled ridges are not included in this measurement.) KnobDiameter = 28; // Shape of top of knob. "Recessed" type can be painted. CapType = 0; // [0:Flat, 1:Recessed, 2:Dome] // Do you want a large timer-knob style pointer? TimerKnob=0; // [0:No, 1:Yes] // Would you like a divot on the top to indicate direction? Pointer1 = 0; // [0:No, 1:Yes] // Would you like a line (pointer) on the front to indicate direction? Pointer2 = 0; // [0:No, 1:Yes] // Do you want finger ridges around the knob? Knurled = 0; // [0:No, 1:Yes] // 0 = A cylindrical knob, any other value will taper the knob. TaperPercentage = 0; // [0:0%, 10:10%, 20:20%, 30:30%, 40:40%, 50:50%] // Width of "dial" ring (in mm). Set to zero if you don't want the ring. RingWidth = 3; // The number of markings on the dial. Set to zero if you don't want markings. (RingWidth must be non-zero.) RingMarkings = 0; // diameter of the hole for the setscrew (in mm). If you don't need a hole, set this to zero. ScrewHoleDiameter = 0; // Length of the shaft on the bottom of the knob (in mm). If you don't want a shaft, set this value to zero. ShaftLength = 0; // Diameter of the shaft on the bottom of the knob (in mm). (ShaftLength must be non-zero.) ShaftDiameter = 10; // Would you like a notch in the shaft? It can be used for a press-on type knob (rather than using a setscrew). (ShaftLength must be non-zero.) NotchedShaft = 1; // [0:No, 1:Yes] ////////////////////////// //Advanced settings ////////////////////////// RingThickness = 5*1; DivotDepth = 1.5*1; MarkingWidth = 1.5*1; DistanceBetweenKnurls = 3*1; TimerKnobConst = 1.8*1; ////////////////////////// //Calculations ////////////////////////// PI=3.14159265*1; KnobMajorRadius = KnobDiameter/2; KnobMinorRadius = KnobDiameter/2 * (1 - TaperPercentage/100); KnobRadius = KnobMinorRadius + (KnobMajorRadius-KnobMinorRadius)/2; KnobCircumference = PI*KnobDiameter; Knurls = round(KnobCircumference/DistanceBetweenKnurls); Divot=CapType; TaperAngle=asin(KnobHeight / (sqrt(pow(KnobHeight, 2) + pow(KnobMajorRadius-KnobMinorRadius,2)))) - 90; DivotRadius = KnobMinorRadius*.4; union() { translate([0, 0, (ShaftLength==0)? 0 : ShaftLength-0.001]) difference() { union() { // Primary knob cylinder cylinder(h=KnobHeight, r1=KnobMajorRadius, r2=KnobMinorRadius, $fn=50); if (Knurled) for (i=[0 : Knurls-1]) rotate([0, 0, i * (360/Knurls)]) translate([KnobRadius, 0, KnobHeight/2]) rotate([0, TaperAngle, 0]) rotate([0, 0, 45]) cube([2, 2, KnobHeight+.001], center=true); if (RingMarkings>0) for (i=[0 : RingMarkings-1]) rotate([0, 0, i * (360/RingMarkings)]) translate([KnobMajorRadius + RingWidth/2, 0, 1]) cube([RingWidth*.5, MarkingWidth, 2], center=true); if (Pointer2==1) translate([KnobRadius, 0, KnobHeight/2-2]) rotate([0, TaperAngle, 0]) cube([8, 3, KnobHeight], center=true); if (RingWidth>0) translate([0, 0, RingThickness/2]) cylinder(r1=KnobMajorRadius + RingWidth, r2=KnobMinorRadius, h=RingThickness, $fn=50, center=true); if (Divot==2) translate([0, 0, KnobHeight]) difference() { scale([1, 1, 0.5]) sphere(r=KnobMinorRadius, $fn=50, center=true); translate([0, 0, 0-(KnobMinorRadius+.001)]) cube([KnobMinorRadius*2.5, KnobMinorRadius*2.5, KnobMinorRadius*2], center=true); } if (TimerKnob==1) intersection() { translate([0, 0, 0-(KnobDiameter*TimerKnobConst) + KnobHeight]) sphere(r=KnobDiameter*TimerKnobConst, $fn=50, center=true); translate([0-(KnobDiameter*TimerKnobConst)*0.1, 0, KnobHeight/2]) scale([1, 0.5, 1]) cylinder(h=KnobHeight, r=(KnobDiameter*TimerKnobConst) * 0.8, $fn=3, center=true); } } // Pointer1: Offset hemispherical divot if (Pointer1==1) translate([KnobMinorRadius*.55, 0, KnobHeight + DivotRadius*.6]) sphere(r=DivotRadius, $fn=40); // Divot1: Centered cylynrical divot if (Divot==1) translate([0, 0, KnobHeight]) cylinder(h=DivotDepth*2, r=KnobMinorRadius-1.5, $fn=50, center=true); if (ShaftLength==0) { // Hole for shaft translate([0, 0, HoleDepth/2 - 0.001]) difference() { cylinder(r=HoleDiameter/2, h=HoleDepth, $fn=20, center=true); // Flat for D-shaped hole translate([(0-HoleDiameter)+HoleFlatThickness, 0, 0]) cube([HoleDiameter, HoleDiameter, HoleDepth+.001], center=true); } // Hole for setscrew if (ScrewHoleDiameter>0) translate([0 - (KnobMajorRadius+RingWidth+1)/2, 0, HoleDepth/2]) rotate([0, 90, 0]) cylinder(h=(KnobMajorRadius+RingWidth+1), r=ScrewHoleDiameter/2, $fn=20, center=true); } // Make sure bottom ends at z=0 translate([0, 0, -10]) cube([(KnobMajorRadius+RingWidth) * 3, (KnobMajorRadius+RingWidth) * 3, 20], center=true); } if (ShaftLength>0) difference() { translate([0, 0, ShaftLength/2]) cylinder(h=ShaftLength, r=ShaftDiameter/2, $fn=20, center=true); if (NotchedShaft==1) { cube([HoleDiameter/2, ShaftDiameter*2, ShaftLength], center=true); } // Hole for shaft translate([0, 0, HoleDepth/2 - 0.001]) difference() { cylinder(r=HoleDiameter/2, h=HoleDepth, $fn=20, center=true); // Flat for D-shaped hole translate([(0-HoleDiameter)+HoleFlatThickness, 0, 0]) cube([HoleDiameter, HoleDiameter, HoleDepth+.001], center=true); } // Hole for setscrew if (ScrewHoleDiameter>0) translate([0 - (KnobMajorRadius+RingWidth+1)/2, 0, HoleDepth/2]) rotate([0, 90, 0]) cylinder(h=(KnobMajorRadius+RingWidth+1), r=ScrewHoleDiameter/2, $fn=20, center=true); } } rotate_extrude() polygon([[0,0],[0,8],[14,8],[17,0]]); } On Mon, 7 Feb 2022 10:25:40 -0500, you wrote: >As a starter, try > >difference() { >     // everything you have now >     rotate_extrude() polygon([[0,0],[0,8],[14,8],[17,0]]); >} > >adjusting corners of the polygon as needed. > >On 2/6/2022 11:33 AM, Terry wrote: >> We've somehow lost one of the four knobs on our 30 year old Candy gas hob. I'm >> not surprised there's no match from the Candy site's (expensive) 13 offerings. >> Ebay have sets of four which are more sensibly priced but I'm going to make my >> own button. However I'm immersed in another (non-OpenSCAD) project, so although >> I'd ideally like to try making it from scratch myself, as a refresher exercise >> after a long gap, I've instead found this handy parameterised design. >> https://www.thingiverse.com/thing:54024 >> >> That made it trivially simple to get to the first draft I've shown. But I'm >> struggling with the next steps, to get the interior 'recessed' and looking >> roughly like the original. >> https://www.dropbox.com/s/8h6dt9sylmijjxh/ButtonGroup.jpg?raw=1 >> >> The bottom of the spindle hole is 5mm above the bottom of the button. When in >> place the button is about 3mm above the surface, and has to be pressed before >> turning. The original button has a small metal insert which flexes, so the >> button be pulled off for cleaning. But I may simply use a screw against the flat >> spindle section instead, and avoid a D shaped spindle hole, >> >> Meanwhile I'm using a temporary fix from my shed workshop 'old knobs' box. But >> any help in getting the button printed quickly would be much appreciated please. >> >> Terry >_______________________________________________ >OpenSCAD mailing list >To unsubscribe send an email to discuss-leave@lists.openscad.org