Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
refactor thread.Parameters method
Browse files Browse the repository at this point in the history
  • Loading branch information
soypat committed May 15, 2022
1 parent d3647ff commit eb15444
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions form3/obj3/thread/acme.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ type Acme struct {

var _ Threader = Acme{} // Compile time check of interface implementation.

func (acme Acme) Parameters() Parameters {
return basic{D: acme.D, P: acme.P}.Parameters()
func (acme Acme) ThreadParams() Parameters {
return basic{D: acme.D, P: acme.P}.ThreadParams()
}

// AcmeThread returns the 2d profile for an acme thread.
Expand Down
4 changes: 2 additions & 2 deletions form3/obj3/thread/ansibuttress.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ type ANSIButtress struct {

var _ Threader = ANSIButtress{} // Compile time check of interface implementation.

func (butt ANSIButtress) Parameters() Parameters {
return basic{D: butt.D, P: butt.P}.Parameters()
func (butt ANSIButtress) ThreadParams() Parameters {
return basic{D: butt.D, P: butt.P}.ThreadParams()
}

// ANSIButtressThread returns the 2d profile for an ANSI 45/7 buttress thread.
Expand Down
2 changes: 1 addition & 1 deletion form3/obj3/thread/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type basic struct {
P float64
}

func (b basic) Parameters() Parameters {
func (b basic) ThreadParams() Parameters {
radius := b.D / 2
return Parameters{
Name: "basic",
Expand Down
2 changes: 1 addition & 1 deletion form3/obj3/thread/bolt.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func Bolt(k BoltParms) (s sdf.SDF3, err error) {
case k.Tolerance < 0:
err = errors.New("tolerance < 0")
}
param := k.Thread.Parameters()
param := k.Thread.ThreadParams()
// head
var head sdf.SDF3

Expand Down
4 changes: 2 additions & 2 deletions form3/obj3/thread/iso.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ type ISO struct {

var _ Threader = ISO{} // Compile time check of interface implementation.

func (iso ISO) Parameters() Parameters {
func (iso ISO) ThreadParams() Parameters {
b := basic{D: iso.D, P: iso.P}
return b.Parameters()
return b.ThreadParams()
}

func (iso ISO) Thread() (sdf.SDF2, error) {
Expand Down
4 changes: 2 additions & 2 deletions form3/obj3/thread/knurl.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func (k KnurlParams) Thread() (sdf.SDF2, error) {
}

// Parameters implements the Threader interface.
func (k KnurlParams) Parameters() Parameters {
p := ISO{D: k.Radius * 2, P: k.Pitch, Ext: true}.Parameters()
func (k KnurlParams) ThreadParams() Parameters {
p := ISO{D: k.Radius * 2, P: k.Pitch, Ext: true}.ThreadParams()
p.Starts = k.starts
return p
}
Expand Down
4 changes: 2 additions & 2 deletions form3/obj3/thread/npt.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ type NPT struct {

var _ Threader = NPT{} // Compile time check of interface implementation.

func (npt NPT) Parameters() Parameters {
p := ISO{D: npt.D, P: 1.0 / npt.TPI}.Parameters()
func (npt NPT) ThreadParams() Parameters {
p := ISO{D: npt.D, P: 1.0 / npt.TPI}.ThreadParams()
p.Name = "NPT"
p.Taper = math.Atan(1.0 / 32.0) // standard NPT taper.
if npt.F2F > 0 {
Expand Down
2 changes: 1 addition & 1 deletion form3/obj3/thread/nut.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func Nut(k NutParms) (s sdf.SDF3, err error) {
return nil, err
}

params := k.Thread.Parameters()
params := k.Thread.ThreadParams()
// nut body
var nut sdf.SDF3
nr := params.HexRadius()
Expand Down
4 changes: 2 additions & 2 deletions form3/obj3/thread/plasticbuttress.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ type PlasticButtress struct {

var _ Threader = PlasticButtress{} // Compile time check of interface implementation.

func (butt PlasticButtress) Parameters() Parameters {
return basic{D: butt.D, P: butt.P}.Parameters()
func (butt PlasticButtress) ThreadParams() Parameters {
return basic{D: butt.D, P: butt.P}.ThreadParams()
}

// Thread returns the 2d profile for a screw top style plastic buttress thread.
Expand Down
4 changes: 2 additions & 2 deletions form3/obj3/thread/thread.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

type Threader interface {
Thread() (sdf.SDF2, error)
Parameters() Parameters
ThreadParams() Parameters
}

type ScrewParameters struct {
Expand Down Expand Up @@ -59,7 +59,7 @@ func Screw(length float64, thread Threader) (sdf.SDF3, error) {
if err != nil {
return nil, err
}
params := thread.Parameters()
params := thread.ThreadParams()
s := screw{}
s.thread = tsdf
s.pitch = params.Pitch
Expand Down
4 changes: 2 additions & 2 deletions form3/obj3/thread/uts.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ type UTS struct {

var _ Threader = UTS{} // Interface implementation.

func (uts UTS) Parameters() Parameters {
p := basic{D: uts.D, P: 1.0 / uts.TPI}.Parameters()
func (uts UTS) ThreadParams() Parameters {
p := basic{D: uts.D, P: 1.0 / uts.TPI}.ThreadParams()
// TODO(soypat) add imperial hex flat-to-flat. See NPT for what that could look like.
return p
}
Expand Down

0 comments on commit eb15444

Please sign in to comment.