IDeviceSheetManager interface
The IDeviceSheetManager interface represents the Device Sheets Folder dialog in Altium Designer. Invoke the DeviceSheetManager method to fetch the IDeviceSheetManager object interface.
public interface IDeviceSheetManager
Namespace: SCH · Assembly: Altium.SDK.Interfaces
Methods
| Method | Returns | Description |
|---|---|---|
| AddDeviceFolder | bool | This method adds a new device folder into the existing top level Device Folder and whether sub folders can be searched from that folder. |
| BrowseDeviceSheet | bool | The method BrowseDeviceSheet invokes the Select Device Sheet dialog and, when you select a device sheet, returns the filename (without the file extension) of the device sheet you chose from this dial… |
| ChooseDeviceFolder | bool | This method invokes the Choose Device Sheet Folder dialog and returns you the valid device folder. |
| ClearFolders | void | |
| ConvertDeviceSheetPathToName | string | The method converts the full file path of the device sheet to the valid device sheet filename (without the file extension). |
| DeleteFolder | void | |
| EditDeviceFolderList | void | This method invokes the Device Sheet Folders dialog with all Device Sheet Folders if any. |
| FindAllDeviceSheetPaths | string | |
| FindDeviceSheetPath | string | This method finds the Device Sheet path for the valid device sheet (without the file extension). |
| GetCurrentProject | IProject | |
| GetFolders_FolderPath | string | This method returns the indexed path of device sheets (as in the Device Sheet Folders dialog). |
| GetFolders_SearchSubFolders | bool | This method returns a boolean result for sub folders of the indexed path of device sheets (as in the Device Sheet Folders dialog). |
| GetFoldersCount | int | The GetFoldersCount method returns the number of Device Sheet Folders in Altium Designer. |
| MakeCurrentProject | void | |
| SetDeviceFolder | void | |
| WillSearchDeviceFolder | bool | This method determines whether a Device Sheet Folder exists or not. |
AddDeviceFolder
This method adds a new device folder into the existing top level Device Folder and whether sub folders can be searched from that folder.
bool AddDeviceFolder(string argFolderPath, bool argSearchSubfolder);
| Parameter | Type | Passing |
|---|---|---|
argFolderPath | string | value |
argSearchSubfolder | bool | value |
Returns: bool
BrowseDeviceSheet
The method BrowseDeviceSheet invokes the Select Device Sheet dialog and, when you select a device sheet, returns the filename (without the file extension) of the device sheet you chose from this dialog.
bool BrowseDeviceSheet(ref string argFileName, out string argFilePath);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argFileName | string | ref | Returns the filename (without the file extension) of the device sheet you chose. |
argFilePath | string | out |
Returns: bool
Example: Let the user browse for a device sheet and show its file name.
using SCH;
IDeviceSheetManager deviceSheetMan = EDP.Utils.GetDeviceSheetManager();
if (deviceSheetMan == null)
return;
string aFileName = "";
string aFilePath;
deviceSheetMan.BrowseDeviceSheet(ref aFileName, out aFilePath);
DXP.Utils.ShowMessage("Filename " + aFileName);
ChooseDeviceFolder
This method invokes the Choose Device Sheet Folder dialog and returns you the valid device folder. The method returns a false value if the dialog is cancelled.
bool ChooseDeviceFolder(ref string argFolderPath);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argFolderPath | string | ref | Returns the valid device folder. |
Returns: bool
Example: Let the user choose another folder for a device sheet path.
using System.IO;
using SCH;
IDeviceSheetManager deviceSheetManager = EDP.Utils.GetDeviceSheetManager();
if (deviceSheetManager == null)
return;
string deviceSheetPathText = "<device sheet path>";
string folderPath = Path.GetDirectoryName(deviceSheetPathText);
if (deviceSheetManager.ChooseDeviceFolder(ref folderPath))
deviceSheetPathText = Path.Combine(folderPath, Path.GetFileName(deviceSheetPathText));
Examples: Extension_TestCS
ClearFolders
No description yet.
void ClearFolders();
Returns: nothing (void)
ConvertDeviceSheetPathToName
The method converts the full file path of the device sheet to the valid device sheet filename (without the file extension). If the file path is invalid, an empty string is returned.
string ConvertDeviceSheetPathToName(string argFilePath);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argFilePath | string | value | The full file path of the device sheet. |
Returns: string
Example: Show the name of a device sheet from its path.
using SCH;
IDeviceSheetManager deviceSheetMan = EDP.Utils.GetDeviceSheetManager();
if (deviceSheetMan == null)
return;
// Shows the file name of the device sheet without the file extension.
DXP.Utils.ShowMessage(deviceSheetMan.ConvertDeviceSheetPathToName("<device sheet path>"));
DeleteFolder
No description yet.
void DeleteFolder(int argIndex);
| Parameter | Type | Passing |
|---|---|---|
argIndex | int | value |
Returns: nothing (void)
EditDeviceFolderList
This method invokes the Device Sheet Folders dialog with all Device Sheet Folders if any.
void EditDeviceFolderList();
Returns: nothing (void)
Example: Open the dialog that edits the list of device sheet folders.
using SCH;
IDeviceSheetManager deviceSheetMan = EDP.Utils.GetDeviceSheetManager();
if (deviceSheetMan == null)
return;
deviceSheetMan.EditDeviceFolderList();
FindAllDeviceSheetPaths
No description yet.
string FindAllDeviceSheetPaths(string argFileName, out string argOtherMatchingPaths);
| Parameter | Type | Passing |
|---|---|---|
argFileName | string | value |
argOtherMatchingPaths | string | out |
Returns: string
FindDeviceSheetPath
This method finds the Device Sheet path for the valid device sheet (without the file extension). If the file name is invalid, a blank string is returned.
string FindDeviceSheetPath(string argFileName);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argFileName | string | value | Defines the valid device sheet (without the file extension). |
Returns: string
Example: Show the path of a device sheet from its name.
using SCH;
IDeviceSheetManager deviceSheetMan = EDP.Utils.GetDeviceSheetManager();
if (deviceSheetMan == null)
return;
DXP.Utils.ShowMessage(deviceSheetMan.FindDeviceSheetPath("<device sheet name>"));
Examples: Extension_PlaceDeviceSheet
GetCurrentProject
No description yet.
IProject GetCurrentProject();
Returns: IProject
Extension method of IDeviceSheetManagerHelper (using SCH;).
GetFolders_FolderPath
This method returns the indexed path of device sheets (as in the Device Sheet Folders dialog). The first entry starts at zero (0).
string GetFolders_FolderPath(int argIndex);
| Parameter | Type | Passing |
|---|---|---|
argIndex | int | value |
Returns: string
Example: Show the path of the last device sheet folder.
using SCH;
IDeviceSheetManager deviceSheetMan = EDP.Utils.GetDeviceSheetManager();
if (deviceSheetMan == null)
return;
int count = deviceSheetMan.GetFoldersCount();
DXP.Utils.ShowMessage(deviceSheetMan.GetFolders_FolderPath(count - 1));
See also: IDeviceSheetManager.GetFoldersCount
GetFolders_SearchSubFolders
This method returns a boolean result for sub folders of the indexed path of device sheets (as in the Device Sheet Folders dialog). The first entry starts at zero (0).
bool GetFolders_SearchSubFolders(int argIndex);
| Parameter | Type | Passing |
|---|---|---|
argIndex | int | value |
Returns: bool
Example: Check whether the sub folders of the first device sheet folder are searched.
using SCH;
IDeviceSheetManager deviceSheetMan = EDP.Utils.GetDeviceSheetManager();
if (deviceSheetMan == null)
return;
bool result = deviceSheetMan.GetFolders_SearchSubFolders(0);
if (result)
DXP.Utils.ShowMessage(deviceSheetMan.GetFolders_FolderPath(0) + " has its sub folders");
See also: IDeviceSheetManager.GetFoldersCount
GetFoldersCount
The GetFoldersCount method returns the number of Device Sheet Folders in Altium Designer.
int GetFoldersCount();
Returns: int
Example: Show the number of device sheet folders.
using SCH;
IDeviceSheetManager deviceSheetMan = EDP.Utils.GetDeviceSheetManager();
if (deviceSheetMan == null)
return;
int count = deviceSheetMan.GetFoldersCount();
DXP.Utils.ShowMessage(count.ToString());
MakeCurrentProject
No description yet.
void MakeCurrentProject(IProject argProject);
void MakeCurrentProject(object argProject);
| Parameter | Type | Passing |
|---|---|---|
argProject | IProject | value |
Returns: nothing (void)
The first overload is an extension method of IDeviceSheetManagerHelper (using SCH;) with typed parameters; the second is declared by the interface.
SetDeviceFolder
No description yet.
void SetDeviceFolder(int argIndex, string argFolderPath, bool argSearchSubfolder);
| Parameter | Type | Passing |
|---|---|---|
argIndex | int | value |
argFolderPath | string | value |
argSearchSubfolder | bool | value |
Returns: nothing (void)
WillSearchDeviceFolder
This method determines whether a Device Sheet Folder exists or not.
bool WillSearchDeviceFolder(string argFolderPath);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argFolderPath | string | value | Represents the Device Sheet Folder. |
Returns: bool
Example: Add the folder of a device sheet to the device sheet folders unless it is searched already.
using System.IO;
using SCH;
IDeviceSheetManager deviceSheetManager = EDP.Utils.GetDeviceSheetManager();
if (deviceSheetManager == null)
return;
string aSheetPath = "<device sheet path>";
if (!deviceSheetManager.WillSearchDeviceFolder(Path.GetDirectoryName(aSheetPath)))
deviceSheetManager.AddDeviceFolder(Path.GetDirectoryName(aSheetPath), false);
Returned by
Examples
Used in the SDK examples: Extension_PlaceDeviceSheet, Extension_TestCS.