obj

package
v0.0.0-...-c238eda Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Angle2D

func Angle2D(k *AngleParms) (sdf.SDF2, error)

Angle2D returns a 2d angle profile.

func Angle3D

func Angle3D(k *AngleParms) (sdf.SDF3, error)

Angle3D returns a piece of 3d angle.

func Arrow3D

func Arrow3D(k *ArrowParms) (sdf.SDF3, error)

Arrow3D returns an arrow.

func Axes3D

func Axes3D(p0, p1 v3.Vec) (sdf.SDF3, error)

Axes3D returns a set of axes for a 1, 2 or 3d coordinate systems.

func Bolt

func Bolt(k *BoltParms) (sdf.SDF3, error)

Bolt returns a simple bolt suitable for 3d printing.

func BoltCircle2D

func BoltCircle2D(
	holeRadius float64,
	circleRadius float64,
	numHoles int,
) (sdf.SDF2, error)

BoltCircle2D returns a 2D profile for a flange bolt circle.

func BoltCircle3D

func BoltCircle3D(
	holeDepth float64,
	holeRadius float64,
	circleRadius float64,
	numHoles int,
) (sdf.SDF3, error)

BoltCircle3D returns a 3D object for a flange bolt circle.

func ChamferedCylinder

func ChamferedCylinder(s sdf.SDF3, kb, kt float64) (sdf.SDF3, error)

ChamferedCylinder intersects a chamfered cylinder with an SDF3.

func ChamferedHole3D

func ChamferedHole3D(
	l float64,
	r float64,
	chRadius float64,
) (sdf.SDF3, error)

ChamferedHole3D returns the SDF3 for a chamfered hole (45 degrees).

func CounterBoredHole3D

func CounterBoredHole3D(
	l float64,
	r float64,
	cbRadius float64,
	cbDepth float64,
) (sdf.SDF3, error)

CounterBoredHole3D returns the SDF3 for a counterbored hole.

func CounterSunkHole3D

func CounterSunkHole3D(
	l float64,
	r float64,
) (sdf.SDF3, error)

CounterSunkHole3D returns the SDF3 for a countersunk hole (45 degrees).

func DirectedArrow3D

func DirectedArrow3D(k *ArrowParms, head, tail v3.Vec) (sdf.SDF3, error)

DirectedArrow3D returns an arrow between points head/tail.

func EuroRackPanel2D

func EuroRackPanel2D(k *EuroRackParms) (sdf.SDF2, error)

EuroRackPanel2D returns a 2d eurorack synthesizer module panel (in mm).

func EuroRackPanel3D

func EuroRackPanel3D(k *EuroRackParms) (sdf.SDF3, error)

EuroRackPanel3D returns a 3d eurorack synthesizer module panel (in mm).

func FingerButton2D

func FingerButton2D(k *FingerButtonParms) (sdf.SDF2, error)

FingerButton2D returns a 2D cutout for a finger button.

func Geneva2D

func Geneva2D(k *GenevaParms) (sdf.SDF2, sdf.SDF2, error)

Geneva2D makes 2d profiles for the driver/driven wheels of a geneva drive.

func HexHead3D

func HexHead3D(
	radius float64,
	height float64,
	round string,
) (sdf.SDF3, error)

HexHead3D returns the rounded hex head for a nut or bolt.

func ImportSTL

func ImportSTL(reader io.ReadSeeker, numNeighbors, minChildren, maxChildren int) (sdf.SDF3, error)

ImportSTL converts an STL model into a SDF3 surface. See ImportTriMesh.

func ImportTriMesh

func ImportTriMesh(tris chan *render.Triangle3, numNeighbors, minChildren, maxChildren int) sdf.SDF3

ImportTriMesh converts a triangle-based mesh into a SDF3 surface. minChildren and maxChildren are parameters that can affect the performance of the internal data structure (3 and 5 are a good default; maxChildren >= minChildren > 0).

WARNING: Setting a low numNeighbors will consider many fewer triangles for each evaluated point, greatly speeding up the algorithm. However, if the count of triangles is too low artifacts will appear on the surface (triangle continuations). Setting this value to MaxInt is extremely slow but will provide correct results, so choose a value that works for your model.

It is recommended to cache (and/or smooth) its values by using sdf.VoxelSdf3.

WARNING: It will only work on non-intersecting closed-surface(s) meshes. NOTE: Fix using blender for intersecting surfaces: Edit mode > P > By loose parts > Add boolean modifier to join them

func InvoluteGear

func InvoluteGear(k *InvoluteGearParms) (sdf.SDF2, error)

InvoluteGear returns an 2D polygon for an involute gear.

func Keyway2D

func Keyway2D(k *KeywayParameters) (sdf.SDF2, error)

Keyway2D returns the 2d profile of a shaft and keyway.

func Keyway3D

func Keyway3D(k *KeywayParameters) (sdf.SDF3, error)

Keyway3D returns a shaft and keyway.

func Knurl3D

func Knurl3D(k *KnurlParms) (sdf.SDF3, error)

Knurl3D returns a knurled cylinder.

func KnurledHead3D

func KnurledHead3D(
	r float64,
	h float64,
	pitch float64,
) (sdf.SDF3, error)

KnurledHead3D returns a generic cylindrical knurled head.

func Nut

func Nut(k *NutParms) (sdf.SDF3, error)

Nut returns a simple nut suitable for 3d printing.

func Panel2D

func Panel2D(k *PanelParms) (sdf.SDF2, error)

Panel2D returns a 2d panel with holes on the edges.

func Panel3D

func Panel3D(k *PanelParms) (sdf.SDF3, error)

Panel3D returns a 3d panel with holes on the edges.

func PanelBox3D

func PanelBox3D(k *PanelBoxParms) ([]sdf.SDF3, error)

PanelBox3D returns a 4 part panel box.

func PanelHole3D

func PanelHole3D(k *PanelHoleParms) (sdf.SDF3, error)

PanelHole3D returns a panel hole and an indent for a retention pin.

func Pipe3D

func Pipe3D(oRadius, iRadius, length float64) (sdf.SDF3, error)

Pipe3D returns a length of pipe.

func PipeConnector3D

func PipeConnector3D(k *PipeConnectorParms) (sdf.SDF3, error)

PipeConnector3D returns an n-way female pipe connector.

func Servo2D

func Servo2D(k *ServoParms, holeRadius float64) (sdf.SDF2, error)

Servo2D returns a 2D cutout model for servo mounting.

func Servo3D

func Servo3D(k *ServoParms) (sdf.SDF3, error)

Servo3D returns a 3D model for a servo.

func ServoHorn

func ServoHorn(k *ServoHornParms) (sdf.SDF2, error)

ServoHorn returns a 2D cutout model for a servo horn nount.

func Standoff3D

func Standoff3D(k *StandoffParms) (sdf.SDF3, error)

Standoff3D returns a single board standoff.

func StdPipe3D

func StdPipe3D(name, units string, length float64) (sdf.SDF3, error)

StdPipe3D returns a length of the named standard pipe.

func StdPipeConnector3D

func StdPipeConnector3D(name, units string, length float64, cfg [6]bool) (sdf.SDF3, error)

StdPipeConnector3D returns an n-way female pipe connector for a standard pipe size.

func TruncRectPyramid3D

func TruncRectPyramid3D(k *TruncRectPyramidParms) (sdf.SDF3, error)

TruncRectPyramid3D returns a truncated rectangular pyramid with rounded edges.

func Washer2D

func Washer2D(k *WasherParms) (sdf.SDF2, error)

Washer2D returns a 2d washer.

func Washer3D

func Washer3D(k *WasherParms) (sdf.SDF3, error)

Washer3D returns a 3d washer. This can also be used to create circular walls.

Types

type AngleLeg

type AngleLeg struct {
	Length    float64
	Thickness float64
}

AngleLeg defines the parameters for one leg of a piece of angle.

type AngleParms

type AngleParms struct {
	X, Y       AngleLeg // angle legs
	RootRadius float64  // radius of inside fillet
	Length     float64  // length (3d only)
}

AngleParms defines the parameters for a piece of angle.

type ArrowParms

type ArrowParms struct {
	Axis  [2]float64 // length/radius of arrow axis
	Head  [2]float64 // length/radius of arrow head
	Tail  [2]float64 // length/radius of arrow tail
	Style string     // head, tail "c" = cone, "b" == ball (else nothing)
}

ArrowParms defines the parameters for an arrow.

type BoltParms

type BoltParms struct {
	Thread      string  // name of thread
	Style       string  // 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 EuroRackParms

type EuroRackParms struct {
	U            float64 // U-size (vertical)
	HP           float64 // HP-size (horizontal)
	CornerRadius float64 // radius of panel corners
	HoleDiameter float64 // panel holes (0 for default)
	Thickness    float64 // panel thickness (3d only)
	Ridge        bool    // add side ridges for reinforcing (3d only)
}

EuroRackParms defines the parameters for a eurorack panel.

type FingerButtonParms

type FingerButtonParms struct {
	Width  float64 // finger width
	Gap    float64 // gap between finger and body
	Length float64 // length of the finger
}

FingerButtonParms defines the parameters for a 2D finger button.

type GenevaParms

type GenevaParms struct {
	NumSectors     int     // number of sectors in the driven wheel
	CenterDistance float64 // center to center distance of driver/driven wheels
	DriverRadius   float64 // radius of lock portion of driver wheel
	DrivenRadius   float64 // radius of driven wheel
	PinRadius      float64 // radius of driver pin
	Clearance      float64 // pin/slot and wheel/wheel clearance
}

GenevaParms specfies the geneva drive parameters.

type InvoluteGearParms

type InvoluteGearParms struct {
	NumberTeeth   int     // number of gear teeth
	Module        float64 // pitch circle diameter / number of gear teeth
	PressureAngle float64 // gear pressure angle (radians)
	Backlash      float64 // backlash expressed as per-tooth distance at pitch circumference
	Clearance     float64 // additional root clearance
	RingWidth     float64 // width of ring wall (from root circle)
	Facets        int     // number of facets for involute flank
}

InvoluteGearParms defines the parameters for an involute gear.

type KeywayParameters

type KeywayParameters struct {
	ShaftRadius float64 // shaft radius
	KeyRadius   float64 // shaft center to bottom/top of key
	KeyWidth    float64 // key width
	ShaftLength float64 // shaft length (3d only)
}

KeywayParameters defines the parameters for a keyway and shaft.

type KnurlParms

type KnurlParms struct {
	Length float64 // length of cylinder
	Radius float64 // radius of cylinder
	Pitch  float64 // knurl pitch
	Height float64 // knurl height
	Theta  float64 // knurl helix angle
}

KnurlParms specifies the knurl parameters.

type NutParms

type NutParms struct {
	Thread    string  // name of thread
	Style     string  // head style "hex" or "knurl"
	Tolerance float64 // add to internal thread radius
}

NutParms defines the parameters for a nut.

type PanelBoxParms

type PanelBoxParms struct {
	Size       v3.Vec  // outer box dimensions (width, height, length)
	Wall       float64 // wall thickness
	Panel      float64 // front/back panel thickness
	Rounding   float64 // radius of corner rounding
	FrontInset float64 // inset depth of box front
	BackInset  float64 // inset depth of box back
	Clearance  float64 // fit clearance (typically 0.05)
	Hole       float64 // diameter of screw holes
	SideTabs   string  // tab pattern b/B (bottom) t/T (top) . (empty)
}

PanelBoxParms defines the parameters for a 4 part panel box.

type PanelHoleParms

type PanelHoleParms struct {
	Diameter    float64 // hole diameter
	Thickness   float64 // panel thickness
	Indent      v3.Vec  // indent size
	Offset      float64 // indent offset from main axis
	Orientation float64 // orientation of indent, 0 == x-axis
}

PanelHoleParms defines the parameters for a panel hole.

type PanelParms

type PanelParms struct {
	Size         v2.Vec     // size of the panel
	CornerRadius float64    // radius of rounded corners
	HoleDiameter float64    // diameter of panel holes
	HoleMargin   [4]float64 // hole margins for top, right, bottom, left
	HolePattern  [4]string  // hole pattern for top, right, bottom, left
	Thickness    float64    // panel thickness (3d only)
}

PanelParms defines the parameters for a 2D panel.

type PipeConnectorParms

type PipeConnectorParms struct {
	Length        float64 // length of connector arm to center
	OuterRadius   float64 // outer radius of connector arm
	InnerRadius   float64 // inner radius of connector arm
	RecessDepth   float64 // depth for recessed stop
	RecessWidth   float64 // width of internal recess step
	Configuration [6]bool // position of arms. +x,-x,+y,-y,+z,-z
}

PipeConnectorParms defines an n-way female pipe connector.

type PipeParameters

type PipeParameters struct {
	Name  string  // name
	Outer float64 // outer radius
	Inner float64 // inner radius
	Units string  // "inch" or "mm"
}

PipeParameters stores the parameters that define pipe.

func PipeLookup

func PipeLookup(name, units string) (*PipeParameters, error)

PipeLookup returns the parameters for a named pipe.

type ServoHornParms

type ServoHornParms struct {
	CenterRadius float64 // radius of center hole
	NumHoles     int     // numer of mount holes
	CircleRadius float64 // radius of bolt circle
	HoleRadius   float64 // radius of mount hole
}

ServoHornParms stores the parameters that define a servo horn.

type ServoParms

type ServoParms struct {
	Body        v3.Vec  // body size
	Mount       v3.Vec  // mounting lugs size
	Hole        v2.Vec  // hole layout
	MountOffset float64 // z-offset of mounting lugs (from base of servo)
	ShaftOffset float64 // x-offset of drive shaft (from mounting hole center to shaft)
	ShaftLength float64
	ShaftRadius float64
	HoleRadius  float64
}

ServoParms stores the parameters that define the servo.

func ServoLookup

func ServoLookup(name string) (*ServoParms, error)

ServoLookup returns the parameters for a named servo.

type StandoffParms

type StandoffParms struct {
	PillarHeight   float64
	PillarDiameter float64
	HoleDepth      float64 // > 0 is a hole, < 0 is a support stub
	HoleDiameter   float64
	NumberWebs     int // number of triangular gussets around the standoff base
	WebHeight      float64
	WebDiameter    float64
	WebWidth       float64
}

StandoffParms defines the parameters for a board standoff pillar.

type TruncRectPyramidParms

type TruncRectPyramidParms struct {
	Size        v3.Vec  // size of truncated pyramid
	BaseAngle   float64 // base angle of pyramid (radians)
	BaseRadius  float64 // base corner radius
	RoundRadius float64 // edge rounding radius
}

TruncRectPyramidParms defines the parameters for a truncated rectangular pyramid.

type WasherParms

type WasherParms struct {
	Thickness   float64 // thickness (3d only)
	InnerRadius float64 // inner radius
	OuterRadius float64 // outer radius
	Remove      float64 // fraction of complete washer removed
}

WasherParms defines the parameters for a washer.

Jump to

Keyboard shortcuts

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