thread

package
v0.0.0-...-1c91121 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2023 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bolt

func Bolt(k BoltParms) (s sdf.SDF3, err error)

Bolt returns a simple bolt suitable for 3d printing.

func HexHead

func HexHead(radius float64, height float64, round string) (s sdf.SDF3, err error)

HexHead3D returns the rounded hex head for a nut or bolt. - round rounding control (t)top, (b)bottom, (tb)top/bottom

func Knurl

func Knurl(k KnurlParams) (s sdf.SDF3, err error)

Knurl returns a knurled cylinder.

func KnurledHead

func KnurledHead(radius float64, height float64, pitch float64) (s sdf.SDF3, err error)

KnurledHead returns a generic cylindrical knurled head.

func Nut

func Nut(k NutParms) (s sdf.SDF3, err error)

Nut returns a simple nut suitable for 3d printing.

func Screw

func Screw(length float64, thread Threader) (sdf.SDF3, error)

Screw returns a screw SDF3. - length of screw - thread taper angle (radians) - pitch thread to thread distance - number of thread starts (< 0 for left hand threads)

Types

type ANSIButtress

type ANSIButtress struct {
	// D is the thread nominal diameter.
	D float64
	// P is the thread pitch.
	P float64
}

func (ANSIButtress) Thread

func (ansi ANSIButtress) Thread() (sdf.SDF2, error)

ANSIButtressThread returns the 2d profile for an ANSI 45/7 buttress thread. https://en.wikipedia.org/wiki/Buttress_thread AMSE B1.9-1973 radius is radius of thread. pitch is thread-to-thread distance.

func (ANSIButtress) ThreadParams

func (butt ANSIButtress) ThreadParams() Parameters

type Acme

type Acme struct {
	// D is the thread nominal diameter.
	D float64
	// P is the thread pitch.
	P float64
}

Acme is a trapezoidal thread form. https://en.wikipedia.org/wiki/Trapezoidal_thread_form

func (Acme) Thread

func (acme Acme) Thread() (sdf.SDF2, error)

AcmeThread returns the 2d profile for an acme thread. radius is radius of thread. pitch is thread-to-thread distance.

func (Acme) ThreadParams

func (acme Acme) ThreadParams() Parameters

type BoltParms

type BoltParms struct {
	Thread      Threader
	Style       NutStyle // head style "hex" or "knurl"
	Tolerance   float64  // subtract from external thread radius
	TotalLength float64  // threaded length + shank length
	ShankLength float64  // non threaded length
}

BoltParms defines the parameters for a bolt.

type ISO

type ISO struct {
	// D is the thread nominal diameter [mm].
	D float64
	// P is the thread pitch [mm].
	P float64
	// Is external or internal thread. Ext set to true means external thread.
	Ext bool
}

ISO is a standardized thread. Pitch is usually the number following the diameter i.e: for M16x2 the pitch is 2mm

func (ISO) Thread

func (iso ISO) Thread() (sdf.SDF2, error)

func (ISO) ThreadParams

func (iso ISO) ThreadParams() Parameters

type KnurlParams

type KnurlParams struct {
	Length float64 // length of cylinder
	Radius float64 // radius of cylinder
	Pitch  float64 // knurl pitch
	Height float64 // knurl height
	Theta  float64 // knurl helix angle
	// contains filtered or unexported fields
}

KnurlParams specifies the knurl parameters.

func (KnurlParams) Thread

func (k KnurlParams) Thread() (sdf.SDF2, error)

Thread implements the Threader interface.

func (KnurlParams) ThreadParams

func (k KnurlParams) ThreadParams() Parameters

Parameters implements the Threader interface.

type NPT

type NPT struct {
	// D is the thread nominal diameter.
	D float64
	// threads per inch. 1.0/TPI gives pitch.
	TPI float64
	// Flat-to-flat hex distance.
	// Can be set by SetFromNominal with a standard value.
	F2F float64
}

func (*NPT) SetFromNominal

func (npt *NPT) SetFromNominal(nominalDimension float64) error

SetFromNominal sets NPT thread dimensions from a nominal measurement which usually takes the form of inch fractions. i.e:

npt.SetFromNominal(1.0/8.0) // sets NPT 1/8

func (NPT) Thread

func (npt NPT) Thread() (sdf.SDF2, error)

func (NPT) ThreadParams

func (npt NPT) ThreadParams() Parameters

type NutParms

type NutParms struct {
	Thread    Threader
	Style     NutStyle
	Tolerance float64 // add to internal thread radius
}

NutParms defines the parameters for a nut.

type NutStyle

type NutStyle int
const (
	NutCircular NutStyle
	NutHex
	NutKnurl
)

func (NutStyle) String

func (c NutStyle) String() (str string)

type Parameters

type Parameters struct {
	Name   string  // name of screw thread
	Radius float64 // nominal major radius of screw
	Pitch  float64 // thread to thread distance of screw
	Starts int     // number of threads
	Taper  float64 // thread taper (radians)
	HexF2F float64 // hex head flat to flat distance
}

func (Parameters) HexHeight

func (t Parameters) HexHeight() float64

HexHeight returns the hex head height (empirical).

func (Parameters) HexRadius

func (t Parameters) HexRadius() float64

HexRadius returns the hex head radius.

type PlasticButtress

type PlasticButtress struct {
	// D is the thread nominal diameter.
	D float64
	// P is the thread pitch.
	P float64
}

func (PlasticButtress) Thread

func (butt PlasticButtress) Thread() (sdf.SDF2, error)

Thread returns the 2d profile for a screw top style plastic buttress thread. Similar to ANSI 45/7 - but with more corner rounding radius is radius of thread. pitch is thread-to-thread distance.

func (PlasticButtress) ThreadParams

func (butt PlasticButtress) ThreadParams() Parameters

type ScrewParameters

type ScrewParameters struct {
	Length float64
	Taper  float64
}

type Threader

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

type UTS

type UTS struct {
	D   float64
	TPI float64
	// External or internal thread.
	Ext bool
}

Unified thread standard. Example: UNC 1/4 with external threading would be

UTS{D:1.0/4.0, TPI:20, Ext: true}

func (UTS) Thread

func (uts UTS) Thread() (sdf.SDF2, error)

func (UTS) ThreadParams

func (uts UTS) ThreadParams() Parameters

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL