在基于文件的库和数据库元件库中进行元件搜索

Applies to Altium Designer version: 24
Chinese - Translation is available for Altium Designer 23: Go to the page

Managing Available Database and File-based Libraries

In Altium Designer, database and file-based library components can only be placed from available libraries. The term "available libraries" includes:

  • Libraries in the current project – if a library is part of the project, then its components are automatically available for placement within that project.
  • Installed libraries – these libraries have been installed in Altium Designer; their components are available for use in any open project.
  • Libraries on a defined search path – it is also possible to define a search path to a folder with multiple libraries. Because all files in the search path are searched every time a new component is chosen in a panel, this approach is only recommended for small libraries with simple model definitions, such as simulation models. Search paths are not recommended for complex models, such as footprints that include 3D models.

To manage available database and file-based libraries, you can use the Available File-based Libraries dialog accessed by clicking the Components panel menu button at the top of the Components panel and selecting File-based Libraries Preferences from the menu.

The Available File-based Libraries dialog has three tabs. All of the libraries and model locations defined in these tabs are collated to make up your list of available libraries. When an action is performed that requires searching for a model, such as transferring the design from schematic to PCB layout, the libraries are searched in the order of the tabs, then within each tab in the order that the libraries/models are listed. As soon as the correct model is located, the search process ceases. 

Project Libraries

Libraries that are part of the active project are listed under the Project tab of the Available File-based Libraries dialog when that project is the active project in the software. The advantage of project libraries is that the model/libraries will automatically become available whenever the project is opened. The disadvantage is if the models/libraries are not stored in the same project folder structure as the design files, they can easily be forgotten if the project files are moved.

The Project tab provides a list of available libraries in the current project.
The Project tab provides a list of available libraries in the current project.

Any library can be a project library; they do not need to be stored in the project's folder. Right-click on the project name in the Projects panel then select the Add Existing to Project command to include libraries as part of the project.

Installed Libraries

Libraries and models that have been made available in your installation of the software are referred to as installed libraries. These are listed in the Installed tab of the Available File-based Libraries dialog.

This list is an environment setting. Any libraries added to the list will be available for all projects and the list is persistent across design sessions. Project libraries can be added to this list but are not initially part of it.

Installed Libraries can be listed using an absolute path or a path relative to the Library Path Relative To setting. The advantage of using a relative path is that this lets you create a common sub-environment across multiple PCs and you can therefore easily move the design files between them. Additionally, installed libraries can be temporarily deactivated by clearing the Activated checkbox rather than needing to be removed.

Only activated libraries are accessible from the Components panel.

The Installed tab lists the libraries that have been made available in this installation of Altium Designer.
The Installed tab lists the libraries that have been made available in this installation of Altium Designer.

When connected to an Altium 365 Workspace, you are also presented with a summary of the health of your Workspace Library. This shows, at-a-glance, the number of components that are completely healthy and the number of components that have at least one issue. Click the See Details control to open the Components page of the Workspace's browser interface in your default web browser.
When connected to an Altium 365 Workspace, you can import an installed library currently selected in the dialog's grid area to the Workspace by clicking Import in the right-most column. The Library Importer in its Simple mode with the selected library loaded will open.

Search Path

The Search Path tab presents a list of libraries that have been located according to the path settings defined on the Search Paths tab of the Project Options dialog, which is accessed by clicking the Paths button. Each search path defines a folder and can include sub-folders if the Recursive option is enabled (available on the Search Paths tab of the Project Options dialog after a path is added). All model and library files found on the search path will be available. Search paths are saved with the project.

Click the Refresh button to refresh the list based on the latest search paths (defined on the Search Paths tab of the Project Options dialog).

The Search Path tab lists the libraries that have been found in the defined search paths.
The Search Path tab lists the libraries that have been found in the defined search paths.

To access the Search Paths tab of the Project Options dialog, the UI.ProjectOptions.SearchPaths option must be enabled in the Advanced Settings dialog. The Advanced Settings dialog is accessed by clicking the Advanced button on the System - General page of the Preferences dialog. If any changes are made in the Advanced Settings dialog, the software must be restarted in order for the changes to take effect.

Retrieving models using search paths can be slow if there are a large number of files in the search path folder(s). For this reason, it is not recommended to use this approach for PCB libraries as they can be large files containing many footprints. The feature was developed to provide a way of referencing available simulation and signal integrity models.

While the software offers flexibility and control over specific model/library locations, it does require the correct file extension to be used for each model type. For example, a footprint will only be found if it is in a file with a .Lib or .PcbLib extension. Similarly, a SPICE .SUBCKT will only be found if it is in a .ckt file and a SPICE .MODEL will only be found if it is in a .mdl file. Whenever a model search does not yield a match, an error appears in the Messages panel.

Localized Caching of Symbols and Models Used by SVN Database Libraries

When an SVNDbLib file is added to the Available Libraries list, the symbol and model libraries in the repository are cached in a temporary folder, local to the Designer's computer. When an action in the software calls for the use of a schematic symbol, or model, that symbol/model is retrieved from the local cache.

Automatic Cache Update

The libraries in the cache will be automatically updated with the latest from the source control repository, when performing any of the following actions within the software:

  • Placing a component from an installed SVNDbLib file (from the Components panel).
  • Performing a design transfer (i.e. updating the PCB).
  • Using the Tools » Update From Libraries command in the Schematic Editor.
  • Using the Tools » Update From PCB Libraries command in the PCB Editor.

Although the update is automatic, it can be controlled by the use of an option available on the Data Management - SVN Libraries page of the Preferences dialog, highlighted in the following image.

Setting a minimum update time threshold for the local cache. Setting a minimum update time threshold for the local cache.

This option essentially provides an 'update timer' for the local cache. If the specified time has elapsed since the last time the cache was updated, then the cache will be updated automatically when one of the listed actions is performed. If an action is performed within this time, the current content of the cache will be used, which may be out of date compared to the content in the repository.

Manually Forcing an Update of the Cache

There may be times when you wish to force an update of the local cache, to ensure you have the most up-to-date libraries that are currently stored in the source control repository. For example, when gearing up to transfer the design from the schematic to the PCB.

You can force an update of the cache, manually, using one of the following methods:

  • Using one of the Refresh commands available from a right-click menu in the Components panel.
  • Uninstalling and re-installing the SVNDbLib file to the Available Libraries list.
Whenever you restart Altium Designer, the local cache will be automatically refreshed with the latest libraries stored in the SVN repository.

Searching for Components in Database and File-based Libraries

To help find a component in file-based (both installed and not currently installed) and database libraries, Altium Designer includes a library searching feature.

Searching for a component in database and file-based libraries is possible using the Search field of the Components panel. Enter a string and press Enter to search the current library for that string, anywhere within the visible component parameters.

You can perform a search directly in the Components panel.You can perform a search directly in the Components panel.

More detailed searching is performed using the File-based Libraries Search dialog, which is accessed by clicking the Components panel menu button on the Components panel, and selecting File-based Libraries Search from the menu. The upper half of the dialog is used to define what you are searching for, the lower half is used to define where to search.

Search across installed libraries (Available libraries), or libraries on the hard drive (Libraries on path).
Search across installed libraries (Available libraries), or libraries on the hard drive (Libraries on path).

The search process can be summarized as follows:

  • Searching is performed by defining Filters that are applied to all libraries that can be searched according to the current search Scope settings.
  • The Scope includes the type of libraries to search. Only one type can be searched at a time.
  • To enable searching of database components, set the Search in field to Database Components and select the required Table. Note that the available Fields, listed in the drop-down above, will change to reflect the column headings available in the chosen table. The remaining options in the dialog become grayed-out, as they are not relevant when searching database libraries.
  • The Scope defines which libraries will be searched: either the libraries the software currently has access to (Available libraries) or all libraries within a folder (Libraries on path).
  • When searching libraries on a path, the target is a specific folder and can also Include Subdirectories.
  • You also can search within the search results by setting the Scope to Refine last search.
  • Click Clear to clear out the entered search parameters.

Setting the Search Filter

The Filters region is used to define text strings that are to be applied to searching. There are three regions to configure:

  • Field – this is the attribute of the component that is to be searched. It can be any component or footprint attribute including the Name, Description, Comment, Footprint, or any parameter that has been added to a component. Select an available field from the drop-down or enter a filed in the text box.
  • Operator – defines how a match is determined. This can be when the value equals, contains, starts with, or ends with. Note that equals require an exact string match so it should only be used when you are confident that the search string is correct and complete.
  • Value – the characters to be searched for in the chosen Field matched according to the chosen Operator. Slect an available value from the drop-down or enter a value into the text field.

By default, there are three filter constraints; you can add up to seven additional rows for a total of 10 rows using the Add Row control. The last added filter constraint row can be removed using the Remove Row. You can remove rows that are unused.

Setting the Scope

There are essentially two approaches to searching:

  • Libraries currently available – this is the list of libraries shown in the drop-down at the top of the Components panel.
  • Libraries stored in a specific folder along with subdirectories if the option is enabled.

Searching will return all items of the search type chosen in the Search in drop-down (Components/Footprints/3D Models/Database Components) found in all libraries that fall under the defined Scope:

  • Available libraries - enable to search for specified model types within available libraries only.
  • Libraries on path - enable to search for specified model types within available libraries in a specified folder(s). In the Path region of the dialog that becomes available with the selected Libraries on path scope option, you can define the path, include sub-directories, and include the library file mask to specify and narrow the search criteria:
    • Path - edit to define the folder where libraries can be searched from or click the browse icon at the end of the field to browse for a folder.
    • Include Subdirectories - enable if you want to search for libraries from the specified path and its sub-paths.
    • File Mask - enter the file mask string or choose one of the existing file masks from the drop-down list. The search is filtered that match the string. You can use the * (any character) wildcard in the string. For example, type * to search all the files and type M to search all files that start with the letter M.

Enable Refine last search to further define a search query criteria from the list of Query Results obtained by the previous search. For example, if you searched for PCB Footprints with a name based on DIP and you want to search and return only those footprints with a defined height that is less than 100 mil, enable this option. Enter the new query expression then click Search. The sub-set of the previous query results will be displayed as the new Query Results list in the Components panel.

For example, if you want to find a component that you think is in a library within specific folders on the hard disk and that library was not currently listed in the Available File-based Libraries, you would define the search as follows:

  1. In the Scope region, set Search in to Components and select Libraries on path.
  2. In the Path region, set the Path to point to the folder containing the library document that you want to search.
  3. Click Search. The results are displayed in the Components panel as the search takes place.
You can only place components from libraries that are installed in Altium Designer. If you attempt to place from a library that is not currently installed you will be asked to confirm the installation of that library when you attempt to place the component.

Advanced Search Mode

Library searching is actually performed using queries. In the File-based Libraries Search dialog, switch to the Advanced mode to examine the query. Hover the cursor over the image above to show the search dialog in Advanced mode.

In the dialog's Advanced mode, you can also create your own queries using the query language keywords to perform a query-based search. Refer to the section below to learn more about available query language keywords.

Use the following additional controls when Advanced mode is selected:

  • Helper - click to open the Query Helper dialog to easily build a library search query with pre-defined library functions and system functions. You also can use the History and Favorites buttons to choose a recently applied or pre-defined library query.
  • History - click to open the Expression Manager dialog to choose one of the previously applied query expressions to use for the library search. You can also use the Favorites button to use a pre-defined query for a specified library search.
  • Favorites - click to open the Expression Manager dialog to choose one of your favorite query expressions to use in a library search. You can also change the Favorites list by removing, renaming, or copying expressions from the History list.

When searching among Database Components, the Advanced mode will allow you to perform an SQL query search. This level of searching offers a 'fine' search based on a specified query expression, where you can enter an SQL query directly into the query editor section of the dialog.

Hover over the image to see how the dialog changes when you click Advanced, giving you access to a more powerful SQL-based query search. Click Advanced again to come back to the simple-style search.Hover over the image to see how the dialog changes when you click Advanced, giving you access to a more powerful SQL-based query search. Click Advanced again to come back to the simple-style search.

Component & Library Query Functions

Component and library query functions shown in the Query Helper dialog
Component and library query functions shown in the Query Helper dialog

Underlying Altium Designer's schematic and PCB editors is a powerful query engine. By entering queries into this engine you can logically scope precisely those objects you require.

A query is a string you enter using specific keywords and syntax, which will return the targeted objects. There are many keywords available, allowing you to target objects by their type, their properties, or both.

For a detailed overview of using the query language, see Working with the Query Language.

The sections below detail the query language keywords available when searching for database and file-based components in Altium Designer. For help on a specific query keyword, use the following collapsible sections or highlight (or click inside) any given keyword - in the Query Helper.

To access the component and library query functions, click the Helper button found in the File-based Libraries Search dialog.

Components

All

Footprints

可用的功能取决于您的 Altium Designer 软件订阅级别

Content