Revision: 76426
          http://sourceforge.net/p/brlcad/code/76426
Author:   starseeker
Date:     2020-07-22 19:44:43 +0000 (Wed, 22 Jul 2020)
Log Message:
-----------
That should be all the mged and libtclcad commands that are hooked directly to 
ged functions.  May still be other argv0 values buried in other calls, but this 
should be virtually all of them.

Modified Paths:
--------------
    brlcad/branches/gedplugins/src/libged/CMakeLists.txt
    brlcad/branches/gedplugins/src/libged/arb/CMakeLists.txt
    brlcad/branches/gedplugins/src/libged/arb/arb.c
    brlcad/branches/gedplugins/src/libged/bot/CMakeLists.txt
    brlcad/branches/gedplugins/src/libged/bot/bot.cpp
    brlcad/branches/gedplugins/src/libged/bot/bot_dump.c
    brlcad/branches/gedplugins/src/libged/bot/ged_bot.h
    brlcad/branches/gedplugins/src/libged/color/color.c
    brlcad/branches/gedplugins/src/libged/comb_std/comb_std.c
    brlcad/branches/gedplugins/src/libged/concat/concat.cpp
    brlcad/branches/gedplugins/src/libged/dbip/dbip.c
    brlcad/branches/gedplugins/src/libged/erase/erase.c
    brlcad/branches/gedplugins/src/libged/exec_mapping.cpp
    brlcad/branches/gedplugins/src/libged/find/find.c
    brlcad/branches/gedplugins/src/libged/ged_private.h
    brlcad/branches/gedplugins/src/libged/ged_util.c
    brlcad/branches/gedplugins/src/libged/instance/instance.c
    brlcad/branches/gedplugins/src/libged/libfuncs/libfuncs.c
    brlcad/branches/gedplugins/src/libged/ls/ls.c
    brlcad/branches/gedplugins/src/libged/move_all/move_all.c
    brlcad/branches/gedplugins/src/libged/move_arb_edge/move_arb_edge.c
    brlcad/branches/gedplugins/src/libged/nirt/nirt.c
    brlcad/branches/gedplugins/src/libged/nmg/nmg.c
    brlcad/branches/gedplugins/src/libged/orient/orient.c
    brlcad/branches/gedplugins/src/libged/pathsum/pathsum.c
    brlcad/branches/gedplugins/src/libged/png/png.c
    brlcad/branches/gedplugins/src/libged/pnts/pnts.cpp
    brlcad/branches/gedplugins/src/libged/ps/ps.c
    brlcad/branches/gedplugins/src/libged/remove/remove.c
    brlcad/branches/gedplugins/src/libged/rot/CMakeLists.txt
    brlcad/branches/gedplugins/src/libged/rot/rot.c
    brlcad/branches/gedplugins/src/libged/rt/rt.c
    brlcad/branches/gedplugins/src/libged/scale/scale.c
    brlcad/branches/gedplugins/src/libged/select/select.c
    brlcad/branches/gedplugins/src/libged/simulate/CMakeLists.txt
    brlcad/branches/gedplugins/src/libged/simulate/utility.hpp
    brlcad/branches/gedplugins/src/libged/slew/slew.c
    brlcad/branches/gedplugins/src/libged/solid_report/solid_report.c
    brlcad/branches/gedplugins/src/libged/tables/tables.c
    brlcad/branches/gedplugins/src/libged/version/version.c
    brlcad/branches/gedplugins/src/libged/view/view.c
    brlcad/branches/gedplugins/src/libged/which/which.cpp

Added Paths:
-----------
    brlcad/branches/gedplugins/src/libged/arb/rotate_arb_face.c
    brlcad/branches/gedplugins/src/libged/bot/edbot.c
    brlcad/branches/gedplugins/src/libged/libfuncs/CMakeLists.txt
    brlcad/branches/gedplugins/src/libged/metaball/
    brlcad/branches/gedplugins/src/libged/metaball/metaball.c
    brlcad/branches/gedplugins/src/libged/pipe/
    brlcad/branches/gedplugins/src/libged/pipe/CMakeLists.txt
    brlcad/branches/gedplugins/src/libged/pipe/pipe.c
    brlcad/branches/gedplugins/src/libged/rot/rotate_about.c

Removed Paths:
-------------
    brlcad/branches/gedplugins/src/libged/edbot.c
    brlcad/branches/gedplugins/src/libged/edit_metaball.c
    brlcad/branches/gedplugins/src/libged/edpipe.c
    brlcad/branches/gedplugins/src/libged/rotate_about.c
    brlcad/branches/gedplugins/src/libged/rotate_arb_face.c

Modified: brlcad/branches/gedplugins/src/libged/CMakeLists.txt
===================================================================
--- brlcad/branches/gedplugins/src/libged/CMakeLists.txt        2020-07-22 
17:27:42 UTC (rev 76425)
+++ brlcad/branches/gedplugins/src/libged/CMakeLists.txt        2020-07-22 
19:44:43 UTC (rev 76426)
@@ -23,13 +23,9 @@
   exec.cpp
   exec_mapping.cpp
   ged_init.cpp
-  libfuncs/libfuncs.c
   columns.c
   display_list.c
   draw_calc.cpp
-  edbot.c
-  edit_metaball.c
-  edpipe.c
   facedef.c
   ged.c
   ged_util.c
@@ -37,11 +33,10 @@
   get_solid_kp.c
   inside.c
   path.c
+  pipe.c
   pnts_util.c
   polyclip.cpp
   qray.c
-  rotate_about.c
-  rotate_arb_face.c
   rotate_eto.c
   rotate_extrude.c
   rotate_hyp.c
@@ -232,6 +227,7 @@
 add_subdirectory(killtree)
 add_subdirectory(label)
 add_subdirectory(lc)
+add_subdirectory(libfuncs)
 add_subdirectory(lint)
 add_subdirectory(list)
 add_subdirectory(lod)
@@ -244,6 +240,7 @@
 add_subdirectory(make_name)
 add_subdirectory(match)
 add_subdirectory(mater)
+add_subdirectory(metaball)
 add_subdirectory(mirror)
 add_subdirectory(model2grid_lu)
 add_subdirectory(model2view)
@@ -265,6 +262,7 @@
 add_subdirectory(pathlist)
 add_subdirectory(pathsum)
 add_subdirectory(perspective)
+add_subdirectory(pipe)
 add_subdirectory(pix2fb)
 add_subdirectory(plot)
 add_subdirectory(pmat)

Modified: brlcad/branches/gedplugins/src/libged/arb/CMakeLists.txt
===================================================================
--- brlcad/branches/gedplugins/src/libged/arb/CMakeLists.txt    2020-07-22 
17:27:42 UTC (rev 76425)
+++ brlcad/branches/gedplugins/src/libged/arb/CMakeLists.txt    2020-07-22 
19:44:43 UTC (rev 76426)
@@ -6,16 +6,21 @@
   ${GED_INCLUDE_DIRS}
   )
 
+set(arb_srcs
+  arb.c
+  rotate_arb_face.c
+  )
+
 add_definitions(-DGED_PLUGIN)
-ged_plugin_library(ged-arb SHARED arb.c)
+ged_plugin_library(ged-arb SHARED ${arb_srcs})
 target_link_libraries(ged-arb libged libbu)
 set_property(TARGET ged-arb APPEND PROPERTY COMPILE_DEFINITIONS BRLCADBUILD 
HAVE_CONFIG_H)
-VALIDATE_STYLE(ged-arb arb.c)
+VALIDATE_STYLE(ged-arb ${arb_srcs})
 PLUGIN_SETUP(ged-arb ged)
 
 CMAKEFILES(
   CMakeLists.txt
-  arb.c
+  ${arb_srcs}
   )
 
 # Local Variables:

Modified: brlcad/branches/gedplugins/src/libged/arb/arb.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/arb/arb.c     2020-07-22 17:27:42 UTC 
(rev 76425)
+++ brlcad/branches/gedplugins/src/libged/arb/arb.c     2020-07-22 19:44:43 UTC 
(rev 76426)
@@ -131,17 +131,17 @@
 
 #ifdef GED_PLUGIN
 #include "../include/plugin.h"
-struct ged_cmd_impl arb_cmd_impl = {
-    "arb",
-    ged_arb_core,
-    GED_CMD_DEFAULT
-};
-
+struct ged_cmd_impl arb_cmd_impl = {"arb", ged_arb_core, GED_CMD_DEFAULT};
 const struct ged_cmd arb_cmd = { &arb_cmd_impl };
-const struct ged_cmd *arb_cmds[] = { &arb_cmd, NULL };
 
-static const struct ged_plugin pinfo = { arb_cmds, 1 };
+extern int ged_rotate_arb_face_core(struct ged *gedp, int argc, const char 
*argv[]);
+struct ged_cmd_impl rotate_arb_face_cmd_impl = {"rotate_arb_face", 
ged_rotate_arb_face_core, GED_CMD_DEFAULT};
+const struct ged_cmd rotate_arb_face_cmd = { &rotate_arb_face_cmd_impl };
 
+const struct ged_cmd *arb_cmds[] = { &arb_cmd, &rotate_arb_face_cmd, NULL };
+
+static const struct ged_plugin pinfo = { arb_cmds, 2 };
+
 COMPILER_DLLEXPORT const struct ged_plugin *ged_plugin_info()
 {
     return &pinfo;

Copied: brlcad/branches/gedplugins/src/libged/arb/rotate_arb_face.c (from rev 
76425, brlcad/branches/gedplugins/src/libged/rotate_arb_face.c)
===================================================================
--- brlcad/branches/gedplugins/src/libged/arb/rotate_arb_face.c                 
        (rev 0)
+++ brlcad/branches/gedplugins/src/libged/arb/rotate_arb_face.c 2020-07-22 
19:44:43 UTC (rev 76426)
@@ -0,0 +1,232 @@
+/*                  R O T A T E _ A R B _ F A C E . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2008-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file libged/rotate_arb_face.c
+ *
+ * The rotate_arb_face command.
+ *
+ */
+
+#include "common.h"
+
+#include <string.h>
+
+#include "bu/cmd.h"
+#include "rt/geom.h"
+
+#include "../ged_private.h"
+
+
+static const short int arb_vertices[5][24] = {
+    { 1, 2, 3, 0, 1, 2, 4, 0, 2, 3, 4, 0, 1, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0 
},        /* arb4 */
+    { 1, 2, 3, 4, 1, 2, 5, 0, 2, 3, 5, 0, 3, 4, 5, 0, 1, 4, 5, 0, 0, 0, 0, 0 
},        /* arb5 */
+    { 1, 2, 3, 4, 2, 3, 6, 5, 1, 5, 6, 4, 1, 2, 5, 0, 3, 4, 6, 0, 0, 0, 0, 0 
},        /* arb6 */
+    { 1, 2, 3, 4, 5, 6, 7, 0, 1, 4, 5, 0, 2, 3, 7, 6, 1, 2, 6, 5, 4, 3, 7, 5 
},        /* arb7 */
+    { 1, 2, 3, 4, 5, 6, 7, 8, 1, 5, 8, 4, 2, 3, 7, 6, 1, 2, 6, 5, 4, 3, 7, 8 } 
/* arb8 */
+};
+
+
+int
+ged_rotate_arb_face_core(struct ged *gedp, int argc, const char *argv[])
+{
+    struct rt_db_internal intern;
+    struct rt_arb_internal *arb;
+    struct directory *dp;
+    fastf_t planes[7][4];              /* ARBs defining plane equations */
+    int arb_type;
+    int face;
+    int vi;
+    mat_t mat;
+    int i;
+    int pnt5;          /* special arb7 case */
+    char *last;
+
+    /* intentionally double for scan */
+    double pt[3];
+
+    static const char *usage = "arb face pt rvec";
+
+    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
+    GED_CHECK_READ_ONLY(gedp, GED_ERROR);
+    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
+
+    /* initialize result */
+    bu_vls_trunc(gedp->ged_result_str, 0);
+
+    /* must be wanting help */
+    if (argc == 1) {
+       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
+       return GED_HELP;
+    }
+
+    if (argc != 5) {
+       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
+       return GED_ERROR;
+    }
+
+    if ((last = strrchr(argv[1], '/')) == NULL)
+       last = (char *)argv[1];
+    else
+       ++last;
+
+    if (last[0] == '\0') {
+       bu_vls_printf(gedp->ged_result_str, "illegal input - %s", argv[1]);
+       return GED_ERROR;
+    }
+
+    if ((dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET)) == 
RT_DIR_NULL) {
+       bu_vls_printf(gedp->ged_result_str, "%s not found", argv[1]);
+       return GED_ERROR;
+    }
+
+    if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], 
gedp->ged_wdbp, mat) == GED_ERROR)
+       return GED_ERROR;
+
+    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
+       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_ARB8) {
+       bu_vls_printf(gedp->ged_result_str, "Object not an ARB");
+       rt_db_free_internal(&intern);
+
+       return GED_OK;
+    }
+
+    if (sscanf(argv[2], "%d", &face) != 1) {
+       bu_vls_printf(gedp->ged_result_str, "bad face - %s", argv[2]);
+       rt_db_free_internal(&intern);
+
+       return GED_ERROR;
+    }
+
+    /*XXX need better checking of the face */
+    face -= 1;
+    if (face < 0 || 5 < face) {
+       bu_vls_printf(gedp->ged_result_str, "bad face - %s", argv[2]);
+       rt_db_free_internal(&intern);
+
+       return GED_ERROR;
+    }
+
+    if (sscanf(argv[3], "%d", &vi) != 1) {
+       bu_vls_printf(gedp->ged_result_str, "bad vertex index - %s", argv[2]);
+       rt_db_free_internal(&intern);
+
+       return GED_ERROR;
+    }
+
+
+    /*XXX need better checking of the vertex index */
+    vi -= 1;
+    if (vi < 0 || 7 < vi) {
+       bu_vls_printf(gedp->ged_result_str, "bad vertex - %s", argv[2]);
+       rt_db_free_internal(&intern);
+
+       return GED_ERROR;
+    }
+
+    if (sscanf(argv[4], "%lf %lf %lf", &pt[X], &pt[Y], &pt[Z]) != 3) {
+       bu_vls_printf(gedp->ged_result_str, "bad point - %s", argv[3]);
+       rt_db_free_internal(&intern);
+
+       return GED_ERROR;
+    }
+
+    arb = (struct rt_arb_internal *)intern.idb_ptr;
+    RT_ARB_CK_MAGIC(arb);
+
+    arb_type = rt_arb_std_type(&intern, &gedp->ged_wdbp->wdb_tol);
+
+    if (rt_arb_calc_planes(gedp->ged_result_str, arb, arb_type, planes, 
&gedp->ged_wdbp->wdb_tol)) {
+       rt_db_free_internal(&intern);
+
+       return GED_ERROR;
+    }
+
+    /* special case for arb4 */
+    if (arb_type == ARB4 && vi >= 3)
+       vi = 4;
+
+    /* special case for arb6 */
+    if (arb_type == ARB6 && vi >= 5)
+       vi = 6;
+
+    /* special case for arb7 */
+    if (arb_type == ARB7) {
+       /* check if point 5 is in the face */
+       pnt5 = 0;
+       for (i = 0; i < 4; i++) {
+           if (arb_vertices[arb_type-4][face*4+i]==5)
+               pnt5=1;
+       }
+
+       if (pnt5)
+           vi = 4;
+    }
+
+    {
+       /* Apply incremental changes */
+       vect_t tempvec;
+       vect_t work;
+       fastf_t *plane;
+       mat_t rmat;
+
+       bn_mat_angles(rmat, pt[X], pt[Y], pt[Z]);
+
+       plane = &planes[face][0];
+       VMOVE(work, plane);
+       MAT4X3VEC(plane, rmat, work);
+
+       /* point notation of fixed vertex */
+       VMOVE(tempvec, arb->pt[vi]);
+
+       /* set D of planar equation to anchor at fixed vertex */
+       planes[face][3]=VDOT(plane, tempvec);
+    }
+
+    /* calculate new points for the arb */
+    (void)rt_arb_calc_points(arb, arb_type, (const plane_t *)planes, 
&gedp->ged_wdbp->wdb_tol);
+
+    {
+       mat_t invmat;
+
+       bn_mat_inv(invmat, mat);
+
+       for (i = 0; i < 8; ++i) {
+           point_t arb_pt;
+
+           MAT4X3PNT(arb_pt, invmat, arb->pt[i]);
+           VMOVE(arb->pt[i], arb_pt);
+       }
+
+       GED_DB_PUT_INTERNAL(gedp, dp, &intern, &rt_uniresource, GED_ERROR);
+    }
+
+    rt_db_free_internal(&intern);
+    return GED_OK;
+}
+
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */

Modified: brlcad/branches/gedplugins/src/libged/bot/CMakeLists.txt
===================================================================
--- brlcad/branches/gedplugins/src/libged/bot/CMakeLists.txt    2020-07-22 
17:27:42 UTC (rev 76425)
+++ brlcad/branches/gedplugins/src/libged/bot/CMakeLists.txt    2020-07-22 
19:44:43 UTC (rev 76426)
@@ -7,23 +7,24 @@
   )
 
 set(BOT_SRCS
-       bot_condense.c
-       bot.cpp
-       bot_decimate.c
-       bot_dump.c
-       bot_face_fuse.c
-       bot_face_sort.c
-       bot_flip.c
-       bot_fuse.c
-       bot_merge.c
-       bot_smooth.c
-       bot_split.c
-       bot_sync.c
-       bot_vertex_fuse.c
-       check.cpp
-       extrude.cpp
-       remesh.cpp
-       )
+  bot_condense.c
+  bot.cpp
+  bot_decimate.c
+  bot_dump.c
+  bot_face_fuse.c
+  bot_face_sort.c
+  bot_flip.c
+  bot_fuse.c
+  bot_merge.c
+  bot_smooth.c
+  bot_split.c
+  bot_sync.c
+  bot_vertex_fuse.c
+  edbot.c
+  check.cpp
+  extrude.cpp
+  remesh.cpp
+  )
 
 add_definitions(-DGED_PLUGIN)
 ged_plugin_library(ged-bot SHARED ${BOT_SRCS})

Modified: brlcad/branches/gedplugins/src/libged/bot/bot.cpp
===================================================================
--- brlcad/branches/gedplugins/src/libged/bot/bot.cpp   2020-07-22 17:27:42 UTC 
(rev 76425)
+++ brlcad/branches/gedplugins/src/libged/bot/bot.cpp   2020-07-22 19:44:43 UTC 
(rev 76426)
@@ -477,6 +477,24 @@
     struct ged_cmd_impl bot_vertex_fuse_cmd_impl = {"bot_vertex_fuse", 
ged_bot_vertex_fuse_core, GED_CMD_DEFAULT};
     const struct ged_cmd bot_vertex_fuse_cmd = { &bot_vertex_fuse_cmd_impl };
 
+    struct ged_cmd_impl dbot_dump_cmd_impl = {"dbot_dump", ged_dbot_dump_core, 
GED_CMD_DEFAULT};
+    const struct ged_cmd dbot_dump_cmd = { &dbot_dump_cmd_impl };
+
+    struct ged_cmd_impl find_bot_edge_cmd_impl = {"find_bot_edge", 
ged_find_bot_edge_nearest_pnt_core, GED_CMD_DEFAULT};
+    const struct ged_cmd find_bot_edge_cmd = { &find_bot_edge_cmd_impl };
+
+    struct ged_cmd_impl find_bot_pnt_cmd_impl = {"find_bot_pnt", 
ged_find_bot_pnt_nearest_pnt_core, GED_CMD_DEFAULT};
+    const struct ged_cmd find_bot_pnt_cmd = { &find_bot_pnt_cmd_impl };
+
+    struct ged_cmd_impl get_bot_edges_cmd_impl = {"get_bot_edges", 
ged_get_bot_edges_core, GED_CMD_DEFAULT};
+    const struct ged_cmd get_bot_edges_cmd = { &get_bot_edges_cmd_impl };
+
+    /*
+       struct ged_cmd_impl _cmd_impl = {"", , GED_CMD_DEFAULT};
+       const struct ged_cmd _cmd = { &_cmd_impl };
+       */
+
+
     const struct ged_cmd *bot_cmds[] = {
                &bot_cmd,
        &bot_condense_cmd,
@@ -491,10 +509,14 @@
        &bot_split_cmd,
        &bot_sync_cmd,
        &bot_vertex_fuse_cmd,
-       NULL
+       &dbot_dump_cmd,
+       &find_bot_edge_cmd,
+       &find_bot_pnt_cmd,
+       &get_bot_edges_cmd,
+       NULL
     };
 
-    static const struct ged_plugin pinfo = { bot_cmds, 13 };
+    static const struct ged_plugin pinfo = { bot_cmds, 17 };
 
     COMPILER_DLLEXPORT const struct ged_plugin *ged_plugin_info()
     {

Modified: brlcad/branches/gedplugins/src/libged/bot/bot_dump.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/bot/bot_dump.c        2020-07-22 
17:27:42 UTC (rev 76425)
+++ brlcad/branches/gedplugins/src/libged/bot/bot_dump.c        2020-07-22 
19:44:43 UTC (rev 76426)
@@ -1386,7 +1386,7 @@
 
 
 int
-ged_dbot_dump(struct ged *gedp, int argc, const char *argv[])
+ged_dbot_dump_core(struct ged *gedp, int argc, const char *argv[])
 {
     int ret;
     char *file_ext = NULL;

Copied: brlcad/branches/gedplugins/src/libged/bot/edbot.c (from rev 76425, 
brlcad/branches/gedplugins/src/libged/edbot.c)
===================================================================
--- brlcad/branches/gedplugins/src/libged/bot/edbot.c                           
(rev 0)
+++ brlcad/branches/gedplugins/src/libged/bot/edbot.c   2020-07-22 19:44:43 UTC 
(rev 76426)
@@ -0,0 +1,693 @@
+/*                        E D B O T . C
+ * BRL-CAD
+ *
+ * Copyright (c) 1995-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file libged/edbot.c
+ *
+ */
+
+#include "common.h"
+
+#include <math.h>
+#include <string.h>
+
+#include "vmath.h"
+#include "nmg.h"
+#include "rt/geom.h"
+#include "ged.h"
+#include "wdb.h"
+
+#include "../ged_private.h"
+
+int
+ged_bot_edge_split(struct ged *gedp, int argc, const char *argv[])
+{
+    static const char *usage = "bot edge";
+    struct directory *dp;
+    struct rt_db_internal intern;
+    struct rt_bot_internal *botip;
+    mat_t mat;
+    char *last;
+    size_t v1_i;
+    size_t v2_i;
+    size_t last_fi;
+    size_t last_vi;
+    size_t save_vi;
+    size_t i;
+    point_t new_pt;
+
+    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
+    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
+
+    /* initialize result */
+    bu_vls_trunc(gedp->ged_result_str, 0);
+
+    /* must be wanting help */
+    if (argc == 1) {
+       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
+       return GED_HELP;
+    }
+
+    if (argc != 3) {
+       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
+       return GED_ERROR;
+    }
+
+    if ((last = strrchr(argv[1], '/')) == NULL)
+       last = (char *)argv[1];
+    else
+       ++last;
+
+    if (last[0] == '\0') {
+       bu_vls_printf(gedp->ged_result_str, "%s: illegal input - %s", argv[0], 
argv[1]);
+       return GED_ERROR;
+    }
+
+    dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET);
+    if (dp == RT_DIR_NULL) {
+       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
+       return GED_ERROR;
+    }
+
+    if (bu_sscanf(argv[2], "%zu %zu", &v1_i, &v2_i) != 2) {
+       bu_vls_printf(gedp->ged_result_str, "%s: bad bot edge - %s", argv[0], 
argv[2]);
+       return GED_ERROR;
+    }
+
+    if (wdb_import_from_path2(gedp->ged_result_str, &intern, last, 
gedp->ged_wdbp, mat) == GED_ERROR) {
+       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
+       return GED_ERROR;
+    }
+
+    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
+       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_BOT) {
+       bu_vls_printf(gedp->ged_result_str, "Object is not a BOT");
+       rt_db_free_internal(&intern);
+
+       return GED_ERROR;
+    }
+
+    botip = (struct rt_bot_internal *)intern.idb_ptr;
+    last_fi = botip->num_faces;
+    last_vi = botip->num_vertices;
+
+    if (v1_i >= botip->num_vertices || v2_i >= botip->num_vertices) {
+       bu_vls_printf(gedp->ged_result_str, "%s: bad bot edge - %s", argv[0], 
argv[2]);
+       rt_db_free_internal(&intern);
+       return GED_ERROR;
+    }
+
+    /*
+     * Create the new point, modify all faces (should only be two)
+     * that share the specified edge and hook in the two extra faces.
+     */
+
+    /* First, create some space */
+    botip->num_vertices++;
+    botip->num_faces += 2;
+    botip->vertices = (fastf_t *)bu_realloc((void *)botip->vertices, 
botip->num_vertices*3*sizeof(fastf_t), "realloc bot vertices");
+    botip->faces = (int *)bu_realloc((void *)botip->faces, 
botip->num_faces*3*sizeof(int), "realloc bot faces");
+
+    /* Create the new point. We're using the average of the edge's points */
+    VADD2(new_pt, &botip->vertices[v1_i*3], &botip->vertices[v2_i*3]);
+    VSCALE(new_pt, new_pt, 0.5);
+
+    /* Add the new point to the last position in the list of vertices. */
+    VMOVE(&botip->vertices[last_vi*3], new_pt);
+
+    /* Update faces associated with the specified edge */
+    for (i = 0; i < last_fi; ++i) {
+       if (((size_t)botip->faces[i*3] == v1_i && (size_t)botip->faces[i*3+1] 
== v2_i) ||
+           ((size_t)botip->faces[i*3] == v2_i && (size_t)botip->faces[i*3+1] 
== v1_i)) {
+
+           save_vi = botip->faces[i*3+1];
+           botip->faces[i*3+1] = last_vi;
+
+           /* Initialize a new face */
+           botip->faces[last_fi*3] = last_vi;
+           botip->faces[last_fi*3+1] = save_vi;
+           botip->faces[last_fi*3+2] = botip->faces[i*3+2];
+
+           ++last_fi;
+       } else if (((size_t)botip->faces[i*3] == v1_i && 
(size_t)botip->faces[i*3+2] == v2_i) ||
+                  ((size_t)botip->faces[i*3] == v2_i && 
(size_t)botip->faces[i*3+2] == v1_i)) {
+           save_vi = botip->faces[i*3];
+           botip->faces[i*3] = last_vi;
+
+           /* Initialize a new face */
+           botip->faces[last_fi*3] = last_vi;
+           botip->faces[last_fi*3+1] = save_vi;
+           botip->faces[last_fi*3+2] = botip->faces[i*3+1];
+
+           ++last_fi;
+       } else if (((size_t)botip->faces[i*3+1] == v1_i && 
(size_t)botip->faces[i*3+2] == v2_i) ||
+                  ((size_t)botip->faces[i*3+1] == v2_i && 
(size_t)botip->faces[i*3+2] == v1_i)) {
+           save_vi = botip->faces[i*3+2];
+           botip->faces[i*3+2] = last_vi;
+
+           /* Initialize a new face */
+           botip->faces[last_fi*3] = botip->faces[i*3];
+           botip->faces[last_fi*3+1] = last_vi;
+           botip->faces[last_fi*3+2] = save_vi;
+
+           ++last_fi;
+       }
+
+       if (last_fi >= botip->num_faces)
+           break;
+    }
+
+    GED_DB_PUT_INTERNAL(gedp, dp, &intern, &rt_uniresource, GED_ERROR);
+    rt_db_free_internal(&intern);
+    return GED_OK;
+}
+
+
+int
+ged_bot_face_split(struct ged *gedp, int argc, const char *argv[])
+{
+    static const char *usage = "bot face";
+    struct directory *dp;
+    static fastf_t sf = 1.0 / 3.0;
+    struct rt_db_internal intern;
+    struct rt_bot_internal *botip;
+    mat_t mat;
+    char *last;
+    size_t face_i;
+    size_t last_vi;
+    size_t save_vi;
+    point_t new_pt;
+
+    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
+    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
+
+    /* initialize result */
+    bu_vls_trunc(gedp->ged_result_str, 0);
+
+    /* must be wanting help */
+    if (argc == 1) {
+       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
+       return GED_HELP;
+    }
+
+    if (argc != 3) {
+       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
+       return GED_ERROR;
+    }
+
+    if ((last = strrchr(argv[1], '/')) == NULL)
+       last = (char *)argv[1];
+    else
+       ++last;
+
+    if (last[0] == '\0') {
+       bu_vls_printf(gedp->ged_result_str, "%s: illegal input - %s", argv[0], 
argv[1]);
+       return GED_ERROR;
+    }
+
+    dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET);
+    if (dp == RT_DIR_NULL) {
+       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
+       return GED_ERROR;
+    }
+
+    if (bu_sscanf(argv[2], "%zu", &face_i) != 1) {
+       bu_vls_printf(gedp->ged_result_str, "%s: bad bot vertex index - %s", 
argv[0], argv[2]);
+       return GED_ERROR;
+    }
+
+    if (wdb_import_from_path2(gedp->ged_result_str, &intern, last, 
gedp->ged_wdbp, mat) == GED_ERROR) {
+       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
+       return GED_ERROR;
+    }
+
+    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
+       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_BOT) {
+       bu_vls_printf(gedp->ged_result_str, "Object is not a BOT");
+       rt_db_free_internal(&intern);
+
+       return GED_ERROR;
+    }
+
+    botip = (struct rt_bot_internal *)intern.idb_ptr;
+    last_vi = botip->num_vertices;
+
+    if (face_i >= botip->num_faces) {
+       bu_vls_printf(gedp->ged_result_str, "%s: bad bot face index - %s", 
argv[0], argv[2]);
+       rt_db_free_internal(&intern);
+       return GED_ERROR;
+    }
+
+    /* Create the new point, modify face_i and hook in the two extra faces */
+    /* First, create some space */
+    botip->num_vertices++;
+    botip->num_faces += 2;
+    botip->vertices = (fastf_t *)bu_realloc((void *)botip->vertices, 
botip->num_vertices*3*sizeof(fastf_t), "realloc bot vertices");
+    botip->faces = (int *)bu_realloc((void *)botip->faces, 
botip->num_faces*3*sizeof(int), "realloc bot faces");
+
+    /* Create the new point. For the moment, we're using the average of the 
face_i's points */
+    VADD3(new_pt,
+         &botip->vertices[botip->faces[face_i*3]*3],
+         &botip->vertices[botip->faces[face_i*3+1]*3],
+         &botip->vertices[botip->faces[face_i*3+2]*3]);
+    VSCALE(new_pt, new_pt, sf);
+
+    /* Add the new point to the last position in the list of vertices. */
+    VMOVE(&botip->vertices[last_vi*3], new_pt);
+
+    /* Update face_i */
+    save_vi = botip->faces[face_i*3+2];
+    botip->faces[face_i*3+2] = last_vi;
+
+    /* Initialize the two new faces */
+    botip->faces[(botip->num_faces-2)*3] = botip->faces[face_i*3+1];
+    botip->faces[(botip->num_faces-2)*3+1] = save_vi;
+    botip->faces[(botip->num_faces-2)*3+2] = last_vi;
+    botip->faces[(botip->num_faces-1)*3] = save_vi;
+    botip->faces[(botip->num_faces-1)*3+1] = botip->faces[face_i*3];
+    botip->faces[(botip->num_faces-1)*3+2] = last_vi;
+
+    bu_vls_printf(gedp->ged_result_str, "%zu", last_vi);
+
+    GED_DB_PUT_INTERNAL(gedp, dp, &intern, &rt_uniresource, GED_ERROR);
+    rt_db_free_internal(&intern);
+    return GED_OK;
+}
+
+int
+ged_get_bot_edges_core(struct ged *gedp, int argc, const char *argv[])
+{
+    static const char *usage = "bot";
+    struct rt_db_internal intern;
+    struct rt_bot_internal *botip;
+    mat_t mat;
+    size_t edge_count;
+    size_t *edge_list;
+
+    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
+    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
+
+    /* initialize result */
+    bu_vls_trunc(gedp->ged_result_str, 0);
+
+    /* must be wanting help */
+    if (argc == 1) {
+       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
+       return GED_HELP;
+    }
+
+    if (argc != 2) {
+       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
+       return GED_ERROR;
+    }
+
+    if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], 
gedp->ged_wdbp, mat) == GED_ERROR) {
+       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
+       return GED_ERROR;
+    }
+
+    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
+       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_BOT) {
+       bu_vls_printf(gedp->ged_result_str, "Object is not a BOT");
+       rt_db_free_internal(&intern);
+
+       return GED_ERROR;
+    }
+
+    botip = (struct rt_bot_internal *)intern.idb_ptr;
+    if ((edge_count = rt_bot_get_edge_list(botip, &edge_list)) > 0) {
+       size_t i;
+
+       for (i = 0; i < edge_count; i++)
+           bu_vls_printf(gedp->ged_result_str, "{%zu %zu} ", edge_list[i*2], 
edge_list[i*2+1]);
+
+       bu_free(edge_list, "bot edge list");
+    }
+
+    rt_db_free_internal(&intern);
+    return GED_OK;
+}
+
+
+int
+ged_bot_move_pnt(struct ged *gedp, int argc, const char *argv[])
+{
+    static const char *usage = "[-r] bot vertex_i pt";
+    struct directory *dp;
+    struct rt_db_internal intern;
+    struct rt_bot_internal *botip;
+    mat_t mat;
+    size_t vertex_i;
+    int rflag = 0;
+    char *last;
+
+    /* must be double for scanf */
+    double pt[ELEMENTS_PER_POINT];
+
+    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
+    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
+
+    /* initialize result */
+    bu_vls_trunc(gedp->ged_result_str, 0);
+
+    /* must be wanting help */
+    if (argc == 1) {
+       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
+       return GED_HELP;
+    }
+
+    if (argc < 4 || 5 < argc) {
+       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
+       return GED_ERROR;
+    }
+
+    if (argc == 5) {
+       if (argv[1][0] != '-' || argv[1][1] != 'r' || argv[1][2] != '\0') {
+           bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
+           return GED_ERROR;
+       }
+
+       rflag = 1;
+       --argc;
+       ++argv;
+    }
+
+    if ((last = strrchr(argv[1], '/')) == NULL)
+       last = (char *)argv[1];
+    else
+       ++last;
+
+    if (last[0] == '\0') {
+       bu_vls_printf(gedp->ged_result_str, "%s: illegal input - %s", argv[0], 
argv[1]);
+       return GED_ERROR;
+    }
+
+    dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET);
+    if (dp == RT_DIR_NULL) {
+       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
+       return GED_ERROR;
+    }
+
+    if (bu_sscanf(argv[2], "%zu", &vertex_i) != 1) {
+       bu_vls_printf(gedp->ged_result_str, "%s: bad bot vertex index - %s", 
argv[0], argv[2]);
+       return GED_ERROR;
+    }
+
+    if (bu_sscanf(argv[3], "%lf %lf %lf", &pt[X], &pt[Y], &pt[Z]) != 3) {
+       bu_vls_printf(gedp->ged_result_str, "%s: bad point - %s", argv[0], 
argv[3]);
+       return GED_ERROR;
+    }
+
+    VSCALE(pt, pt, gedp->ged_wdbp->dbip->dbi_local2base);
+
+    if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], 
gedp->ged_wdbp, mat) == GED_ERROR) {
+       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
+       return GED_ERROR;
+    }
+
+    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
+       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_BOT) {
+       bu_vls_printf(gedp->ged_result_str, "Object is not a BOT");
+       rt_db_free_internal(&intern);
+
+       return GED_ERROR;
+    }
+
+    botip = (struct rt_bot_internal *)intern.idb_ptr;
+
+    if (vertex_i >= botip->num_vertices) {
+       bu_vls_printf(gedp->ged_result_str, "%s: bad bot vertex index - %s", 
argv[0], argv[2]);
+       rt_db_free_internal(&intern);
+       return GED_ERROR;
+    }
+
+    if (rflag) {
+       VADD2(&botip->vertices[vertex_i*3], pt, &botip->vertices[vertex_i*3]);
+    } else {
+       VMOVE(&botip->vertices[vertex_i*3], pt);
+    }
+
+    {
+       mat_t invmat;
+       point_t curr_pt;
+       size_t idx;
+
+       bn_mat_inv(invmat, mat);
+       for (idx = 0; idx < botip->num_vertices; idx++) {
+           MAT4X3PNT(curr_pt, invmat, &botip->vertices[idx*3]);
+           VMOVE(&botip->vertices[idx*3], curr_pt);
+       }
+    }
+
+    GED_DB_PUT_INTERNAL(gedp, dp, &intern, &rt_uniresource, GED_ERROR);
+    rt_db_free_internal(&intern);
+
+    return GED_OK;
+}
+
+
+int
+ged_bot_move_pnts(struct ged *gedp, int argc, const char *argv[])
+{
+    static const char *usage = "bot vec vertex_1 [vertex_2 ... vertex_n]";
+    struct directory *dp;
+    struct rt_db_internal intern;
+    struct rt_bot_internal *botip;
+    mat_t mat;
+    register int i;
+    size_t vertex_i;
+    char *last;
+
+    /* must be double for scanf */
+    double vec[ELEMENTS_PER_VECT];
+
+    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
+    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
+
+    /* initialize result */
+    bu_vls_trunc(gedp->ged_result_str, 0);
+
+    /* must be wanting help */
+    if (argc == 1) {
+       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
+       return GED_HELP;
+    }
+
+    if (argc < 4) {
+       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
+       return GED_ERROR;
+    }
+
+    if ((last = strrchr(argv[1], '/')) == NULL)
+       last = (char *)argv[1];
+    else
+       ++last;
+
+    if (last[0] == '\0') {
+       bu_vls_printf(gedp->ged_result_str, "%s: illegal input - %s", argv[0], 
argv[1]);
+       return GED_ERROR;
+    }
+
+    dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET);
+    if (dp == RT_DIR_NULL) {
+       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
+       return GED_ERROR;
+    }
+
+    if (bu_sscanf(argv[2], "%lf %lf %lf", &vec[X], &vec[Y], &vec[Z]) != 3) {
+       bu_vls_printf(gedp->ged_result_str, "%s: bad vector - %s", argv[0], 
argv[2]);
+       return GED_ERROR;
+    }
+
+    VSCALE(vec, vec, gedp->ged_wdbp->dbip->dbi_local2base);
+
+    if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], 
gedp->ged_wdbp, mat) == GED_ERROR) {
+       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
+       return GED_ERROR;
+    }
+
+    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
+       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_BOT) {
+       bu_vls_printf(gedp->ged_result_str, "Object is not a BOT");
+       rt_db_free_internal(&intern);
+
+       return GED_ERROR;
+    }
+
+    botip = (struct rt_bot_internal *)intern.idb_ptr;
+
+    for (i = 3; i < argc; ++i) {
+       if (bu_sscanf(argv[i], "%zu", &vertex_i) != 1) {
+           bu_vls_printf(gedp->ged_result_str, "%s: bad bot vertex index - 
%s\n", argv[0], argv[i]);
+           continue;
+       }
+
+       if (vertex_i >= botip->num_vertices) {
+           bu_vls_printf(gedp->ged_result_str, "%s: bad bot vertex index - 
%s\n", argv[0], argv[i]);
+           continue;
+       }
+
+       VADD2(&botip->vertices[vertex_i*3], vec, &botip->vertices[vertex_i*3]);
+    }
+
+    {
+       mat_t invmat;
+       point_t curr_pt;
+       size_t idx;
+
+       bn_mat_inv(invmat, mat);
+       for (idx = 0; idx < botip->num_vertices; idx++) {
+           MAT4X3PNT(curr_pt, invmat, &botip->vertices[idx*3]);
+           VMOVE(&botip->vertices[idx*3], curr_pt);
+       }
+    }
+
+    GED_DB_PUT_INTERNAL(gedp, dp, &intern, &rt_uniresource, GED_ERROR);
+    rt_db_free_internal(&intern);
+
+    return GED_OK;
+}
+
+
+int
+ged_find_bot_edge_nearest_pnt_core(struct ged *gedp, int argc, const char 
*argv[])
+{
+    static const char *usage = "bot view_xyz";
+    struct rt_db_internal intern;
+    struct rt_bot_internal *botip;
+    mat_t mat;
+    int vi1, vi2;
+    vect_t view;
+
+    /* must be double for scanf */
+    double scan[ELEMENTS_PER_VECT];
+
+    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
+    GED_CHECK_VIEW(gedp, GED_ERROR);
+    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
+
+    /* initialize result */
+    bu_vls_trunc(gedp->ged_result_str, 0);
+
+    /* must be wanting help */
+    if (argc == 1) {
+       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
+       return GED_HELP;
+    }
+
+    if (argc != 3) {
+       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
+       return GED_ERROR;
+    }
+
+    if (bu_sscanf(argv[2], "%lf %lf %lf", &scan[X], &scan[Y], &scan[Z]) != 3) {
+       bu_vls_printf(gedp->ged_result_str, "%s: bad view location - %s", 
argv[0], argv[2]);
+       return GED_ERROR;
+    }
+    VMOVE(view, scan); /* convert double to fastf_t */
+
+    if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], 
gedp->ged_wdbp, mat) == GED_ERROR) {
+       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
+       return GED_ERROR;
+    }
+
+    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
+       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_BOT) {
+       bu_vls_printf(gedp->ged_result_str, "Object is not a BOT");
+       rt_db_free_internal(&intern);
+
+       return GED_ERROR;
+    }
+
+    botip = (struct rt_bot_internal *)intern.idb_ptr;
+    (void)rt_bot_find_e_nearest_pt2(&vi1, &vi2, botip, view, 
gedp->ged_gvp->gv_model2view);
+    bu_vls_printf(gedp->ged_result_str, "%d %d", vi1, vi2);
+
+    rt_db_free_internal(&intern);
+    return GED_OK;
+}
+
+int
+ged_find_bot_pnt_nearest_pnt_core(struct ged *gedp, int argc, const char 
*argv[])
+{
+    static const char *usage = "bot view_xyz";
+    struct rt_db_internal intern;
+    struct rt_bot_internal *botip;
+    mat_t mat;
+    int nearest_pt;
+    vect_t view;
+
+    /* must be double for scanf */
+    double scan[ELEMENTS_PER_VECT];
+
+    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
+    GED_CHECK_VIEW(gedp, GED_ERROR);
+    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
+
+    /* initialize result */
+    bu_vls_trunc(gedp->ged_result_str, 0);
+
+    /* must be wanting help */
+    if (argc == 1) {
+       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
+       return GED_HELP;
+    }
+
+    if (argc != 3) {
+       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
+       return GED_ERROR;
+    }
+
+    if (bu_sscanf(argv[2], "%lf %lf %lf", &scan[X], &scan[Y], &scan[Z]) != 3) {
+       bu_vls_printf(gedp->ged_result_str, "%s: bad view location - %s", 
argv[0], argv[2]);
+       return GED_ERROR;
+    }
+
+    if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], 
gedp->ged_wdbp, mat) == GED_ERROR) {
+       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
+       return GED_ERROR;
+    }
+
+    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
+       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_BOT) {
+       bu_vls_printf(gedp->ged_result_str, "Object is not a BOT");
+       rt_db_free_internal(&intern);
+
+       return GED_ERROR;
+    }
+
+    botip = (struct rt_bot_internal *)intern.idb_ptr;
+    VMOVE(view, scan); /* convert double to fastf_t */
+
+    nearest_pt = rt_bot_find_v_nearest_pt2(botip, view, 
gedp->ged_gvp->gv_model2view);
+    bu_vls_printf(gedp->ged_result_str, "%d", nearest_pt);
+
+    rt_db_free_internal(&intern);
+    return GED_OK;
+}
+
+
+/*
+ * Local Variables:
+ * mode: C
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */

Modified: brlcad/branches/gedplugins/src/libged/bot/ged_bot.h
===================================================================
--- brlcad/branches/gedplugins/src/libged/bot/ged_bot.h 2020-07-22 17:27:42 UTC 
(rev 76425)
+++ brlcad/branches/gedplugins/src/libged/bot/ged_bot.h 2020-07-22 19:44:43 UTC 
(rev 76426)
@@ -81,7 +81,12 @@
 GED_EXPORT extern int ged_bot_split_core(struct ged *gedp, int argc, const 
char **argv);
 GED_EXPORT extern int ged_bot_sync_core(struct ged *gedp, int argc, const char 
**argv);
 GED_EXPORT extern int ged_bot_vertex_fuse_core(struct ged *gedp, int argc, 
const char **argv);
+GED_EXPORT extern int ged_find_bot_pnt_nearest_pnt_core(struct ged *gedp, int 
argc, const char *argv[]);
+GED_EXPORT extern int ged_find_bot_edge_nearest_pnt_core(struct ged *gedp, int 
argc, const char *argv[]);
+GED_EXPORT extern int ged_get_bot_edges_core(struct ged *gedp, int argc, const 
char *argv[]);
+GED_EXPORT extern int ged_dbot_dump_core(struct ged *gedp, int argc, const 
char **argv);
 
+
 GED_EXPORT extern int _bot_cmd_extrude(void *bs, int argc, const char **argv);
 
 GED_EXPORT extern int _bot_cmd_check(void *bs, int argc, const char **argv);

Modified: brlcad/branches/gedplugins/src/libged/color/color.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/color/color.c 2020-07-22 17:27:42 UTC 
(rev 76425)
+++ brlcad/branches/gedplugins/src/libged/color/color.c 2020-07-22 19:44:43 UTC 
(rev 76426)
@@ -247,7 +247,7 @@
 
 
 int
-ged_edcolor(struct ged *gedp, int argc, const char *argv[])
+ged_edcolor_core(struct ged *gedp, int argc, const char *argv[])
 {
     GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
     GED_CHECK_READ_ONLY(gedp, GED_ERROR);
@@ -360,17 +360,16 @@
 
 #ifdef GED_PLUGIN
 #include "../include/plugin.h"
-struct ged_cmd_impl color_cmd_impl = {
-    "color",
-    ged_color_core,
-    GED_CMD_DEFAULT
-};
-
+struct ged_cmd_impl color_cmd_impl = {"color", ged_color_core, 
GED_CMD_DEFAULT};
 const struct ged_cmd color_cmd = { &color_cmd_impl };
-const struct ged_cmd *color_cmds[] = { &color_cmd, NULL };
 
-static const struct ged_plugin pinfo = { color_cmds, 1 };
+struct ged_cmd_impl edcolor_cmd_impl = {"edcolor", ged_edcolor_core, 
GED_CMD_DEFAULT};
+const struct ged_cmd edcolor_cmd = { &edcolor_cmd_impl };
 
+const struct ged_cmd *color_cmds[] = { &color_cmd, &edcolor_cmd, NULL };
+
+static const struct ged_plugin pinfo = { color_cmds, 2 };
+
 COMPILER_DLLEXPORT const struct ged_plugin *ged_plugin_info()
 {
     return &pinfo;

Modified: brlcad/branches/gedplugins/src/libged/comb_std/comb_std.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/comb_std/comb_std.c   2020-07-22 
17:27:42 UTC (rev 76425)
+++ brlcad/branches/gedplugins/src/libged/comb_std/comb_std.c   2020-07-22 
19:44:43 UTC (rev 76426)
@@ -656,17 +656,16 @@
 
 #ifdef GED_PLUGIN
 #include "../include/plugin.h"
-struct ged_cmd_impl comb_std_cmd_impl = {
-    "comb_std",
-    ged_comb_std_core,
-    GED_CMD_DEFAULT
-};
-
+struct ged_cmd_impl comb_std_cmd_impl = {"comb_std", ged_comb_std_core, 
GED_CMD_DEFAULT};
 const struct ged_cmd comb_std_cmd = { &comb_std_cmd_impl };
-const struct ged_cmd *comb_std_cmds[] = { &comb_std_cmd, NULL };
 
-static const struct ged_plugin pinfo = { comb_std_cmds, 1 };
+struct ged_cmd_impl c_std_cmd_impl = {"c", ged_comb_std_core, GED_CMD_DEFAULT};
+const struct ged_cmd c_std_cmd = { &c_std_cmd_impl };
 
+const struct ged_cmd *comb_std_cmds[] = { &comb_std_cmd, &c_std_cmd, NULL };
+
+static const struct ged_plugin pinfo = { comb_std_cmds, 2 };
+
 COMPILER_DLLEXPORT const struct ged_plugin *ged_plugin_info()
 {
     return &pinfo;

Modified: brlcad/branches/gedplugins/src/libged/concat/concat.cpp
===================================================================
--- brlcad/branches/gedplugins/src/libged/concat/concat.cpp     2020-07-22 
17:27:42 UTC (rev 76425)
+++ brlcad/branches/gedplugins/src/libged/concat/concat.cpp     2020-07-22 
19:44:43 UTC (rev 76426)
@@ -530,10 +530,15 @@
 extern "C" {
     struct ged_cmd_impl concat_cmd_impl = { "concat", ged_concat_core, 
GED_CMD_DEFAULT };
     const struct ged_cmd concat_cmd = { &concat_cmd_impl };
-    const struct ged_cmd *concat_cmds[] = { &concat_cmd,  NULL };
 
-    static const struct ged_plugin pinfo = { concat_cmds, 1 };
+    struct ged_cmd_impl dbconcat_cmd_impl = { "dbconcat", ged_concat_core, 
GED_CMD_DEFAULT };
+    const struct ged_cmd dbconcat_cmd = { &dbconcat_cmd_impl };
 
+
+    const struct ged_cmd *concat_cmds[] = { &concat_cmd,  &dbconcat_cmd, NULL 
};
+
+    static const struct ged_plugin pinfo = { concat_cmds, 2 };
+
     COMPILER_DLLEXPORT const struct ged_plugin *ged_plugin_info()
     {
        return &pinfo;

Modified: brlcad/branches/gedplugins/src/libged/dbip/dbip.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/dbip/dbip.c   2020-07-22 17:27:42 UTC 
(rev 76425)
+++ brlcad/branches/gedplugins/src/libged/dbip/dbip.c   2020-07-22 19:44:43 UTC 
(rev 76426)
@@ -59,17 +59,16 @@
 
 #ifdef GED_PLUGIN
 #include "../include/plugin.h"
-struct ged_cmd_impl dbip_cmd_impl = {
-    "get_dbip",
-    ged_dbip_core,
-    GED_CMD_DEFAULT
-};
+struct ged_cmd_impl get_dbip_cmd_impl = {"get_dbip", ged_dbip_core, 
GED_CMD_DEFAULT};
+const struct ged_cmd get_dbip_cmd = { &get_dbip_cmd_impl };
 
+struct ged_cmd_impl dbip_cmd_impl = {"dbip", ged_dbip_core, GED_CMD_DEFAULT};
 const struct ged_cmd dbip_cmd = { &dbip_cmd_impl };
-const struct ged_cmd *dbip_cmds[] = { &dbip_cmd, NULL };
 
-static const struct ged_plugin pinfo = { dbip_cmds, 1 };
+const struct ged_cmd *dbip_cmds[] = { &get_dbip_cmd, &dbip_cmd, NULL };
 
+static const struct ged_plugin pinfo = { dbip_cmds, 2 };
+
 COMPILER_DLLEXPORT const struct ged_plugin *ged_plugin_info()
 {
     return &pinfo;

Deleted: brlcad/branches/gedplugins/src/libged/edbot.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/edbot.c       2020-07-22 17:27:42 UTC 
(rev 76425)
+++ brlcad/branches/gedplugins/src/libged/edbot.c       2020-07-22 19:44:43 UTC 
(rev 76426)
@@ -1,769 +0,0 @@
-/*                        E D B O T . C
- * BRL-CAD
- *
- * Copyright (c) 1995-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-/** @file libged/edbot.c
- *
- */
-
-#include "common.h"
-
-#include <math.h>
-#include <string.h>
-
-#include "vmath.h"
-#include "nmg.h"
-#include "rt/geom.h"
-#include "ged.h"
-#include "wdb.h"
-
-#include "./ged_private.h"
-
-int
-ged_bot_edge_split(struct ged *gedp, int argc, const char *argv[])
-{
-    static const char *usage = "bot edge";
-    struct directory *dp;
-    struct rt_db_internal intern;
-    struct rt_bot_internal *botip;
-    mat_t mat;
-    char *last;
-    size_t v1_i;
-    size_t v2_i;
-    size_t last_fi;
-    size_t last_vi;
-    size_t save_vi;
-    size_t i;
-    point_t new_pt;
-
-    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
-    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
-
-    /* initialize result */
-    bu_vls_trunc(gedp->ged_result_str, 0);
-
-    /* must be wanting help */
-    if (argc == 1) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_HELP;
-    }
-
-    if (argc != 3) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_ERROR;
-    }
-
-    if ((last = strrchr(argv[1], '/')) == NULL)
-       last = (char *)argv[1];
-    else
-       ++last;
-
-    if (last[0] == '\0') {
-       bu_vls_printf(gedp->ged_result_str, "%s: illegal input - %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET);
-    if (dp == RT_DIR_NULL) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    if (bu_sscanf(argv[2], "%zu %zu", &v1_i, &v2_i) != 2) {
-       bu_vls_printf(gedp->ged_result_str, "%s: bad bot edge - %s", argv[0], 
argv[2]);
-       return GED_ERROR;
-    }
-
-    if (wdb_import_from_path2(gedp->ged_result_str, &intern, last, 
gedp->ged_wdbp, mat) == GED_ERROR) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
-       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_BOT) {
-       bu_vls_printf(gedp->ged_result_str, "Object is not a BOT");
-       rt_db_free_internal(&intern);
-
-       return GED_ERROR;
-    }
-
-    botip = (struct rt_bot_internal *)intern.idb_ptr;
-    last_fi = botip->num_faces;
-    last_vi = botip->num_vertices;
-
-    if (v1_i >= botip->num_vertices || v2_i >= botip->num_vertices) {
-       bu_vls_printf(gedp->ged_result_str, "%s: bad bot edge - %s", argv[0], 
argv[2]);
-       rt_db_free_internal(&intern);
-       return GED_ERROR;
-    }
-
-    /*
-     * Create the new point, modify all faces (should only be two)
-     * that share the specified edge and hook in the two extra faces.
-     */
-
-    /* First, create some space */
-    botip->num_vertices++;
-    botip->num_faces += 2;
-    botip->vertices = (fastf_t *)bu_realloc((void *)botip->vertices, 
botip->num_vertices*3*sizeof(fastf_t), "realloc bot vertices");
-    botip->faces = (int *)bu_realloc((void *)botip->faces, 
botip->num_faces*3*sizeof(int), "realloc bot faces");
-
-    /* Create the new point. We're using the average of the edge's points */
-    VADD2(new_pt, &botip->vertices[v1_i*3], &botip->vertices[v2_i*3]);
-    VSCALE(new_pt, new_pt, 0.5);
-
-    /* Add the new point to the last position in the list of vertices. */
-    VMOVE(&botip->vertices[last_vi*3], new_pt);
-
-    /* Update faces associated with the specified edge */
-    for (i = 0; i < last_fi; ++i) {
-       if (((size_t)botip->faces[i*3] == v1_i && (size_t)botip->faces[i*3+1] 
== v2_i) ||
-           ((size_t)botip->faces[i*3] == v2_i && (size_t)botip->faces[i*3+1] 
== v1_i)) {
-
-           save_vi = botip->faces[i*3+1];
-           botip->faces[i*3+1] = last_vi;
-
-           /* Initialize a new face */
-           botip->faces[last_fi*3] = last_vi;
-           botip->faces[last_fi*3+1] = save_vi;
-           botip->faces[last_fi*3+2] = botip->faces[i*3+2];
-
-           ++last_fi;
-       } else if (((size_t)botip->faces[i*3] == v1_i && 
(size_t)botip->faces[i*3+2] == v2_i) ||
-                  ((size_t)botip->faces[i*3] == v2_i && 
(size_t)botip->faces[i*3+2] == v1_i)) {
-           save_vi = botip->faces[i*3];
-           botip->faces[i*3] = last_vi;
-
-           /* Initialize a new face */
-           botip->faces[last_fi*3] = last_vi;
-           botip->faces[last_fi*3+1] = save_vi;
-           botip->faces[last_fi*3+2] = botip->faces[i*3+1];
-
-           ++last_fi;
-       } else if (((size_t)botip->faces[i*3+1] == v1_i && 
(size_t)botip->faces[i*3+2] == v2_i) ||
-                  ((size_t)botip->faces[i*3+1] == v2_i && 
(size_t)botip->faces[i*3+2] == v1_i)) {
-           save_vi = botip->faces[i*3+2];
-           botip->faces[i*3+2] = last_vi;
-
-           /* Initialize a new face */
-           botip->faces[last_fi*3] = botip->faces[i*3];
-           botip->faces[last_fi*3+1] = last_vi;
-           botip->faces[last_fi*3+2] = save_vi;
-
-           ++last_fi;
-       }
-
-       if (last_fi >= botip->num_faces)
-           break;
-    }
-
-    GED_DB_PUT_INTERNAL(gedp, dp, &intern, &rt_uniresource, GED_ERROR);
-    rt_db_free_internal(&intern);
-    return GED_OK;
-}
-
-
-int
-ged_bot_face_split(struct ged *gedp, int argc, const char *argv[])
-{
-    static const char *usage = "bot face";
-    struct directory *dp;
-    static fastf_t sf = 1.0 / 3.0;
-    struct rt_db_internal intern;
-    struct rt_bot_internal *botip;
-    mat_t mat;
-    char *last;
-    size_t face_i;
-    size_t last_vi;
-    size_t save_vi;
-    point_t new_pt;
-
-    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
-    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
-
-    /* initialize result */
-    bu_vls_trunc(gedp->ged_result_str, 0);
-
-    /* must be wanting help */
-    if (argc == 1) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_HELP;
-    }
-
-    if (argc != 3) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_ERROR;
-    }
-
-    if ((last = strrchr(argv[1], '/')) == NULL)
-       last = (char *)argv[1];
-    else
-       ++last;
-
-    if (last[0] == '\0') {
-       bu_vls_printf(gedp->ged_result_str, "%s: illegal input - %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET);
-    if (dp == RT_DIR_NULL) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    if (bu_sscanf(argv[2], "%zu", &face_i) != 1) {
-       bu_vls_printf(gedp->ged_result_str, "%s: bad bot vertex index - %s", 
argv[0], argv[2]);
-       return GED_ERROR;
-    }
-
-    if (wdb_import_from_path2(gedp->ged_result_str, &intern, last, 
gedp->ged_wdbp, mat) == GED_ERROR) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
-       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_BOT) {
-       bu_vls_printf(gedp->ged_result_str, "Object is not a BOT");
-       rt_db_free_internal(&intern);
-
-       return GED_ERROR;
-    }
-
-    botip = (struct rt_bot_internal *)intern.idb_ptr;
-    last_vi = botip->num_vertices;
-
-    if (face_i >= botip->num_faces) {
-       bu_vls_printf(gedp->ged_result_str, "%s: bad bot face index - %s", 
argv[0], argv[2]);
-       rt_db_free_internal(&intern);
-       return GED_ERROR;
-    }
-
-    /* Create the new point, modify face_i and hook in the two extra faces */
-    /* First, create some space */
-    botip->num_vertices++;
-    botip->num_faces += 2;
-    botip->vertices = (fastf_t *)bu_realloc((void *)botip->vertices, 
botip->num_vertices*3*sizeof(fastf_t), "realloc bot vertices");
-    botip->faces = (int *)bu_realloc((void *)botip->faces, 
botip->num_faces*3*sizeof(int), "realloc bot faces");
-
-    /* Create the new point. For the moment, we're using the average of the 
face_i's points */
-    VADD3(new_pt,
-         &botip->vertices[botip->faces[face_i*3]*3],
-         &botip->vertices[botip->faces[face_i*3+1]*3],
-         &botip->vertices[botip->faces[face_i*3+2]*3]);
-    VSCALE(new_pt, new_pt, sf);
-
-    /* Add the new point to the last position in the list of vertices. */
-    VMOVE(&botip->vertices[last_vi*3], new_pt);
-
-    /* Update face_i */
-    save_vi = botip->faces[face_i*3+2];
-    botip->faces[face_i*3+2] = last_vi;
-
-    /* Initialize the two new faces */
-    botip->faces[(botip->num_faces-2)*3] = botip->faces[face_i*3+1];
-    botip->faces[(botip->num_faces-2)*3+1] = save_vi;
-    botip->faces[(botip->num_faces-2)*3+2] = last_vi;
-    botip->faces[(botip->num_faces-1)*3] = save_vi;
-    botip->faces[(botip->num_faces-1)*3+1] = botip->faces[face_i*3];
-    botip->faces[(botip->num_faces-1)*3+2] = last_vi;
-
-    bu_vls_printf(gedp->ged_result_str, "%zu", last_vi);
-
-    GED_DB_PUT_INTERNAL(gedp, dp, &intern, &rt_uniresource, GED_ERROR);
-    rt_db_free_internal(&intern);
-    return GED_OK;
-}
-
-
-int
-ged_find_bot_edge_nearest_pnt(struct ged *gedp, int argc, const char *argv[])
-{
-    static const char *usage = "bot view_xyz";
-    struct rt_db_internal intern;
-    struct rt_bot_internal *botip;
-    mat_t mat;
-    int vi1, vi2;
-    vect_t view;
-
-    /* must be double for scanf */
-    double scan[ELEMENTS_PER_VECT];
-
-    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
-    GED_CHECK_VIEW(gedp, GED_ERROR);
-    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
-
-    /* initialize result */
-    bu_vls_trunc(gedp->ged_result_str, 0);
-
-    /* must be wanting help */
-    if (argc == 1) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_HELP;
-    }
-
-    if (argc != 3) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_ERROR;
-    }
-
-    if (bu_sscanf(argv[2], "%lf %lf %lf", &scan[X], &scan[Y], &scan[Z]) != 3) {
-       bu_vls_printf(gedp->ged_result_str, "%s: bad view location - %s", 
argv[0], argv[2]);
-       return GED_ERROR;
-    }
-    VMOVE(view, scan); /* convert double to fastf_t */
-
-    if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], 
gedp->ged_wdbp, mat) == GED_ERROR) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
-       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_BOT) {
-       bu_vls_printf(gedp->ged_result_str, "Object is not a BOT");
-       rt_db_free_internal(&intern);
-
-       return GED_ERROR;
-    }
-
-    botip = (struct rt_bot_internal *)intern.idb_ptr;
-    (void)rt_bot_find_e_nearest_pt2(&vi1, &vi2, botip, view, 
gedp->ged_gvp->gv_model2view);
-    bu_vls_printf(gedp->ged_result_str, "%d %d", vi1, vi2);
-
-    rt_db_free_internal(&intern);
-    return GED_OK;
-}
-
-
-int
-ged_find_bot_pnt_nearest_pnt(struct ged *gedp, int argc, const char *argv[])
-{
-    static const char *usage = "bot view_xyz";
-    struct rt_db_internal intern;
-    struct rt_bot_internal *botip;
-    mat_t mat;
-    int nearest_pt;
-    vect_t view;
-
-    /* must be double for scanf */
-    double scan[ELEMENTS_PER_VECT];
-
-    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
-    GED_CHECK_VIEW(gedp, GED_ERROR);
-    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
-
-    /* initialize result */
-    bu_vls_trunc(gedp->ged_result_str, 0);
-
-    /* must be wanting help */
-    if (argc == 1) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_HELP;
-    }
-
-    if (argc != 3) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_ERROR;
-    }
-
-    if (bu_sscanf(argv[2], "%lf %lf %lf", &scan[X], &scan[Y], &scan[Z]) != 3) {
-       bu_vls_printf(gedp->ged_result_str, "%s: bad view location - %s", 
argv[0], argv[2]);
-       return GED_ERROR;
-    }
-
-    if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], 
gedp->ged_wdbp, mat) == GED_ERROR) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
-       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_BOT) {
-       bu_vls_printf(gedp->ged_result_str, "Object is not a BOT");
-       rt_db_free_internal(&intern);
-
-       return GED_ERROR;
-    }
-
-    botip = (struct rt_bot_internal *)intern.idb_ptr;
-    VMOVE(view, scan); /* convert double to fastf_t */
-
-    nearest_pt = rt_bot_find_v_nearest_pt2(botip, view, 
gedp->ged_gvp->gv_model2view);
-    bu_vls_printf(gedp->ged_result_str, "%d", nearest_pt);
-
-    rt_db_free_internal(&intern);
-    return GED_OK;
-}
-
-
-int
-ged_get_bot_edges(struct ged *gedp, int argc, const char *argv[])
-{
-    static const char *usage = "bot";
-    struct rt_db_internal intern;
-    struct rt_bot_internal *botip;
-    mat_t mat;
-    size_t edge_count;
-    size_t *edge_list;
-
-    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
-    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
-
-    /* initialize result */
-    bu_vls_trunc(gedp->ged_result_str, 0);
-
-    /* must be wanting help */
-    if (argc == 1) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_HELP;
-    }
-
-    if (argc != 2) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_ERROR;
-    }
-
-    if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], 
gedp->ged_wdbp, mat) == GED_ERROR) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
-       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_BOT) {
-       bu_vls_printf(gedp->ged_result_str, "Object is not a BOT");
-       rt_db_free_internal(&intern);
-
-       return GED_ERROR;
-    }
-
-    botip = (struct rt_bot_internal *)intern.idb_ptr;
-    if ((edge_count = rt_bot_get_edge_list(botip, &edge_list)) > 0) {
-       size_t i;
-
-       for (i = 0; i < edge_count; i++)
-           bu_vls_printf(gedp->ged_result_str, "{%zu %zu} ", edge_list[i*2], 
edge_list[i*2+1]);
-
-       bu_free(edge_list, "bot edge list");
-    }
-
-    rt_db_free_internal(&intern);
-    return GED_OK;
-}
-
-
-int
-ged_bot_move_pnt(struct ged *gedp, int argc, const char *argv[])
-{
-    static const char *usage = "[-r] bot vertex_i pt";
-    struct directory *dp;
-    struct rt_db_internal intern;
-    struct rt_bot_internal *botip;
-    mat_t mat;
-    size_t vertex_i;
-    int rflag = 0;
-    char *last;
-
-    /* must be double for scanf */
-    double pt[ELEMENTS_PER_POINT];
-
-    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
-    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
-
-    /* initialize result */
-    bu_vls_trunc(gedp->ged_result_str, 0);
-
-    /* must be wanting help */
-    if (argc == 1) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_HELP;
-    }
-
-    if (argc < 4 || 5 < argc) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_ERROR;
-    }
-
-    if (argc == 5) {
-       if (argv[1][0] != '-' || argv[1][1] != 'r' || argv[1][2] != '\0') {
-           bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-           return GED_ERROR;
-       }
-
-       rflag = 1;
-       --argc;
-       ++argv;
-    }
-
-    if ((last = strrchr(argv[1], '/')) == NULL)
-       last = (char *)argv[1];
-    else
-       ++last;
-
-    if (last[0] == '\0') {
-       bu_vls_printf(gedp->ged_result_str, "%s: illegal input - %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET);
-    if (dp == RT_DIR_NULL) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    if (bu_sscanf(argv[2], "%zu", &vertex_i) != 1) {
-       bu_vls_printf(gedp->ged_result_str, "%s: bad bot vertex index - %s", 
argv[0], argv[2]);
-       return GED_ERROR;
-    }
-
-    if (bu_sscanf(argv[3], "%lf %lf %lf", &pt[X], &pt[Y], &pt[Z]) != 3) {
-       bu_vls_printf(gedp->ged_result_str, "%s: bad point - %s", argv[0], 
argv[3]);
-       return GED_ERROR;
-    }
-
-    VSCALE(pt, pt, gedp->ged_wdbp->dbip->dbi_local2base);
-
-    if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], 
gedp->ged_wdbp, mat) == GED_ERROR) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
-       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_BOT) {
-       bu_vls_printf(gedp->ged_result_str, "Object is not a BOT");
-       rt_db_free_internal(&intern);
-
-       return GED_ERROR;
-    }
-
-    botip = (struct rt_bot_internal *)intern.idb_ptr;
-
-    if (vertex_i >= botip->num_vertices) {
-       bu_vls_printf(gedp->ged_result_str, "%s: bad bot vertex index - %s", 
argv[0], argv[2]);
-       rt_db_free_internal(&intern);
-       return GED_ERROR;
-    }
-
-    if (rflag) {
-       VADD2(&botip->vertices[vertex_i*3], pt, &botip->vertices[vertex_i*3]);
-    } else {
-       VMOVE(&botip->vertices[vertex_i*3], pt);
-    }
-
-    {
-       mat_t invmat;
-       point_t curr_pt;
-       size_t idx;
-
-       bn_mat_inv(invmat, mat);
-       for (idx = 0; idx < botip->num_vertices; idx++) {
-           MAT4X3PNT(curr_pt, invmat, &botip->vertices[idx*3]);
-           VMOVE(&botip->vertices[idx*3], curr_pt);
-       }
-    }
-
-    GED_DB_PUT_INTERNAL(gedp, dp, &intern, &rt_uniresource, GED_ERROR);
-    rt_db_free_internal(&intern);
-
-    return GED_OK;
-}
-
-
-int
-ged_bot_move_pnts(struct ged *gedp, int argc, const char *argv[])
-{
-    static const char *usage = "bot vec vertex_1 [vertex_2 ... vertex_n]";
-    struct directory *dp;
-    struct rt_db_internal intern;
-    struct rt_bot_internal *botip;
-    mat_t mat;
-    register int i;
-    size_t vertex_i;
-    char *last;
-
-    /* must be double for scanf */
-    double vec[ELEMENTS_PER_VECT];
-
-    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
-    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
-
-    /* initialize result */
-    bu_vls_trunc(gedp->ged_result_str, 0);
-
-    /* must be wanting help */
-    if (argc == 1) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_HELP;
-    }
-
-    if (argc < 4) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_ERROR;
-    }
-
-    if ((last = strrchr(argv[1], '/')) == NULL)
-       last = (char *)argv[1];
-    else
-       ++last;
-
-    if (last[0] == '\0') {
-       bu_vls_printf(gedp->ged_result_str, "%s: illegal input - %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET);
-    if (dp == RT_DIR_NULL) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    if (bu_sscanf(argv[2], "%lf %lf %lf", &vec[X], &vec[Y], &vec[Z]) != 3) {
-       bu_vls_printf(gedp->ged_result_str, "%s: bad vector - %s", argv[0], 
argv[2]);
-       return GED_ERROR;
-    }
-
-    VSCALE(vec, vec, gedp->ged_wdbp->dbip->dbi_local2base);
-
-    if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], 
gedp->ged_wdbp, mat) == GED_ERROR) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
-       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_BOT) {
-       bu_vls_printf(gedp->ged_result_str, "Object is not a BOT");
-       rt_db_free_internal(&intern);
-
-       return GED_ERROR;
-    }
-
-    botip = (struct rt_bot_internal *)intern.idb_ptr;
-
-    for (i = 3; i < argc; ++i) {
-       if (bu_sscanf(argv[i], "%zu", &vertex_i) != 1) {
-           bu_vls_printf(gedp->ged_result_str, "%s: bad bot vertex index - 
%s\n", argv[0], argv[i]);
-           continue;
-       }
-
-       if (vertex_i >= botip->num_vertices) {
-           bu_vls_printf(gedp->ged_result_str, "%s: bad bot vertex index - 
%s\n", argv[0], argv[i]);
-           continue;
-       }
-
-       VADD2(&botip->vertices[vertex_i*3], vec, &botip->vertices[vertex_i*3]);
-    }
-
-    {
-       mat_t invmat;
-       point_t curr_pt;
-       size_t idx;
-
-       bn_mat_inv(invmat, mat);
-       for (idx = 0; idx < botip->num_vertices; idx++) {
-           MAT4X3PNT(curr_pt, invmat, &botip->vertices[idx*3]);
-           VMOVE(&botip->vertices[idx*3], curr_pt);
-       }
-    }
-
-    GED_DB_PUT_INTERNAL(gedp, dp, &intern, &rt_uniresource, GED_ERROR);
-    rt_db_free_internal(&intern);
-
-    return GED_OK;
-}
-
-
-int
-_ged_select_botpts(struct ged *gedp, struct rt_bot_internal *botip, double vx, 
double vy, double vwidth, double vheight, double vminz, int rflag)
-{
-    size_t i;
-    fastf_t vr = 0.0;
-    fastf_t vmin_x = 0.0;
-    fastf_t vmin_y = 0.0;
-    fastf_t vmax_x = 0.0;
-    fastf_t vmax_y = 0.0;
-
-    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
-    GED_CHECK_VIEW(gedp, GED_ERROR);
-
-    if (rflag) {
-       vr = vwidth;
-    } else {
-       vmin_x = vx;
-       vmin_y = vy;
-
-       if (vwidth > 0)
-           vmax_x = vx + vwidth;
-       else {
-           vmin_x = vx + vwidth;
-           vmax_x = vx;
-       }
-
-       if (vheight > 0)
-           vmax_y = vy + vheight;
-       else {
-           vmin_y = vy + vheight;
-           vmax_y = vy;
-       }
-    }
-
-    if (rflag) {
-       for (i = 0; i < botip->num_vertices; i++) {
-           point_t vloc;
-           point_t vpt;
-           vect_t diff;
-           fastf_t mag;
-
-           MAT4X3PNT(vpt, gedp->ged_gvp->gv_model2view, &botip->vertices[i*3]);
-
-           if (vpt[Z] < vminz)
-               continue;
-
-           VSET(vloc, vx, vy, vpt[Z]);
-           VSUB2(diff, vpt, vloc);
-           mag = MAGNITUDE(diff);
-
-           if (mag > vr)
-               continue;
-
-           bu_vls_printf(gedp->ged_result_str, "%zu ", i);
-       }
-    } else {
-       for (i = 0; i < botip->num_vertices; i++) {
-           point_t vpt;
-
-           MAT4X3PNT(vpt, gedp->ged_gvp->gv_model2view, &botip->vertices[i*3]);
-
-           if (vpt[Z] < vminz)
-               continue;
-
-           if (vmin_x <= vpt[X] && vpt[X] <= vmax_x &&
-               vmin_y <= vpt[Y] && vpt[Y] <= vmax_y) {
-               bu_vls_printf(gedp->ged_result_str, "%zu ", i);
-           }
-       }
-    }
-
-    return GED_OK;
-}
-
-/*
- * Local Variables:
- * mode: C
- * tab-width: 8
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */

Deleted: brlcad/branches/gedplugins/src/libged/edit_metaball.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/edit_metaball.c       2020-07-22 
17:27:42 UTC (rev 76425)
+++ brlcad/branches/gedplugins/src/libged/edit_metaball.c       2020-07-22 
19:44:43 UTC (rev 76426)
@@ -1,662 +0,0 @@
-/*                         E D I T _ M E T A B A L L . C
- * BRL-CAD
- *
- * Copyright (c) 2008-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-/** @file libged/edit_metaball.c
- *
- * Functions -
- *
- *
- */
-
-#include "common.h"
-
-#include <string.h>
-
-#include "bu/cmd.h"
-#include "rt/geom.h"
-#include "raytrace.h"
-#include "wdb.h"
-
-#include "./ged_private.h"
-
-
-#define GED_METABALL_SCALE(_d, _scale) \
-    if ((_scale) < 0.0) \
-       (_d) = -(_scale); \
-    else                 \
-       (_d) *= (_scale);
-
-
-/*
- * Returns the index for the metaball point matching mbpp.
- */
-int
-_ged_get_metaball_i_pnt(struct rt_metaball_internal *mbip, struct 
wdb_metaball_pnt *mbpp)
-{
-    struct wdb_metaball_pnt *curr_mbpp;
-    int mbp_i = 0;
-
-    for (BU_LIST_FOR(curr_mbpp, wdb_metaball_pnt, &mbip->metaball_ctrl_head)) {
-       if (curr_mbpp == mbpp)
-           return mbp_i;
-
-       ++mbp_i;
-    }
-
-    return -1;
-}
-
-
-/*
- * Returns point mbp_i.
- */
-struct wdb_metaball_pnt *
-_ged_get_metaball_pt_i(struct rt_metaball_internal *mbip, int mbp_i)
-{
-    int i = 0;
-    struct wdb_metaball_pnt *curr_mbpp;
-
-    for (BU_LIST_FOR(curr_mbpp, wdb_metaball_pnt, &mbip->metaball_ctrl_head)) {
-       if (i == mbp_i)
-           return curr_mbpp;
-
-       ++i;
-    }
-
-    return (struct wdb_metaball_pnt *)NULL;
-}
-
-
-int
-_ged_set_metaball(struct ged *gedp, struct rt_metaball_internal *mbip, const 
char *attribute, fastf_t sf)
-{
-    RT_METABALL_CK_MAGIC(mbip);
-
-    switch (attribute[0]) {
-       case 'm':
-       case 'M':
-           if (sf <= METABALL_METABALL)
-               mbip->method = METABALL_METABALL;
-           else if (sf >= METABALL_BLOB)
-               mbip->method = METABALL_BLOB;
-           else
-               mbip->method = (int)sf;
-
-           break;
-       case 't':
-       case 'T':
-           if (sf < 0)
-               mbip->threshold = -sf;
-           else
-               mbip->threshold = sf;
-
-           break;
-       default:
-           bu_vls_printf(gedp->ged_result_str, "bad metaball attribute - %s", 
attribute);
-           return GED_ERROR;
-    }
-
-    return GED_OK;
-}
-
-
-int
-_ged_scale_metaball(struct ged *gedp, struct rt_metaball_internal *mbip, const 
char *attribute, fastf_t sf, int rflag)
-{
-    int mbp_i;
-    struct wdb_metaball_pnt *mbpp;
-
-    RT_METABALL_CK_MAGIC(mbip);
-
-    if (!rflag && sf > 0)
-       sf = -sf;
-
-    switch (attribute[0]) {
-       case 'f':
-       case 'F':
-           if (sscanf(attribute+1, "%d", &mbp_i) != 1)
-               mbp_i = 0;
-
-           if ((mbpp = _ged_get_metaball_pt_i(mbip, mbp_i)) == (struct 
wdb_metaball_pnt *)NULL)
-               return GED_ERROR;
-
-           BU_CKMAG(mbpp, WDB_METABALLPT_MAGIC, "wdb_metaball_pnt");
-           GED_METABALL_SCALE(mbpp->fldstr, sf);
-
-           break;
-       case 's':
-       case 'S':
-           if (sscanf(attribute+1, "%d", &mbp_i) != 1)
-               mbp_i = 0;
-
-           if ((mbpp = _ged_get_metaball_pt_i(mbip, mbp_i)) == (struct 
wdb_metaball_pnt *)NULL)
-               return GED_ERROR;
-
-           BU_CKMAG(mbpp, WDB_METABALLPT_MAGIC, "wdb_metaball_pnt");
-           GED_METABALL_SCALE(mbpp->sweat, sf);
-
-           break;
-       default:
-           bu_vls_printf(gedp->ged_result_str, "bad metaball attribute - %s", 
attribute);
-           return GED_ERROR;
-    }
-
-    return GED_OK;
-}
-
-
-struct wdb_metaball_pnt *
-find_metaball_pnt_nearest_pnt(const struct bu_list *metaball_hd, const point_t 
model_pt, matp_t view2model)
-{
-    struct wdb_metaball_pnt *mbpp;
-    struct wdb_metaball_pnt *nearest=(struct wdb_metaball_pnt *)NULL;
-    struct bn_tol tmp_tol;
-    fastf_t min_dist = MAX_FASTF;
-    vect_t dir, work;
-
-    tmp_tol.magic = BN_TOL_MAGIC;
-    tmp_tol.dist = 0.0;
-    tmp_tol.dist_sq = tmp_tol.dist * tmp_tol.dist;
-    tmp_tol.perp = 0.0;
-    tmp_tol.para = 1.0 - tmp_tol.perp;
-
-    /* get a direction vector in model space corresponding to z-direction in 
view */
-    VSET(work, 0.0, 0.0, 1.0);
-    MAT4X3VEC(dir, view2model, work);
-
-    for (BU_LIST_FOR(mbpp, wdb_metaball_pnt, metaball_hd)) {
-       fastf_t dist;
-
-       dist = bn_dist_line3_pnt3(model_pt, dir, mbpp->coord);
-       if (dist < min_dist) {
-           min_dist = dist;
-           nearest = mbpp;
-       }
-    }
-
-    return nearest;
-}
-
-
-int
-ged_find_metaball_pnt_nearest_pnt(struct ged *gedp, int argc, const char 
*argv[])
-{
-    struct directory *dp;
-    static const char *usage = "metaball x y z";
-    struct rt_db_internal intern;
-    struct wdb_metaball_pnt *nearest;
-    point_t model_pt;
-    double scan[3];
-    mat_t mat;
-    int pt_i;
-    const char *last;
-
-    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
-    GED_CHECK_VIEW(gedp, GED_ERROR);
-    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
-
-    /* initialize result */
-    bu_vls_trunc(gedp->ged_result_str, 0);
-
-    /* must be wanting help */
-    if (argc == 1) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_HELP;
-    }
-
-    if (argc != 3 && argc != 5) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_ERROR;
-    }
-
-    if ((last = strrchr(argv[1], '/')) == NULL)
-       last = argv[1];
-    else
-       ++last;
-
-    if (last[0] == '\0') {
-       bu_vls_printf(gedp->ged_result_str, "%s: illegal input - %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET);
-    if (dp == RT_DIR_NULL) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    if (argc == 3) {
-       if (sscanf(argv[2], "%lf %lf %lf", &scan[X], &scan[Y], &scan[Z]) != 3) {
-           bu_vls_printf(gedp->ged_result_str, "%s: bad point - %s", argv[0], 
argv[2]);
-           return GED_ERROR;
-       }
-    } else if (sscanf(argv[2], "%lf", &scan[X]) != 1 ||
-              sscanf(argv[3], "%lf", &scan[Y]) != 1 ||
-              sscanf(argv[4], "%lf", &scan[Z]) != 1) {
-       bu_vls_printf(gedp->ged_result_str, "%s: bad X, Y or Z", argv[0]);
-       return GED_ERROR;
-    }
-    /* convert from double to fastf_t */
-    VMOVE(model_pt, scan);
-
-    if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], 
gedp->ged_wdbp, mat) == GED_ERROR)
-       return GED_ERROR;
-
-    nearest = find_metaball_pnt_nearest_pnt(&((struct rt_metaball_internal 
*)intern.idb_ptr)->metaball_ctrl_head,
-                                           model_pt, 
gedp->ged_gvp->gv_view2model);
-    pt_i = _ged_get_metaball_i_pnt((struct rt_metaball_internal 
*)intern.idb_ptr, nearest);
-    rt_db_free_internal(&intern);
-
-    if (pt_i < 0) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to find point for %s", 
argv[0], argv[1]);
-       return GED_ERROR;
-    }
-
-    bu_vls_printf(gedp->ged_result_str, "%d", pt_i);
-    return GED_OK;
-}
-
-
-struct wdb_metaball_pnt *
-_ged_metaball_add_pnt(struct rt_metaball_internal *mbip, struct 
wdb_metaball_pnt *mbp, const point_t new_pt)
-{
-    struct wdb_metaball_pnt *last;
-    struct wdb_metaball_pnt *newmbp;
-
-    RT_METABALL_CK_MAGIC(mbip);
-
-    if (mbp) {
-       BU_CKMAG(mbp, WDB_METABALLPT_MAGIC, "metaball point");
-       last = mbp;
-    } else {
-       /* add new point to end of metaball solid */
-       last = BU_LIST_LAST(wdb_metaball_pnt, &mbip->metaball_ctrl_head);
-
-       if (last->l.magic == BU_LIST_HEAD_MAGIC) {
-           BU_GET(newmbp, struct wdb_metaball_pnt);
-           newmbp->l.magic = WDB_METABALLPT_MAGIC;
-           newmbp->fldstr = 1.0;
-           newmbp->sweat = 1.0;
-           VMOVE(newmbp->coord, new_pt);
-           BU_LIST_INSERT(&mbip->metaball_ctrl_head, &newmbp->l);
-           return newmbp;
-       }
-    }
-
-    /* build new point */
-    BU_GET(newmbp, struct wdb_metaball_pnt);
-    newmbp->l.magic = WDB_METABALLPT_MAGIC;
-    newmbp->fldstr = 1.0;
-    newmbp->sweat = 1.0;
-    VMOVE(newmbp->coord, new_pt);
-
-    if (mbp) {
-       /* append after current point */
-       BU_LIST_APPEND(&mbp->l, &newmbp->l);
-    } else {
-       /* add to end of metaball solid */
-       BU_LIST_INSERT(&mbip->metaball_ctrl_head, &newmbp->l);
-    }
-
-    return newmbp;
-}
-
-
-int
-ged_metaball_add_pnt(struct ged *gedp, int argc, const char *argv[])
-{
-    struct directory *dp;
-    static const char *usage = "metaball pt";
-    struct rt_db_internal intern;
-    struct rt_metaball_internal *mbip;
-    mat_t mat;
-    point_t view_mb_pt;
-    point_t view_coord;
-    point_t mb_pt;
-    struct wdb_metaball_pnt *lastmbp;
-    double scan[3];
-    const char *last;
-
-    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
-    GED_CHECK_VIEW(gedp, GED_ERROR);
-    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
-
-    /* initialize result */
-    bu_vls_trunc(gedp->ged_result_str, 0);
-
-    /* must be wanting help */
-    if (argc == 1) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_HELP;
-    }
-
-    if (argc != 3) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_ERROR;
-    }
-
-    if ((last = strrchr(argv[1], '/')) == NULL)
-       last = argv[1];
-    else
-       ++last;
-
-    if (last[0] == '\0') {
-       bu_vls_printf(gedp->ged_result_str, "%s: illegal input - %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET);
-    if (dp == RT_DIR_NULL) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    if (sscanf(argv[2], "%lf %lf %lf", &scan[X], &scan[Y], &scan[Z]) != 3) {
-       bu_vls_printf(gedp->ged_result_str, "%s: bad point - %s", argv[0], 
argv[2]);
-       return GED_ERROR;
-    }
-    /* convert from double to fastf_t */
-    VMOVE(view_mb_pt, scan);
-
-    if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], 
gedp->ged_wdbp, mat) == GED_ERROR)
-       return GED_ERROR;
-
-    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
-       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_METABALL) {
-       bu_vls_printf(gedp->ged_result_str, "Object not a METABALL");
-       rt_db_free_internal(&intern);
-
-       return GED_ERROR;
-    }
-
-    mbip = (struct rt_metaball_internal *)intern.idb_ptr;
-
-    /* use the view z from the last metaball point */
-    lastmbp = BU_LIST_LAST(wdb_metaball_pnt, &mbip->metaball_ctrl_head);
-
-    MAT4X3PNT(view_coord, gedp->ged_gvp->gv_model2view, lastmbp->coord);
-    view_mb_pt[Z] = view_coord[Z];
-    MAT4X3PNT(mb_pt, gedp->ged_gvp->gv_view2model, view_mb_pt);
-
-    if (_ged_metaball_add_pnt(mbip, (struct wdb_metaball_pnt *)NULL, mb_pt) == 
(struct wdb_metaball_pnt *)NULL) {
-       rt_db_free_internal(&intern);
-       bu_vls_printf(gedp->ged_result_str, "%s: cannot move point there", 
argv[0]);
-       return GED_ERROR;
-    }
-
-    {
-       mat_t invmat;
-       struct wdb_metaball_pnt *curr_mbp;
-       point_t curr_pt;
-
-       bn_mat_inv(invmat, mat);
-       for (BU_LIST_FOR(curr_mbp, wdb_metaball_pnt, 
&mbip->metaball_ctrl_head)) {
-           MAT4X3PNT(curr_pt, invmat, curr_mbp->coord);
-           VMOVE(curr_mbp->coord, curr_pt);
-       }
-
-       GED_DB_PUT_INTERNAL(gedp, dp, &intern, &rt_uniresource, GED_ERROR);
-    }
-
-    rt_db_free_internal(&intern);
-    return GED_OK;
-}
-
-
-struct wdb_metaball_pnt *
-_ged_metaball_delete_pnt(struct wdb_metaball_pnt *mbp)
-{
-    struct wdb_metaball_pnt *next;
-    struct wdb_metaball_pnt *prev;
-    struct wdb_metaball_pnt *head;
-
-    BU_CKMAG(mbp, WDB_METABALLPT_MAGIC, "metaball point");
-
-    /* Find the head */
-    head = mbp;
-    while (head->l.magic != BU_LIST_HEAD_MAGIC)
-       head = BU_LIST_NEXT(wdb_metaball_pnt, &head->l);
-
-    next = BU_LIST_NEXT(wdb_metaball_pnt, &mbp->l);
-    if (next->l.magic == BU_LIST_HEAD_MAGIC)
-       next = (struct wdb_metaball_pnt *)NULL;
-
-    prev = BU_LIST_PREV(wdb_metaball_pnt, &mbp->l);
-    if (prev->l.magic == BU_LIST_HEAD_MAGIC)
-       prev = (struct wdb_metaball_pnt *)NULL;
-
-    if (!prev && !next) {
-       return mbp;
-    }
-
-    BU_LIST_DEQUEUE(&mbp->l);
-
-    BU_PUT(mbp, struct wdb_metaball_pnt);
-
-    if (prev)
-       return prev;
-    else
-       return next;
-
-}
-
-
-int
-ged_metaball_delete_pnt(struct ged *gedp, int argc, const char *argv[])
-{
-    struct directory *dp;
-    static const char *usage = "metaball pt_i";
-    struct rt_db_internal intern;
-    struct wdb_metaball_pnt *mbp;
-    struct rt_metaball_internal *mbip;
-    int pt_i;
-    const char *last;
-
-    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
-    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
-
-    /* initialize result */
-    bu_vls_trunc(gedp->ged_result_str, 0);
-
-    /* must be wanting help */
-    if (argc == 1) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_HELP;
-    }
-
-    if (argc != 3) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_ERROR;
-    }
-
-    if ((last = strrchr(argv[1], '/')) == NULL)
-       last = argv[1];
-    else
-       ++last;
-
-    if (last[0] == '\0') {
-       bu_vls_printf(gedp->ged_result_str, "%s: illegal input - %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET);
-    if (dp == RT_DIR_NULL) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    if (sscanf(argv[2], "%d", &pt_i) != 1) {
-       bu_vls_printf(gedp->ged_result_str, "%s: bad metaball point index - 
%s", argv[0], argv[3]);
-       return GED_ERROR;
-    }
-
-    if (rt_db_get_internal(&intern, dp, gedp->ged_wdbp->dbip, (fastf_t *)NULL, 
&rt_uniresource) < 0) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to get internal for 
%s", argv[0], argv[1]);
-       return GED_ERROR;
-    }
-
-    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
-       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_METABALL) {
-       bu_vls_printf(gedp->ged_result_str, "%s is not a METABALL", argv[1]);
-       rt_db_free_internal(&intern);
-
-       return GED_ERROR;
-    }
-
-    mbip = (struct rt_metaball_internal *)intern.idb_ptr;
-    if ((mbp = _ged_get_metaball_pt_i(mbip, pt_i)) == (struct wdb_metaball_pnt 
*)NULL) {
-       rt_db_free_internal(&intern);
-       bu_vls_printf(gedp->ged_result_str, "%s: bad metaball point index - 
%s", argv[0], argv[2]);
-       return GED_ERROR;
-    }
-
-    if (_ged_metaball_delete_pnt(mbp) == mbp) {
-       rt_db_free_internal(&intern);
-       bu_vls_printf(gedp->ged_result_str, "%s: cannot delete last metaball 
point %d", argv[0], pt_i);
-       return GED_ERROR;
-    }
-
-    GED_DB_PUT_INTERNAL(gedp, dp, &intern, &rt_uniresource, GED_ERROR);
-
-    rt_db_free_internal(&intern);
-    return GED_OK;
-}
-
-
-int
-ged_metaball_move_pnt(struct ged *gedp, int argc, const char *argv[])
-{
-    struct directory *dp;
-    static const char *usage = "[-r] metaball seg_i pt";
-    struct rt_db_internal intern;
-    struct wdb_metaball_pnt *mbp;
-    struct rt_metaball_internal *mbip;
-    mat_t mat;
-    point_t mb_pt;
-    double scan[3];
-    int seg_i;
-    int rflag = 0;
-    const char *last;
-
-    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
-    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
-
-    /* initialize result */
-    bu_vls_trunc(gedp->ged_result_str, 0);
-
-    /* must be wanting help */
-    if (argc == 1) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_HELP;
-    }
-
-    if (argc < 4 || 5 < argc) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_ERROR;
-    }
-
-    if (argc == 5) {
-       if (argv[1][0] != '-' || argv[1][1] != 'r' || argv[1][2] != '\0') {
-           bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-           return GED_ERROR;
-       }
-
-       rflag = 1;
-       --argc;
-       ++argv;
-    }
-
-    if ((last = strrchr(argv[1], '/')) == NULL)
-       last = argv[1];
-    else
-       ++last;
-
-    if (last[0] == '\0') {
-       bu_vls_printf(gedp->ged_result_str, "%s: illegal input - %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET);
-    if (dp == RT_DIR_NULL) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    if (sscanf(argv[2], "%d", &seg_i) != 1) {
-       bu_vls_printf(gedp->ged_result_str, "%s: bad metaball point index - 
%s", argv[0], argv[2]);
-       return GED_ERROR;
-    }
-
-    if (sscanf(argv[3], "%lf %lf %lf", &scan[X], &scan[Y], &scan[Z]) != 3) {
-       bu_vls_printf(gedp->ged_result_str, "%s: bad point - %s", argv[0], 
argv[3]);
-       return GED_ERROR;
-    }
-    VSCALE(mb_pt, scan, gedp->ged_wdbp->dbip->dbi_local2base);
-
-    if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], 
gedp->ged_wdbp, mat) == GED_ERROR)
-       return GED_ERROR;
-
-    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
-       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_METABALL) {
-       bu_vls_printf(gedp->ged_result_str, "Object not a METABALL");
-       rt_db_free_internal(&intern);
-
-       return GED_ERROR;
-    }
-
-    mbip = (struct rt_metaball_internal *)intern.idb_ptr;
-    if ((mbp = _ged_get_metaball_pt_i(mbip, seg_i)) == (struct 
wdb_metaball_pnt *)NULL) {
-       rt_db_free_internal(&intern);
-       bu_vls_printf(gedp->ged_result_str, "%s: bad metaball point index - 
%s", argv[0], argv[2]);
-       return GED_ERROR;
-    }
-
-    if (rflag) {
-       VADD2(mb_pt, mb_pt, mbp->coord);
-    }
-
-    VMOVE(mbp->coord, mb_pt);
-
-    {
-       mat_t invmat;
-       struct wdb_metaball_pnt *curr_mbp;
-       point_t curr_pt;
-
-       bn_mat_inv(invmat, mat);
-       for (BU_LIST_FOR(curr_mbp, wdb_metaball_pnt, 
&mbip->metaball_ctrl_head)) {
-           MAT4X3PNT(curr_pt, invmat, curr_mbp->coord);
-           VMOVE(curr_mbp->coord, curr_pt);
-       }
-
-       GED_DB_PUT_INTERNAL(gedp, dp, &intern, &rt_uniresource, GED_ERROR);
-    }
-
-    rt_db_free_internal(&intern);
-    return GED_OK;
-}
-
-/*
- * Local Variables:
- * mode: C
- * tab-width: 8
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */

Deleted: brlcad/branches/gedplugins/src/libged/edpipe.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/edpipe.c      2020-07-22 17:27:42 UTC 
(rev 76425)
+++ brlcad/branches/gedplugins/src/libged/edpipe.c      2020-07-22 19:44:43 UTC 
(rev 76426)
@@ -1,978 +0,0 @@
-/*                        E D P I P E . C
- * BRL-CAD
- *
- * Copyright (c) 1995-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-/** @file libged/edpipe.c
- *
- * Functions -
- *
- * pipe_split_pnt - split a pipe segment at a given point
- *
- * find_pipe_pnt_nearest_pnt - find which segment of a pipe is nearest
- * the ray from "pt" in the viewing direction (for segment selection
- * in MGED)
- */
-
-#include "common.h"
-
-#include <math.h>
-#include <string.h>
-
-#include "vmath.h"
-#include "nmg.h"
-#include "rt/geom.h"
-#include "ged.h"
-#include "wdb.h"
-
-#include "./ged_private.h"
-
-/*
- * Returns the index for the pipe segment matching ps.
- */
-int
-_ged_get_pipe_i_seg(struct rt_pipe_internal *pipeip, struct wdb_pipe_pnt *ps)
-{
-    struct wdb_pipe_pnt *curr_ps;
-    int seg_i = 0;
-
-    for (BU_LIST_FOR(curr_ps, wdb_pipe_pnt, &pipeip->pipe_segs_head)) {
-       if (curr_ps == ps)
-           return seg_i;
-
-       ++seg_i;
-    }
-
-    return -1;
-}
-
-
-/*
- * Returns segment seg_i.
- */
-struct wdb_pipe_pnt *
-_ged_get_pipe_seg_i(struct rt_pipe_internal *pipeip, int seg_i)
-{
-    int i = 0;
-    struct wdb_pipe_pnt *curr_ps;
-
-    for (BU_LIST_FOR(curr_ps, wdb_pipe_pnt, &pipeip->pipe_segs_head)) {
-       if (i == seg_i)
-           return curr_ps;
-
-       ++i;
-    }
-
-    return (struct wdb_pipe_pnt *)NULL;
-}
-
-
-void
-pipe_split_pnt(struct bu_list *UNUSED(pipe_hd), struct wdb_pipe_pnt 
*UNUSED(ps), fastf_t *UNUSED(new_pt))
-{
-    bu_log("WARNING: pipe splitting unimplemented\n");
-}
-
-
-static fastf_t
-edpipe_scale(fastf_t d, fastf_t scale)
-{
-    if (scale < 0.0) {
-       /* negative value sets the scale */
-       return (-scale);
-    }
-
-    /* positive value gets multiplied */
-    return (d * scale);
-}
-
-
-void
-pipe_scale_od(struct rt_pipe_internal *pipeip, fastf_t scale)
-{
-    struct wdb_pipe_pnt *ps;
-
-    RT_PIPE_CK_MAGIC(pipeip);
-
-    /* check that this can be done */
-    for (BU_LIST_FOR(ps, wdb_pipe_pnt, &pipeip->pipe_segs_head)) {
-       fastf_t tmp_od;
-
-       tmp_od = edpipe_scale(ps->pp_od, scale);
-
-       if (ps->pp_id > tmp_od) {
-           /* Silently ignore */
-           return;
-       }
-       if (tmp_od > 2.0*ps->pp_bendradius) {
-           /* Silently ignore */
-           return;
-       }
-    }
-
-    for (BU_LIST_FOR(ps, wdb_pipe_pnt, &pipeip->pipe_segs_head)) {
-       ps->pp_od = edpipe_scale(ps->pp_od, scale);
-    }
-}
-
-
-void
-pipe_scale_id(struct rt_pipe_internal *pipeip, fastf_t scale)
-{
-    struct wdb_pipe_pnt *ps;
-
-    RT_PIPE_CK_MAGIC(pipeip);
-
-    /* check that this can be done */
-    for (BU_LIST_FOR(ps, wdb_pipe_pnt, &pipeip->pipe_segs_head)) {
-       fastf_t tmp_id;
-
-       tmp_id = edpipe_scale(ps->pp_id, scale);
-
-       if (ps->pp_od < tmp_id) {
-           /* Silently ignore */
-           return;
-       }
-       if (tmp_id > 2.0*ps->pp_bendradius) {
-           /* Silently ignore */
-           return;
-       }
-    }
-
-    for (BU_LIST_FOR(ps, wdb_pipe_pnt, &pipeip->pipe_segs_head)) {
-       ps->pp_id = edpipe_scale(ps->pp_id, scale);
-    }
-}
-
-
-void
-pipe_seg_scale_od(struct wdb_pipe_pnt *ps, fastf_t scale)
-{
-    fastf_t tmp_od;
-
-    BU_CKMAG(ps, WDB_PIPESEG_MAGIC, "pipe segment");
-
-    tmp_od = edpipe_scale(ps->pp_od, scale);
-
-    /* need to check that the new OD is not less than ID
-     * of any affected segment.
-     */
-    if (ps->pp_id > tmp_od) {
-       bu_log("Cannot make OD smaller than ID\n");
-       return;
-    }
-    if (tmp_od > 2.0*ps->pp_bendradius) {
-       bu_log("Cannot make outer radius greater than bend radius\n");
-       return;
-    }
-
-    ps->pp_od = edpipe_scale(ps->pp_od, scale);
-}
-
-
-void
-pipe_seg_scale_id(struct wdb_pipe_pnt *ps, fastf_t scale)
-{
-    fastf_t tmp_id;
-
-    BU_CKMAG(ps, WDB_PIPESEG_MAGIC, "pipe segment");
-
-    tmp_id = edpipe_scale(ps->pp_id, scale);
-
-    /* need to check that the new ID is not greater than OD */
-    if (ps->pp_od < tmp_id) {
-       bu_log( "Cannot make ID greater than OD\n");
-       return;
-    }
-    if (tmp_id > 2.0*ps->pp_bendradius) {
-       bu_log("Cannot make inner radius greater than bend radius\n");
-       return;
-    }
-
-    ps->pp_id = edpipe_scale(ps->pp_id, scale);
-}
-
-
-void
-pipe_seg_scale_radius(struct wdb_pipe_pnt *ps, fastf_t scale)
-{
-    fastf_t old_radius;
-    struct wdb_pipe_pnt *head;
-
-    BU_CKMAG(ps, WDB_PIPESEG_MAGIC, "pipe point");
-
-    head = ps;
-    while (head->l.magic != BU_LIST_HEAD_MAGIC)
-       head = BU_LIST_NEXT(wdb_pipe_pnt, &head->l);
-
-    /* make sure we can make this change */
-    old_radius = ps->pp_bendradius;
-
-    ps->pp_bendradius = edpipe_scale(ps->pp_bendradius, scale);
-
-    if (ps->pp_bendradius < ps->pp_od * 0.5) {
-       bu_log("Cannot make bend radius less than pipe outer radius\n");
-       ps->pp_bendradius = old_radius;
-       return;
-    }
-
-    if (rt_pipe_ck(&head->l)) {
-       /* won't work, go back to original radius */
-       ps->pp_bendradius = old_radius;
-       return;
-    }
-}
-
-
-void
-pipe_scale_radius(struct rt_pipe_internal *pipeip, fastf_t scale)
-{
-    struct bu_list head;
-    struct wdb_pipe_pnt *old_ps, *new_ps;
-
-    RT_PIPE_CK_MAGIC(pipeip);
-
-    /* make a quick check for minimum bend radius */
-    for (BU_LIST_FOR(old_ps, wdb_pipe_pnt, &pipeip->pipe_segs_head)) {
-       if (scale < 0.0) {
-           if ((-scale) < old_ps->pp_od * 0.5) {
-               bu_log("Cannot make bend radius less than pipe outer radius\n");
-               return;
-           }
-       } else {
-           if (old_ps->pp_bendradius * scale < old_ps->pp_od * 0.5) {
-               bu_log("Cannot make bend radius less than pipe outer radius\n");
-               return;
-           }
-       }
-    }
-
-    /* make temporary copy of this pipe solid */
-    BU_LIST_INIT(&head);
-    for (BU_LIST_FOR(old_ps, wdb_pipe_pnt, &pipeip->pipe_segs_head)) {
-       BU_GET(new_ps, struct wdb_pipe_pnt);
-       *new_ps = (*old_ps);
-       BU_LIST_APPEND(&head, &new_ps->l);
-    }
-
-    /* make the desired editing changes to the copy */
-    for (BU_LIST_FOR(new_ps, wdb_pipe_pnt, &head)) {
-       new_ps->pp_bendradius = edpipe_scale(new_ps->pp_bendradius, scale);
-    }
-
-    /* check if the copy is O.K. */
-    if (rt_pipe_ck(&head)) {
-       /* won't work, go back to original */
-       while (BU_LIST_NON_EMPTY(&head)) {
-           new_ps = BU_LIST_FIRST(wdb_pipe_pnt, &head);
-           BU_LIST_DEQUEUE(&new_ps->l);
-           BU_PUT(new_ps, struct wdb_pipe_pnt);
-       }
-       return;
-    }
-
-    /* free temporary pipe solid */
-    while (BU_LIST_NON_EMPTY(&head)) {
-       new_ps = BU_LIST_FIRST(wdb_pipe_pnt, &head);
-       BU_LIST_DEQUEUE(&new_ps->l);
-       BU_PUT(new_ps, struct wdb_pipe_pnt);
-    }
-
-    /* make changes to the original */
-    for (BU_LIST_FOR(old_ps, wdb_pipe_pnt, &pipeip->pipe_segs_head)) {
-       old_ps->pp_bendradius = edpipe_scale(old_ps->pp_bendradius, scale);
-    }
-}
-
-
-struct wdb_pipe_pnt *
-find_pipe_pnt_nearest_pnt(const struct bu_list *pipe_hd, const point_t 
model_pt, matp_t view2model)
-{
-    struct wdb_pipe_pnt *ps;
-    struct wdb_pipe_pnt *nearest=(struct wdb_pipe_pnt *)NULL;
-    struct bn_tol tmp_tol;
-    fastf_t min_dist = MAX_FASTF;
-    vect_t dir, work;
-
-    tmp_tol.magic = BN_TOL_MAGIC;
-    tmp_tol.dist = 0.0;
-    tmp_tol.dist_sq = tmp_tol.dist * tmp_tol.dist;
-    tmp_tol.perp = 0.0;
-    tmp_tol.para = 1.0 - tmp_tol.perp;
-
-    /* get a direction vector in model space corresponding to z-direction in 
view */
-    VSET(work, 0.0, 0.0, 1.0);
-    MAT4X3VEC(dir, view2model, work);
-
-    for (BU_LIST_FOR(ps, wdb_pipe_pnt, pipe_hd)) {
-       fastf_t dist;
-
-       dist = bn_dist_line3_pnt3(model_pt, dir, ps->pp_coord);
-       if (dist < min_dist) {
-           min_dist = dist;
-           nearest = ps;
-       }
-    }
-
-    return nearest;
-}
-
-
-struct wdb_pipe_pnt *
-_ged_pipe_add_pnt(struct rt_pipe_internal *pipeip, struct wdb_pipe_pnt *pp, 
const point_t new_pt)
-{
-    struct wdb_pipe_pnt *last;
-    struct wdb_pipe_pnt *newpp;
-
-    RT_PIPE_CK_MAGIC(pipeip);
-
-    if (pp) {
-       BU_CKMAG(pp, WDB_PIPESEG_MAGIC, "pipe point");
-       last = pp;
-    } else {
-       /* add new point to end of pipe solid */
-       last = BU_LIST_LAST(wdb_pipe_pnt, &pipeip->pipe_segs_head);
-
-       if (last->l.magic == BU_LIST_HEAD_MAGIC) {
-           BU_GET(newpp, struct wdb_pipe_pnt);
-           newpp->l.magic = WDB_PIPESEG_MAGIC;
-           newpp->pp_od = 30.0;
-           newpp->pp_id = 0.0;
-           newpp->pp_bendradius = 40.0;
-           VMOVE(newpp->pp_coord, new_pt);
-           BU_LIST_INSERT(&pipeip->pipe_segs_head, &newpp->l);
-           return newpp;
-       }
-    }
-
-    /* build new point */
-    BU_GET(newpp, struct wdb_pipe_pnt);
-    newpp->l.magic = WDB_PIPESEG_MAGIC;
-    newpp->pp_od = last->pp_od;
-    newpp->pp_id = last->pp_id;
-    newpp->pp_bendradius = last->pp_bendradius;
-    VMOVE(newpp->pp_coord, new_pt);
-
-    if (pp) {
-       /* append after current point */
-       BU_LIST_APPEND(&pp->l, &newpp->l);
-    } else {
-       /* add to end of pipe solid */
-       BU_LIST_INSERT(&pipeip->pipe_segs_head, &newpp->l);
-    }
-
-    if (rt_pipe_ck(&pipeip->pipe_segs_head)) {
-       /* won't work here, so refuse to do it */
-       BU_LIST_DEQUEUE(&newpp->l);
-       BU_PUT(newpp, struct wdb_pipe_pnt);
-       return pp;
-    }
-
-    return newpp;
-}
-
-
-struct wdb_pipe_pnt *
-_ged_pipe_ins_pnt(struct rt_pipe_internal *pipeip, struct wdb_pipe_pnt *pp, 
const point_t new_pt)
-{
-    struct wdb_pipe_pnt *first;
-    struct wdb_pipe_pnt *newpp;
-
-    RT_PIPE_CK_MAGIC(pipeip);
-
-    if (pp) {
-       BU_CKMAG(pp, WDB_PIPESEG_MAGIC, "pipe point");
-       first = pp;
-    } else {
-       /* insert new point at start of pipe solid */
-       first = BU_LIST_FIRST(wdb_pipe_pnt, &pipeip->pipe_segs_head);
-
-       if (first->l.magic == BU_LIST_HEAD_MAGIC) {
-           BU_GET(newpp, struct wdb_pipe_pnt);
-           newpp->l.magic = WDB_PIPESEG_MAGIC;
-           newpp->pp_od = 30.0;
-           newpp->pp_id = 0.0;
-           newpp->pp_bendradius = 40.0;
-           VMOVE(newpp->pp_coord, new_pt);
-           BU_LIST_APPEND(&pipeip->pipe_segs_head, &newpp->l);
-           return newpp;
-       }
-    }
-
-    /* build new point */
-    BU_GET(newpp, struct wdb_pipe_pnt);
-    newpp->l.magic = WDB_PIPESEG_MAGIC;
-    newpp->pp_od = first->pp_od;
-    newpp->pp_id = first->pp_id;
-    newpp->pp_bendradius = first->pp_bendradius;
-    VMOVE(newpp->pp_coord, new_pt);
-
-    if (pp) {
-       /* insert before current point */
-       BU_LIST_INSERT(&pp->l, &newpp->l);
-    } else {
-       /* add to start of pipe */
-       BU_LIST_APPEND(&pipeip->pipe_segs_head, &newpp->l);
-    }
-
-    if (rt_pipe_ck(&pipeip->pipe_segs_head)) {
-       /* won't work here, so refuse to do it */
-       BU_LIST_DEQUEUE(&newpp->l);
-       BU_PUT(newpp, struct wdb_pipe_pnt);
-       return pp;
-    }
-
-    return newpp;
-}
-
-
-struct wdb_pipe_pnt *
-_ged_pipe_delete_pnt(struct wdb_pipe_pnt *ps)
-{
-    struct wdb_pipe_pnt *next;
-    struct wdb_pipe_pnt *prev;
-    struct wdb_pipe_pnt *head;
-
-    BU_CKMAG(ps, WDB_PIPESEG_MAGIC, "pipe segment");
-
-    head = ps;
-    while (head->l.magic != BU_LIST_HEAD_MAGIC)
-       head = BU_LIST_NEXT(wdb_pipe_pnt, &head->l);
-
-    next = BU_LIST_NEXT(wdb_pipe_pnt, &ps->l);
-    if (next->l.magic == BU_LIST_HEAD_MAGIC)
-       next = (struct wdb_pipe_pnt *)NULL;
-
-    prev = BU_LIST_PREV(wdb_pipe_pnt, &ps->l);
-    if (prev->l.magic == BU_LIST_HEAD_MAGIC)
-       prev = (struct wdb_pipe_pnt *)NULL;
-
-    if (!prev && !next) {
-       bu_log("Cannot delete last point in pipe\n");
-       return ps;
-    }
-
-    BU_LIST_DEQUEUE(&ps->l);
-
-    if (rt_pipe_ck(&head->l)) {
-       bu_log("Cannot delete this point, it will result in an illegal pipe\n");
-       if (next) {
-           BU_LIST_INSERT(&next->l, &ps->l);
-       } else if (prev) {
-           BU_LIST_APPEND(&prev->l, &ps->l);
-       } else {
-           BU_LIST_INSERT(&head->l, &ps->l);
-       }
-
-       return ps;
-    } else {
-       BU_PUT(ps, struct wdb_pipe_pnt);
-    }
-
-    if (prev)
-       return prev;
-    else
-       return next;
-
-}
-
-
-int
-_ged_pipe_move_pnt(struct rt_pipe_internal *pipeip, struct wdb_pipe_pnt *ps, 
const point_t new_pt)
-{
-    point_t old_pt;
-
-    RT_PIPE_CK_MAGIC(pipeip);
-    BU_CKMAG(ps, WDB_PIPESEG_MAGIC, "pipe segment");
-
-    VMOVE(old_pt, ps->pp_coord);
-
-    VMOVE(ps->pp_coord, new_pt);
-    if (rt_pipe_ck(&pipeip->pipe_segs_head)) {
-       bu_log("Cannot move point there\n");
-       VMOVE(ps->pp_coord, old_pt);
-       return 1;
-    }
-
-    return 0;
-}
-
-
-int
-_ged_scale_pipe(struct ged *gedp, struct rt_pipe_internal *pipeip, const char 
*attribute, fastf_t sf, int rflag)
-{
-    int seg_i;
-    struct wdb_pipe_pnt *ps;
-
-    RT_PIPE_CK_MAGIC(pipeip);
-
-    /* encode rflag as a negative scale so we don't have to pass it */
-    if (!rflag && sf > 0)
-       sf = -sf;
-
-    switch (attribute[0]) {
-       case 'b':
-       case 'r':
-           if (sscanf(attribute+1, "%d", &seg_i) != 1)
-               seg_i = 0;
-
-           if ((ps = _ged_get_pipe_seg_i(pipeip, seg_i)) == (struct 
wdb_pipe_pnt *)NULL)
-               return GED_ERROR;
-
-           pipe_seg_scale_radius(ps, sf);
-           break;
-       case 'B':
-       case 'R':
-           pipe_scale_radius(pipeip, sf);
-           break;
-       case 'i':
-           if (sscanf(attribute+1, "%d", &seg_i) != 1)
-               seg_i = 0;
-
-           if ((ps = _ged_get_pipe_seg_i(pipeip, seg_i)) == (struct 
wdb_pipe_pnt *)NULL)
-               return GED_ERROR;
-
-           pipe_seg_scale_id(ps, sf);
-           break;
-       case 'I':
-           pipe_scale_id(pipeip, sf);
-           break;
-       case 'o':
-           if (sscanf(attribute+1, "%d", &seg_i) != 1)
-               seg_i = 0;
-
-           if ((ps = _ged_get_pipe_seg_i(pipeip, seg_i)) == (struct 
wdb_pipe_pnt *)NULL)
-               return GED_ERROR;
-
-           pipe_seg_scale_od(ps, sf);
-           break;
-       case 'O':
-           pipe_scale_od(pipeip, sf);
-           break;
-       default:
-           bu_vls_printf(gedp->ged_result_str, "bad pipe attribute - %s", 
attribute);
-           return GED_ERROR;
-    }
-
-    return GED_OK;
-}
-
-
-int
-_ged_pipe_append_pnt_common(struct ged *gedp, int argc, const char *argv[], 
struct wdb_pipe_pnt *(*func)(struct rt_pipe_internal *, struct wdb_pipe_pnt *, 
const point_t))
-{
-    struct directory *dp;
-    static const char *usage = "pipe pt";
-    struct rt_db_internal intern;
-    struct rt_pipe_internal *pipeip;
-    mat_t mat;
-    point_t view_ps_pt;
-    point_t view_pp_coord;
-    point_t ps_pt;
-    struct wdb_pipe_pnt *prevpp;
-    double scan[3];
-    char *last;
-
-    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
-    GED_CHECK_VIEW(gedp, GED_ERROR);
-    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
-
-    /* initialize result */
-    bu_vls_trunc(gedp->ged_result_str, 0);
-
-    /* must be wanting help */
-    if (argc == 1) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_HELP;
-    }
-
-    if (argc != 3) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_ERROR;
-    }
-
-    if ((last = strrchr(argv[1], '/')) == NULL)
-       last = (char *)argv[1];
-    else
-       ++last;
-
-    if (last[0] == '\0') {
-       bu_vls_printf(gedp->ged_result_str, "%s: illegal input - %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET);
-    if (dp == RT_DIR_NULL) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    if (sscanf(argv[2], "%lf %lf %lf", &scan[X], &scan[Y], &scan[Z]) != 3) {
-       bu_vls_printf(gedp->ged_result_str, "%s: bad point - %s", argv[0], 
argv[2]);
-       return GED_ERROR;
-    }
-    /* convert from double to fastf_t */
-    VMOVE(view_ps_pt, scan);
-
-    if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], 
gedp->ged_wdbp, mat) == GED_ERROR)
-       return GED_ERROR;
-
-    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
-       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_PIPE) {
-       bu_vls_printf(gedp->ged_result_str, "Object not a PIPE");
-       rt_db_free_internal(&intern);
-
-       return GED_ERROR;
-    }
-
-    pipeip = (struct rt_pipe_internal *)intern.idb_ptr;
-
-    /* use the view z from the first or last pipe point, depending on whether 
we're appending or prepending */
-    if (func == _ged_pipe_add_pnt)
-       prevpp = BU_LIST_LAST(wdb_pipe_pnt, &pipeip->pipe_segs_head);
-    else
-       prevpp = BU_LIST_FIRST(wdb_pipe_pnt, &pipeip->pipe_segs_head);
-
-    MAT4X3PNT(view_pp_coord, gedp->ged_gvp->gv_model2view, prevpp->pp_coord);
-    view_ps_pt[Z] = view_pp_coord[Z];
-    MAT4X3PNT(ps_pt, gedp->ged_gvp->gv_view2model, view_ps_pt);
-
-    if ((*func)(pipeip, (struct wdb_pipe_pnt *)NULL, ps_pt) == (struct 
wdb_pipe_pnt *)NULL) {
-       rt_db_free_internal(&intern);
-       bu_vls_printf(gedp->ged_result_str, "%s: cannot move point there", 
argv[0]);
-       return GED_ERROR;
-    }
-
-    {
-       mat_t invmat;
-       struct wdb_pipe_pnt *curr_ps;
-       point_t curr_pt;
-
-       bn_mat_inv(invmat, mat);
-       for (BU_LIST_FOR(curr_ps, wdb_pipe_pnt, &pipeip->pipe_segs_head)) {
-           MAT4X3PNT(curr_pt, invmat, curr_ps->pp_coord);
-           VMOVE(curr_ps->pp_coord, curr_pt);
-       }
-
-       GED_DB_PUT_INTERNAL(gedp, dp, &intern, &rt_uniresource, GED_ERROR);
-    }
-
-    rt_db_free_internal(&intern);
-    return GED_OK;
-}
-
-
-int
-ged_pipe_append_pnt(struct ged *gedp, int argc, const char *argv[])
-{
-    return _ged_pipe_append_pnt_common(gedp, argc, argv, _ged_pipe_add_pnt);
-}
-
-
-int
-ged_pipe_delete_pnt(struct ged *gedp, int argc, const char *argv[])
-{
-    struct directory *dp;
-    static const char *usage = "pipe seg_i";
-    struct rt_db_internal intern;
-    struct wdb_pipe_pnt *ps;
-    struct rt_pipe_internal *pipeip;
-    int seg_i;
-    char *last;
-
-    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
-    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
-
-    /* initialize result */
-    bu_vls_trunc(gedp->ged_result_str, 0);
-
-    /* must be wanting help */
-    if (argc == 1) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_HELP;
-    }
-
-    if (argc != 3) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_ERROR;
-    }
-
-    if ((last = strrchr(argv[1], '/')) == NULL)
-       last = (char *)argv[1];
-    else
-       ++last;
-
-    if (last[0] == '\0') {
-       bu_vls_printf(gedp->ged_result_str, "%s: illegal input - %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET);
-    if (dp == RT_DIR_NULL) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    if (sscanf(argv[2], "%d", &seg_i) != 1) {
-       bu_vls_printf(gedp->ged_result_str, "%s: bad pipe segment index - %s", 
argv[0], argv[3]);
-       return GED_ERROR;
-    }
-
-    if (rt_db_get_internal(&intern, dp, gedp->ged_wdbp->dbip, (fastf_t *)NULL, 
&rt_uniresource) < 0) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to get internal for 
%s", argv[0], argv[1]);
-       return GED_ERROR;
-    }
-
-    if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
-       intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_PIPE) {
-       bu_vls_printf(gedp->ged_result_str, "%s is not a PIPE", argv[1]);
-       rt_db_free_internal(&intern);
-
-       return GED_ERROR;
-    }
-
-    pipeip = (struct rt_pipe_internal *)intern.idb_ptr;
-    if ((ps = _ged_get_pipe_seg_i(pipeip, seg_i)) == (struct wdb_pipe_pnt 
*)NULL) {
-       rt_db_free_internal(&intern);
-       bu_vls_printf(gedp->ged_result_str, "%s: bad pipe segment index - %s", 
argv[0], argv[2]);
-       return GED_ERROR;
-    }
-
-    if (_ged_pipe_delete_pnt(ps) == ps) {
-       rt_db_free_internal(&intern);
-       bu_vls_printf(gedp->ged_result_str, "%s: cannot delete pipe segment 
%d", argv[0], seg_i);
-       return GED_ERROR;
-    }
-
-    GED_DB_PUT_INTERNAL(gedp, dp, &intern, &rt_uniresource, GED_ERROR);
-
-    rt_db_free_internal(&intern);
-    return GED_OK;
-}
-
-
-int
-ged_find_pipe_pnt_nearest_pnt(struct ged *gedp, int argc, const char *argv[])
-{
-    struct directory *dp;
-    static const char *usage = "pipe x y z";
-    struct rt_db_internal intern;
-    struct wdb_pipe_pnt *nearest;
-    point_t model_pt;
-    double scan[3];
-    mat_t mat;
-    int seg_i;
-    char *last;
-
-    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
-    GED_CHECK_VIEW(gedp, GED_ERROR);
-    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
-
-    /* initialize result */
-    bu_vls_trunc(gedp->ged_result_str, 0);
-
-    /* must be wanting help */
-    if (argc == 1) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_HELP;
-    }
-
-    if (argc != 3 && argc != 5) {
-       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
-       return GED_ERROR;
-    }
-
-    if ((last = strrchr(argv[1], '/')) == NULL)
-       last = (char *)argv[1];
-    else
-       ++last;
-
-    if (last[0] == '\0') {
-       bu_vls_printf(gedp->ged_result_str, "%s: illegal input - %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    dp = db_lookup(gedp->ged_wdbp->dbip, last, LOOKUP_QUIET);
-    if (dp == RT_DIR_NULL) {
-       bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], 
argv[1]);
-       return GED_ERROR;
-    }
-
-    if (argc == 3) {
-       if (sscanf(argv[2], "%lf %lf %lf", &scan[X], &scan[Y], &scan[Z]) != 3) {
-           bu_vls_printf(gedp->ged_result_str, "%s: bad point - %s", argv[0], 
argv[2]);
-           return GED_ERROR;
-       }
-    } else if (sscanf(argv[2], "%lf", &scan[X]) != 1 ||
-              sscanf(argv[3], "%lf", &scan[Y]) != 1 ||
-              sscanf(argv[4], "%lf", &scan[Z]) != 1) {
-       bu_vls_printf(gedp->ged_result_str, "%s: bad X, Y or Z", argv[0]);
-       return GED_ERROR;
-    }
-    /* convert from double to fastf_t */
-    VMOVE(model_pt, scan);
-
-    if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], 
gedp->ged_wdbp, mat) == GED_ERROR)
-       return GED_ERROR;
-
-    nearest = find_pipe_pnt_nearest_pnt(&((struct rt_pipe_internal 
*)intern.idb_ptr)->pipe_segs_head,
-                                    model_pt, gedp->ged_gvp->gv_view2model);

@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to