Contact our corporate or local offices directly.
Perhaps the greatest challenge when working on a complex electronics design is managing a large number of design objects. From the components, net labels and text strings on the schematic sheets to the hundreds of components and tracks that make up the routing on the PCB, you need to be able to access, review and edit those objects. Like most Windows applications, you can double-click on an object and edit its properties. This is fine for a single object, but not something you want to do if you need to edit 300+ component designator strings or change all the vias on the PCB. For these kinds of updates, you need to access multiple objects simultaneously.
Underlying Altium Designer's schematic and PCB editors is a powerful query engine. By entering queries into this engine you can filter down to find and edit precisely those objects you require.
The powerful data filtering and editing system in Altium Designer lets you instruct the software to return a specified set of objects. This instruction is entered in the form of a query. A query is a string you enter using specific keywords and syntax, which will return the targeted objects. What you do with those objects is up to you. Perhaps you want to highlight them and dim out all other objects, or perhaps you want to browse or sort their properties and modify specific attributes they all share.
There are a number of places where you can apply a query but command central are the Filter panels shown in the images below. Press F12 to display/hide the Filter panel.
The controls in the panel are used to define to which objects the query will be applied and how to handle the objects that pass the query, as well as those that fail.
Now that you have written a query in the Filter panel, how do you access the objects returned by your query? There are two ways that objects can be accessed and edited in the Altium Designer environment.
Whenever a query is applied (or the data filtering feature is otherwise used), each object within the target document becomes a member of that filtering action's results. However, how the objects in the results and the objects that are not in the results are subsequently displayed depends upon the highlighting option(s) selected in the Filter panel. There are three different highlighting options available and the options are totally independent of one another, so you can select one, two or all.
When the Zoom option is enabled when the query is applied, the view of the target document is updated to display the region occupied by all of the objects that are in the results. Whether or not each remaining object is displayed in the updated view depends upon its location relative to that region, so each of those objects can end up being totally displayed, or partially displayed, or not even displayed at all.
This option is often selected in conjunction with one or both of the other options. If the Mask option has not been enabled, objects that are not in the results will still be displayed in the graphical view if they are located within the updated boundaries. At first glance, selecting this option by itself might seem pointless, but there could be times when you want to update the graphical view so that this encompasses particular objects, while not changing the selected state or masked state of any of the document's objects.
When the Select option is enabled, all of the objects that are in the results are in the selected state, while all of the remaining objects are not selected. Selected objects are displayed in a more distinctive manner as non-selected objects.
If the Select option is selected when the current query is applied, all of the objects which are members of the result set subsequently acquire a selected state, while all of the remaining objects (which are not members of the result set) acquire an unselected state instead. This option would typically be selected just prior to global editing procedures because only those objects which are currently selected have their properties updated at the time. But there are other occasions when the Select option can be useful, such as when particular objects are to be moved, copied or deleted.
The Mask highlighting option determines the updated masked property of objects in the target document. When selected, all of the objects that are in the results are masked, while all of the remaining objects are unmasked. The main aspect of masked objects is that they and their properties are not capable of being edited. (Masked objects are displayed as dimmed in the list view, but are not displayed in the list view unless the all objects option is currently selected in the List panel.) The main aspect of masked objects is that the object and its properties are not capable of being edited.
The PCB editor includes a dedicated Query Builder dialog. This dialog allows you to build complex queries by choosing test conditions from drop-down lists. An advantage of the Query Builder is that it lets you create a query that targets different kinds of objects.
The 'Building Query' dialog (part of the 'Query Builder' feature) assists those who are less experienced in specifying queries; a query is automatically generated whose contents correspond to the conditions specified by the designer.
The left-hand section in this dialog contains controls, whose purpose is to assist the designer in the task of specifying what properties are required for each of the document's objects to be returned by the query generated by this dialog. As each of those conditions is specified or edited, the contents of the corresponding query are updated and displayed in the dialog's right-hand section. If this dialog is then closed by clicking on its OK (or Apply) button, either the associated query will then be applied, or its contents will then be copied back to the Filter panel (depending upon how this dialog was invoked in the first instance).
The Query Builder dialog can be launched from the following places (as shown in the image below):
The image below shows the Query Builder dialog being used to create a query that targets both pads and vias on the 5V net.
The next step in building your query-writing skills is to use the Query Helper dialog (PCB version; SCH version). The Query Helper dialog includes a Query box in which you can enter the desired query, while also using the syntax buttons below the Query field (e.g., And, Or, <, Not, Like, etc.,) as well as a complete list of all query keywords in the Categories field.
The 'Query Helper' dialog provides assistance for designers who want to specify their own queries. A brief description is provided for each keyword that is listed, but the online help can be accessed by pressing the F1 key while a keyword is highlighted. That invokes the Altium Designer Documentation Library dialog, which provides details of which objects within a document are returned by the highlighted keyword, how to use that keyword, and one or more examples of its usage.
The dialog can be accessed in the following ways:
Browse through the Categories of available keywords for the one you want. Use the Mask field if you are not sure what the exact keyword is. For example, in the schematic editor's Query Helper, entering *har in the Mask field will find keywords that apply specifically to harnesses, as shown in the image below. Note that the Mask field works on both the keyword Name field and the Description field, so it can be the quickest way to find possible keywords.
If you press F1 when a keyword is highlighted or the cursor is within a keyword you have entered, documentation for that keyword will open. This is the most valuable resource for learning the basic behavior of each query keyword.
Use the Query Helper dialog (described above) to create an expression. After it has been created and executed, it is added to the list of previously executed queries on the History tab of the Expression Manager dialog. To add it as a favorite, on the History tab of the Expression Manager dialog (PCB version; SCH version), select the desired favorite then click Add To Favorites. The query will then be displayed on the Favorites tab.
There are two ways to use your favorite queries.
To give a favorite query an appropriate name, click on a favorite on the Favorites tab of the Expression Manager dialog then click Rename or right-click then select Rename.
Favorites are stored in the Expression Manager dialog (PCB version; SCH version). The dialog can be accessed by using the Favorites button in the Filter panel or by using the Y shortcut key then selecting Organize Favorites from the menu.
Both the schematic and PCB editors come with a set of pre-packaged example queries. To use the examples, press the Y shortcut key to display the Filter pop-up menu then hover over Examples to view the sub-menu.
When you select an entry in the sub-menu, the query behind that filter is applied. To view the actual query behind one of the examples, look in the History list after applying it. You also can access this list in the Filter pop-up menu.
Perhaps the easiest way to write a query is to have Altium Designer write it for you! You can do this by using either the Find Similar Objects dialog or the Query Builder dialog.
When you use the Find Similar Objects dialog (PCB version; Schematic version), it generates a query to find the required objects. If the Create Expression option is enabled, that query will be displayed in the Filter panel. This is an excellent technique for learning different query keywords.
The Find Similar Objects dialog opens when you right-click on any unmasked object in your design document then select Find Similar Objects from the context menu.
This dialog allows you to find objects similar to the one on which you right-clicked, then define which of the object's attributes that must be the same (or different) for a match. Suppose you wanted to change all GND pads in your design. You could right-click on one such pad, choose Find Similar Objects, then change the Net field from Any (the default setting) to Same. All of the GND pads will be selected when you click Apply in the dialog. If the Create Expression option is enabled, the following query would appear in the Filter panel: (ObjectKind = 'Pad') And (Net = 'GND').
As an example from a schematic, you can change the Color property of all Power Objects having a particular Text property (e.g. 'GND') within a document to the same value. For example, from a PCB, you can change the Hole Size property of all vias having a particular Via Diameter property within a document to the same value.
Enable the Clear Existing option to clear any existing selection or editing mask before applying the search. Disable this option if you are performing successive searches and it is desirable for the results to accumulate.
The Filter Toolbar is provided for PCB documents and allows you to mask all of the objects within a document except for those having a specified property, or for those forming part of a specified component. The right-most field of the toolbar is used to specify the contents of a query. You can enter the query in the field or you can use the drop-down to select from recent queries. It is not possible to specify which options to use when queries are applied from the Filter Toolbar and in all cases, any previous query is cleared, and the Mask and Zoom options are then used with the current query. To use query options, use the Filter panel, Query Builder dialog, Query Helper dialog, or Find Similar Objects dialog.
An operator causes an operation to take place within a statement in a script. Operator precedence is highest at the start of the list and lowest at the bottom. The scripting engine supports the following operators.
Contact our corporate or local offices directly.