Git Product home page Git Product logo

bh-lib's Introduction

BH Lib

An OpenSCAD library of useful functions, modules and components.

OpenSCAD library

Notes

  • All shapes and solids default to center = true, though component mocks are positioned to suit their typical use case (e.g. screws are aligned with head in positive and shank in negative y axis).

Constants

  • Millimeters per inch
  • Pi
  • Metric nuts/screw dimensions
  • Component dimensions

Helper functions/modules

  • circumference(r) - circumference of a circle
  • clamp(value, v1, v2) - clamps a value between two other values
  • contains(needle, haystack) - checks if vector contains given value
  • error(msg) - logs a vector of error message values to the console
  • for_unity3d(scale = 0.001) - scales and orients models for use in Unity3D
  • get_fragments_from_r(r, fa = $fa, fn = $fn, fs = $fs) - derives $fn from radius, as per docs
  • helix_angle(r, pitch) - determines angle of a helix at given pitch and radius
  • index_of(needle, haystack) - finds index of given value
  • join(values, sep = ", ") - creates a string from vector elements
  • linear_extrude_chamfer(h, chamfer, round = false, center = false, convexity = 1, $fn = $fn) - applies a linear_extrude and minkowski to a shape resulting in chamfered edge
  • linear_rotate_extrude(h = 1, a = 360, center = true, convexity = 1, $fn = 0) - mimics rotate_extrude while applying a linear transform. It's a hack! - hulls two thin linear_extrudes, since we can't hull 2D shapes in 3D
  • lookup_vector(i, table) - same as lookup but also works on vector values
  • offset_point(p, delta = 0) - INVESTIGATE delta * 2 - should be *1?
  • oscillate(min = -1, max = 1, t = $t) - sweeps a value between given minimum and maximum, for animation
  • poly_coords(n, r = 1, mid = true) - creates vector of points with faces at radius (rather than points)
  • print_registration_bounds(bounds = [180, 180], h = 0.2, t = 0.5) - used to ensure position when slicing separate models on one plate (e.g. two material prints)
  • print(msg) - logs a vector of message values to the console
  • reflect(x = true, y = true, z = false) - mirrors children across axes
  • rotate_point_x(p, a) - rotates given point around x axis
  • rotate_point_y(p, a) - rotates given point around y axis
  • rotate_point_z(p, a) - rotates given point around z axis
  • rotate_point(p, a) - rotates given point around all axes
  • rotate_points(p, a) - rotates given points around all axes
  • show_half(r = [0, 0, 0], t = [0, 0, 0], d = 1000, 2d = false) - cuts children in half for internals investigation or simple bisections
  • sum(v) - sums numeric values of a vector
  • translate_point(p, a) - translates given point
  • translate_points(p, a) - translates given points
  • transpose(pos = []) - positions children reflected without mirroring across all axes
  • warn(msg) - logs a vector of warning message values to the console

2D

  • arc(a, r1, r2, $fn = $fn) - like a rainbow
  • bezier(points, width = 0.5, connect = true, n = -1) - draws a bezier curve from given three (cubic) or four (quadratic) points, of either given width or by hulling children, if any
  • circle_true(r, center = true, $fa = $fa, $fn = $fn, $fs = $fs) - circle with edges at radius (rather than points)
  • grid(coords = [100, 100], x = 10, y = 10, walls = 1, edges = false, center = false) - draws a grid of lines
  • l(dim = [10, 10], t = 1, t1, t2) - "L" shape, for beams
  • rounded_gear(r = 10, n = 3, inset = true, s = [1, 1], $fn = $fn) - a simple lobed gear (for knob handles)
  • rounded_square(dim, r, center = true) - square with corners of given radius
  • segment(a, r, $fn = $fn) - a portion of given angle of a circle
  • semicircle(r = 1, $fa = $fa, $fn = $fn, $fs = $fs) - half a circle
  • semicircle_true(r = 1, $fa = $fa, $fn = $fn, $fs = $fs) - half a circle, with edges at radius (instead of points)
  • smooth(r) - applies two consective offsets to achieve a simple smoothing effect
  • smooth_acute(r = 0, dim = [1000, 1000]) - smoothing, but also applies to acute angles
  • sq(dim, center = true) - convenience wrapper for centred square; handles dimension array lengths > 2
  • star(r, n = 5, inset = 0.5) - makes star shapes with given side inset
  • t(dim = [10, 10], t = 1, t1, t2) - "T" shape, for beams
  • u(dim = [10, 10], t = 1, t1, t2) - "U" shape, for beams

3D

  • capsule(h = 10, r, r1, r2, center = false) - a cylinder with semi-spherical ends
  • cylinder_true(h, r = 0, r1 = 0, r2 = 0, center = true, $fa = $fa, $fn = $fn, $fs = $fs) - cylinder with faces at radius (instead of edges)
  • pie(a = 90, r = 1, h = 1, center = true) - an extruded segment
  • rounded_cube(dim, r, edges = false, center = true, $fa = $fa, $fn = $fn, $fs = $fs) - a cube with edges of given radius
  • rounded_cylinder(h, r, f, f1, f2, r1, r2, center = true, $fa = $fa, $fn = $fn, $fs = $fs) - a cylinder with top and bottom edges of given radii
  • sphere_true(r, $fa = $fa, $fn = $fn, $fs = $fs) - sphere with faces at radius (instead of edges)
  • torus(r1, r2, fa = $fa, fn = $fn, fs = $fs) - a donut
  • torus_true(r1, r2, $fa = $fa, $fn = $fn, $fs = $fs) - a donut with extruded circle having edges at radius (instead of points)

Hardware

Electrical

  • Buzzer
  • Chip
  • Connectors
  • Displays
  • Jacks
  • LEDs
  • Pin headers
  • Potentiometers
  • Stepper motors
  • Switches (DIP, slide, tact)
  • Voltage regulators
  • Wire

Engineering

  • Beams (L/T/U)
  • Bearings
  • Gears
  • Nuts
  • Screws
  • Threads
  • Truss
  • Washers

Mechanical

  • Centrifugal fan (blower)
  • Duct/pipe flange

RC

  • 5.8GHz antenna
  • Batteries
  • Cameras
  • DVRs
  • ESCs
  • Flight controllers
  • GPS
  • Motors
  • Propellers
  • Receivers
  • Servos
  • Video receivers
  • Video transmitters

bh-lib's People

Contributors

brandonhill avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.