Skip to content

Instantly share code, notes, and snippets.

@eddieliberato
eddieliberato / pb.py
Created July 23, 2017 17:51
Pillow block designed with cadquery
import cadquery as cq
from Helpers import show
# pillow block
height = 42 #cube parameters
width = 42
length = 35
cyl_dia = 32 #cylinder parameters
cyl_lenght = 17
between_holes = 31 #holes parameters
@eddieliberato
eddieliberato / antikink.py
Created June 5, 2017 13:47
Cadquery script for an antikink device mold
import cadquery as cq
from Helpers import show
# parameters
sr_OD = 12
sr_lenght = 13
nSides = 6
fillet_size = 2
cutcone_BD = 12
cutcone_SD = 2
@eddieliberato
eddieliberato / pxs.py
Created October 29, 2016 18:31
car, moto and bike power plot using python
#Program to plot graph of car, moto and bike power
#Written by Eddie Liberato in 25/10/16
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.font_manager as font_manager
import matplotlib.patches as mpatches
font_path = '/usr/share/fonts/truetype/strasua/strasua.ttf'
font_prop = font_manager.FontProperties(fname=font_path, size=14)
@eddieliberato
eddieliberato / hexbeam.inp
Created October 29, 2016 17:52
Calculix cantilever beam calculix input deck
*include,input=hexb.inp
** material description
*MATERIAL, NAME=steel
*ELASTIC
210000.,0.3
*density
7.850e-09
*BOUNDARY
@eddieliberato
eddieliberato / beam.py
Last active July 13, 2018 10:28
Cantilever Beam Computing and plotting in python
#Program to compute and graph a cantilever beam
#subject to Uniformly Distributed Load
#Written by Eddie Liberato in 25/10/16
import numpy as np
import matplotlib.pyplot as plt
#Beam parameters
l=200 #mm, lenght
h=100 #mm, height
b=10 #mm, width
@eddieliberato
eddieliberato / canc.inp
Created June 20, 2016 14:26
Input deck for an internal pressure aluminum can simulation in calculix
*INCLUDE, INPUT=can.inp
*MATERIAL, NAME=Al
*ELASTIC
69.0E+09,0.3
*SHELL SECTION, MATERIAL=Al, ELSET=bottom
0.22
*SHELL SECTION, MATERIAL=Al, ELSET=body
0.1
@eddieliberato
eddieliberato / powerxspeed.py
Created June 17, 2016 19:44
A matplotlib graph comparing car, moto and bike mechanical energy involved in the moviment, power vs speed.
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.font_manager as font_manager
import matplotlib.patches as mpatches
font_path = '/usr/share/fonts/truetype/strasua/strasua.ttf'
font_prop = font_manager.FontProperties(fname=font_path, size=14)
plt.figure(figsize=(10, 5), dpi=1200)
@eddieliberato
eddieliberato / CF.hp
Created June 10, 2016 23:21
compressibility factor for air to be used in the HP50g calculator in algebraic mode
<< HEAD(INFORM("compressibility factor for air",{{"T:","Kelvin",0},{"P:","bar",0}},{1,0},{},{})) \-> L
<< L(1) -> T
<< L(2) -> P
<< 1|>Z ; P/37.71|>Pr ; T/132.65|>Tr ; .00001|>Ge ;
DO .08664*Pr/(Z*Tr)|>k ; 1/(1-k)-4.9339796/Tr^1.5*(k/(1+k))|>Zrk ; Z-Zrk|>E ; Zrk|>Z ;
UNTIL Ge>E
END ; PURGE({'E','Ge','Zrk','k','Tr','Pr'}) ; Z
>>
>>
>>
@eddieliberato
eddieliberato / LiveGraph.py
Created June 10, 2016 18:55
Live Data Plot with Arduino and Python
import serial
import matplotlib.pyplot as plt
from time import sleep
from drawnow import *
arduino = serial.Serial('/dev/ttyUSB0')
with arduino:
arduino.setDTR(False)
sleep(1)
arduino.flushInput()
@eddieliberato
eddieliberato / Scriber.py
Created June 8, 2016 13:37
CadQuery Scriber
import cadquery as cq
from Helpers import show
l1 = 20
d1 = 7
l2 = 90
d2 = 10
l3 = 25.4
d3 = 8
hole_diameter = 3