Index: trunk/src_plugins/export_stl/exp_fmt_amf.c =================================================================== --- trunk/src_plugins/export_stl/exp_fmt_amf.c (nonexistent) +++ trunk/src_plugins/export_stl/exp_fmt_amf.c (revision 35965) @@ -0,0 +1,52 @@ +/* + * COPYRIGHT + * + * pcb-rnd, interactive printed circuit board design + * Copyright (C) 2021 Tibor 'Igor2' Palinkas + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Contact: + * Project page: http://repo.hu/projects/pcb-rnd + * lead developer: http://repo.hu/projects/pcb-rnd/contact.html + * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") + */ + +static void amf_print_horiz_tri(FILE *f, fp2t_triangle_t *t, int up, rnd_coord_t z) +{ +} + +static void amf_print_vert_tri(FILE *f, rnd_coord_t x1, rnd_coord_t y1, rnd_coord_t x2, rnd_coord_t y2, rnd_coord_t z0, rnd_coord_t z1) +{ +} + +static void amf_print_facet(FILE *f, stl_facet_t *head, double mx[16], double mxn[16]) +{ + double v[3], p[3]; + int n; + + for(n = 0; n < 3; n++) { + p[0] = head->vx[n]; p[1] = head->vy[n]; p[2] = head->vz[n]; + v_transform(v, p, mx); + } +} + +static void amf_print_header(FILE *f) +{ +} + +static void amf_print_footer(FILE *f) +{ +} Index: trunk/src_plugins/export_stl/export_stl.c =================================================================== --- trunk/src_plugins/export_stl/export_stl.c (revision 35964) +++ trunk/src_plugins/export_stl/export_stl.c (revision 35965) @@ -332,9 +332,10 @@ RND_INLINE void v_transform(double dst[3], double src[3], double mx[16]); #include "exp_fmt_stl.c" +#include "exp_fmt_amf.c" #include "stl_models.c" -int stl_hid_export_to_file(FILE *f, rnd_hid_attr_val_t *options, rnd_coord_t maxy, rnd_coord_t z0, rnd_coord_t z1) +static int stl_hid_export_to_file(FILE *f, rnd_hid_attr_val_t *options, rnd_coord_t maxy, rnd_coord_t z0, rnd_coord_t z1, int fmt_amf) { pcb_dynf_t df; pcb_poly_t *brdpoly; @@ -406,12 +407,21 @@ fp2t_triangulate(&tri); - stl_print_header(f); + if (fmt_amf) + amf_print_header(f); + else + stl_print_header(f); /* write the top and bottom plane */ for(n = 0; n < tri.TriangleCount; n++) { - stl_print_horiz_tri(f, tri.Triangles[n], 0, z0); - stl_print_horiz_tri(f, tri.Triangles[n], 1, z1); + if (fmt_amf) { + amf_print_horiz_tri(f, tri.Triangles[n], 0, z0); + amf_print_horiz_tri(f, tri.Triangles[n], 1, z1); + } + else { + stl_print_horiz_tri(f, tri.Triangles[n], 0, z0); + stl_print_horiz_tri(f, tri.Triangles[n], 1, z1); + } } /* write the vertical side */ @@ -427,7 +437,10 @@ px = contours.array[pn], py = contours.array[pn+1]; cx = contours.array[n], cy = contours.array[n+1]; /* rnd_trace(" [%ld <- %ld] c:%f;%f p:%f;%f\n", n, pn, cx/1000000.0, cy/1000000.0, px/1000000.0, py/1000000.0);*/ - stl_print_vert_tri(f, cx, cy, px, py, z0, z1); + if (fmt_amf) + amf_print_vert_tri(f, cx, cy, px, py, z0, z1); + else + stl_print_vert_tri(f, cx, cy, px, py, z0, z1); } cn += 2; cn_start = cn; @@ -437,7 +450,10 @@ if (options[HA_models].lng) stl_models_print(PCB, f, maxy, z0, z1); - stl_print_footer(f); + if (fmt_amf) + amf_print_footer(f); + else + stl_print_footer(f); vtp0_uninit(&cutouts); for(n = 0; n < cutouts.used; n++) @@ -449,7 +465,7 @@ return 0; } -static void stl_do_export(rnd_hid_t *hid, rnd_hid_attr_val_t *options) +static void stl_do_export_(rnd_hid_t *hid, rnd_hid_attr_val_t *options, int fmt_amf) { const char *filename; pcb_cam_t cam; @@ -482,14 +498,24 @@ } if (options[HA_zcent].lng) - stl_hid_export_to_file(f, options, PCB->hidlib.size_y, -thick/2, +thick/2); + stl_hid_export_to_file(f, options, PCB->hidlib.size_y, -thick/2, +thick/2, fmt_amf); else - stl_hid_export_to_file(f, options, PCB->hidlib.size_y, 0, thick); + stl_hid_export_to_file(f, options, PCB->hidlib.size_y, 0, thick, fmt_amf); fclose(f); pcb_cam_end(&cam); } +static void stl_do_export(rnd_hid_t *hid, rnd_hid_attr_val_t *options) +{ + stl_do_export_(hid, options, 0); +} + +static void amf_do_export(rnd_hid_t *hid, rnd_hid_attr_val_t *options) +{ + stl_do_export_(hid, options, 1); +} + static int stl_parse_arguments(rnd_hid_t *hid, int *argc, char ***argv) { rnd_export_register_opts2(hid, stl_attribute_list, sizeof(stl_attribute_list) / sizeof(stl_attribute_list[0]), stl_cookie, 0);