Skip to content

Instantly share code, notes, and snippets.

View BarbourSmith's full-sized avatar
🏠
Working from home 🌏

BarbourSmith

🏠
Working from home 🌏
View GitHub Profile
@BarbourSmith
BarbourSmith / script.jsxcad
Created March 20, 2020 14:50
GT2 Pulley #jsxcad
//The tooth profile of a 2GT belt
//A support function to generate arcs
function arc(x, xOffset, yOffset, radius, sign){
if(sign){
return yOffset + Math.sqrt(Math.pow(radius, 2) - Math.pow(x - xOffset, 2));
}
else{
return yOffset - Math.sqrt(Math.pow(radius, 2) - Math.pow(x - xOffset, 2));
}
@BarbourSmith
BarbourSmith / script.jsxcad
Created March 20, 2020 14:50
Test2 #jsxcad
const numberOfTeeth = 30;
const toothLength = 20;
const circumference = numberOfTeeth*toothLength;
const radius = circumference/(2*3.14159);
const rampHeight = 9;
const resolution = 1;
var radialExtension = 0;
var upDownFlag = 1;
var stepsPerTooth = 0;
@BarbourSmith
BarbourSmith / script.jsxcad
Created March 20, 2020 14:49
Test 4 #jsxcad
//A basic saw tooth profile with length 2
function sawTooth(i){
//Ramp up
if(i>.75 && i<1.25){
return 1;
}
//Ramp Down
else{
return 0;
@BarbourSmith
BarbourSmith / script.jsx
Created March 20, 2020 14:46
Bend and Unbend #jsxcad
//Create a bend and a tab which have connectors
function bend(attachedGeometry, settings){
//Give this bend a unique ID...This should really be something more rigerous than random
const bendID = Math.floor((Math.random() * 1000)).toString().padStart(4, "0");
settings.bendID = bendID;
const bendArc = assemble(
Square(settings.length,settings.thickness)
.moveY(settings.interiorRadius + settings.thickness/2)
@BarbourSmith
BarbourSmith / flatten.pdf
Created March 19, 2020 00:24
Test #jsxcad
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@BarbourSmith
BarbourSmith / flatten.pdf
Created March 12, 2020 15:13
Test #jsxcad
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@BarbourSmith
BarbourSmith / flatten.pdf
Created March 2, 2020 23:30
Test #jsxcad
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@BarbourSmith
BarbourSmith / flatten.pdf
Created February 26, 2020 15:00
Test #jsxcad
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@BarbourSmith
BarbourSmith / flatten.pdf
Created February 9, 2020 05:34
Test #jsxcad
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@BarbourSmith
BarbourSmith / flatten.pdf
Created February 9, 2020 05:34
Test #jsxcad
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.