PCB Fab and Assembly -- http://www.bittele.com/ -- PCB Fab and Assembly

Tuesday, June 19, 2012

Altium Designer: Introduction to the Query Language (Part 1 of 2)



Introduction to the Query Language (Part 1)

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.

Perhaps the greatest challenge when working on a complex electronics design is managing the large number of design objects. From the components, net labels and text strings on the schematic sheets, through to the hundreds of components and tens of thousands of track objects that make up the routing on the PCB, as the designer you need to be able to access, review and edit these objects.



Like most Windows application you can of course double-click on an object and edit its properties. This is fine for a single object, but not something you would like to do if you need to edit the stroke width for the 300+ component designator strings, or change the annular ring for all the vias on the PCB. For this you need to access multiple objects simultaneously - to inspect them, to edit them, or apply a PCB design rule to them. Ideally you should be able to access different types of objects simultaneously too - the query-based filtering system lets you do precisely this.

Figure 1. You write a query to filter your design data, which can then be viewed and modified.



What is a Query? 

Queries are used to determine whether each object within a document is highlighted or otherwise. The highlighted objects are normally displayed which is distinctive in comparison with the remaining (non-highlighted) objects, which are either displayed in a less prominent manner, or are not even displayed at all.

Queries can be used to control how a document's objects are displayed. They can also be used to determine whether any objects within a document have particular properties (or particular sets of properties), and to assist in locating such objects. Another important reason for using queries is to qualify which objects have their properties modified during succeeding commands, including during global editing commands.

The powerful data filtering and editing system in Altium Designer lets you instruct the software to return you 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, dimming out all other objects. Or perhaps you want to browse or sort their properties, and modify specific attributes that they all share. There are a number of places where you can apply a query but command central is the Filter panel, as shown in Figure 2. 



Press F12 to display/hide the Filter panel.
Figure 2. The PCB filter panel, the query shown will return all relays (all components that has a Ref Des that begins with K) on the bottom layer.
So you have written a query in the Filter panel, now how do you access the objects returned by your query?



There are three ways that objects can be accessed and edited in the Altium Designer environment.

Graphically - after applying a filter the default behavior is to mask (fade and make non-editable) all objects that failed the query, leaving only those that passed. This mode is excellent for locating and reviewing objects in the workspace. Since the masked objects are not editable, commands like Ctrl+A (select all) only apply to the objects returned by the query.
For example, applying the query expression in Figure 2.
(InComponent('K*') AND OnBottomLayer)
will result on the Figure below:

Figure 3.


Selecting all objects (CTRL+A), will result to ONLY relays being selected since the rest of the items on the PCB that did not match the query expression will be masked out.
Figure 4.



List panel - the List panel (Shift+F12) is a spreadsheet-like view into your design data. By default it displays all design objects, once a filter has been applied it displays only the objects returned by the query. The List has standard spreadsheet-like behaviors for sorting and selecting, allowing you to edit single or multiple cells directly.
Figure 5.

Note that the top of the List panel has a number of controls, 
press F1 when the cursor is over the panel for help with these controls and other general panel behavior.

Figure 6.



Inspector panel - where the List presents the objects' properties in a table, the Inspector collates the common attributes of the selected objects into a single column. Note the total number of selected objects is displayed at the bottom of the panel. After editing the value in a cell press Enter to apply the change.

Figure 7.

Press F1 when the cursor is over the Inspector panel for more information.


Figure 8.







No comments:

Post a Comment