Skip to content

Commit

Permalink
clamp: improve and setup build queue
Browse files Browse the repository at this point in the history
  • Loading branch information
erichstuder committed Nov 20, 2022
1 parent 80db506 commit 1395cab
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 12 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/mechanics_clamp_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: mechanics_clamp_build

on:
workflow_dispatch:
workflow_call:
push:
# only trigger on branches, not on tags
branches: '**'


jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: install openscad
run: sudo apt-get install -y openscad

- name: set environment variable
run: echo MY_VERSION_ID=$(echo $GITHUB_REF_NAME | grep -oE "v[0-9]+\.[0-9]+\.[0-9]+") >> $GITHUB_ENV

- name: checkout
uses: actions/checkout@v3

- name: build
run: |
cd ./mechanics/clamp
echo version: $MY_VERSION_ID
openscad --hardwarnings -D "ver=\"$MY_VERSION_ID\"" -o clamp.stl clamp.scad
openscad --hardwarnings -o distance.stl distance.scad
- name: upload results
uses: actions/upload-artifact@v3
with:
name: clamp
path: |
./mechanics/clamp/clamp.stl
./mechanics/clamp/distance.stl
./mechanics/clamp/3d_print_instructions
45 changes: 45 additions & 0 deletions .github/workflows/mechanics_clamp_createRelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: mechanics_clamp_createRelease

on:
workflow_dispatch:
push:
tags: 'mechanics_clamp_v*.*.*'


jobs:
build:
uses: ./.github/workflows/mechanics_clamp_build.yml

create_release:
runs-on: ubuntu-22.04
needs: build
steps:
- name: create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }} # tag_name is the same tag name the triggered this workflow
release_name: ${{ github.ref_name }}
draft: false
prerelease: false

- name: download build data
uses: actions/download-artifact@v3
with:
name: clamp
path: ./clamp_data

- name: zip fabrication data
run: zip -jr clamp ./clamp_data

- name: upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # references to the step with id 'create_release'
asset_path: ./clamp.zip
asset_name: ${{ github.event.repository.name }}__${{ github.ref_name }}__clamp.zip
asset_content_type: application/zip
4 changes: 4 additions & 0 deletions mechanics/clamp/3d_print_instructions
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
suggestions:
- PETG for outdoor use
- variable layer height for high quality
- infill 100% for better stability
58 changes: 46 additions & 12 deletions mechanics/clamp/clamp.scad
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
$fn = 180;

back();
plate_height = 3;
ver = "vX.X.X";



back();
translate([50, 0, 0]){
front();
}




module front(){
difference(){
intersection(){
base();
cut();
}
xAbs = 10;
xAbs = 9;
for(x = [-xAbs, xAbs]){
translate([x, 0, -25])
translate([x, 0, 38.5])
rotate([90, 0, 0]){
#cylinder(d=3.9, h=15);
translate([0, 0, 5])
Expand All @@ -29,30 +35,58 @@ module back(){
difference(){
base();
cut();
xAbs = 10;
xAbs = 9;
for(x = [-xAbs, xAbs]){
translate([x, 0, -25])
translate([x, 0, 38.5])
rotate([-90, 0, 0])
#cylinder(d=2.5, h=15);
#cylinder(d=2.6, h=15);
}
}
}


module cut(){
translate([0, -7.5, -25])
translate([0, -7.5, 38.5])
cube([50, 15, 10], center=true);
}


module base(){
difference(){
union(){
cube([50, 50, 5], center=true);
translate([0, 0, -15])
cylinder(d=30, h=30, center=true);
cube([100, 100, plate_height], center=true);
cylinder(d=29.9, h=42+plate_height/2);
}
translate([0, 0, 15])
cube([12, 4, 60], center=true);

for(angle = [0:90:270]){
rotate([0, 0, angle])
translate([50, 0])
cylinder(d=50, h=plate_height+1, center=true);
}
translate([0, 0, -15])
cube([12, 4, 40], center=true);

xyAbs = 40;
for(x=[-xyAbs, xyAbs], y=[-xyAbs, xyAbs]){
translate([x, y]){
cylinder(d=2.6, h=plate_height+1, center=true);
translate([0, 0, -plate_height/2+1])
cylinder(d1=4.9, d2=2.6, h=2, center=true);
}
}

version_ids();
}
}


module version_ids(){
translate([0, 20, -plate_height/2])
rotate([180])
linear_extrude(1, center=true)
text(ver, size=10, halign="center");

translate([0, -8, 42+plate_height/2])
linear_extrude(1, center=true)
text(ver, size=4, halign="center");
}

0 comments on commit 1395cab

Please sign in to comment.