Skip to content

Commit 44e5046

Browse files
committed
fix npt flange example
1 parent e5576ab commit 44e5046

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,19 @@ This was converted from the [original example](https://github.com/soypat/sdf/blo
4242
Thread: npt,
4343
Style: threads.NutCircular,
4444
})
45+
4546
// Base plate which goes bolted to joint.
4647
flange, _ = gsdf.NewCylinder(flangeD/2, flangeH, flangeH/8)
47-
// Make through-hole in flange bottom.
48-
hole, _ := gsdf.NewCylinder(internalDiameter/2, flangeH, 0)
49-
flange = gsdf.Difference(flange, hole)
5048

5149
// Join threaded section with flange.
5250
flange = gsdf.Translate(flange, 0, 0, -tlen/2)
5351
union := gsdf.SmoothUnion(pipe, flange, 0.2)
54-
union = gsdf.Scale(union, 1)
52+
53+
// Make through-hole in flange bottom. Holes usually done at the end
54+
// to avoid smoothing effects covering up desired negative space.
55+
hole, _ := gsdf.NewCylinder(internalDiameter/2, 4*flangeH, 0)
56+
union = gsdf.Difference(union, hole)
57+
// Convert from imperial inches units to millimeter:
58+
union = gsdf.Scale(union, 25.4)
5559
renderSDF(union)
5660
```

examples/npt-flange/flange.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,21 @@ func scene() (gleval.SDF3, error) {
9292

9393
pipe, _ := threads.Nut(threads.NutParms{
9494
Thread: npt,
95-
Style: threads.NutHex,
95+
Style: threads.NutCircular,
9696
})
97-
pipe = gsdf.Scale(pipe, 100)
98-
return makeSDF(pipe)
97+
9998
// Base plate which goes bolted to joint.
10099
flange, _ = gsdf.NewCylinder(flangeD/2, flangeH, flangeH/8)
101-
// Make through-hole in flange bottom.
102-
hole, _ := gsdf.NewCylinder(internalDiameter/2, 4*flangeH, 0)
103-
flange = gsdf.Difference(flange, hole)
104100

105101
// Join threaded section with flange.
106102
flange = gsdf.Translate(flange, 0, 0, -tlen/2)
107103
union := gsdf.SmoothUnion(pipe, flange, 0.2)
104+
105+
// Make through-hole in flange bottom. Holes usually done at the end
106+
// to avoid smoothing effects covering up desired negative space.
107+
hole, _ := gsdf.NewCylinder(internalDiameter/2, 4*flangeH, 0)
108+
union = gsdf.Difference(union, hole)
109+
// Convert from imperial inches units to millimeter:
108110
union = gsdf.Scale(union, 25.4)
109111
return makeSDF(union)
110112
}

0 commit comments

Comments
 (0)