Skip to main content
View as Markdown

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​

MethodReturnsDescription
AddDeviceFolderboolThis method adds a new device folder into the existing top level Device Folder and whether sub folders can be searched from that folder.
BrowseDeviceSheetboolThe 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…
ChooseDeviceFolderboolThis method invokes the Choose Device Sheet Folder dialog and returns you the valid device folder.
ClearFoldersvoid
ConvertDeviceSheetPathToNamestringThe method converts the full file path of the device sheet to the valid device sheet filename (without the file extension).
DeleteFoldervoid
EditDeviceFolderListvoidThis method invokes the Device Sheet Folders dialog with all Device Sheet Folders if any.
FindAllDeviceSheetPathsstring
FindDeviceSheetPathstringThis method finds the Device Sheet path for the valid device sheet (without the file extension).
GetCurrentProjectIProject
GetFolders_FolderPathstringThis method returns the indexed path of device sheets (as in the Device Sheet Folders dialog).
GetFolders_SearchSubFoldersboolThis method returns a boolean result for sub folders of the indexed path of device sheets (as in the Device Sheet Folders dialog).
GetFoldersCountintThe GetFoldersCount method returns the number of Device Sheet Folders in Altium Designer.
MakeCurrentProjectvoid
SetDeviceFoldervoid
WillSearchDeviceFolderboolThis 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);
ParameterTypePassing
argFolderPathstringvalue
argSearchSubfolderboolvalue

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);
ParameterTypePassingDescription
argFileNamestringrefReturns the filename (without the file extension) of the device sheet you chose.
argFilePathstringout

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);
ParameterTypePassingDescription
argFolderPathstringrefReturns 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);
ParameterTypePassingDescription
argFilePathstringvalueThe 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);
ParameterTypePassing
argIndexintvalue

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);
ParameterTypePassing
argFileNamestringvalue
argOtherMatchingPathsstringout

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);
ParameterTypePassingDescription
argFileNamestringvalueDefines 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);
ParameterTypePassing
argIndexintvalue

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);
ParameterTypePassing
argIndexintvalue

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);
ParameterTypePassing
argProjectIProjectvalue

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);
ParameterTypePassing
argIndexintvalue
argFolderPathstringvalue
argSearchSubfolderboolvalue

Returns: nothing (void)

WillSearchDeviceFolder​

This method determines whether a Device Sheet Folder exists or not.

bool WillSearchDeviceFolder(string argFolderPath);
ParameterTypePassingDescription
argFolderPathstringvalueRepresents 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​

Utils.GetDeviceSheetManager

Examples​

Used in the SDK examples: Extension_PlaceDeviceSheet, Extension_TestCS.