Revision: 50342 http://brlcad.svn.sourceforge.net/brlcad/?rev=50342&view=rev Author: indianlarry Date: 2012-04-27 05:06:06 +0000 (Fri, 27 Apr 2012) Log Message: ----------- Extended 'brep' debugging command to take an index range. You can now enter a dash("1-5") to plot ranges of indexes of surfaces,faces or edges.
Modified Paths: -------------- brlcad/trunk/src/librt/primitives/brep/brep_debug.cpp Modified: brlcad/trunk/src/librt/primitives/brep/brep_debug.cpp =================================================================== --- brlcad/trunk/src/librt/primitives/brep/brep_debug.cpp 2012-04-27 04:36:48 UTC (rev 50341) +++ brlcad/trunk/src/librt/primitives/brep/brep_debug.cpp 2012-04-27 05:06:06 UTC (rev 50342) @@ -1790,68 +1790,112 @@ } else if (argc >= 4) { const char *part = argv[3]; int index = -1; + int startindex = -1; + int endindex = -1; int plotres = 100; if (argc == 6) { const char *strres = argv[5]; plotres = atoi(strres); } if (argc >= 5) { - const char *strindex = argv[4]; - if (BU_STR_EQUAL(strindex, "all")) { - index = -1; + const char *str = argv[4]; + if (BU_STR_EQUAL(str, "all")) { + index = startindex = endindex = -1; } else { - index = atoi(strindex); + const char *dash = strchr(str, '-'); + if (dash) { + struct bu_vls tmpstr = BU_VLS_INIT_ZERO; + bu_vls_strcpy(&tmpstr, str); + bu_vls_trunc(&tmpstr, dash - str); + startindex = atoi(bu_vls_addr(&tmpstr)); + bu_vls_strcpy(&tmpstr, ++dash); + endindex = atoi(bu_vls_addr(&tmpstr)); + bu_vls_free(&tmpstr); + } else { + startindex = atoi(str); + endindex = startindex; + } + index = startindex; } } if (BU_STR_EQUAL(part, "S")) { snprintf(commtag, 64, "_BC_S_"); - ret = brep_surface_plot(vls, bs, bi, vbp, index, plotres); - } else if (BU_STR_EQUAL(part, "E")) { - snprintf(commtag, 64, "_BC_EE_"); - ret = brep_isosurface_plot(vls, bs, bi, vbp, index, plotres); - } else if (BU_STR_EQUAL(part, "EE")) { - snprintf(commtag, 64, "_BC_EE_"); - int index1 = index; - int index2 = plotres; - for (int i=index1; i <= index2; i++) { - ret = brep_isosurface_plot(vls, bs, bi, vbp, i, 3); + for (int i = startindex; i <= endindex; i++) { + ret = brep_surface_plot(vls, bs, bi, vbp, i, plotres); } + } else if (BU_STR_EQUAL(part, "I")) { + snprintf(commtag, 64, "_BC_I_"); + for (int i = startindex; i <= endindex; i++) { + ret = brep_isosurface_plot(vls, bs, bi, vbp, i, plotres); + } } else if (BU_STR_EQUAL(part, "SN")) { snprintf(commtag, 64, "_BC_SN_"); - ret = brep_surface_normal_plot(vls, bs, bi, vbp, index, plotres); + for (int i = startindex; i <= endindex; i++) { + ret = brep_surface_normal_plot(vls, bs, bi, vbp, i, + plotres); + } } else if (BU_STR_EQUAL(part, "KN")) { snprintf(commtag, 64, "_BC_KN_"); - ret = brep_surface_knot_plot(vls, bs, bi, vbp, index); + for (int i = startindex; i <= endindex; i++) { + ret = brep_surface_knot_plot(vls, bs, bi, vbp, i); + } } else if (BU_STR_EQUAL(part, "F")) { snprintf(commtag, 64, "_BC_F_"); - ret = brep_facetrim_plot(vls, bs, bi, vbp, index, plotres, true); + for (int i = startindex; i <= endindex; i++) { + ret = brep_facetrim_plot(vls, bs, bi, vbp, i, plotres, + true); + } } else if (BU_STR_EQUAL(part, "F2d")) { snprintf(commtag, 64, "_BC_F2d_"); - ret = brep_facetrim_plot(vls, bs, bi, vbp, index, plotres, false); + for (int i = startindex; i <= endindex; i++) { + ret = brep_facetrim_plot(vls, bs, bi, vbp, i, plotres, + false); + } } else if (BU_STR_EQUAL(part, "SBB")) { snprintf(commtag, 64, "_BC_SBB_"); - ret = brep_surfaceleafs_plot(vls, bs, bi, vbp, true, index, plotres); + for (int i = startindex; i <= endindex; i++) { + ret = brep_surfaceleafs_plot(vls, bs, bi, vbp, true, i, + plotres); + } } else if (BU_STR_EQUAL(part, "SBB2d")) { snprintf(commtag, 64, "_BC_SBB2d_"); - ret = brep_surfaceleafs_plot(vls, bs, bi, vbp, false, index, plotres); - } else if (BU_STR_EQUAL(part, "TD")) { + for (int i = startindex; i <= endindex; i++) { + ret = brep_surfaceleafs_plot(vls, bs, bi, vbp, false, i, + plotres); + } + } else if (BU_STR_EQUAL(part, "TD")) { snprintf(commtag, 64, "_BC_TD_"); - ret = brep_trim_direction_plot(vls, bs, bi, vbp, index, plotres); + for (int i = startindex; i <= endindex; i++) { + ret = brep_trim_direction_plot(vls, bs, bi, vbp, i, + plotres); + } } else if (BU_STR_EQUAL(part, "T")) { snprintf(commtag, 64, "_BC_T_"); - ret = brep_trim_plot(vls, bs, bi, vbp, index, plotres, true); + for (int i = startindex; i <= endindex; i++) { + ret = brep_trim_plot(vls, bs, bi, vbp, i, plotres, true); + } } else if (BU_STR_EQUAL(part, "T2d")) { snprintf(commtag, 64, "_BC_T2d_"); - ret = brep_trim_plot(vls, bs, bi, vbp, index, plotres, false); + for (int i = startindex; i <= endindex; i++) { + ret = brep_trim_plot(vls, bs, bi, vbp, i, plotres, false); + } } else if (BU_STR_EQUAL(part, "TBB")) { snprintf(commtag, 64, "_BC_TBB_"); - ret = brep_trimleafs_plot(vls, bs, bi, vbp, true, index, plotres); + for (int i = startindex; i <= endindex; i++) { + ret = brep_trimleafs_plot(vls, bs, bi, vbp, true, i, + plotres); + } } else if (BU_STR_EQUAL(part, "TBB2d")) { snprintf(commtag, 64, "_BC_TBB2d_"); - ret = brep_trimleafs_plot(vls, bs, bi, vbp, false, index, plotres); + for (int i = startindex; i <= endindex; i++) { + ret = brep_trimleafs_plot(vls, bs, bi, vbp, false, i, + plotres); + } } else if (BU_STR_EQUAL(part, "E")) { snprintf(commtag, 64, "_BC_E_"); - ret = brep_edge3d_plot(vls, bs, bi, vbp, index, plotres); + for (int i = startindex; i <= endindex; i++) { + ret = brep_edge3d_plot(vls, bs, bi, vbp, i, plotres); + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits