Revision: 75377
http://sourceforge.net/p/brlcad/code/75377
Author: starseeker
Date: 2020-04-13 14:45:43 +0000 (Mon, 13 Apr 2020)
Log Message:
-----------
Use the gdiff trick for the lint command and add the ability to specify search
style filters to only examine subsets of the .g database.
Modified Paths:
--------------
brlcad/trunk/NEWS
brlcad/trunk/doc/docbook/system/mann/lint.xml
brlcad/trunk/src/libged/lint.cpp
Modified: brlcad/trunk/NEWS
===================================================================
--- brlcad/trunk/NEWS 2020-04-13 14:01:37 UTC (rev 75376)
+++ brlcad/trunk/NEWS 2020-04-13 14:45:43 UTC (rev 75377)
@@ -14,6 +14,7 @@
--- 20XX-XX-XX Release 7.XX.X ---
----------------------------------------------------------------------
+* added -F option to lint cmd to test specifc solid types - Cliff Yapp
* added support to MGED for zooming with mouse wheel - Cliff Yapp
* repaired wireframe visualization during MGED solid edit - Cliff Yapp
* added .r suffixes to region names in 3dm-g conversion - Cliff Yapp
Modified: brlcad/trunk/doc/docbook/system/mann/lint.xml
===================================================================
--- brlcad/trunk/doc/docbook/system/mann/lint.xml 2020-04-13 14:01:37 UTC
(rev 75376)
+++ brlcad/trunk/doc/docbook/system/mann/lint.xml 2020-04-13 14:45:43 UTC
(rev 75377)
@@ -21,6 +21,7 @@
<arg choice="opt" rep="norepeat">-C</arg>
<arg choice="opt" rep="norepeat">-M</arg>
<arg choice="opt" rep="norepeat">-I</arg>
+ <arg choice="opt" rep="norepeat">-F "filters"</arg>
<arg choice="opt"
rep="norepeat"><replaceable>ObjectName</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
@@ -82,14 +83,49 @@
</para>
</listitem>
</varlistentry>
-
+ <varlistentry>
+ <term><option>-F</option>, <option>--filter</option></term>
+ <listitem>
+ <para>
+ Apply search command style filters to the set of objects to be
tested. Allows,
+ (for example) a user to test only brep objects and not bot objects or
only objects
+ matching a particular name pattern. Does not impact the checks for
missing or
+ cylic geometry - the underlying search mechanism assumes inputs do
not have those
+ particular categories of problem and thus can't be reliably applied
in those cases.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
</refsection>
<refsection xml:id="examples"><title>EXAMPLES</title>
+ <example>
+ <title>Examine entire database for all defect categories</title>
+
+ <para>
+ <prompt>mged> </prompt><userinput>lint</userinput>
+ <literallayout class="normal">
+Checking for cyclic paths...
+Checking for references to non-extant objects...
+Checking for invalid objects...
+Found cyclic paths:
+ /c1/c2/c1
+ /c2/c1/c2
+Found references to missing objects:
+ invalid_dsp_missing_binary_obj.s/missing_binary_object.s
+ invalid_dsp_missing_file.s/missing_file.data
+ invalid_extrude_missing_sketch.s/missing_sketch.s
+ missingentry.c/missing.s
+Found invalid objects:
+ nonsolid.bot[bot] failed solidity test, but BoT type is RT_BOT_SOLID
+
+ </literallayout>
+ </para>
+ </example>
+
<example>
- <title>Examine a single geometry object for validity</title>
+ <title>Check the validity of a single geometry object</title>
<para>
<prompt>mged> </prompt><userinput>lint -I nonsolid.bot</userinput>
@@ -96,7 +132,7 @@
<literallayout class="normal">
Checking for invalid objects...
Found invalid objects:
- nonsolid.bot[bot] failed bot solid test
+ nonsolid.bot[bot] failed solidity test, but BoT type is RT_BOT_SOLID
</literallayout>
</para>
@@ -103,24 +139,20 @@
</example>
<example>
- <title>Examine entire database for all defect categories</title>
+ <title>Examine all non-BoT objects in the database matching the name
pattern "*_1.*" for invalidity</title>
<para>
- <prompt>mged> </prompt><userinput>lint</userinput>
+ <prompt>mged> </prompt><userinput>lint -F "! -type bot -name
*_1.*"</userinput>
<literallayout class="normal">
-Checking for cyclic paths...
-Checking for references to non-extant objects...
Checking for invalid objects...
-Found cyclic paths:
- /c1/c2/c1
- /c2/c1/c2
-Found references to missing objects:
- invalid_dsp_missing_binary_obj.s/missing_binary_object.s
- invalid_dsp_missing_file.s/missing_file.data
- invalid_extrude_missing_sketch.s/missing_sketch.s
- missingentry.c/missing.s
Found invalid objects:
- nonsolid.bot[bot] failed bot solid test
+ Brep_1.s[brep] failed OpenNURBS validity test
+brep.m_L[27] loop is not valid.
+ end of brep.m_T[loop.m_ti[5]=147]=(0,-1.309) and start
+ of brep.m_T[loop.m_ti[6]=148]=(0,-5.63995e-08) do not match.
+brep.m_F[25] face is not valid.
+ brep.m_L[face.m_li[0]=27] is not valid.
+ON_Brep.m_F[25] is invalid.
</literallayout>
</para>
Modified: brlcad/trunk/src/libged/lint.cpp
===================================================================
--- brlcad/trunk/src/libged/lint.cpp 2020-04-13 14:01:37 UTC (rev 75376)
+++ brlcad/trunk/src/libged/lint.cpp 2020-04-13 14:45:43 UTC (rev 75377)
@@ -40,6 +40,7 @@
int cyclic_check;
int missing_check;
int invalid_shape_check;
+ struct bu_vls filter;
};
struct _ged_lint_opts *
@@ -51,6 +52,7 @@
o->cyclic_check = 0;
o->missing_check = 0;
o->invalid_shape_check = 0;
+ o->filter = BU_VLS_INIT_ZERO;
return o;
}
@@ -396,12 +398,12 @@
case DB5_MINORTYPE_BRLCAD_BOT:
bot = (struct rt_bot_internal *)intern.idb_ptr;
RT_BOT_CK_MAGIC(bot);
- if (bot->mode != RT_BOT_PLATE && bot->mode != RT_BOT_PLATE_NOCOS) {
+ if (bot->mode == RT_BOT_SOLID) {
not_valid = bg_trimesh_solid2((int)bot->num_vertices,
(int)bot->num_faces, bot->vertices, bot->faces, NULL);
if (not_valid) {
obj.name = std::string(dp->d_namep);
obj.type= std::string("bot");
- obj.error = std::string("failed bot solid test");
+ obj.error = std::string("failed solidity test, but BoT type
is RT_BOT_SOLID");
}
}
rt_db_free_internal(&intern);
@@ -444,33 +446,25 @@
{
int ret = GED_OK;
struct directory *dp;
- if (argc) {
- unsigned int i;
- struct bu_ptbl *pc = NULL;
- const char *osearch = "! -type comb";
- if (!dpa) return GED_ERROR;
- BU_ALLOC(pc, struct bu_ptbl);
- if (db_search(pc, DB_SEARCH_RETURN_UNIQ_DP, osearch, argc, dpa,
gedp->ged_wdbp->dbip, NULL) < 0) {
- ret = GED_ERROR;
- bu_ptbl_free(pc);
- bu_free(pc, "pc table");
- } else {
- for (i = 0; i < BU_PTBL_LEN(pc); i++) {
- dp = (struct directory *)BU_PTBL_GET(pc, i);
- _ged_invalid_prim_check(idata, gedp, dp);
- }
- bu_ptbl_free(pc);
- bu_free(pc, "pc table");
- }
+ struct _ged_lint_opts *opts = (struct _ged_lint_opts *)idata->o;
+ unsigned int i;
+ struct bu_ptbl *pc = NULL;
+ struct bu_vls sopts = BU_VLS_INIT_ZERO;
+ bu_vls_sprintf(&sopts, "! -type comb %s", bu_vls_cstr(&opts->filter));
+ BU_ALLOC(pc, struct bu_ptbl);
+ if (db_search(pc, DB_SEARCH_RETURN_UNIQ_DP, bu_vls_cstr(&sopts), argc,
dpa, gedp->ged_wdbp->dbip, NULL) < 0) {
+ ret = GED_ERROR;
+ bu_ptbl_free(pc);
+ bu_free(pc, "pc table");
} else {
- int i;
- for (i = 0; i < RT_DBNHASH; i++) {
- for (dp = gedp->ged_wdbp->dbip->dbi_Head[i]; dp != RT_DIR_NULL; dp
= dp->d_forw) {
- _ged_invalid_prim_check(idata, gedp, dp);
- }
+ for (i = 0; i < BU_PTBL_LEN(pc); i++) {
+ dp = (struct directory *)BU_PTBL_GET(pc, i);
+ _ged_invalid_prim_check(idata, gedp, dp);
}
+ bu_ptbl_free(pc);
+ bu_free(pc, "pc table");
}
-
+ bu_vls_free(&sopts);
return ret;
}
@@ -482,7 +476,6 @@
static const char *usage = "Usage: lint [ -CMS ] [obj1] [obj2] [...]\n";
int print_help = 0;
struct _ged_lint_opts *opts;
- struct bu_opt_desc d[6];
struct directory **dpa = NULL;
int nonexist_obj_cnt = 0;
struct _ged_cyclic_data *cdata = NULL;
@@ -494,12 +487,14 @@
opts = _ged_lint_opts_create();
+ struct bu_opt_desc d[7];
BU_OPT(d[0], "h", "help", "", NULL, &print_help,
"Print help and exit");
BU_OPT(d[1], "v", "verbose", "", &_ged_vopt, &(opts->verbosity),
"Verbose output (multiple flags increase verbosity)");
BU_OPT(d[2], "C", "cyclic", "", NULL, &(opts->cyclic_check),
"Check for cyclic paths (combs whose children reference their parents -
potential for infinite looping)");
BU_OPT(d[3], "M", "missing", "", NULL, &(opts->missing_check),
"Check for objects reference by combs that are not in the database");
BU_OPT(d[4], "I", "invalid-shape", "", NULL,
&(opts->invalid_shape_check), "Check for objects that are intended to be valid
shapes but do not satisfy that criteria (examples include non-solid BoTs and
twisted arbs)");
- BU_OPT_NULL(d[5]);
+ BU_OPT(d[5], "F", "filter", "", &bu_opt_vls, &(opts->filter),
"For checks on existing geometry objects, apply search-style filters to check
only the subset of objects that satisfy the filters. In particular these
filters do NOT impact cyclic and missing geometry checks.");
+ BU_OPT_NULL(d[6]);
/* skip command name argv[0] */
argc-=(argc>0); argv+=(argc>0);
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