threads

package
v0.0.0-...-9b2a9f7 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bolt

func Bolt(k BoltParams) (s glbuild.Shader3D, err error)

Bolt returns a simple bolt suitable for 3d printing.

func HexHead

func HexHead(radius float32, height float32, roundNeg, roundPos bool) (s glbuild.Shader3D, err error)

HexHead3D returns the rounded hex head for a nut or bolt. Ability to round positive side and/or negative side of hex head provided. By convention the negative side is the top of the hex in this package.

func Knurl

func Knurl(k KnurlParams) (s glbuild.Shader3D, err error)

Knurl returns a knurled cylinder.

func KnurledHead

func KnurledHead(radius float32, height float32, pitch float32) (s glbuild.Shader3D, err error)

KnurledHead returns a generic cylindrical knurled head.

func Nut

func Nut(k NutParams) (s glbuild.Shader3D, err error)

Nut returns a simple nut suitable for 3d printing.

func Screw

func Screw(length float32, thread Threader) (glbuild.Shader3D, 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 float32
	// P is the thread pitch.
	P float32
}

func (ANSIButtress) Thread

func (ansi ANSIButtress) Thread() (glbuild.Shader2D, error)

ANSIButtressThread returns the 2d profile for an ANSI 45/7 buttress thread. https://en.wikipedia.org/wiki/Buttress_thread ASME 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 float32
	// P is the thread pitch.
	P float32
}

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

func (Acme) Thread

func (acme Acme) Thread() (glbuild.Shader2D, 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 BoltParams

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

BoltParams defines the parameters for a bolt.

type ISO

type ISO struct {
	// D is the thread nominal diameter [mm].
	D float32
	// P is the thread pitch [mm].
	P float32
	// Is external or internal thread. Ext set to true means external thread
	// which is for screws. Internal threads refer to tapped holes.
	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() (glbuild.Shader2D, error)

func (ISO) ThreadParams

func (iso ISO) ThreadParams() Parameters

type KnurlParams

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

KnurlParams specifies the knurl parameters.

func (KnurlParams) Thread

func (k KnurlParams) Thread() (glbuild.Shader2D, 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 float32
	// threads per inch. 1.0/TPI gives pitch.
	TPI float32
	// Flat-to-flat hex distance.
	// Can be set by SetFromNominal with a standard value.
	F2F float32
}

func (*NPT) SetFromNominal

func (npt *NPT) SetFromNominal(nominalDimension float32) 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() (glbuild.Shader2D, error)

func (NPT) ThreadParams

func (npt NPT) ThreadParams() Parameters

type NutParams

type NutParams struct {
	Thread    Threader
	Style     NutStyle
	Tolerance float32 // add to internal thread radius
}

NutParams 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 float32 // nominal major radius of screw.
	Pitch  float32 // thread to thread distance of screw.
	Starts int     // number of threads.
	Taper  float32 // thread taper (radians).
	HexF2F float32 // hex head flat to flat distance. F2F = 2*cosd(30)*radius.
}

func (Parameters) HexHeight

func (t Parameters) HexHeight() float32

HexHeight returns the hex head height (empirical).

func (Parameters) HexRadius

func (t Parameters) HexRadius() float32

HexRadius returns the hex head radius.

type PlasticButtress

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

func (PlasticButtress) Thread

func (butt PlasticButtress) Thread() (glbuild.Shader2D, 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 ScrewParams

type ScrewParams struct {
	Length float32
	Taper  float32
}

type Threader

type Threader interface {
	Thread() (glbuild.Shader2D, error)
	ThreadParams() Parameters
}

type UTS

type UTS struct {
	// Diameter.
	D float32
	// Threads per inch, equivalent to thread revolutions per 25.4mm.
	TPI float32
	// 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() (glbuild.Shader2D, 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