Index: trunk/src_plugins/trimesh/trimesh.c =================================================================== --- trunk/src_plugins/trimesh/trimesh.c (revision 38290) +++ trunk/src_plugins/trimesh/trimesh.c (revision 38291) @@ -33,14 +33,80 @@ #include #include +#include "board.h" +#include "data.h" +#include "flag.h" +#include "obj_line.h" + #include static const char *trimesh_cookie = "trimesh"; +typedef enum { + PT_EDGE, + PT_MAIN, + PT_AUX, + PT_max +} point_t; + +typedef struct { + pcb_board_t *pcb; + rnd_rtree_t pts[PT_max]; +} trimesh_t; + + +static void trimesh_init(trimesh_t *ctx, pcb_board_t *pcb) +{ + int n; + + ctx->pcb = pcb; + for(n = 0; n < PT_max; n++) + rnd_rtree_init(&ctx->pts[n]); +} + +static void trimesh_uninit(trimesh_t *ctx) +{ + int n; + + for(n = 0; n < PT_max; n++) + rnd_rtree_uninit(&ctx->pts[n]); + +} + +static void trimesh_selected_lines(trimesh_t *ctx) +{ + PCB_LINE_ALL_LOOP(ctx->pcb->Data); { + if (!PCB_FLAG_TEST(PCB_FLAG_SELECTED, line)) + continue; + + } PCB_ENDALL_LOOP; +} + +static const char pcb_acts_TriMesh[] = "TriMesh()\n"; +static const char pcb_acth_TriMesh[] = "replicate the outer contour of the selected polygon(s) with growing or shrinking them by offset; the new polygon is drawn on the current layer"; +static fgw_error_t pcb_act_TriMesh(fgw_arg_t *res, int argc, fgw_arg_t *argv) +{ + trimesh_t ctx = {0}; + + trimesh_init(&ctx, PCB_ACT_BOARD); + trimesh_selected_lines(&ctx); + trimesh_uninit(&ctx); + + RND_ACT_IRES(0); + return 0; +} + + +static rnd_action_t trimesh_action_list[] = { + {"TriMesh", pcb_act_TriMesh, pcb_acth_TriMesh, pcb_acts_TriMesh} +}; + + int pplg_check_ver_trimesh(int ver_needed) { return 0; } void pplg_uninit_trimesh(void) { + rnd_remove_actions_by_cookie(trimesh_cookie); } int pplg_init_trimesh(void) @@ -47,5 +113,7 @@ { RND_API_CHK_VER; + RND_REGISTER_ACTIONS(trimesh_action_list, trimesh_cookie); + return 0; }