Commit 6c1e4b97 authored by Neil Gershenfeld's avatar Neil Gershenfeld
Browse files

C eval neg z broken

parent 2bf330ad
Pipeline #12192 passed with stage
in 1 second
......@@ -53,12 +53,16 @@ xmin = frep['xmin']
xmax = frep['xmax']
ymin = frep['ymin']
ymax = frep['ymax']
zmin = min(frep['layers'])
zmax = max(frep['layers'])
units = float(frep['mm_per_unit'])
delta = (25.4/dpi)/units
fn = frep['function']
fn = fn.replace('math.','')
for z in frep['layers']:
print(z)
layers = str(frep['layers'][0])
nlayers = len(frep['layers'])
for i in range(1,nlayers):
layers += ','+str(frep['layers'][i])
#
# write program
#
......@@ -70,6 +74,7 @@ f"""
#include <png.h>
using namespace std;
int fn(float X,float Y,float Z) {{
cout << Z << ' ' << ({fn}) << endl;
return ({fn});
}}
int main(int argc, char** argv) {{
......@@ -77,17 +82,30 @@ int main(int argc, char** argv) {{
float xmax = {xmax};
float ymin = {ymin};
float ymax = {ymax};
float zmin = {zmin};
float zmax = {zmax};
float units = {units};
int dpi = {dpi};
float delta = (25.4/dpi)/units;
int nx = (xmax-xmin)/delta;
int ny = (ymax-ymin)/delta;
int *m = (int*) malloc(nx*ny*sizeof(int));
for (int ix = 0; ix < nx; ++ix) {{
float x = xmin+ix*delta;
int *m = (int*) calloc(nx*ny,sizeof(int));
float layers[] = {{{layers}}};
int intensity;
for (int layer = 0; layer < {nlayers}; ++layer) {{
float z = layers[layer];
cout << " z =" << z << endl;
if (zmin == zmax)
intensity = 0xFFFFFF;
else
intensity = ((int) (255*(z-zmin)/(zmax-zmin))) | (255 << 8) | (255 << 16);
for (int iy = 0; iy < ny; ++iy) {{
float y = ymin+iy*delta;
m[iy*nx+ix] = fn(x,y,0);
for (int ix = 0; ix < nx; ++ix) {{
float x = xmin+ix*delta;
m[iy*nx+ix] += intensity & fn(x,y,z);
//cout << fn(x,y,z) << endl;
}}
}}
}}
FILE *file;
......
......@@ -22,10 +22,10 @@
#output = "top, labels, and exterior"
#output = "top, labels, holes, and exterior"
#output = "top, bottom, labels, and exterior"
output = "top, bottom, labels, holes, and exterior"
#output = "top traces"
#output = "top, bottom, labels, holes, and exterior"
output = "top traces"
#output = "top traces and exterior"
#output = "bottom traces reversed"
output = "bottom traces reversed"
#output = "bottom traces reversed and exterior"
#output = "holes"
#output = "interior"
......@@ -7958,6 +7958,16 @@ mask = .004 # solder mask size
pcb = PCB(x,y,width,height,mask)
pcb = wire(pcb,w,
point(x,y,zt),
point(x+width,y,zt))
pcb = wire(pcb,w,
point(x,y,zb),
point(x,y+height,zb))
'''
IC1 = ATtiny44_SOICN('IC1\nt44')
pcb = IC1.add(pcb,x+.49,y+.56)
......@@ -8109,6 +8119,8 @@ pcb = wire(pcb,w,
point(V7.x,V6.y,zb),
V7.pad[2])
'''
############################################################
# select output
############################################################
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment