Documentation
¶
Index ¶
- func AddTabs(s sdf.SDF3, tab Tab, upper bool, mset []sdf.M44) sdf.SDF3
- func Angle2D(k *AngleParms) (sdf.SDF2, error)
- func Angle3D(k *AngleParms) (sdf.SDF3, error)
- func Arrow3D(k *ArrowParms) (sdf.SDF3, error)
- func Axes3D(p0, p1 v3.Vec) (sdf.SDF3, error)
- func Bolt(k *BoltParms) (sdf.SDF3, error)
- func BoltCircle2D(holeRadius float64, circleRadius float64, numHoles int) (sdf.SDF2, error)
- func BoltCircle3D(holeDepth float64, holeRadius float64, circleRadius float64, numHoles int) (sdf.SDF3, error)
- func ChamferedCylinder(s sdf.SDF3, kb, kt float64) (sdf.SDF3, error)
- func ChamferedHole3D(l float64, r float64, chRadius float64) (sdf.SDF3, error)
- func CircleGrille2D(k *CircleGrilleParms) (sdf.SDF2, error)
- func CircleGrille3D(k *CircleGrilleParms) (sdf.SDF3, error)
- func CounterBoredHole3D(l float64, r float64, cbRadius float64, cbDepth float64) (sdf.SDF3, error)
- func CounterSunkHole3D(l float64, r float64) (sdf.SDF3, error)
- func DirectedArrow3D(k *ArrowParms, head, tail v3.Vec) (sdf.SDF3, error)
- func Display(k *DisplayParms, negative bool) (sdf.SDF3, error)
- func DrainCover(k *DrainCoverParms) (sdf.SDF3, error)
- func DroneMotorArm(k *DroneArmParms) (sdf.SDF3, error)
- func DroneMotorArmSocket(k *DroneArmSocketParms) (sdf.SDF3, error)
- func EuroRackPanel2D(k *EuroRackParms) (sdf.SDF2, error)
- func EuroRackPanel3D(k *EuroRackParms) (sdf.SDF3, error)
- func FingerButton2D(k *FingerButtonParms) (sdf.SDF2, error)
- func Geneva2D(k *GenevaParms) (sdf.SDF2, sdf.SDF2, error)
- func GfBase(k *GfBaseParms) sdf.SDF3
- func GfBody(k *GfBodyParms) sdf.SDF3
- func Hex2D(radius, round float64) (sdf.SDF2, error)
- func Hex3D(radius, height, round float64) (sdf.SDF3, error)
- func HexHead3D(radius float64, height float64, round string) (sdf.SDF3, error)
- func ImportSTL(path string, numNeighbors, minChildren, maxChildren int) (sdf.SDF3, error)
- func ImportTriMesh(mesh []*sdf.Triangle3, numNeighbors, minChildren, maxChildren int) sdf.SDF3
- func InvoluteGear(k *InvoluteGearParms) (sdf.SDF2, error)
- func IsocelesTrapezoid2D(base0, base1, height float64) (sdf.SDF2, error)
- func IsocelesTriangle2D(base, height float64) (sdf.SDF2, error)
- func KeyedHole2D(k *KeyedHoleParms) (sdf.SDF2, error)
- func KeyedHole3D(k *KeyedHoleParms) (sdf.SDF3, error)
- func Keyway2D(k *KeywayParameters) (sdf.SDF2, error)
- func Keyway3D(k *KeywayParameters) (sdf.SDF3, error)
- func Knurl3D(k *KnurlParms) (sdf.SDF3, error)
- func KnurledHead3D(r float64, h float64, pitch float64) (sdf.SDF3, error)
- func Nut(k *NutParms) (sdf.SDF3, error)
- func Panel2D(k *PanelParms) (sdf.SDF2, error)
- func Panel3D(k *PanelParms) (sdf.SDF3, error)
- func PanelBox3D(k *PanelBoxParms) ([]sdf.SDF3, error)
- func PanelHole3D(k *PanelHoleParms) (sdf.SDF3, error)
- func Pipe3D(oRadius, iRadius, length float64) (sdf.SDF3, error)
- func PipeConnector3D(k *PipeConnectorParms) (sdf.SDF3, error)
- func Servo2D(k *ServoParms, holeRadius float64) (sdf.SDF2, error)
- func Servo3D(k *ServoParms) (sdf.SDF3, error)
- func ServoHorn(k *ServoHornParms) (sdf.SDF2, error)
- func Standoff3D(k *StandoffParms) (sdf.SDF3, error)
- func StdPipe3D(name, units string, length float64) (sdf.SDF3, error)
- func StdPipeConnector3D(name, units string, length float64, cfg [6]bool) (sdf.SDF3, error)
- func TruncRectPyramid3D(k *TruncRectPyramidParms) (sdf.SDF3, error)
- func Washer2D(k *WasherParms) (sdf.SDF2, error)
- func Washer3D(k *WasherParms) (sdf.SDF3, error)
- type AngleLeg
- type AngleParms
- type AngleTab
- type ArrowParms
- type BoltParms
- type CircleGrilleParms
- type DisplayParms
- type DrainCoverParms
- type DroneArmParms
- type DroneArmSocketParms
- type EuroRackParms
- type FingerButtonParms
- type GenevaParms
- type GfBaseParms
- type GfBodyParms
- type InvoluteGearParms
- type KeyedHoleParms
- type KeywayParameters
- type KnurlParms
- type NutParms
- type PanelBoxParms
- type PanelHoleParms
- type PanelParms
- type PipeConnectorParms
- type PipeParameters
- type ScrewTab
- type ServoHornParms
- type ServoParms
- type SpringParms
- type StandoffParms
- type StraightTab
- type Tab
- type ThreadedCylinderParms
- type TruncRectPyramidParms
- type WasherParms
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoltCircle2D ¶
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 ¶
ChamferedCylinder intersects a chamfered cylinder with an SDF3.
func ChamferedHole3D ¶
ChamferedHole3D returns the SDF3 for a chamfered hole (45 degrees).
func CircleGrille2D ¶
func CircleGrille2D(k *CircleGrilleParms) (sdf.SDF2, error)
CircleGrille2D returns the SDF2 for a circular grille.
func CircleGrille3D ¶
func CircleGrille3D(k *CircleGrilleParms) (sdf.SDF3, error)
CircleGrille3D returns the SDF3 for a circular grille.
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 ¶
CounterSunkHole3D returns the SDF3 for a countersunk hole (45 degrees).
func DirectedArrow3D ¶
DirectedArrow3D returns an arrow between points head/tail.
func DrainCover ¶
func DrainCover(k *DrainCoverParms) (sdf.SDF3, error)
DrainCover returns a grated drain pipe cover.
func DroneMotorArm ¶
func DroneMotorArm(k *DroneArmParms) (sdf.SDF3, error)
DroneMotorArm returns a drone motor arm.
func DroneMotorArmSocket ¶
func DroneMotorArmSocket(k *DroneArmSocketParms) (sdf.SDF3, error)
DroneMotorArmSocket returns a socket for a drone motor arm.
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 ImportTriMesh ¶
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 IsocelesTrapezoid2D ¶
IsocelesTrapezoid2D
func IsocelesTriangle2D ¶
IsocelesTriangle2D
func KeyedHole2D ¶
func KeyedHole2D(k *KeyedHoleParms) (sdf.SDF2, error)
KeyedHole2D retuns a 2D object for a round hole with a flat section.
func KeyedHole3D ¶
func KeyedHole3D(k *KeyedHoleParms) (sdf.SDF3, error)
KeyedHole3D retuns a 3D object for a round hole with a flat section.
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 KnurledHead3D ¶
KnurledHead3D returns a generic cylindrical knurled head.
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 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 StdPipeConnector3D ¶
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.
Types ¶
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 AngleTab ¶
type AngleTab struct {
// contains filtered or unexported fields
}
AngleTab contains the angle tab parameters.
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 CircleGrilleParms ¶
type CircleGrilleParms struct {
HoleDiameter float64 // diameter of the grille holes
GrilleDiameter float64 // diameter of grille
RadialSpacing float64 // radial spacing of holes
TangentialSpacing float64 // tangential spacing of holes
Thickness float64 // hole thickness (3d only)
}
CircleGrilleParms defines the parameters for a circular grille pattern.
type DisplayParms ¶
type DisplayParms struct {
Window v2.Vec // display window
Rounding float64 // window corner rounding
Supports v2.Vec // support positions
SupportHeight float64 // support height
SupportDiameter float64 // support diameter
HoleDiameter float64 // suport hole diameter
Offset v2.Vec // offset between window and supports
Thickness float64 // panel thickness
Countersunk bool // counter sink screws on panel face
}
DisplayParms defines the parameters for a display mount.
type DrainCoverParms ¶
type DrainCoverParms struct {
WallDiameter float64 // outer diameter of wall
WallHeight float64 // height of wall
WallThickness float64 // thickness of wall
WallDraft float64 // draft angle of walls
OuterWidth float64 // extra width beyond the wall
InnerWidth float64 // width between inner wall and grate field
CoverThickness float64 // thickness of the drain cover
GrateNumber int // number of grate slots
GrateWidth float64 // multiple of inter-slot gap
GrateDraft float64 // draft angle of grate slots (radians)
CrossBarWidth float64 // multiple of InnerWidth
CrossBarWeb bool // add a reinforcing crossbar web
}
DrainCoverParms defines a grated drain pipe cover.
type DroneArmParms ¶
type DroneArmParms struct {
MotorSize v2.Vec // motor diameter/height
MotorMount v3.Vec // motor mount l0, l1, diameter
RotorCavity v2.Vec // cavity for bottom of rotor
WallThickness float64 // wall thickness
SideClearance float64 // wall to motor clearance
MountHeight float64 // height of motor mount wrt motor height
ArmHeight float64 // height of arm wrt motor mount height
ArmLength float64 // length of rotor arm
}
DroneArmParms are drone arm parameters.
type DroneArmSocketParms ¶
type DroneArmSocketParms struct {
Arm *DroneArmParms // drone arm parameters
Size v3.Vec // body size for socket
Clearance float64 // clearance between arm and socket
Stop float64 // depth of arm stop
}
DroneArmSocketParms defines a socket for a drone motor arm.
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 GfBaseParms ¶
type GfBaseParms struct {
Size v2i.Vec // size of base in gridfinity units
Magnet bool // add magnet mounts
Hole bool // add mounting holes
}
GfBaseParms are the gridfinity base parameters.
type GfBodyParms ¶
type GfBodyParms struct {
Size v3i.Vec // size of body in gridfinity units
Empty bool // return an empty container
Hole bool // add through holes to the body
}
GfBodyParms are the gridfinity body 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 KeyedHoleParms ¶
type KeyedHoleParms struct {
Diameter float64 // diameter of hole
KeySize float64 // key size / hole diameter, [0..1]
NumKeys int // number of key flats (1 or 2)
Thickness float64 // hole thickness (3d only)
}
KeyedHoleParms defines the parameters for a keyed hole.
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)
Ridge v2.Vec // add side ridges for reinforcing (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 ScrewTab ¶
type ScrewTab struct {
Length float64 // length of pillar
Radius float64 // radius of pillar
Round bool // round the bottom of the pillar
HoleUpper float64 // length of upper hole
HoleLower float64 // length of lower hole
HoleRadius float64 // radius of hole
}
ScrewTab contains the screw tab parameters.
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 SpringParms ¶
type SpringParms struct {
Width float64 // width of spring
Height float64 // height of spring (3d only)
WallThickness float64 // thickness of wall
Diameter float64 // diameter of spring turn
NumSections int // number of spring sections
Boss [2]float64 // boss sizes
}
SpringParms defines a 3d printable spring.
func (*SpringParms) Spring2D ¶
func (k *SpringParms) Spring2D() (sdf.SDF2, error)
Spring2D returns a 2d spring.
func (*SpringParms) Spring3D ¶
func (k *SpringParms) Spring3D() (sdf.SDF3, error)
Spring3D returns a 3d spring.
func (*SpringParms) SpringLength ¶
func (k *SpringParms) SpringLength() float64
springLength returns the total spring length.
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 StraightTab ¶
type StraightTab struct {
// contains filtered or unexported fields
}
StraightTab contains the straight tab parameters.
type Tab ¶
type Tab interface {
Body(upper bool, m sdf.M44) sdf.SDF3 // + to connected body
Envelope(upper bool, m sdf.M44) sdf.SDF3 // - from connected body
}
Tab is the interface to a tab object.
func NewAngleTab ¶
NewAngleTab returns a new angle tab object.
func NewScrewTab ¶
NewScrewTab returns a new screw tab object.
type ThreadedCylinderParms ¶
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.