SEARCH(nged)
find and list objects in a BRL-CAD database
okay bestie, this is the SEARCH(nged) page from BRL-CAD User Commands โ itโs basically find(1) energy but for objects in your MGED database instead of files on disk. ๐
๐ NAME ๐
search โ find and list objects in a BRL-CAD database.
โจ SYNOPSIS โจ
search [-a] [-v] [-Q] [-h] [path] [expressions...]
๐ฆ DESCRIPTION ๐ฆ
search works in a fashion similar to Unix-style find commands (internally it is based on OpenBSD's and NetBSD's find code) but searches objects in the current open database in MGED rather than files in a file system. One or more search paths are specified for searching, and a search plan specifies filters through which objects in the search paths are tested. The names of objects satisfying all of the filters are returned as the command output. ๐ซถ
Search Inputs are specified using PATHS and matching of objects is done according to a search plan built using boolean expressions constructed using the PRIMITIVES and OPERATORS described below. Note that OPTIONS are not used to form search plans โ unlike the search plan they are specified before the paths and are used to control settings that apply globally to search's behavior and reporting during the execution of the search. no cap, options are their own little vibe check.
The results of the search command will be sorted according to David Koelle's "alphanum" algorithm, which is basically a human-intuitive ordering for strings with letters and numbers. For example, a result returning d1.r, d10.r and d2.r will be sorted as:
d1.r
d2.r
d10.r
instead of the default ASCII character ordering, which would look like:
d1.r
d10.r
d2.r
๐ OPTIONS ๐
-hโ Print help and exit.-aโ Include hidden objects when assembling implicit, top-level, or flat input lists and when walking search hierarchies.-Qโ Exit quietly without printing error messages if the search plan contains errors. Primarily used in situations where programs automatically generate search invocations.-v[v..]โ Prints extra (verbose) information in results. Can be stacked up to 3 times for increasingly verbose printing. (See Example 22 for in-depth usage)
๐ธ PATHS: ๐ธ
By default, only the "top level" objects in any search are used as starting points in the search. The default mode if no path is explicitly specified returns a list of all objects found matching the criteria using the top level objects as inputs. Specifying paths is done as follows:
Table 1. Path Specifiers
/โ Search using top level objects in database as starting points, return list of matching full paths..โ Search using top level objects in database as starting points, return list of all matching objects (default).|โ Iterate over all objects in the database without doing a tree walk, return list of all matching objects.|/โ flat version of/: uses every object in the database as a starting point for a full tree walk, then returns matching full paths.|.โ flat version of.: uses every object in the database as a starting point for a full tree walk, then returns all matching objects.objnameโ Use objectobjnameas the starting point, return list of matching full paths./objnameโ Use objectobjnameas the starting point, return list of all matching objects.|objnameโ Use every object belowobjnameas starting points, return list of all matching objects.
One search command may use multiple paths, each of which can specify its own mode โ such a "mixed mode" search will return a list of full paths and objects in the order paths were supplied to search. ๐
The "flat" searches that are specified by using | as a modifier to other paths will use every object in the database as starting points for full tree walks and consequently will be significantly more expensive for complex tree hierarchies. The "truly flat" iterative search triggered by the the stand-alone | path specifier will be faster, but because it does not walk the tree hierarchy depth-related options (-above, -below, -depth, etc.) will not function. iykyk, flat is fast until depth options ghost you.
๐ฅ PRIMITIVES: ๐ฅ
๐ -attr attrib[>/</=val] ๐
Returns TRUE if the object has attribute attrib. If a specific value is also supplied for the attribute with an equal condition, TRUE is returned if the object both has the attribute and the attribute is set to value val. In the case of >, <, >=, and <= there are two possibilities โ if val is numerical a numerical comparison is performed, otherwise a string comparison is performed. Both attrib and val are treated as patterns under shell pattern matching rules when a string comparison is performed, but in numerical mode only the attribute name is pattern matched.
๐ -bool u/+/โ ๐
True if the object in question is being combined into the local hierarchy with the specified boolean operation. Recognized types are Union (u), Intersection (+), and Subtraction (-).
Note that by convention, top level objects are implicitly "unioned" into the database. To see only objects that have been unioned into a comb tree without returning the top level comb object as well, use the -mindepth option to filter for returns deeper in the tree.
๐ -depth [>/</=]depth ๐
True if the depth of the object in the tree is within the range specified.
๐ -exec expression arg1 arg2 ... ";" ๐
Pass expression and its arguments to the host application's search execution handler. The filter is true if the handler reports success and false if it reports an error; a textual command result is not interpreted as a boolean. The commands available to -exec depend on the host application. Any pair of curly braces ({}) in an argument is replaced by the name or full path of the object. The semicolon terminates the argument list and must not be omitted. Remember to quote the parameters properly. The semicolon must stand on its own and must be quoted. ๐ญ
bestie, do not forget that semicolon. it is not decorative. it is the whole assignment. ๐
When using multiple -exec filters, keep in mind that filters are evaluated lazily, so if you have two -execs and the first one returns false for one node, the second one will not run at all.
๐ -iname pattern ๐
Like name except the match is case insensitive.
๐ -iregex pattern ๐
Like regex except the match is case insensitive.
-matrix IDN|{#,#,#,#,#,#,#,#,#,#,#,#,#,#,#,#}โ true when the object in question is being combined into the local hierarchy with the specified matrix โจ. This one is so good when you pair it with the!operator for finding objects in a hierarchy with matrices over them โ iykyk. AndIDNis a shorthand that lets you specify an identity matrix more succinctly, which, thank you, because typing all those numbers is a โจchoiceโจ.-maxdepth nโ true if the depth of the object in the tree is less than or equal to n.-mindepth nโ true if the depth of the object in the tree is greater than or equal to n.-name patternโ true if the object name matches pattern โ and bestie, that's the name only, not the full path, just the name ๐ . The evaluation is done according to shell pattern matching rules.-nnodes nโ true if the object is a combination and has n nodes. This one also supports supplying<,>,<=, and>=in front of the number, so you can get true for objects with node counts less than, greater than, less than or equal to, and greater than or equal to n. Slay, comparison operators.-param param[>/</=val]โ returns TRUE if the object has parameter param. And here's the tea: unlike-attr, which looks only at general attributes stored as metadata on objects, the-paramfilters based only on the internal geometric object's characteristics ๐ซถ. If a specific value is also supplied for the parameter with an equal condition, TRUE is returned if the object both has the parameter and the parameter is set to value val. In the case of>,<,>=, and<=there are two possibilities โ if val is numerical a numerical comparison is performed, otherwise a string comparison is performed. Both attrib and val are treated as patterns under shell pattern matching rules when a string comparison is performed, but in numerical mode only the parameter name is pattern matched. No cap.
The following table outlines what parameters are visible to the -param option ๐. Because BRL-CAD uses the same internal containers for some types, some parameters will be present even when they do not make sense for the specific subtype โ examples include using arb8's container for arb4 and tgc for rcc ๐. Note: there are also a number of primitives whose parameters are not exposed in a way that that -param can access them: arbn, ars, brep, bspline, dsp, metaball, nmg, pipe, pnts, and poly. So if your fave is on that list, that's literally why the vibe check failed.
๐ Table 2. Primitive Parameters ๐
arb8(arb4,arb5,arb6,arb7) โV1, V2, V3, V4, V5, V6, V7, V8botโmode[surf,volume,plate,plate_nocos], orient[no,lh,rh], V, F, TclineโV, H, R, TebmโF, W, N, H, MehyโV, H, A, r_1, r_2, cell(sph) โV, A, B, CepaโV, H, A, r_1, r_2etoโV, N, C, r, r_dextrudeโV, H, A, B, S, KgripโV, N, LhalfโN, dhfโcfile, dfile, fmt, w, n, shorts, file2mm, v, x, y, xlen, ylen, zscalehypโV, H, A, b, bnrpartโV, H, r_v, r_hrevolveโV, axis, R, ang, sk_namerhcโV, H, B, r, crpcโV, H, B, rsketchโV, A, B, VL, SLsubmodelโfile, treetop, methtgc(rcc,rec,tec,trc) โV, H, A, B, C, DtorโV, H, r_a, r_hvolโfile, w, n, d, lo, hi, size, mat-path patternโ true if the object path matches pattern. The evaluation is done according to shell pattern matching rules.-printโ evaluates to TRUE ๐ โ used to print out the path and name of the object.-regexpattern โ true if the object's path matches pattern. The matching here is done with Regular Expression matching, so go off with your regex self ๐-size [>/</=]size โ true if the object's size lands inside the range you specified. Big note though bestie: for combs, extrudes, and other composite objects, this filter only looks at the object definition itself, not its related elements. So don't come for it expecting it to count the whole squad ๐-stdattrโ returns TRUE if an object has ONLY standard attributes attached to it. In BRL-CAD, the standard attributes are literally these:GIFTmaterโ value type#inheritโ value type0or1material_idโ value type#oshaderโ value type shader stringregion_idโ value type#rgbโ value type#/#/#
-typepattern โ returns TRUE if the object's type matches pattern. This one uses shell pattern matching for the evaluation, so it's giving glob energy โจ Types it recognizes include:arb4,arb5,arb6,arb7,arb8,arbnannot,ars,binunif,bot,brep,bsplinecline,constrnt,datum,dsp,ebm,ehyell,epa,eto,extrude,grip,halfhf,hrt,hyp,joint,metaball,nmgpart,pipe,pnts,poly,rec,rhcrpc,script,sketch,sph,submodel,superelltgc,tor,vol
And for the combinations, these are the types and the abbreviations it recognizes:
combinationโc,comb,combinationregionโr,reg,region
Also, as a little convenience treat ๐ the -type option will also recognize the pattern shape, which matches any object that is not a combination, region, annotation, constraint, grip or joint. Not me giving you a catch-all, but she did that ๐
And okay so if you're trying to identify shapes that are defined as implicit solids using the "plate mode" methodology โ the pattern plate is your girl. It matches any object whose internal definition indicates it's of that type. Currently that's possible with bot and brep objects. ๐ฅ
The pattern volume is basically the mirror of plate: it reports objects that clearly define a non-implicit solid volume. But heads up, its determination is local โ like, combs aren't matched because a comb may be made up of non-volumetric objects. In particular, plate mode objects won't match because their volume is implicit, and (for example) surface mode BoTs won't match because they don't define a volume. It's giving "read the room, the room is the local definition" ๐ญ
๐ฅ OPERATORS ๐ฅ
( expression )โ evaluates to true when the expression inside the parentheses is true. Itโs the โbestie, please respect my order of operationsโ move ๐ .-below[>/</=val] expressionโ true if an ancestor of the current path satisfies expression. The current object itself is not tested by expression. For example,-below -name start_comb.cis true for both/component/region.r/start_comb.c/prim1.sand any deeper descendants ofstart_comb.c, but itโs false forstart_comb.citself. No cap.
An optional comparison constrains the number of hierarchy edges between the current object and the ancestor being tested. The immediate parent is at relative depth 1, its parent is at relative depth 2, and so on. So -below=1 -type region selects objects whose immediate parent is a region, while -below>1 -type region requires a matching region at least two levels above the current object. The unqualified form tests all ancestors. Slay.
Nested forms such as -below -below -name X are valid. They test whether the current object has an ancestor which is itself below an ancestor matching X. See Hierarchy Operator Performance before using constrained or action-bearing forms on large hierarchies. Fr fr, check the performance tea first โ.
expression -and expression(a.k.a.-a) โ the and operator operates like the logical AND operator:TRUEonly if both expressions are true. AND is the default operator assumed if two expressions are present with no operator explicitly defined. Itโs giving โif both of you are coming, then itโs a partyโ ๐.-above[>/</=val] expressionโ true if a descendant of the current path satisfies expression. The current object itself is not tested by expression. For example,-above -name prim1.sis true for/component,/component/region.r, and/component/region.r/start_comb.cwhenprim1.sis below them, but itโs false forprim1.sitself.
An optional comparison constrains the number of hierarchy edges between the current object and the descendant being tested. An immediate child is at relative depth 1. Thus, -above=1 -name prim1.s matches only direct parents of prim1.s; the unqualified form tests descendants at every depth.
Using -above as the expression within another -above (for example, -above -above -name X) is valid, but may be dramatically slower than an ordinary -above. See Hierarchy Operator Performance. Basically: valid, but it can be a lil dramatic ๐ญ.
-not expression(a.k.a.!) โ the logical NOT operator. Returns the opposite of the evaluation result of expression. Itโs the โflip the vibe checkโ button.expression -or expression(a.k.a.-o) โ the logical OR operator. True if either expression is true. One of them showing up is enough, iconic behavior โจ.
๐ฅ Hierarchy Operator Performance ๐ฅ
Ordinary, unconstrained, side-effect-free -above and -below expressions use cached propagation and are intended for large searches. Pure boolean composition with -and, -or, parentheses, or ! does not by itself disable these hierarchy caches. The following cases automatically require exhaustive evaluation instead:
- Any
-execanywhere in a plan containing-aboveor-belowdisables all hierarchy-result caching for that plan. This is necessary because the callback may change the database, and later filters must observe those changes even when-execis in a different-andor-orbranch. Like, the database said โIโm different now,โ and the filters have to respect that ๐ . - A
-belowwith a relative-depth comparison, or whose expression contains an explicit action such as-execor-print, may inspect the ancestor chain separately for every candidate. Its cost is proportional to the number of paths times their depth and can become quadratic on a deep chain. Unconstrained nested-belowexpressions remain cached when they contain no actions; in the unusual case of more than64cached-belowoperators, additional operators use exhaustive evaluation. Sixty-four is the vibes limit, apparently ๐. - A depth-constrained
-above, an-abovewhose expression contains an explicit action, or an-abovedirectly nested inside another-abovemay compare candidates against the collected path set repeatedly. These forms can be quadratic in the number of paths. Oof. - Nesting hierarchy operators that require these exhaustive forms can compound the cost beyond quadratic. Itโs giving โthis could get real expensive real fastโ ๐.
The implicit final -print added by search does not disable caching. Only an explicit -print inside the hierarchy expression does so. Important distinction, bestie ๐ซถ.
Traversal pruning by -maxdepth is also conservative. An -or permits pruning only when every branch has a -maxdepth bound; for example, -maxdepth 2 -or -name *.s cannot prune, while -maxdepth 2 -or -maxdepth 4 can prune below depth 4. A -maxdepth under !, -above, or -below does not bound the outer traversal. Actions are evaluated from left to right, so -exec ... ";" -and -maxdepth 2 cannot prune before running the action, whereas placing -maxdepth 2 first permits pruning and prevents the later action from running below that depth.
โ ๏ธ Warning โ on large, deep, or heavily shared models, the number of full paths can be much larger than the number of database objects. The exhaustive forms above can therefore take an untenably long time and may appear to have hung. Not the cute kind of suspense ๐ญ.
When possible, start from the narrowest applicable path, put inexpensive selective filters such as -name, -type, or -depth before a costly hierarchy operator, and avoid relative-depth constraints or nested hierarchy operators when an equivalent simpler plan is available. Test unavoidable exhaustive plans on a representative subtree before applying them to the complete database. Be smart, be safe, protect your runtime ๐ธ.
๐ฌ A NOTE ON EXPRESSIONS ๐ฌ
All primaries and operands must be expressed as separate arguments to search. In practice, this means that there must be a space between each element in a search expression. E.g. !(-name [a-z] -or -name [0-9]) must be written as:
! ( -name [a-z] -or -name [0-9] )
While this may seem like a rather verbose way of writing the expression, it greatly simplifies the parsing of the expression and is standard for virtually all find type commands. Because [a-z] and [0-9] are atomic arguments as far as search is concerned, they should NOT be expanded in a similar fashion. The parser said โgive me spaces,โ and honestly? We respect it ๐.
๐ฎ A NOTE ON SPECIAL CHARACTERS ๐ฎ
Depending upon your environment, special characters such as wildcards or brackets may require an escape character (\). Double quotes can also be used to surround the expression negating the need for multiple escape characters. The following three examples show a search for names containing the string "tire" using two wildcards.
search -name *tire*
search -name \*tire\*
search -name "tire"
If an escape character is required but not used, an "unknown option passed to find_create" error will be displayed. So if you see that, itโs not a mystery, itโs the shell/parser saying โbestie, you forgot the escapeโ ๐.
๐ Example 1 โ Shell Globbing Based Pattern Match of Object Name ๐
search -name *.s
Finds literally every object in the database whose name ends in ".s". Slay.
๐ธ Example 2 โ Full Path Instance Reporting of Search Results ๐ธ
search / -name *.s
Finds every instance of objects in the database with names ending in ".s". Yes bestie, there's a difference โ we'll get to it.
๐ฆ Example 3 โ Name Pattern Matching at Depth >= 3 ๐ฆ
search / -name *.s -mindepth 3
Finds all the instances of objects whose names end in ".s" that are 3 or more levels deep in their tree. Deep cuts only.
๐ Example 4 โ Finding all Objects in a Subtree ๐
search group1 -name *.r
Finds all objects within group1 in the database that have names ending in ".r". Heads up though: this returns a list of objects, not the full path info associated with each instance of the matched objects. Just the objects themselves, no lore.
โจ Example 5 โ Finding all Instances of Objects in a Subtree โจ
search /group1 -name *.r
Finds all instances of objects within group1 whose names end in ".r". And unlike the previous example, this one does hand you the full path information associated with each instance of the objects matched. That leading / is doing so much work, iykyk.
๐ง Example 6 โ Finding all Instances of a Sub-Path ๐ง
search / -path \*r245
Finds all paths that end with the object r245. Note bestie: all paths generated by objects below r245 will not match this pattern. If you want to find all paths with r245 in them, use this pattern instead:
search / -path \*r245\*
And if you need to match an object path that's potentially ambiguous (say, r1 when there are lots of regions matching the r1* globbing rule), add the trailing slash to the expression:
search / -path \*r1\/\*
๐ฅ Example 7 โ Searching by Type ๐ฅ
search . -type eto
Finds all objects in the database that are elliptical tori. And note that a path of "." produces the same search behavior as the default behavior for an unspecified path. Same vibe, different spelling.
๐ซถ Example 8 โ Finding all Instances of Nested Regions ๐ซถ
search / -type region -below -type region
Finds all instances of objects of type region that are nested within another region. So it's searching for regions being used within the subtrees of other regions โ which is, and I cannot stress this enough, considered bad practice in BRL-CAD. Not the moment.
๐ Example 9 โ Finding all Assemblies ๐
search / -type comb ! -below -type region ! -type region
Finds all instances of objects of type combination that are not below regions and are not themselves regions. These are regarded as "assemblies" in BRL-CAD. Main character objects, honestly.
๐ Example 10 โ Finding all Combinations below Regions ๐
search / -type comb -below -type region ! -type region
Finds all instances of combinations that are not regions and are located within a region (below a region in the hierarchy). Combs living inside regions, we see you.
๐ Example 11 โ Finding all Empty Combinations ๐
search -nnodes 0
Finds all combinations containing zero nodes. Empty combs, no thoughts, head empty.
๐ Example 12 โ Finding all Combinations With 10 or More Nodes ๐
search -nnodes >=10
Finds all combinations with 10 or more nodes. Busy combs, thriving.
โญ Example 13 โ Finding all Intersected Objects โญ
search -bool +
Finds all objects that are combined into one or more trees using the Intersect boolean operation somewhere in the .g file. Important caveat: this approach only identifies which objects are intersected somewhere in the tree โ it does not tell you where specifically they're intersected.
๐ธ Example 14 โ Finding all Instances of Object Intersection ๐ธ
search / -bool +
Finds all boolean operations that use the Intersect boolean operation and reports the full paths to those objects. So this reports all the individual cases where an object has been combined into a hierarchy by intersection, not just which objects have been included with the intersection operator. Receipts AND locations ๐
๐ฆ Example 15 โ Finding all Unions Within a Comb's Tree ๐ฆ
search /all.g -mindepth 1 -bool u
Finds all unions within the all.g tree hierarchy, excluding all.g itself. -mindepth 1 said "not you, queen."
๐ Example 16 โ Finding all Non-Subtracted Regions below Regions ๐
search / -type region -below -type region ! -bool -
A more nuanced variation on finding nested regions, which adds a check to make sure the regions aren't being subtracted. So real talk โ while this isn't ideal, using a subtraction does avoid the modeling error of two volumes claiming the same three dimensional space, and it's arguably acceptable. The -below command is the one that finds nested region instances that are considered errors.
โจ Example 17 โ Finding all Non-Identity Matrix Instances โจ
search / ! -matrix IDN
Reports all comb instances included in their parent comb with a non-identity positioning matrix. We love a transformed king.
๐ Example 18 โ Finding all Regions with RGB color 180 180 180 ๐
search -type region ( -attr color=180/180/180 -or -attr
rgb=180/180/180 )
Prints all regions with their color attribute set to 180/180/180. Some files may use rgb instead of color, so to be comprehensive an -or option is used to check both possibilities. Covering all bases, periodt.
๐ง Example 19 โ Find All Combs Containing At Least One of Two Objects (dbfind) ๐ง
search |. ( -depth 0 -above=1 -name obj1 ) -or ( -depth 0 -above=1
-name obj2 )
Prints all combs immediately above either obj1 or obj2. This more or less mimics the results of the dbfind command โ although it'll be somewhat slower (noticeably so on large databases). Worth it though.
๐ฅ Example 20 โ Finding all regions containing an intersection of obj2 ๐ฅ
search |/ -maxdepth 0 -type region -above ( -name obj2 -bool + )
Prints all regions immediately above obj2 where obj2 is included using an intersection operation.
๐ Example 21 โ Finding all Plate-Mode BoT Objects ๐
search -type bot -param mode=plate
Prints all BoT primitives using "plate" mode, instead of the closed-mesh-requiring "volume" mode. Plate mode girlies rise.
๐ซถ Example 22 โ Returning all Combinations That Have Given Object As a Member ๐ซถ
search -above=1 -name example.s
Prints all combinations that have example.s as a member. This behavior is identical to the deprecated command dbfind.
๐ Example 23 โ Returning the Full Path(s) of a Given Object ๐
search / -name example.s
Prints all paths to example.s. This behavior is identical to the deprecated command dbfindtree.
๐ Example 24 โ Verbose Reporting of Search Information ๐
search allows for multiple levels of verbose reporting, and each one is giving more:
- The first level reports the total number of items found.
- The second level reports the boolean operator used at each step along the path.
- The next, and final, level reports the primitive type of each object along the path.
You can supply increased verbosity two different ways: as a single flag with each 'v' indicating an elevated level (search -vv..), as well as stacked -v flags (search -v -v ..). Both work, pick your fighter.
mged>search -v /all.g ! -type comb
/all.g/box.r/box.s
/all.g/cone.r/cone.s
/all.g/ellipse.r/ellipse.s
/all.g/light.r/LIGHT
/all.g/platform.r/platform.s
/all.g/tor.r/tor
[6] items found in search
First level of verbosity prints the total number of items found in the search. This is especially useful when coupled with the '-exec' flag, which may or may not print the number of items effected by the exec.
mged> search -vv /all.g ! -type comb
OR
mged> search -v -v /all.g ! -type comb
/u all.g/u box.r/u box.s
/u all.g/u cone.r/u cone.s
/u all.g/u ellipse.r/u ellipse.s
/u all.g/u light.r/u LIGHT
/u all.g/u platform.r/u platform.s
/u all.g/u tor.r/u tor
[6] items found in search
Second level of verbosity prints the total number of items found in the search as well as the boolean operators at each step along the path.
mged> search -vvv /all.g ! -type comb
OR
mged> search -v -v -v /all.g ! -type comb
/u all.g(c)/u platform.r(r)/u platform.s(arb8)
/u all.g(c)/u box.r(r)/u box.s(arb8)
/u all.g(c)/u cone.r(r)/u cone.s(tgc)
/u all.g(c)/u ellipse.r(r)/u ellipse.s(ell)
/u all.g(c)/u tor.r(r)/u tor(tor)
/u all.g(c)/u light.r(r)/u LIGHT(ell)
[6] items found in search
At max verbosity, it prints the total number of items found in the search, the boolean operators, and finally the primitive type of each object along the path. That's the full tea โ
๐ Example 25 โ Operating on Sets of search Results ๐
There are two available methods for working with sets of search results. Okay so:
Method one: the exec option, used in the following example to search for all regions below subtractions or intersections in the m35.g example model in BRL-CAD and draw the objects' wireframes in the display manager:
mged> search all.g -type region -and ( -below -bool - -or -below -bool + ) -exec draw "{}" ";"
mged> autoview
Method two: another possibility โ especially useful for doing multiple sequential operations which would be awkward to write out in a single search line โ is to assign the results of a search command to a Tcl variable.
To illustrate, let's randomize the colors of all regions in the "cab" assembly of the m35.g example model and then assign a glass shader with transparency as a follow-on step.
First, we collect the set of search results into a Tcl variable:
mged> set glob_compat_mode 0
mged> set search_results [search cab -type region]
Next we randomize the colors using Tcl's functionality (here we use random numbers and avoid any value less than 30 to keep objects more visible):
mged> foreach i $search_results {attr set $i color [expr {int(rand()*225)+30}]/[expr {int(rand()*225)+30}]/[expr {int(rand()*225)+30}]}
Finally, we add transparency to the same regions:
mged> foreach i $search_results {attr set $i shader {glass {tr 0.7 ri 1}}}
โ ๏ธ Note โ ๏ธ Remember, when you're setting region colors, to check for the presence of aregionid_colortableattribute on the_GLOBALobject. If such a table is present (them35.gsample model has one, for example) you need to remove that table (and for MGED wireframes, re-open the database) before the colors on the individual regions will"take":mged> attr rm _GLOBAL regionid_colortable
๐ DIAGNOSTICS ๐
Errors will be returned if parsing of the arguments fails, or if one of the primaries' evaluation functions returns an error. So like, if the words don't make sense, or the thing you asked for breaks โ you'll get an error. No cap.
๐ AUTHOR ๐
Clifford Yapp
๐ COPYRIGHT ๐
okay so the legal bit, but make it cute: this software is Copyright (c) 2008-2026 United States Government as represented by the U.S. Army Research Laboratory. Portions Copyright 1990, 1993, 1994 The Regents of the University of California, per copyright and license information from OpenBSD and NetBSD. For more details see the copyright statements in search.c and search.h. ๐ซถโจ
๐ BUGS ๐
bugs resulting from incorrect parsing of shell pattern expressions are the result of libbu's fnmatch โ literally thatโs the source, no cap. ๐
๐ฌ BUG REPORTS ๐ฌ
got a bug or a problem? reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org. ๐
and thatโs the whole page, bestie! footer sign-off: source/version BRL-CAD, page SEARCH(nged), and the date isnโt shown on the footer line as given โ no invented dates here, periodt. the trailing MANPAGE word is acknowledged too. ๐โจ๐
๐ฆ where this page comes from
- nixpkgs unstable: brlcad 7.44.0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms