discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

BOLS2 Hinge question

JB
Jon Bondy
Sun, May 11, 2025 5:53 PM

I want the two hinges in this example to have the flat parts lie flat
together, but cannot figure out how to modify the parameters to make
this happen.

// DNG Belly Support

include <BOSL2/std.scad>
include <BOSL2/hinges.scad>

inches = 25.4;
$fn=32;
eps = 0.01;

mw = 125;    // max width

// left/middle/right

cX = 2;
cY = 40;
cZ = 15;
pd = 1.9;    // pin diameter

module Hinge1h(th)
    cuboid([th, cY, cZ])
        position(TOP) orient(anchor=RIGHT)
            knuckle_hinge(length=35, segs=9, offset=2, arm_height=1,
pin_diam=pd, clear_top=false);
*Hinge1();

module Hinge2h(th)
    translate([0, 0, cZ])
        rotate([180, 0, 0])
            cuboid([th, cY, cZ])
                position(TOP+RIGHT) orient(anchor=RIGHT)
                    knuckle_hinge(length=35, segs=9, offset=2,
arm_height=1, inner=true, pin_diam=pd, clear_top=false);
*Hinge2(th + bt + th);

th = 2;            // thickness
bt = 7.2;        // board thickness
sthd = 1;        // stitch hole diameter
schd = 4;        // screw hole diameter

lm = 0;        // left mode
mm = 1;
rm = 2;

module Hinged(b, m) {
    if (b) {
        Hinge1h(cX);
        }
    else {
        Hinge2h(cX);
        }
    }

color("red") Hinged(true);
color("green")
    translate([5, 0, 15])
        rotate([180, 0, 180])
            Hinged(false);

--
This email has been checked for viruses by AVG antivirus software.
www.avg.com

I want the two hinges in this example to have the flat parts lie flat together, but cannot figure out how to modify the parameters to make this happen. // DNG Belly Support include <BOSL2/std.scad> include <BOSL2/hinges.scad> inches = 25.4; $fn=32; eps = 0.01; mw = 125;    // max width // left/middle/right cX = 2; cY = 40; cZ = 15; pd = 1.9;    // pin diameter module Hinge1h(th)     cuboid([th, cY, cZ])         position(TOP) orient(anchor=RIGHT)             knuckle_hinge(length=35, segs=9, offset=2, arm_height=1, pin_diam=pd, clear_top=false); *Hinge1(); module Hinge2h(th)     translate([0, 0, cZ])         rotate([180, 0, 0])             cuboid([th, cY, cZ])                 position(TOP+RIGHT) orient(anchor=RIGHT)                     knuckle_hinge(length=35, segs=9, offset=2, arm_height=1, inner=true, pin_diam=pd, clear_top=false); *Hinge2(th + bt + th); th = 2;            // thickness bt = 7.2;        // board thickness sthd = 1;        // stitch hole diameter schd = 4;        // screw hole diameter lm = 0;        // left mode mm = 1; rm = 2; module Hinged(b, m) {     if (b) {         Hinge1h(cX);         }     else {         Hinge2h(cX);         }     } color("red") Hinged(true); color("green")     translate([5, 0, 15])         rotate([180, 0, 180])             Hinged(false); -- This email has been checked for viruses by AVG antivirus software. www.avg.com
GH
gene heskett
Sun, May 11, 2025 7:19 PM

On 5/11/25 13:53, Jon Bondy via Discuss wrote:

I want the two hinges in this example to have the flat parts lie flat
together, but cannot figure out how to modify the parameters to make
this happen.

In the form of a school lesson, no actual code.

Break  it down into individual modules Jon. Start by making a flathead
screw which is the OD of the screw (minus the thread depth if self
threaded,  making it with a cylinder of suitable diameter and length to
penetrate whatever the screw is going into, then cap one end of it with
the profile of a flat head screw using a short 2 diameter cylinder with
a short cylinder using an h=,d1=,d2= setting to exactly fill the
thickness of the hinge leaf.  Pass a var that will make it as a bolt but
subtracting .45mm so if it is a bolt, its sized to sit with a flush top,
and the underside then matches the cone of a flat head screw. Either
geometry which I'm poor at, didn't get that far in school, or look it up
in the Machinery Handbook. close to 2000 pages of everything.

Then write a module that places 3 or 4 copies of the single bolt, into
the desired pattern.

Then write the module that uses that bolt pattern module, translated &
rotated into position in each leaf.  But if its used as a difference in
the leaf add .45mm to the diameter of it all so the bolt sits flush, or
subtract that if actually making the bolt so the recess again fits
flush. might be 75 LOC, and by passing in vars in the calls, can be
totally parametric.  I haven't found a limit but have passed as many as
4, either as numerical value or as var names.  But above 2 such vars, I
find it difficult to follow a week later, poor short term memory at my age.

Old code:

// DNG Belly Support

include <BOSL2/std.scad>
include <BOSL2/hinges.scad>

inches = 25.4;
$fn=32;
eps = 0.01;

mw = 125;    // max width

// left/middle/right

cX = 2;
cY = 40;
cZ = 15;
pd = 1.9;    // pin diameter

module Hinge1h(th)
    cuboid([th, cY, cZ])
        position(TOP) orient(anchor=RIGHT)
            knuckle_hinge(length=35, segs=9, offset=2, arm_height=1,
pin_diam=pd, clear_top=false);
*Hinge1();

module Hinge2h(th)
    translate([0, 0, cZ])
        rotate([180, 0, 0])
            cuboid([th, cY, cZ])
                position(TOP+RIGHT) orient(anchor=RIGHT)
                    knuckle_hinge(length=35, segs=9, offset=2,
arm_height=1, inner=true, pin_diam=pd, clear_top=false);
*Hinge2(th + bt + th);

th = 2;            // thickness
bt = 7.2;        // board thickness
sthd = 1;        // stitch hole diameter
schd = 4;        // screw hole diameter

lm = 0;        // left mode
mm = 1;
rm = 2;

module Hinged(b, m) {
    if (b) {
        Hinge1h(cX);
        }
    else {
        Hinge2h(cX);
        }
    }

color("red") Hinged(true);
color("green")
    translate([5, 0, 15])
        rotate([180, 0, 180])
            Hinged(false);


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

Cheers, Gene Heskett, CET.

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.

  • Louis D. Brandeis
On 5/11/25 13:53, Jon Bondy via Discuss wrote: > I want the two hinges in this example to have the flat parts lie flat > together, but cannot figure out how to modify the parameters to make > this happen. In the form of a school lesson, no actual code. Break  it down into individual modules Jon. Start by making a flathead screw which is the OD of the screw (minus the thread depth if self threaded,  making it with a cylinder of suitable diameter and length to penetrate whatever the screw is going into, then cap one end of it with the profile of a flat head screw using a short 2 diameter cylinder with a short cylinder using an h=,d1=,d2= setting to exactly fill the thickness of the hinge leaf.  Pass a var that will make it as a bolt but subtracting .45mm so if it is a bolt, its sized to sit with a flush top, and the underside then matches the cone of a flat head screw. Either geometry which I'm poor at, didn't get that far in school, or look it up in the Machinery Handbook. close to 2000 pages of everything. Then write a module that places 3 or 4 copies of the single bolt, into the desired pattern. Then write the module that uses that bolt pattern module, translated & rotated into position in each leaf.  But if its used as a difference in the leaf add .45mm to the diameter of it all so the bolt sits flush, or subtract that if actually making the bolt so the recess again fits flush. might be 75 LOC, and by passing in vars in the calls, can be totally parametric.  I haven't found a limit but have passed as many as 4, either as numerical value or as var names.  But above 2 such vars, I find it difficult to follow a week later, poor short term memory at my age. Old code: > // DNG Belly Support > > include <BOSL2/std.scad> > include <BOSL2/hinges.scad> > > inches = 25.4; > $fn=32; > eps = 0.01; > > mw = 125;    // max width > > // left/middle/right > > cX = 2; > cY = 40; > cZ = 15; > pd = 1.9;    // pin diameter > > module Hinge1h(th) >     cuboid([th, cY, cZ]) >         position(TOP) orient(anchor=RIGHT) >             knuckle_hinge(length=35, segs=9, offset=2, arm_height=1, > pin_diam=pd, clear_top=false); > *Hinge1(); > > module Hinge2h(th) >     translate([0, 0, cZ]) >         rotate([180, 0, 0]) >             cuboid([th, cY, cZ]) >                 position(TOP+RIGHT) orient(anchor=RIGHT) >                     knuckle_hinge(length=35, segs=9, offset=2, > arm_height=1, inner=true, pin_diam=pd, clear_top=false); > *Hinge2(th + bt + th); > > th = 2;            // thickness > bt = 7.2;        // board thickness > sthd = 1;        // stitch hole diameter > schd = 4;        // screw hole diameter > > lm = 0;        // left mode > mm = 1; > rm = 2; > > module Hinged(b, m) { >     if (b) { >         Hinge1h(cX); >         } >     else { >         Hinge2h(cX); >         } >     } > > > color("red") Hinged(true); > color("green") >     translate([5, 0, 15]) >         rotate([180, 0, 180]) >             Hinged(false); > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org Cheers, Gene Heskett, CET. -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author, 1940) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis
RW
Raymond West
Sun, May 11, 2025 7:53 PM

Hi Jon,

As an exercise ,I've just done it in pythonscad. Not too difficult. It
should be the same in openscad wrt simplicity.

  1. make a cross-section of the hinge profile, basically a square with a
    circle at one end. Make the circle, centred on the origin, say, the diam
    of the hole for the pin plus twice the thickness of the leaf (name it d,
    say)

2)linear extrude it the length of a hinge leaf, and  make leaf1 and
leaf2 equal to that original leaf

3)make, n= the maximum number of segments on one leaf, 5 in your case,
so divide the length by n+n-1, to get to the spacing requirements

Then you need to think about the fitting tolerance, say tol=0.2 (but
test your code by making tol much bigger)

  1. using for loops, say, difference a cylinder of diameter d+tol, and
    height of tol+(leaf/(n+n-1) through leaf1, and offset by height (more or
    less) for leaf2

  2. this is not a print in place version

  3. if needed add ornamentation, fixing holes, etc.

by drawing a cross section, and linear extrude, you can obviously simply
design cranked or other hinges.

I could post the python scad code if any use, but basically it follows
what I  outlined above.

Best wishes,

Ray

On 11/05/2025 18:53, Jon Bondy via Discuss wrote:

I want the two hinges in this example to have the flat parts lie flat
together, but cannot figure out how to modify the parameters to make
this happen.

// DNG Belly Support

include <BOSL2/std.scad>
include <BOSL2/hinges.scad>

inches = 25.4;
$fn=32;
eps = 0.01;

mw = 125;    // max width

// left/middle/right

cX = 2;
cY = 40;
cZ = 15;
pd = 1.9;    // pin diameter

module Hinge1h(th)
    cuboid([th, cY, cZ])
        position(TOP) orient(anchor=RIGHT)
            knuckle_hinge(length=35, segs=9, offset=2, arm_height=1,
pin_diam=pd, clear_top=false);
*Hinge1();

module Hinge2h(th)
    translate([0, 0, cZ])
        rotate([180, 0, 0])
            cuboid([th, cY, cZ])
                position(TOP+RIGHT) orient(anchor=RIGHT)
                    knuckle_hinge(length=35, segs=9, offset=2,
arm_height=1, inner=true, pin_diam=pd, clear_top=false);
*Hinge2(th + bt + th);

th = 2;            // thickness
bt = 7.2;        // board thickness
sthd = 1;        // stitch hole diameter
schd = 4;        // screw hole diameter

lm = 0;        // left mode
mm = 1;
rm = 2;

module Hinged(b, m) {
    if (b) {
        Hinge1h(cX);
        }
    else {
        Hinge2h(cX);
        }
    }

color("red") Hinged(true);
color("green")
    translate([5, 0, 15])
        rotate([180, 0, 180])
            Hinged(false);

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
Virus-free.www.avg.com
http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


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

Hi Jon, As an exercise ,I've just done it in pythonscad. Not too difficult. It should be the same in openscad wrt simplicity. 1) make a cross-section of the hinge profile, basically a square with a circle at one end. Make the circle, centred on the origin, say, the diam of the hole for the pin plus twice the thickness of the leaf (name it d, say) 2)linear extrude it the length of a hinge leaf, and  make leaf1 and leaf2 equal to that original leaf 3)make, n= the maximum number of segments on one leaf, 5 in your case, so divide the length by n+n-1, to get to the spacing requirements Then you need to think about the fitting tolerance, say tol=0.2 (but test your code by making tol much bigger) 4) using for loops, say, difference a cylinder of diameter d+tol, and height of tol+(leaf/(n+n-1) through leaf1, and offset by height (more or less) for leaf2 5) this is not a print in place version 6) if needed add ornamentation, fixing holes, etc. by drawing a cross section, and linear extrude, you can obviously simply design cranked or other hinges. I could post the python scad code if any use, but basically it follows what I  outlined above. Best wishes, Ray On 11/05/2025 18:53, Jon Bondy via Discuss wrote: > > I want the two hinges in this example to have the flat parts lie flat > together, but cannot figure out how to modify the parameters to make > this happen. > > > > // DNG Belly Support > > include <BOSL2/std.scad> > include <BOSL2/hinges.scad> > > inches = 25.4; > $fn=32; > eps = 0.01; > > mw = 125;    // max width > > // left/middle/right > > cX = 2; > cY = 40; > cZ = 15; > pd = 1.9;    // pin diameter > > module Hinge1h(th) >     cuboid([th, cY, cZ]) >         position(TOP) orient(anchor=RIGHT) >             knuckle_hinge(length=35, segs=9, offset=2, arm_height=1, > pin_diam=pd, clear_top=false); > *Hinge1(); > > module Hinge2h(th) >     translate([0, 0, cZ]) >         rotate([180, 0, 0]) >             cuboid([th, cY, cZ]) >                 position(TOP+RIGHT) orient(anchor=RIGHT) >                     knuckle_hinge(length=35, segs=9, offset=2, > arm_height=1, inner=true, pin_diam=pd, clear_top=false); > *Hinge2(th + bt + th); > > th = 2;            // thickness > bt = 7.2;        // board thickness > sthd = 1;        // stitch hole diameter > schd = 4;        // screw hole diameter > > lm = 0;        // left mode > mm = 1; > rm = 2; > > module Hinged(b, m) { >     if (b) { >         Hinge1h(cX); >         } >     else { >         Hinge2h(cX); >         } >     } > > > color("red") Hinged(true); > color("green") >     translate([5, 0, 15]) >         rotate([180, 0, 180]) >             Hinged(false); > > > <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > Virus-free.www.avg.com > <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > > > <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org
JB
Jordan Brown
Tue, May 13, 2025 2:29 AM

On 5/11/2025 10:53 AM, Jon Bondy via Discuss wrote:

I want the two hinges in this example to have the flat parts lie flat
together, but cannot figure out how to modify the parameters to make
this happen.

I don't immediately see how either.

One key component is that each side needs space for the other side's
"knuckle" to be subtracted from it.  It looks like the clear_knuckle
parameter is somehow tied to that, but it's only weakly documented and
doesn't appear to really be implemented.

Note also that to make this happen the hinge pin hole needs to drill
through the part, not just through the hinge.  (Or the hinge needs to be
moved so that the hinge pin hole is entirely above the part.)

On 5/11/2025 10:53 AM, Jon Bondy via Discuss wrote: > > I want the two hinges in this example to have the flat parts lie flat > together, but cannot figure out how to modify the parameters to make > this happen. > > I don't immediately see how either. One key component is that each side needs space for the other side's "knuckle" to be subtracted from it.  It looks like the clear_knuckle parameter is somehow tied to that, but it's only weakly documented and doesn't appear to really be implemented. Note also that to make this happen the hinge pin hole needs to drill through the part, not just through the hinge.  (Or the hinge needs to be moved so that the hinge pin hole is entirely above the part.)
RW
Raymond West
Tue, May 13, 2025 11:49 AM

Here's an attached  hinge, simply based on what I mentioned before. If
the reinforcement fillet is required, then it should be simple enough to
alter the profile. Depending on which side of the leaf you want the
fillet, then  instead of differencing a cylinder+ tolerance, you'll need
to difference the cylinder+fillet+tolerance. I've not tested by printing
the .obj file, it should be good enough, but I could well have missed
something.

 On 13/05/2025 03:29, Jordan Brown via Discuss wrote:

On 5/11/2025 10:53 AM, Jon Bondy via Discuss wrote:

I want the two hinges in this example to have the flat parts lie flat
together, but cannot figure out how to modify the parameters to make
this happen.

I don't immediately see how either.

One key component is that each side needs space for the other side's
"knuckle" to be subtracted from it.  It looks like the clear_knuckle
parameter is somehow tied to that, but it's only weakly documented and
doesn't appear to really be implemented.

Note also that to make this happen the hinge pin hole needs to drill
through the part, not just through the hinge.  (Or the hinge needs to
be moved so that the hinge pin hole is entirely above the part.)


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

Here's an attached  hinge, simply based on what I mentioned before. If the reinforcement fillet is required, then it should be simple enough to alter the profile. Depending on which side of the leaf you want the fillet, then  instead of differencing a cylinder+ tolerance, you'll need to difference the cylinder+fillet+tolerance. I've not tested by printing the .obj file, it should be good enough, but I could well have missed something.  On 13/05/2025 03:29, Jordan Brown via Discuss wrote: > On 5/11/2025 10:53 AM, Jon Bondy via Discuss wrote: >> >> I want the two hinges in this example to have the flat parts lie flat >> together, but cannot figure out how to modify the parameters to make >> this happen. >> >> > > I don't immediately see how either. > > One key component is that each side needs space for the other side's > "knuckle" to be subtracted from it.  It looks like the clear_knuckle > parameter is somehow tied to that, but it's only weakly documented and > doesn't appear to really be implemented. > > Note also that to make this happen the hinge pin hole needs to drill > through the part, not just through the hinge.  (Or the hinge needs to > be moved so that the hinge pin hole is entirely above the part.) > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org
RW
Raymond West
Tue, May 13, 2025 12:02 PM

Attached pythonscad script, fwiw

On 13/05/2025 12:49, Raymond West via Discuss wrote:

Here's an attached  hinge, simply based on what I mentioned before. If
the reinforcement fillet is required, then it should be simple enough
to alter the profile. Depending on which side of the leaf you want the
fillet, then  instead of differencing a cylinder+ tolerance, you'll
need to difference the cylinder+fillet+tolerance. I've not tested by
printing the .obj file, it should be good enough, but I could well
have missed something.

 On 13/05/2025 03:29, Jordan Brown via Discuss wrote:

On 5/11/2025 10:53 AM, Jon Bondy via Discuss wrote:

I want the two hinges in this example to have the flat parts lie
flat together, but cannot figure out how to modify the parameters to
make this happen.

I don't immediately see how either.

One key component is that each side needs space for the other side's
"knuckle" to be subtracted from it.  It looks like the clear_knuckle
parameter is somehow tied to that, but it's only weakly documented
and doesn't appear to really be implemented.

Note also that to make this happen the hinge pin hole needs to drill
through the part, not just through the hinge.  (Or the hinge needs to
be moved so that the hinge pin hole is entirely above the part.)


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


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

Attached pythonscad script, fwiw On 13/05/2025 12:49, Raymond West via Discuss wrote: > > Here's an attached  hinge, simply based on what I mentioned before. If > the reinforcement fillet is required, then it should be simple enough > to alter the profile. Depending on which side of the leaf you want the > fillet, then  instead of differencing a cylinder+ tolerance, you'll > need to difference the cylinder+fillet+tolerance. I've not tested by > printing the .obj file, it should be good enough, but I could well > have missed something. > >  On 13/05/2025 03:29, Jordan Brown via Discuss wrote: >> On 5/11/2025 10:53 AM, Jon Bondy via Discuss wrote: >>> >>> I want the two hinges in this example to have the flat parts lie >>> flat together, but cannot figure out how to modify the parameters to >>> make this happen. >>> >>> >> >> I don't immediately see how either. >> >> One key component is that each side needs space for the other side's >> "knuckle" to be subtracted from it.  It looks like the clear_knuckle >> parameter is somehow tied to that, but it's only weakly documented >> and doesn't appear to really be implemented. >> >> Note also that to make this happen the hinge pin hole needs to drill >> through the part, not just through the hinge.  (Or the hinge needs to >> be moved so that the hinge pin hole is entirely above the part.) >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email todiscuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org
AM
Adrian Mariano
Tue, May 13, 2025 8:19 PM

There are lots of ways to attach a hinge to something.  To achieve what you
want, you need to design a hinge that has its centerpoint aligned with the
edge of the object it's attached to.  Note that such a hinge won't actually
work in reality.  You need clearance between the plates. I looked at a
couple real hinges and the expensive one is about 20mm long hinge with a
bit less than 1mm of space between the leaves when they are parallel.  The
cheap one had much more space.  But here's a way to do what you requested.
I also activated knuckle clearance, which appears to be working fine.  How
did it not work for you, Jordan?

include<BOSL2/std.scad>
include<BOSL2/hinges.scad>

$fn=32;
kd=4;
color("green")
diff()
cuboid([20,kd/2,7],anchor=BACK)
position(TOP+BACK)
knuckle_hinge(20, segs=3, offset=kd/2, knuckle_clearance=0.2,
knuckle_diam=kd, arm_angle=90, arm_height=0,
clear_top=true);
color("red")
diff()
cuboid([20,kd/2,7],anchor=FWD)
position(TOP+FWD)
yflip()knuckle_hinge(20, segs=3, offset=kd/2, knuckle_clearance=.2,
inner=true,
knuckle_diam=kd, arm_angle=90, arm_height=0,
clear_top=true);

[image: image.png]

On Sun, May 11, 2025 at 1:53 PM Jon Bondy via Discuss <
discuss@lists.openscad.org> wrote:

I want the two hinges in this example to have the flat parts lie flat
together, but cannot figure out how to modify the parameters to make this
happen.

// DNG Belly Support

include <BOSL2/std.scad>
include <BOSL2/hinges.scad>

inches = 25.4;
$fn=32;
eps = 0.01;

mw = 125;    // max width

// left/middle/right

cX = 2;
cY = 40;
cZ = 15;
pd = 1.9;    // pin diameter

module Hinge1h(th)
cuboid([th, cY, cZ])
position(TOP) orient(anchor=RIGHT)
knuckle_hinge(length=35, segs=9, offset=2, arm_height=1,
pin_diam=pd, clear_top=false);
*Hinge1();

module Hinge2h(th)
translate([0, 0, cZ])
rotate([180, 0, 0])
cuboid([th, cY, cZ])
position(TOP+RIGHT) orient(anchor=RIGHT)
knuckle_hinge(length=35, segs=9, offset=2,
arm_height=1, inner=true, pin_diam=pd, clear_top=false);
*Hinge2(th + bt + th);

th = 2;            // thickness
bt = 7.2;        // board thickness
sthd = 1;        // stitch hole diameter
schd = 4;        // screw hole diameter

lm = 0;        // left mode
mm = 1;
rm = 2;

module Hinged(b, m) {
if (b) {
Hinge1h(cX);
}
else {
Hinge2h(cX);
}
}

color("red") Hinged(true);
color("green")
translate([5, 0, 15])
rotate([180, 0, 180])
Hinged(false);

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
Virus-free.www.avg.com
http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
<#m_-3935134853923460209_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


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

There are lots of ways to attach a hinge to something. To achieve what you want, you need to design a hinge that has its centerpoint aligned with the edge of the object it's attached to. Note that such a hinge won't actually work in reality. You need clearance between the plates. I looked at a couple real hinges and the expensive one is about 20mm long hinge with a bit less than 1mm of space between the leaves when they are parallel. The cheap one had much more space. But here's a way to do what you requested. I also activated knuckle clearance, which appears to be working fine. How did it not work for you, Jordan? include<BOSL2/std.scad> include<BOSL2/hinges.scad> $fn=32; kd=4; color("green") diff() cuboid([20,kd/2,7],anchor=BACK) position(TOP+BACK) knuckle_hinge(20, segs=3, offset=kd/2, knuckle_clearance=0.2, knuckle_diam=kd, arm_angle=90, arm_height=0, clear_top=true); color("red") diff() cuboid([20,kd/2,7],anchor=FWD) position(TOP+FWD) yflip()knuckle_hinge(20, segs=3, offset=kd/2, knuckle_clearance=.2, inner=true, knuckle_diam=kd, arm_angle=90, arm_height=0, clear_top=true); [image: image.png] On Sun, May 11, 2025 at 1:53 PM Jon Bondy via Discuss < discuss@lists.openscad.org> wrote: > I want the two hinges in this example to have the flat parts lie flat > together, but cannot figure out how to modify the parameters to make this > happen. > > > > // DNG Belly Support > > include <BOSL2/std.scad> > include <BOSL2/hinges.scad> > > inches = 25.4; > $fn=32; > eps = 0.01; > > mw = 125; // max width > > // left/middle/right > > cX = 2; > cY = 40; > cZ = 15; > pd = 1.9; // pin diameter > > module Hinge1h(th) > cuboid([th, cY, cZ]) > position(TOP) orient(anchor=RIGHT) > knuckle_hinge(length=35, segs=9, offset=2, arm_height=1, > pin_diam=pd, clear_top=false); > *Hinge1(); > > module Hinge2h(th) > translate([0, 0, cZ]) > rotate([180, 0, 0]) > cuboid([th, cY, cZ]) > position(TOP+RIGHT) orient(anchor=RIGHT) > knuckle_hinge(length=35, segs=9, offset=2, > arm_height=1, inner=true, pin_diam=pd, clear_top=false); > *Hinge2(th + bt + th); > > th = 2; // thickness > bt = 7.2; // board thickness > sthd = 1; // stitch hole diameter > schd = 4; // screw hole diameter > > lm = 0; // left mode > mm = 1; > rm = 2; > > module Hinged(b, m) { > if (b) { > Hinge1h(cX); > } > else { > Hinge2h(cX); > } > } > > > color("red") Hinged(true); > color("green") > translate([5, 0, 15]) > rotate([180, 0, 180]) > Hinged(false); > > > > <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > Virus-free.www.avg.com > <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > <#m_-3935134853923460209_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jon Bondy
Tue, May 13, 2025 9:47 PM

Thanks, Adrian.   I think this would be a good addition to the hinge
examples.

Jon

On 5/13/2025 4:19 PM, Adrian Mariano via Discuss wrote:

There are lots of ways to attach a hinge to something.  To achieve
what you want, you need to design a hinge that has its centerpoint
aligned with the edge of the object it's attached to.  Note that such
a hinge won't actually work in reality. You need clearance between the
plates. I looked at a couple real hinges and the expensive one is
about 20mm long hinge with a bit less than 1mm of space between the
leaves when they are parallel.  The cheap one had much more space. 
But here's a way to do what you requested.  I also activated knuckle
clearance, which appears to be working fine.  How did it not work for
you, Jordan?

include<BOSL2/std.scad>
include<BOSL2/hinges.scad>

$fn=32;
kd=4;
color("green")
diff()
cuboid([20,kd/2,7],anchor=BACK)
  position(TOP+BACK)
    knuckle_hinge(20, segs=3, offset=kd/2, knuckle_clearance=0.2,
                 knuckle_diam=kd, arm_angle=90, arm_height=0,
clear_top=true);
color("red")
diff()
cuboid([20,kd/2,7],anchor=FWD)
  position(TOP+FWD)
    yflip()knuckle_hinge(20, segs=3, offset=kd/2,
knuckle_clearance=.2, inner=true,
                         knuckle_diam=kd, arm_angle=90, arm_height=0,
clear_top=true);

image.png

On Sun, May 11, 2025 at 1:53 PM Jon Bondy via Discuss
discuss@lists.openscad.org wrote:

 I want the two hinges in this example to have the flat parts lie
 flat together, but cannot figure out how to modify the parameters
 to make this happen.



 // DNG Belly Support

 include <BOSL2/std.scad>
 include <BOSL2/hinges.scad>

 inches = 25.4;
 $fn=32;
 eps = 0.01;

 mw = 125;    // max width

 // left/middle/right

 cX = 2;
 cY = 40;
 cZ = 15;
 pd = 1.9;    // pin diameter

 module Hinge1h(th)
     cuboid([th, cY, cZ])
         position(TOP) orient(anchor=RIGHT)
             knuckle_hinge(length=35, segs=9, offset=2,
 arm_height=1, pin_diam=pd, clear_top=false);
 *Hinge1();

 module Hinge2h(th)
     translate([0, 0, cZ])
         rotate([180, 0, 0])
             cuboid([th, cY, cZ])
                 position(TOP+RIGHT) orient(anchor=RIGHT)
                     knuckle_hinge(length=35, segs=9, offset=2,
 arm_height=1, inner=true, pin_diam=pd, clear_top=false);
 *Hinge2(th + bt + th);

 th = 2;            // thickness
 bt = 7.2;        // board thickness
 sthd = 1;        // stitch hole diameter
 schd = 4;        // screw hole diameter

 lm = 0;        // left mode
 mm = 1;
 rm = 2;

 module Hinged(b, m) {
     if (b) {
         Hinge1h(cX);
         }
     else {
         Hinge2h(cX);
         }
     }


 color("red") Hinged(true);
 color("green")
     translate([5, 0, 15])
         rotate([180, 0, 180])
             Hinged(false);


 <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
 	Virus-free.www.avg.com
 <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>


 <#m_-3935134853923460209_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
 _______________________________________________
 OpenSCAD mailing list
 To unsubscribe send an email to discuss-leave@lists.openscad.org

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

--
This email has been checked for viruses by AVG antivirus software.
www.avg.com

Thanks, Adrian.   I think this would be a good addition to the hinge examples. Jon On 5/13/2025 4:19 PM, Adrian Mariano via Discuss wrote: > There are lots of ways to attach a hinge to something.  To achieve > what you want, you need to design a hinge that has its centerpoint > aligned with the edge of the object it's attached to.  Note that such > a hinge won't actually work in reality. You need clearance between the > plates. I looked at a couple real hinges and the expensive one is > about 20mm long hinge with a bit less than 1mm of space between the > leaves when they are parallel.  The cheap one had much more space.  > But here's a way to do what you requested.  I also activated knuckle > clearance, which appears to be working fine.  How did it not work for > you, Jordan? > > include<BOSL2/std.scad> > include<BOSL2/hinges.scad> > > $fn=32; > kd=4; > color("green") > diff() > cuboid([20,kd/2,7],anchor=BACK) >   position(TOP+BACK) >     knuckle_hinge(20, segs=3, offset=kd/2, knuckle_clearance=0.2, >                  knuckle_diam=kd, arm_angle=90, arm_height=0, > clear_top=true); > color("red") > diff() > cuboid([20,kd/2,7],anchor=FWD) >   position(TOP+FWD) >     yflip()knuckle_hinge(20, segs=3, offset=kd/2, > knuckle_clearance=.2, inner=true, >                          knuckle_diam=kd, arm_angle=90, arm_height=0, > clear_top=true); > > image.png > > > On Sun, May 11, 2025 at 1:53 PM Jon Bondy via Discuss > <discuss@lists.openscad.org> wrote: > > I want the two hinges in this example to have the flat parts lie > flat together, but cannot figure out how to modify the parameters > to make this happen. > > > > // DNG Belly Support > > include <BOSL2/std.scad> > include <BOSL2/hinges.scad> > > inches = 25.4; > $fn=32; > eps = 0.01; > > mw = 125;    // max width > > // left/middle/right > > cX = 2; > cY = 40; > cZ = 15; > pd = 1.9;    // pin diameter > > module Hinge1h(th) >     cuboid([th, cY, cZ]) >         position(TOP) orient(anchor=RIGHT) >             knuckle_hinge(length=35, segs=9, offset=2, > arm_height=1, pin_diam=pd, clear_top=false); > *Hinge1(); > > module Hinge2h(th) >     translate([0, 0, cZ]) >         rotate([180, 0, 0]) >             cuboid([th, cY, cZ]) >                 position(TOP+RIGHT) orient(anchor=RIGHT) >                     knuckle_hinge(length=35, segs=9, offset=2, > arm_height=1, inner=true, pin_diam=pd, clear_top=false); > *Hinge2(th + bt + th); > > th = 2;            // thickness > bt = 7.2;        // board thickness > sthd = 1;        // stitch hole diameter > schd = 4;        // screw hole diameter > > lm = 0;        // left mode > mm = 1; > rm = 2; > > module Hinged(b, m) { >     if (b) { >         Hinge1h(cX); >         } >     else { >         Hinge2h(cX); >         } >     } > > > color("red") Hinged(true); > color("green") >     translate([5, 0, 15]) >         rotate([180, 0, 180]) >             Hinged(false); > > > <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > Virus-free.www.avg.com > <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> > > > <#m_-3935134853923460209_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org -- This email has been checked for viruses by AVG antivirus software. www.avg.com
JB
Jordan Brown
Tue, May 13, 2025 11:57 PM

On 5/13/2025 1:19 PM, Adrian Mariano via Discuss wrote:

I also activated knuckle clearance, which appears to be working fine. 
How did it not work for you, Jordan?

The documentation says clear_knuckle, and does not list
knuckle_clearance.  (In the primary parameter list.  I do see it now in
the examples.)

On 5/13/2025 1:19 PM, Adrian Mariano via Discuss wrote: > I also activated knuckle clearance, which appears to be working fine.  > How did it not work for you, Jordan? The documentation says clear_knuckle, and does not list knuckle_clearance.  (In the primary parameter list.  I do see it now in the examples.)