Revision: 76632
          http://sourceforge.net/p/brlcad/code/76632
Author:   starseeker
Date:     2020-08-01 12:50:29 +0000 (Sat, 01 Aug 2020)
Log Message:
-----------
Start working on hiding the details of how the view set is stored.  List 
removal isn't quite working yet, so this commit still uses the head bu_list

Modified Paths:
--------------
    brlcad/branches/bioh/include/ged/defines.h
    brlcad/branches/bioh/include/ged/view.h
    brlcad/branches/bioh/src/libged/ged.c
    brlcad/branches/bioh/src/libged/ged_private.h
    brlcad/branches/bioh/src/libged/ged_util.c
    brlcad/branches/bioh/src/libtclcad/fb.c
    brlcad/branches/bioh/src/libtclcad/tclcad_mouse.c
    brlcad/branches/bioh/src/libtclcad/tclcad_obj.c
    brlcad/branches/bioh/src/libtclcad/tclcad_obj_wrapper.c
    brlcad/branches/bioh/src/libtclcad/tclcad_polygons.c
    brlcad/branches/bioh/src/libtclcad/view/arrows.c
    brlcad/branches/bioh/src/libtclcad/view/autoview.c
    brlcad/branches/bioh/src/libtclcad/view/axes.c
    brlcad/branches/bioh/src/libtclcad/view/faceplate.c
    brlcad/branches/bioh/src/libtclcad/view/labels.c
    brlcad/branches/bioh/src/libtclcad/view/lines.c
    brlcad/branches/bioh/src/libtclcad/view/refresh.c

Modified: brlcad/branches/bioh/include/ged/defines.h
===================================================================
--- brlcad/branches/bioh/include/ged/defines.h  2020-08-01 07:06:58 UTC (rev 
76631)
+++ brlcad/branches/bioh/include/ged/defines.h  2020-08-01 12:50:29 UTC (rev 
76632)
@@ -192,7 +192,8 @@
     struct bu_vls               go_name;
     struct rt_wdb              *ged_wdbp;
 
-    // The full set of views associated with this ged object
+    // The full set of bviews associated with this ged object
+    //struct bu_ptbl              ged_views;
     struct bview                go_head_views;
 
     void                        *u_data; /**< @brief User data associated with 
this ged instance */

Modified: brlcad/branches/bioh/include/ged/view.h
===================================================================
--- brlcad/branches/bioh/include/ged/view.h     2020-08-01 07:06:58 UTC (rev 
76631)
+++ brlcad/branches/bioh/include/ged/view.h     2020-08-01 12:50:29 UTC (rev 
76632)
@@ -149,6 +149,8 @@
 GED_EXPORT extern int ged_polygons_overlap(struct ged *gedp, struct bg_polygon 
*polyA, struct bg_polygon *polyB);
 GED_EXPORT extern void ged_polygon_fill_segments(struct ged *gedp, struct 
bg_polygon *poly, vect2d_t vfilldir, fastf_t vfilldelta);
 
+GED_EXPORT extern struct bview * ged_find_view(struct ged *gedp, const char 
*key);
+
 // TODO - this (and probably the grid logic too) belong at the libdm level - 
they're operating
 // on the bview, rather than the ged level data...
 GED_EXPORT extern int ged_snap_to_lines(struct ged *gedp, fastf_t *vx, fastf_t 
*vy);

Modified: brlcad/branches/bioh/src/libged/ged.c
===================================================================
--- brlcad/branches/bioh/src/libged/ged.c       2020-08-01 07:06:58 UTC (rev 
76631)
+++ brlcad/branches/bioh/src/libged/ged.c       2020-08-01 12:50:29 UTC (rev 
76632)
@@ -165,6 +165,8 @@
     // Since libged does not link libdm, it's also the responsibility of the
     // caller to close any display managers associated with the view.
     struct bview *gdvp;
+//    for (size_t i = 0; i < BU_PTBL_LEN(&gedp->ged_views); i++) {
+//     gdvp = (struct bview *)BU_PTBL_GET(&gedp->ged_views, i);
     while (BU_LIST_WHILE(gdvp, bview, &gedp->go_head_views.l)) {
        BU_LIST_DEQUEUE(&(gdvp->l));
        bu_vls_free(&gdvp->gv_name);
@@ -172,6 +174,7 @@
        BU_PUT(gdvp->callbacks, struct bu_ptbl);
        bu_free((void *)gdvp, "bview");
     }
+//    bu_ptbl_free(&gedp->ged_views);
 
     if (gedp->ged_gdp != GED_DRAWABLE_NULL) {
        if (gedp->ged_gdp->gd_headDisplay)
@@ -231,8 +234,8 @@
     // TODO - rename to ged_name
     bu_vls_init(&gedp->go_name);
 
-    // TODO - rename to ged_views
     BU_LIST_INIT(&gedp->go_head_views.l);
+//    BU_PTBL_INIT(&gedp->ged_views);
 
     BU_GET(gedp->ged_log, struct bu_vls);
     bu_vls_init(gedp->ged_log);

Modified: brlcad/branches/bioh/src/libged/ged_private.h
===================================================================
--- brlcad/branches/bioh/src/libged/ged_private.h       2020-08-01 07:06:58 UTC 
(rev 76631)
+++ brlcad/branches/bioh/src/libged/ged_private.h       2020-08-01 12:50:29 UTC 
(rev 76632)
@@ -649,6 +649,7 @@
 GED_EXPORT extern int ged_view_snap(struct ged *gedp, int argc, const char 
*argv[]);
 GED_EXPORT extern int ged_view_data_lines(struct ged *gedp, int argc, const 
char *argv[]);
 
+
 __END_DECLS
 
 #endif /* LIBGED_GED_PRIVATE_H */

Modified: brlcad/branches/bioh/src/libged/ged_util.c
===================================================================
--- brlcad/branches/bioh/src/libged/ged_util.c  2020-08-01 07:06:58 UTC (rev 
76631)
+++ brlcad/branches/bioh/src/libged/ged_util.c  2020-08-01 12:50:29 UTC (rev 
76632)
@@ -50,6 +50,31 @@
 #include "ged.h"
 #include "./ged_private.h"
 
+struct bview *
+ged_find_view(struct ged *gedp, const char *key)
+{
+    struct bview *gdvp = NULL;
+#if 0
+    // TODO - use this when we replace with bu_ptbl
+    for (size_t i = 0; i < BU_PTBL_LEN(&gedp->ged_views); i++) {
+       gdvp = (struct bview *)BU_PTBL_GET(&gedp->ged_views, i);
+       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), key))
+           break;
+       gdvp = NULL;
+    }
+#endif
+
+    for (BU_LIST_FOR(gdvp, bview, &gedp->go_head_views.l)) {
+       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), key))
+           break;
+    }
+    if (BU_LIST_IS_HEAD(&gdvp->l, &gedp->go_head_views.l)) {
+       gdvp = NULL;
+    }
+
+    return gdvp;
+}
+
 int
 _ged_results_init(struct ged_results *results)
 {

Modified: brlcad/branches/bioh/src/libtclcad/fb.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/fb.c     2020-08-01 07:06:58 UTC (rev 
76631)
+++ brlcad/branches/bioh/src/libtclcad/fb.c     2020-08-01 12:50:29 UTC (rev 
76632)
@@ -969,7 +969,6 @@
               int UNUSED(maxargs))
 {
     int mode;
-    struct bview *gdvp;
 
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
@@ -985,12 +984,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -1031,8 +1026,6 @@
          const char *usage,
          int UNUSED(maxargs))
 {
-    struct bview *gdvp;
-
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
 
@@ -1047,12 +1040,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }

Modified: brlcad/branches/bioh/src/libtclcad/tclcad_mouse.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/tclcad_mouse.c   2020-08-01 07:06:58 UTC 
(rev 76631)
+++ brlcad/branches/bioh/src/libtclcad/tclcad_mouse.c   2020-08-01 12:50:29 UTC 
(rev 76632)
@@ -41,8 +41,6 @@
                  const char *usage,
                  int UNUSED(maxargs))
 {
-    struct bview *gdvp;
-
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
 
@@ -57,12 +55,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -84,7 +78,6 @@
     char *av[4];
     point_t view;
     struct bu_vls pt_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -103,12 +96,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -164,7 +153,6 @@
 {
     const char *cmd_argv[11] = {"brep", NULL, "selection", "append", "active"};
     int ret, cmd_argc = (int)(sizeof(cmd_argv) / sizeof(const char *));
-    struct bview *gdvp;
     char *brep_name;
     char *end;
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
@@ -179,9 +167,11 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
+
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
+       bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
+       return GED_ERROR;
     }
 
     /* parse args */
@@ -277,7 +267,6 @@
 {
     const char *cmd_argv[8] = {"brep", NULL, "selection", "translate", 
"active"};
     int ret, cmd_argc = (int)(sizeof(cmd_argv) / sizeof(const char *));
-    struct bview *gdvp;
     char *brep_name;
     char *end;
     point_t screen_end, view_start, view_end, model_start, model_end;
@@ -289,9 +278,10 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
+       bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
+       return GED_ERROR;
     }
 
     brep_name = bu_path_basename(argv[2], NULL);
@@ -373,7 +363,6 @@
     fastf_t dx, dy;
     fastf_t sf;
     struct bu_vls rot_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -392,16 +381,13 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
 
+
     if ((argv[2][0] != 'x' && argv[2][0] != 'y' && argv[2][0] != 'z') || 
argv[2][1] != '\0') {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
@@ -487,7 +473,6 @@
     fastf_t sf;
     fastf_t inv_width;
     struct bu_vls tran_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -506,12 +491,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -598,7 +579,6 @@
     char *av[6];
     point_t view;
     struct bu_vls pt_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -617,12 +597,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -664,7 +640,6 @@
     char *av[6];
     point_t view;
     struct bu_vls pt_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -683,12 +658,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -729,7 +700,6 @@
     char *av[6];
     point_t view;
     struct bu_vls pt_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -748,12 +718,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -795,7 +761,6 @@
     point_t model;
     point_t view;
     struct bu_vls pt_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -814,12 +779,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -862,7 +823,6 @@
     point_t model;
     point_t view;
     struct bu_vls pt_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -881,12 +841,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -928,7 +884,6 @@
 {
     const char *cmd_argv[11] = {"joint2", NULL, "selection", "replace", 
"active"};
     int ret, cmd_argc = (int)(sizeof(cmd_argv) / sizeof(const char *));
-    struct bview *gdvp;
     char *joint_name;
     char *end;
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
@@ -943,9 +898,10 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
+       bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
+       return GED_ERROR;
     }
 
     /* parse args */
@@ -1039,7 +995,6 @@
 {
     const char *cmd_argv[8] = {"joint2", NULL, "selection", "translate", 
"active"};
     int ret, cmd_argc = (int)(sizeof(cmd_argv) / sizeof(const char *));
-    struct bview *gdvp;
     char *joint_name;
     char *end;
     point_t screen_end, view_start, view_end, model_start, model_end;
@@ -1051,9 +1006,10 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
+       bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
+       return GED_ERROR;
     }
 
     joint_name = bu_path_basename(argv[2], NULL);
@@ -1187,7 +1143,6 @@
     point_t view;
     mat_t inv_rot;
     struct bu_vls pt_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -1206,12 +1161,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -1288,7 +1239,6 @@
     point_t view;
     mat_t inv_rot;
     struct bu_vls pt_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -1307,12 +1257,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -1391,7 +1337,6 @@
     point_t view;
     mat_t v2m_mat;
     struct bu_vls pt_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -1424,13 +1369,9 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
-       bu_vls_printf(gedp->ged_result_str, "%s: View not found - %s", cmd, 
argv[1]);
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
+       bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
 
@@ -1574,7 +1515,6 @@
     point_t view;
     mat_t v2m_mat;
     struct bu_vls pt_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -1595,13 +1535,9 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
-       bu_vls_printf(gedp->ged_result_str, "%s: View not found - %s", cmd, 
argv[1]);
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
+       bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
 
@@ -1691,7 +1627,6 @@
     point_t view;
     mat_t inv_rot;
     struct bu_vls pt_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -1710,12 +1645,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -1790,7 +1721,6 @@
     struct bu_vls rot_x_vls = BU_VLS_INIT_ZERO;
     struct bu_vls rot_y_vls = BU_VLS_INIT_ZERO;
     struct bu_vls rot_z_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -1809,12 +1739,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -1902,7 +1828,6 @@
     fastf_t sf;
     fastf_t inv_width;
     struct bu_vls sf_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -1921,12 +1846,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -2014,7 +1935,6 @@
     struct bu_vls tran_x_vls = BU_VLS_INIT_ZERO;
     struct bu_vls tran_y_vls = BU_VLS_INIT_ZERO;
     struct bu_vls tran_z_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -2033,12 +1953,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -2174,7 +2090,6 @@
                   const char *usage,
                   int UNUSED(maxargs))
 {
-    struct bview *gdvp;
     int ret;
 
     /* initialize result */
@@ -2191,12 +2106,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -2353,7 +2264,6 @@
                   const char *usage,
                   int UNUSED(maxargs))
 {
-    struct bview *gdvp;
     int ret;
 
     /* initialize result */
@@ -2370,12 +2280,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -2498,7 +2404,6 @@
                  const char *usage,
                  int UNUSED(maxargs))
 {
-    struct bview *gdvp;
     int ret;
 
     /* initialize result */
@@ -2515,12 +2420,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -2685,7 +2586,6 @@
                   const char *usage,
                   int UNUSED(maxargs))
 {
-    struct bview *gdvp;
     int ret;
 
     /* initialize result */
@@ -2702,12 +2602,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -2846,7 +2742,6 @@
     int dx, dy;
     struct bu_vls dx_vls = BU_VLS_INIT_ZERO;
     struct bu_vls dy_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
@@ -2862,12 +2757,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -2915,7 +2806,6 @@
     char *av[4];
     fastf_t dx, dy;
     struct bu_vls rot_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -2934,12 +2824,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -3009,7 +2895,6 @@
     point_t view;
     mat_t inv_rot;
     struct bu_vls pt_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -3028,12 +2913,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -3114,12 +2995,8 @@
            return GED_ERROR; \
        } \
  \
-       for (BU_LIST_FOR((_gdvp), bview, 
&current_top->to_gedp->go_head_views.l)) { \
-           if (BU_STR_EQUAL(bu_vls_addr(&(_gdvp)->gv_name), (_argv)[1])) \
-               break; \
-       } \
- \
-       if (BU_LIST_IS_HEAD(&(_gdvp)->l, 
&current_top->to_gedp->go_head_views.l)) { \
+        gdvp = ged_find_view(gedp, argv[1]); \
+        if (!gdvp) { \
            bu_vls_printf(gedp->ged_result_str, "View not found - %s", 
(_argv)[1]); \
            return GED_ERROR; \
        } \
@@ -3171,7 +3048,6 @@
              int UNUSED(maxargs))
 {
     register int i;
-    struct bview *gdvp;
     fastf_t sf;
 
     /* initialize result */
@@ -3189,12 +3065,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -3326,7 +3198,6 @@
     point_t view;
     mat_t inv_rot;
     struct bu_vls mrot_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -3345,12 +3216,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -3421,7 +3288,6 @@
     fastf_t sf;
     fastf_t inv_width;
     struct bu_vls sf_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -3440,12 +3306,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -3522,7 +3384,6 @@
     fastf_t inv_width;
     mat_t inv_rot;
     struct bu_vls tvec_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -3541,12 +3402,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -3620,7 +3477,6 @@
     fastf_t dx, dy;
     fastf_t inv_width;
     struct bu_vls trans_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -3639,12 +3495,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }

Modified: brlcad/branches/bioh/src/libtclcad/tclcad_obj.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/tclcad_obj.c     2020-08-01 07:06:58 UTC 
(rev 76631)
+++ brlcad/branches/bioh/src/libtclcad/tclcad_obj.c     2020-08-01 12:50:29 UTC 
(rev 76632)
@@ -1102,6 +1102,8 @@
        // Clean up the libtclcad view data.
        struct bview *gdvp = NULL;
        for (BU_LIST_FOR(gdvp, bview, &top->to_gedp->go_head_views.l)) {
+//     for (size_t i = 0; i < BU_PTBL_LEN(&top->to_gedp->ged_views); i++) {
+//         gdvp = (struct bview *)BU_PTBL_GET(&top->to_gedp->ged_views, i);
 
            // There is a top level command created in the Tcl interp that is 
the name
            // of the dm.  Clear that command.
@@ -1369,7 +1371,6 @@
       int UNUSED(maxargs))
 {
     int r, g, b;
-    struct bview *gdvp;
 
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
@@ -1385,12 +1386,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -1440,7 +1437,6 @@
          const char *usage,
          int UNUSED(maxargs))
 {
-    struct bview *gdvp;
     fastf_t bounds[6];
 
     /* must be double for scanf */
@@ -1460,12 +1456,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -1518,7 +1510,6 @@
             const char *usage,
             int UNUSED(maxargs))
 {
-    struct bview *gdvp;
     int status;
 
     /* initialize result */
@@ -1529,12 +1520,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -1583,7 +1570,6 @@
                   int UNUSED(maxargs))
 {
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -1602,12 +1588,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -1652,7 +1634,6 @@
                   int UNUSED(maxargs))
 {
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -1671,12 +1652,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -1881,8 +1858,6 @@
             const char *usage,
             int UNUSED(maxargs))
 {
-    struct bview *gdvp;
-
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
 
@@ -1897,12 +1872,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -2287,8 +2258,6 @@
                         const char *usage,
                         int UNUSED(maxargs))
 {
-    struct bview *gdvp;
-
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
 
@@ -2303,12 +2272,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -2385,8 +2350,6 @@
                        const char *usage,
                        int UNUSED(maxargs))
 {
-    struct bview *gdvp;
-
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
 
@@ -2401,12 +2364,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -2482,8 +2441,6 @@
             const char *usage,
             int UNUSED(maxargs))
 {
-    struct bview *gdvp;
-
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
 
@@ -2498,12 +2455,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -2881,8 +2834,6 @@
           const char *usage,
           int UNUSED(maxargs))
 {
-    struct bview *gdvp;
-
     /* must be double for scanf */
     double vZ;
 
@@ -2900,12 +2851,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -3240,7 +3187,6 @@
            int UNUSED(maxargs))
 {
     int fontsize;
-    struct bview *gdvp;
 
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
@@ -3256,12 +3202,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -3403,8 +3345,6 @@
                      const char *usage,
                      int UNUSED(maxargs))
 {
-    struct bview *gdvp;
-
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
 
@@ -3419,12 +3359,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -3443,8 +3379,6 @@
               const char *usage,
               int UNUSED(maxargs))
 {
-    struct bview *gdvp;
-
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
 
@@ -3459,12 +3393,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -3514,7 +3444,6 @@
             const char *usage,
             int UNUSED(maxargs))
 {
-    struct bview *gdvp;
     int hide_view;
 
     /* initialize result */
@@ -3531,12 +3460,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -3657,7 +3582,6 @@
             const char *usage,
             int UNUSED(maxargs))
 {
-    struct bview *gdvp;
     int mode, need_refresh = 0;
     struct redraw_edited_path_data data;
     struct tclcad_ged_data *tgd = (struct tclcad_ged_data 
*)current_top->to_gedp->u_data;
@@ -3676,12 +3600,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -3770,7 +3690,6 @@
         int UNUSED(maxargs))
 {
     int light;
-    struct bview *gdvp;
 
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
@@ -3786,12 +3705,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -3837,8 +3752,11 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l))
+    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
+//    for (size_t i = 0; i < BU_PTBL_LEN(&top->to_gedp->ged_views); i++) {
+//     gdvp = (struct bview *)BU_PTBL_GET(&top->to_gedp->ged_views, i);
        bu_vls_printf(gedp->ged_result_str, "%s ", bu_vls_addr(&gdvp->gv_name));
+    }
 
     return GED_OK;
 }
@@ -3873,6 +3791,8 @@
     struct bview *gdvp;
 
     for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
+//    for (size_t i = 0; i < BU_PTBL_LEN(&current_top->to_gedp->ged_views); 
i++) {
+//     gdvp = (struct bview *)BU_PTBL_GET(&current_top->to_gedp->ged_views, i);
        gedp->ged_gvp = gdvp;
        (*func)(gedp, argc, (const char **)argv);
     }
@@ -3939,7 +3859,6 @@
                              int UNUSED(maxargs))
 {
     register int i;
-    struct bview *gdvp;
 
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
@@ -3950,12 +3869,8 @@
        return GED_HELP;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -4027,7 +3942,6 @@
                      int UNUSED(maxargs))
 {
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -4046,12 +3960,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -4090,7 +4000,6 @@
                      int UNUSED(maxargs))
 {
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -4109,12 +4018,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -4209,7 +4114,6 @@
                     int UNUSED(maxargs))
 {
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -4228,13 +4132,9 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
-       bu_vls_printf(gedp->ged_result_str, "%s: View not found - %s", argv[0], 
argv[1]);
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
+       bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
 
@@ -4273,7 +4173,6 @@
 {
     register int i;
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -4292,13 +4191,9 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
-       bu_vls_printf(gedp->ged_result_str, "%s: View not found - %s", argv[0], 
argv[1]);
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
+       bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
 
@@ -4339,7 +4234,6 @@
                          int UNUSED(maxargs))
 {
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -4358,12 +4252,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -4402,7 +4292,6 @@
                      int UNUSED(maxargs))
 {
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -4421,12 +4310,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -4602,6 +4487,7 @@
     bu_vls_printf(&new_gdvp->gv_name, "%s", argv[name_index]);
     ged_view_init(new_gdvp);
     BU_LIST_INSERT(&current_top->to_gedp->go_head_views.l, &new_gdvp->l);
+    //bu_ptbl_ins(&current_top->to_gedp->ged_views, (long *)new_gdvp);
 
     new_gdvp->gv_point_scale = 1.0;
     new_gdvp->gv_curve_scale = 1.0;
@@ -4651,7 +4537,6 @@
                int UNUSED(maxargs))
 {
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -4670,12 +4555,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -4713,7 +4594,6 @@
               int UNUSED(maxargs))
 {
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -4732,12 +4612,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -4776,7 +4652,6 @@
                   int UNUSED(maxargs))
 {
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -4795,12 +4670,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -4837,7 +4708,6 @@
                   const char *usage,
                   int UNUSED(maxargs))
 {
-    struct bview *gdvp;
 
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
@@ -4852,12 +4722,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -4883,7 +4749,6 @@
        const char *usage,
        int UNUSED(maxargs))
 {
-    struct bview *gdvp = NULL;
     FILE *fp = NULL;
     unsigned char *scanline;
     unsigned char *pixels;
@@ -4907,12 +4772,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -4972,7 +4833,6 @@
 {
     png_structp png_p;
     png_infop info_p;
-    struct bview *gdvp = NULL;
     FILE *fp = NULL;
     unsigned char **rows = NULL;
     unsigned char *pixels;
@@ -4997,12 +4857,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -5087,7 +4943,6 @@
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
     struct bu_vls x_vls = BU_VLS_INIT_ZERO;
     struct bu_vls y_vls = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
@@ -5103,12 +4958,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -5173,7 +5024,6 @@
                        int UNUSED(maxargs))
 {
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -5192,12 +5042,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -5237,7 +5083,6 @@
               int UNUSED(maxargs))
 {
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -5256,12 +5101,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -5404,7 +5245,6 @@
                int UNUSED(maxargs))
 {
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -5423,12 +5263,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -5467,7 +5303,6 @@
               int UNUSED(maxargs))
 {
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -5486,12 +5321,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -5530,7 +5361,6 @@
                   int UNUSED(maxargs))
 {
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -5549,12 +5379,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -5593,7 +5419,6 @@
                   int UNUSED(maxargs))
 {
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -5612,12 +5437,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -5654,7 +5475,6 @@
              int UNUSED(maxargs))
 {
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -5673,12 +5493,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -5716,7 +5532,6 @@
 {
     point_t view;
     point_t model;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -5735,12 +5550,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -5771,7 +5582,6 @@
               int UNUSED(maxargs))
 {
     point_t view;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -5790,12 +5600,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -5824,8 +5630,6 @@
             const char *usage,
             int UNUSED(maxargs))
 {
-    struct bview *gdvp;
-
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
 
@@ -5840,12 +5644,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -5876,7 +5676,6 @@
             const char *usage,
             int UNUSED(maxargs))
 {
-    struct bview *gdvp;
     fastf_t fvx, fvy;
 
     /* must be double for scanf */
@@ -5896,12 +5695,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -6008,7 +5803,6 @@
                  int UNUSED(maxargs))
 {
     struct bu_vls bindings = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double x, y;
@@ -6027,12 +5821,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -6069,7 +5859,6 @@
                int UNUSED(maxargs))
 {
     int transparency;
-    struct bview *gdvp;
 
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
@@ -6085,12 +5874,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -6127,7 +5912,6 @@
                 int UNUSED(maxargs))
 {
     register int i;
-    struct bview *gdvp;
 
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
@@ -6138,12 +5922,8 @@
        return GED_HELP;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -6174,7 +5954,6 @@
                 const char *usage,
                 int UNUSED(maxargs))
 {
-    struct bview *gdvp;
     int width, height;
 
     /* initialize result */
@@ -6191,12 +5970,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -6242,7 +6017,6 @@
     int width, height;
     fastf_t x, y;
     fastf_t aspect;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double view[ELEMENTS_PER_POINT];
@@ -6261,12 +6035,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -6296,8 +6066,6 @@
         const char *usage,
         int UNUSED(maxargs))
 {
-    struct bview *gdvp;
-
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
 
@@ -6312,12 +6080,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -6371,7 +6135,6 @@
     fastf_t xpos2, ypos2;
     fastf_t sf;
     struct bu_vls slew_vec = BU_VLS_INIT_ZERO;
-    struct bview *gdvp;
 
     /* must be double for scanf */
     double xpos1, ypos1;
@@ -6390,12 +6153,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -6463,7 +6222,6 @@
           int UNUSED(maxargs))
 {
     int zbuffer;
-    struct bview *gdvp;
 
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
@@ -6479,12 +6237,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -6523,7 +6277,6 @@
         int UNUSED(maxargs))
 {
     int zclip;
-    struct bview *gdvp;
 
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
@@ -6539,12 +6292,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    struct bview *gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -6582,6 +6331,9 @@
     register int first = 1;
     struct tclcad_ged_data *tgd = (struct tclcad_ged_data 
*)current_top->to_gedp->u_data;
 
+
+//    for (size_t i = 0; i < BU_PTBL_LEN(&current_top->to_gedp->ged_views); 
i++) {
+//     gdvp = (struct bview *)BU_PTBL_GET(&current_top->to_gedp->ged_views, i);
     for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
        if (tgd->go_dlist_on && to_is_viewable(gdvp)) {
 
@@ -6630,6 +6382,8 @@
     struct bview *gdvp;
     struct tclcad_ged_data *tgd = (struct tclcad_ged_data 
*)current_top->to_gedp->u_data;
 
+//    for (size_t i = 0; i < BU_PTBL_LEN(&current_top->to_gedp->ged_views); 
i++) {
+//     gdvp = (struct bview *)BU_PTBL_GET(&current_top->to_gedp->ged_views, i);
     for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
        if (tgd->go_dlist_on && to_is_viewable(gdvp)) {
            (void)dm_make_current((struct dm *)gdvp->dmp);

Modified: brlcad/branches/bioh/src/libtclcad/tclcad_obj_wrapper.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/tclcad_obj_wrapper.c     2020-08-01 
07:06:58 UTC (rev 76631)
+++ brlcad/branches/bioh/src/libtclcad/tclcad_obj_wrapper.c     2020-08-01 
12:50:29 UTC (rev 76632)
@@ -68,6 +68,8 @@
        aflag = 1;
 
     for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
+//    for (i = 0; i < BU_PTBL_LEN(&current_top->to_gedp->ged_views); i++) {
+//     gdvp = (struct bview *)BU_PTBL_GET(&current_top->to_gedp->ged_views, i);
        if (to_is_viewable(gdvp)) {
            gedp->ged_gvp->gv_x_samples = dm_get_width((struct dm *)gdvp->dmp);
            gedp->ged_gvp->gv_y_samples = dm_get_height((struct dm *)gdvp->dmp);
@@ -270,12 +272,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -394,12 +392,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }

Modified: brlcad/branches/bioh/src/libtclcad/tclcad_polygons.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/tclcad_polygons.c        2020-08-01 
07:06:58 UTC (rev 76631)
+++ brlcad/branches/bioh/src/libtclcad/tclcad_polygons.c        2020-08-01 
12:50:29 UTC (rev 76632)
@@ -1060,12 +1060,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -1140,12 +1136,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -1414,12 +1406,14 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
+    gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
+       bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
+       return GED_ERROR;
     }
 
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -1486,12 +1480,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -1577,12 +1567,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -1737,12 +1723,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }

Modified: brlcad/branches/bioh/src/libtclcad/view/arrows.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/view/arrows.c    2020-08-01 07:06:58 UTC 
(rev 76631)
+++ brlcad/branches/bioh/src/libtclcad/view/arrows.c    2020-08-01 12:50:29 UTC 
(rev 76632)
@@ -96,12 +96,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }

Modified: brlcad/branches/bioh/src/libtclcad/view/autoview.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/view/autoview.c  2020-08-01 07:06:58 UTC 
(rev 76631)
+++ brlcad/branches/bioh/src/libtclcad/view/autoview.c  2020-08-01 12:50:29 UTC 
(rev 76632)
@@ -77,12 +77,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -102,6 +98,8 @@
     struct bview *gdvp;
 
     for (BU_LIST_FOR(gdvp, bview, &top->to_gedp->go_head_views.l)) {
+//    for (size_t i = 0; i < BU_PTBL_LEN(&top->to_gedp->ged_views); i++) {
+//        gdvp = (struct bview *)BU_PTBL_GET(&top->to_gedp->ged_views, i);
        to_autoview_view(gdvp, NULL);
     }
 }

Modified: brlcad/branches/bioh/src/libtclcad/view/axes.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/view/axes.c      2020-08-01 07:06:58 UTC 
(rev 76631)
+++ brlcad/branches/bioh/src/libtclcad/view/axes.c      2020-08-01 12:50:29 UTC 
(rev 76632)
@@ -503,12 +503,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }
@@ -720,16 +716,12 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
+    gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
+        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
+        return GED_ERROR;
     }
 
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
-       bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
-       return GED_ERROR;
-    }
-
     return to_axes(gedp, gdvp, &gdvp->gv_model_axes, argc, argv, usage);
 }
 
@@ -782,12 +774,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }

Modified: brlcad/branches/bioh/src/libtclcad/view/faceplate.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/view/faceplate.c 2020-08-01 07:06:58 UTC 
(rev 76631)
+++ brlcad/branches/bioh/src/libtclcad/view/faceplate.c 2020-08-01 12:50:29 UTC 
(rev 76632)
@@ -56,12 +56,8 @@
     if (argc < 4 || 7 < argc)
        goto bad;
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }

Modified: brlcad/branches/bioh/src/libtclcad/view/labels.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/view/labels.c    2020-08-01 07:06:58 UTC 
(rev 76631)
+++ brlcad/branches/bioh/src/libtclcad/view/labels.c    2020-08-01 12:50:29 UTC 
(rev 76632)
@@ -96,12 +96,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }

Modified: brlcad/branches/bioh/src/libtclcad/view/lines.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/view/lines.c     2020-08-01 07:06:58 UTC 
(rev 76631)
+++ brlcad/branches/bioh/src/libtclcad/view/lines.c     2020-08-01 12:50:29 UTC 
(rev 76632)
@@ -134,12 +134,8 @@
        return GED_ERROR;
     }
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), argv[1]))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    gdvp = ged_find_view(gedp, argv[1]);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", argv[1]);
        return GED_ERROR;
     }

Modified: brlcad/branches/bioh/src/libtclcad/view/refresh.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/view/refresh.c   2020-08-01 07:06:58 UTC 
(rev 76631)
+++ brlcad/branches/bioh/src/libtclcad/view/refresh.c   2020-08-01 12:50:29 UTC 
(rev 76632)
@@ -156,6 +156,8 @@
     struct bview *gdvp;
 
     for (BU_LIST_FOR(gdvp, bview, &top->to_gedp->go_head_views.l)) {
+//    for (size_t i = 0; i < BU_PTBL_LEN(&top->to_gedp->ged_views); i++) {
+//     gdvp = (struct bview *)BU_PTBL_GET(&top->to_gedp->ged_views, i);
        to_refresh_view(gdvp);
     }
 }
@@ -247,12 +249,8 @@
 {
     struct bview *gdvp;
 
-    for (BU_LIST_FOR(gdvp, bview, &current_top->to_gedp->go_head_views.l)) {
-       if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), name))
-           break;
-    }
-
-    if (BU_LIST_IS_HEAD(&gdvp->l, &current_top->to_gedp->go_head_views.l)) {
+    gdvp = ged_find_view(gedp, name);
+    if (!gdvp) {
        bu_vls_printf(gedp->ged_result_str, "View not found - %s", name);
        return GED_ERROR;
     }

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