Procedure for Finding Objects Using the Search Language

You can use the search language to search for objects. The search language offers almost all of the search functions available with Edit > Find....

The stages in this procedure are as follows:

Run a Search via the Power Input Box

The search language can be used both in the power input box and in the Advanced tab of the Find dialog box but also in macros. The search query both searches for the elements and automatically selects them. Searching using the Find... command generates a search query (expressed in the search language) displayed in the Generated query box of the Find dialog box.

Any generated query can be run via the power input box or in macros, whether transformat or not. However, the transformat query is the only usable query whatever the session language, therefore any query you expect to run in different session languages must be written in this format. If you are not familiar with this format, you can display its contents and identify the syntax to be used prior to writing your transformat query using a hidden column (you need to drag the column separator next to the Query column to display it) in the Favorites tab of the Find dialog box:



For instance, CATDrwSearch.DrwText.Name=test,in means that you will search for objects named "test" in the Drafting workbench using the "In <UI-Active object>" scope.

  1. Enter the search string.

  2. Press Enter.

The searched objects are sent to the current command. For instance, if the current command is Select, the objects are selected.

The language to be used when entering your query is detailed hereafter.

Syntax

You can search for objects using the same criteria as with the Edit > Find... command.

The message catalog KeyboardInput.CATNls sets up the power input search syntax, and search language shortcuts. The localized version of this message catalog determines the exact syntax and shortcuts for each language.

Operating Signs

The search language uses separators (whose role you will discover in various examples).


  • : and = (these separators are interchangeable)
  • != (different)
  • <, <=, >, =>.

Search by Name

You can search for an object name. This is particularly useful if you renamed objects using Edit > Properties, or the Properties contextual command. The name can also contain special characters.

To search for an object by its name, enter the following command:

name:object_name or name=object_name

or a command using an abbreviation referred to as a "shortcut" as follows:

n:object_name

where "object_name" is the name of the object.

You can also use the "*" character as a wildcard to replace any number of characters. For example, the command:

name:wheel*

searches for all objects starting with the string "wheel".

The message catalog KeyboardInput.CATNls sets up unambiguous default shortcuts. For example, there is no ambiguity between the shortcut c: (used in the power input area to enter a command), and col: (used for searches on color). In localized versions of the catalog, check that there are no identical shortcuts for two different items.

If you want the search to be case sensitive, enter the following command:

NAME:Wheel*

searches for all objects starting with the string "Wheel".

Important: The keyword used for queries that are not case sensitive is always in lowercase whereas for case sensitive queries, the keyword is in uppercase. For languages that do not make any difference between uppercase and lowercase characters, you can either add the string _CAP to the keyword to specify that the query is case sensitive, or use the Name_CAP transformat keyword.

Search by Name in Graph

You can search for an object name. This search is different from a search by name since it deals with the name as is displayed in the specification tree.

To search for an object by its name as displayed in the specification tree, enter the following command:

name in graph=object_name

If you want the search to be case sensitive, enter the following command:

NAME IN GRAPH=object_name

This name may be customized and thus, may differ from the name you entered in the Properties dialog box.

To illustrate this, suppose you have a part named "Shape1" whose properties are as follows:



The part looks like this in the specification tree:



Entering:

name=*complex*

gives no result since the search is based on the name displayed in the Name box of the Instance area.

But entering:

name in graph=*part*

finds the part.

Note that the tree item size defined in the Tree Appearance tab is not taken into account.

Search by Type

You can use the Type box in the Find dialog box to display a list of types (the types are translated in each language).

To search for an object by its type, enter the following command:

type:type or type=type

or:

t:type

You can also search for types using the "." (period) as follows:

Part Design.Pad

searches for all objects of type Pad created using the Part Design workbench.

The following syntax is also allowed:

workbench.type.attribute=

For example, entering:

Part Design.Pad.Color=Sea Green

searches for all objects of type Pad created using the Part Design workbench, and of the color Sea Green.

You can omit the workbench name if the type exists only for this workbench:

Part Design.Pad

and:

.Pad

are equivalent.

Similarly:

Part Design.Pad.Color=Sea Green

and:

type=Pad & Color=Sea Green

are also equivalent.

Here are some more examples using other operators described in Search Using Operators:

workbench.type.name=point*

workbench.type.name!=point*

workbench.type.name:point*

and:

workbench.type.color='sea green'

workbench.type.color!='sea green'

workbench.type.color:'sea green'

Search by Color

You assign colors to objects using the Color list in the Graphic tab, when using Edit > Properties or the Properties contextual command.

For a reminder about how to use this list, see Editing Graphic Properties.

To search for an object of a specific color, enter the following command:

color:color_name

or:

col:color_name

where "color_name" is the color of the object.

If the name of the color contains a blank (which is the case with most of the colors available), you can type the full name as follows:

color:Sandy Brown

You can also surround the blank or the color name with a single quote (by default) like this:

color:Sandy' 'Brown

or like this:

color:'Sandy Brown'

You can also search for colors using their RGB values. For example:

color:'(211,178,125)'

In addition to this, each color displayed in the Color list or in the color palette is identified by an index in the color table. Therefore, when searching for the "Salmon" color for instance, you can enter either:

col:Salmon

or:

col:17

since "Salmon" is the 17th color in the color palette.

The 16 colors available in the Color list are:



Clicking More Colors... lets you access the Color chooser.

Search by Product Properties

You assign properties to products (and parts in products) by right-clicking an element in the specification tree and selecting Properties, clicking the Product tab in the Properties dialog box, and setting the properties in the Product frame.

The properties you can search for (the same as those you assigned to the element) are:


  • Part Number
  • Revision
  • Definition
  • Nomenclature
  • Product Description
  • Component Description.

For example, the search queries:

Product Description:completed

Product' 'Description:completed

'Product Description':completed

'Product Description'=completed

search for all elements whose Product Description is the text "completed".

The property name is case sensitive.

Search for Objects Belonging to a Layer

You can search for an object belonging to a specific layer (as seen in the Graphic Properties toolbar).

To do so, enter the following command:

l:layer_number or l=layer_number

or

layer:layer_number or layer=layer_number

where "layer_number" is the number of the layer.

Search for Objects Belonging to a Selection Set

You can search for an object belonging to a selection set.

To do so, enter the following command:

s:selection_set_name

or

set:selection_set_name

where "selection_set_name" is the name of the selection set.

If you want the search to be case sensitive, enter the following command:

SET=selection_set_name

The strings "name", "type", "color" and "set" are appropriate for the English language only. The message catalog KeyboardInput.CATNls determines the exact syntax for your language.

Search for Visible or Hidden Elements

You can search for visible, invisible, shown elements, or elements hidden in the No Show space.

To do so, use the following syntax:

visibility:visible

vis:visible

and:

visibility:hidden

vis:hidden

Search for Line Thickness or Linetype

You can search for objects with a specific line thickness or linetype (as seen in the Graphic Properties toolbar).

To do so, use the following syntax:

weight:

w:

or:

dashed:

d:

When searching for lines with a specific weight, you can specify the weight index like this:

weight:6,all

to search for all lines which are 2.0000 mm thick.

Search by Symbol

You can search for a point symbol.

To do so, enter the following command:

symbol:small full square or symbol=small full square

or

symb:small full square or symb=small full square

searches for the following point symbol: .

Capital letters are meaningless for the symbol name and you can also type:

symbol:Small Full Square or symbol=SMALL FULL SQUARE

The point symbols you can search for are:



Cross
Plus
Circle
Double Circle
Dot
Full Square
Star
Small Full Square
Small Dot

Search Using Favorites

You can search for objects using your favorite queries defined via the Favorites tab in the Find dialog box.

To do so:

favorite=favorite_query_name or favorite:favorite_query_name

but you can also enter:

f=favorite_query_name or f:favorite_query_name

where "favorite_query_name" is the name of the favorite query. Note that the language used in favorite queries is case sensitive.

When you press Enter, the search results are selected in the specification tree.

You can use any of the special characters such as !. For example, let's use the query defined in the Favorites tab. This query searches for any element named "My Sketch". Now, suppose you want your search to select all elements whose names are other than "My Sketch", you just have to type:

favorite!=Query_1

or

f!=Query_1

In that case, the search scope is not modified.

To modify the search scope, indicate the new scope after the favorite query name in the power input box:

favorite=Query_1, from

searches for any element named "My Sketch" From Search to bottom and not Everywhere as originally defined in Query_1. The new scope supersedes the previous one.

You can also combine favorite queries with predefined favorite queries using operators.

Search Using Predefined Favorites

You can search for objects using predefined favorite queries that you run by entering specific shortcuts. These predefined favorite queries (which deal with V6 objects only) can be neither modified, nor deleted contrary to standard favorite queries you define in the Favorites tab of the Find dialog box.

The shortcuts used to run these predefined queries have been defined to search "Everywhere". However, if the scr as Visible on screen option is selected in the Default Search Scope for Power Input list and if the Replaces scope defined in favorite queries option is selected, the queries will search for visible elements only.

You can use the following shortcuts:

  Shortcut for Searches for
* t:*,all all objects everywhere (i.e. in the whole specification tree from top to bottom)
*PLN .Plane,all all planes everywhere
*SUR .Surface-.Plane,all all surfaces (except planes) everywhere
*FAC .Face,all all topological faces everywhere
*VOL .Volume,all all volumes everywhere
*LN .Line-.Sketcher.Line,all all lines (except sketcher's) everywhere
*PT .Point-.Sketcher.Point,all all points (except sketcher's) everywhere
*CRV .Curve-.Line-.Sketcher.Curve,all all curves (except sketcher's and lines) everywhere
*SKT .Sketch,all all sketches everywhere
*AXS .Axis System+.AbsoluteAxis,all all axis systems (including sketcher's) everywhere
*FTA .Functional Tolerancing & Annotation Element all Functional Tolerancing & Annotation elements everywhere

For instance, to search for all sketches everywhere, enter the appropriate shortcut after the prefix used to run favorite queries:

f:*SKT or f=*SKT

but you can also enter

favorite:*SKT or favorite=*SKT

Tip: If the option f: as favorite: is selected in the Default Prefix for Power Input list, you do not need to type the prefix before the shortcut. You simply enter *SKT to search for all sketches everywhere.

Predefined shortcuts are provided to search for elements having a characteristic in common with the element you select:

  Searches for
*COL all objects with the same color as the selected object
*LAY all objects included in the same layer as the selected object
*LNW all lines with the same thickness as the selected object
*LNT all lines with the same linetype as the selected object
*PTT all points with the same point type as the selected object
*PRT all objects included included in the same part as the selected object
*PBD all objects included included in the same part body (or hybrid body) as the selected object
*GST all objects included included in the same geometrical set (named "open body" before V5R13) as the selected object
*OGS all objects included included in the same ordered geometrical set (named "shape body" before V5R13) as the selected object

To run a predefined favorite query involving a selection, you need to select the object before or after entering the appropriate shortcut.

For instance, to search for all objects with the same color as the selected object ("blue" in our example), select a "blue" object then enter:

*COL

or enter

*COL and select the object. In that case, when you press Enter after entering the shortcut is entered, an acquisition agent opens:



Select the object then click Close to close the acquisition agent.

You can run predefined favorite queries with arguments. These predefined queries are run using the following shortcuts:

  Shortcut for Searches for
*COL< xxx > Color= xxx ,all all elements with the color xxx everywhere, where xxx is the RGB code (e.g. *COL'(0,0,255)' when searching for the "blue" color) or the color name (e.g. *COLblue) or the color index (e.g. *COL45)
*SST< xxx > Set= xxx ,all all objects in the selection set xxx everywhere (where xxx is the name of the set, e.g. *SST'Set1' or SSTSet1)
*LAY< n > Layer= n ,all all objects in the layer n everywhere (where n is the layer number, e.g. *LAY2)
*LNW< n > .Line & Weight= n ,all all lines drawn with the thickness index n , as displayed in the Weight list of the Search dialog box, everywhere (e.g. *LNW3to search for a 0.7000 mm line: )
*LNT< n > .Line & Dashed= n ,all all lines drawn with the dashed index n , as displayed in the Dashed list of the Search dialog box, everywhere (e.g. *LNT2to search for a "Dotted" line: )
*PTT< n > .Point & Symbol= n ,all all points drawn with the symbol n , as displayed in the Symbol list of the Search dialog box, everywhere (e.g. *PTT8 to searchfor the eighth symbol in the list , from top to bottom: )

For instance, to search for all lines of type "Dotted" everywhere, enter the appropriate shortcut after the prefix used to run favorite queries:

f:*LNT2 or f=*LNT2

but you can also enter

favorite:*LNT2 or favorite=*LNT2

Tip: If the option f: as favorite: is selected in the Default Prefix for Power Input list, you do not need to type the prefix before the shortcut. You simply enter: *LNT2 to search for all lines of type "Dotted" everywhere.

Search Using Special Characters

Characters & + - ( ) play a special role in the search syntax. To be interpreted literally in names, those characters or text strings containing those characters must be surrounded by the character ' (apostrophe by default).

For example:

n:*')' searches for all names ending with )

n:*'&' searches for all names containing &

n:*'(1)' searches for all names ending with (1).

The following line in the KeyboardInput.CATNls resource file :

Quote = " ' ";

specifies the default character for surrounding strings.

The character * is always interpreted as a wild card except if surrounded by two characters '.

For example:

n:*''*'' searches for all names ending with *

n:*''*''* searches for all names containing *

n:*'&'''*''* searches for all names containing &*

n:'*)' searches for all names ending with ). This is identical to n:*')'

The character ' must be doubled twice to be interpreted literally.

For example:

n:*''''* searches for all names containing a '

n:P''''* searches for all names beginning with P'

n:P''''''''* searches for all names beginning with P''

n:P''''''''''''* searches for all names beginning with P'''

n:P''''''''''''''''* searches for all names beginning with P''''.

Search Using Operators

You can use operators to combine standard queries.

The supported operators are: &, +, and - (for AND, OR and EXCEPT respectively) and ( ).

Blanks are not considered as separators. They may be surrounded by ', but this is not mandatory.

You can combine standard queries as follows:

name:*wheel'&'door&type:Part

name:*wheel'&'door & type:Part

name:*'wheel&door' & type:Part

name:*'wheel&door'& type:Part

name:*wheel'&'door &type:Part

all search for parts whose names end with "wheel&door".

The command:

name:wheel1 + name:wheel2

searches for objects named "wheel1" and objects named "wheel2".

You can combine predefined favorite queries, favorite queries and standard queries

Before you start, note the following information:


  • If you do not specify any search scope when entering your query, the scope used is:


    • Either the one defined in the Default Search Scope for Power Input list.
    • Or, the scope of the predefined favorite query or of the favorite query (provided that the Replaces scope defined in favorite queries option is not selected. Otherwise, the scope defined in the Default Search Scope for Power Input list prevails).

  • If a defaut prefix has been set in the Default Prefix for Power Input list, you do not need to type it in the power input box. For instance, if f: has been set as the default prefix, you just have to enter *LN+*PT instead of f:*LN+f:*PT.
  • If at least one shortcut in the query requires a selection, you must select an object before or after running the query. If there is more than one shortcut requiring a selection, then you must select only one object ; the properties of the selected object will be used for all the shortcuts involved in the query.

You can combine predefined favorite queries:

Let's suppose you want to search for all lines or all points. You enter:

f:*LN+*PT

but you can also use any other favorite prefix (f=, favorite: or favorite=).

This query searches for all lines and points everywhere since no scope has been specified and, as explained above, the scope of the predefined query is used.

If you want to use another search scope, you need to specify it after the query. For instance, to search for all lines and points visible on screen, you can either set scr as Visible on screen as the default scope in the Default Search Scope for Power Input list (do not forget to select the Replaces scope defined in favorite queries option as well) or enter:

f:*LN+*PT, scr

You can combine predefined favorite queries and favorite queries:

Let's suppose a favorite query named "Query_1". This query searches for all elements whose color is "black".

If you want your search to select all lines and whose color is "black", you just have to type:

f:*LN&Query_1

but you can also use any other favorite prefix (f=, favorite: or favorite=).

You can combine predefined favorite queries and standard queries:

Let's suppose you want to search for all sketches except those whose name ends with "1". You enter:

f:*SKT-(n:*1) or f:*SKT-(name:*1)

but you can also use any other favorite prefix (f=, favorite: or favorite=).

You can combine predefined favorite queries, favorite queries and standard queries:

Still using a favorite query named "Query_1" (which searches for all elements whose color is "black"), let's suppose you want to search for all lines and whose color is black or whose name ends with "3". You enter:

f:*LN&(Query_1+n:*3) or f:*LN&(Query_1+name:*3)

but you can also use any other favorite prefix (f=, favorite: or favorite=).

Priority

There is no priority among operators, but there is a priority in their order of appearance (from left to right).

For example, the query:

type:Part* & name:toto + type:Hole & Color:Black

is interpreted as:

type:Part* & (name:toto + (type:Hole & Color:Black) )

and thus searches for elements of type "Part" among the objects in the document that are "black holes" or named "toto".

To avoid ambiguity, use parentheses like this:

type:Part* & (name:toto + (type:Hole & Color:Black) )

to obtain the same result.

Search Using Search Scopes

You can use the same search scopes as with Edit > Find... (except From search results which is only available in the Find dialog box) , by using the following context aliases: all, in, from, sel and scr.


  • all: searches the whole specification tree from top to bottom, to find objects created using all workbenches.
  • in: locates the appropriate elements in the active object and in the workbench you are currently using.
  • from: searches the elements in the active object to the bottom of the tree. For example, in a Part document, both parts and sketches are searched.
  • sel: if you already selected objects before selecting Edit > Find..., this option searches from the selected objects to the bottom of the tree.
  • scr: searches for objects visible in the current window. Elements that are not activated or not represented in the geometry area are not taken into account. Elements that are not represented in the geometry area are, for instance, elements transferred to the No Show space, elements that are not in the current filter or not in the current mask, features used to build other features that appear in the specification tree but not in the geometry area, etc.

The default is in. Scope aliases must always be placed at the end of the search string, and after the separator "," like this:

type:Hole, all

The separator is the comma (",") for the English, Japanese, Korean and simplified Chinese environments, and the semi-colon (";") for all other supported environments.

Search Using a Default Prefix

A prefix is required to run a command or a query via the power input box. One prefix (c:) is already provided to run commands and several prefixes are dedicated to search queries.

When searching for a name for instance, the value you type must be prefixed by n: or with name:, e.g. n:wheel.

By default, no default prefix is defined. But if you use a default prefix, this avoids having to type the prefix when entering your query in the power input box, you just have to enter the search string. The default prefix is defined in the Find tab which provides a list of predefined prefixes.

Suppose you select the prefix n: as name: in the Default Prefix for Power Input list then in the power input box, you enter only the name you are searching for such as:

wheel

to search for objects named "wheel".

Search Using a Default Search Scope

You can use a default search scope to avoid having to type the scope in the power input box. The default scope is in when running a query in the power input box.

This means that if no scope alias is entered at the end of the search string, the search locates the appropriate elements in the active object and in the workbench you are currently using.

The default search scope is defined in the Find tab which provides a list of predefined search scopes.

For instance, if the scope all as Everywhere is selected in the Default Search Scope for Power Input list, you just need to enter:

type:Hole

instead of

type:Hole, all

to search for objects of type "Hole" in the whole specification tree from top to bottom.