Index: trunk/src_plugins/export_stl/model_load_amf.c =================================================================== --- trunk/src_plugins/export_stl/model_load_amf.c (revision 35974) +++ trunk/src_plugins/export_stl/model_load_amf.c (revision 35975) @@ -27,13 +27,22 @@ #include #ifdef PCB_HAVE_LIBXML2 -stl_facet_t *amf_solid_fload(rnd_hidlib_t *hl, FILE *f) +#include +#include + +stl_facet_t *amf_solid_fload(rnd_hidlib_t *hl, FILE *f, const char *fn) { return NULL; } + + + #else -stl_facet_t *amf_solid_fload(rnd_hidlib_t *hl, FILE *f) + +/* Fallback: still provide a dummy if libxml is not available */ +stl_facet_t *amf_solid_fload(rnd_hidlib_t *hl, FILE *f, const char *fn) { return &stl_format_not_supported; } + #endif Index: trunk/src_plugins/export_stl/model_load_stl.c =================================================================== --- trunk/src_plugins/export_stl/model_load_stl.c (revision 35974) +++ trunk/src_plugins/export_stl/model_load_stl.c (revision 35975) @@ -24,7 +24,7 @@ * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") */ -stl_facet_t *stl_solid_fload(rnd_hidlib_t *hl, FILE *f) +stl_facet_t *stl_solid_fload(rnd_hidlib_t *hl, FILE *f, const char *fn) { stl_facet_t *head = NULL, *tail = NULL, *t; char *cmd, line[512]; @@ -32,7 +32,7 @@ /* find the 'solid' header */ cmd = stl_getline(line, sizeof(line), f); if ((cmd == NULL) || (strncmp(cmd, "solid", 5) != 0)) { - rnd_message(RND_MSG_ERROR, "Invalid stl file: first line is not a 'solid'\n"); + rnd_message(RND_MSG_ERROR, "Invalid stl file %s: first line is not a 'solid'\n", fn); return NULL; } @@ -41,7 +41,7 @@ cmd = stl_getline(line, sizeof(line), f); if (cmd == NULL) { - rnd_message(RND_MSG_ERROR, "Invalid stl file: premature end of file in solid\n"); + rnd_message(RND_MSG_ERROR, "Invalid stl file %s: premature end of file in solid\n", fn); goto error; } if (strncmp(cmd, "endsolid", 8) == 0) @@ -48,7 +48,7 @@ break; /* normal end of file */ if (strncmp(cmd, "facet normal", 12) != 0) { - rnd_message(RND_MSG_ERROR, "Invalid stl file: expected facet, got %s\n", cmd); + rnd_message(RND_MSG_ERROR, "Invalid stl file %s: expected facet, got %s\n", fn, cmd); goto error; } @@ -63,13 +63,13 @@ cmd += 12; if (sscanf(cmd, "%lf %lf %lf", &t->n[0], &t->n[1], &t->n[2]) != 3) { - rnd_message(RND_MSG_ERROR, "Invalid stl file: wrong facet normals '%s'\n", cmd); + rnd_message(RND_MSG_ERROR, "Invalid stl file %s: wrong facet normals '%s'\n", fn, cmd); goto error; } cmd = stl_getline(line, sizeof(line), f); if (strncmp(cmd, "outer loop", 10) != 0) { - rnd_message(RND_MSG_ERROR, "Invalid stl file: expected outer loop, got %s\n", cmd); + rnd_message(RND_MSG_ERROR, "Invalid stl file %s: expected outer loop, got %s\n", fn, cmd); goto error; } @@ -76,12 +76,12 @@ for(n = 0; n < 3; n++) { cmd = stl_getline(line, sizeof(line), f); if (strncmp(cmd, "vertex", 6) != 0) { - rnd_message(RND_MSG_ERROR, "Invalid stl file: expected vertex, got %s\n", cmd); + rnd_message(RND_MSG_ERROR, "Invalid stl file %s: expected vertex, got %s\n", fn, cmd); goto error; } cmd+=6; if (sscanf(cmd, "%lf %lf %lf", &t->vx[n], &t->vy[n], &t->vz[n]) != 3) { - rnd_message(RND_MSG_ERROR, "Invalid stl file: wrong facet vertex '%s'\n", cmd); + rnd_message(RND_MSG_ERROR, "Invalid stl file: %s wrong facet vertex '%s'\n", fn, cmd); goto error; } } @@ -88,13 +88,13 @@ cmd = stl_getline(line, sizeof(line), f); if (strncmp(cmd, "endloop", 7) != 0) { - rnd_message(RND_MSG_ERROR, "Invalid stl file: expected endloop, got %s\n", cmd); + rnd_message(RND_MSG_ERROR, "Invalid stl file %s: expected endloop, got %s\n", fn, cmd); goto error; } cmd = stl_getline(line, sizeof(line), f); if (strncmp(cmd, "endfacet", 8) != 0) { - rnd_message(RND_MSG_ERROR, "Invalid stl file: expected endfacet, got %s\n", cmd); + rnd_message(RND_MSG_ERROR, "Invalid stl file %s: expected endfacet, got %s\n", fn, cmd); goto error; } } Index: trunk/src_plugins/export_stl/stl_models.c =================================================================== --- trunk/src_plugins/export_stl/stl_models.c (revision 35974) +++ trunk/src_plugins/export_stl/stl_models.c (revision 35975) @@ -169,7 +169,7 @@ char *full_path; FILE *f = rnd_fopen_first(&PCB->hidlib, &conf_core.rc.library_search_paths, name, "r", &full_path, rnd_true); if (f != NULL) { - head = stl_solid_fload(hl, f); + head = stl_solid_fload(hl, f, full_path); if (head == NULL) rnd_message(RND_MSG_ERROR, "STL model failed to load: %s\n", full_path); else if (head == &stl_format_not_supported)