Skip to main content
View as Markdown

IServerDocument interface

The IServerDocument interface represents the document container. Each IServerDocument interface is a document container made up of views of the same kind.

public interface IServerDocument

Namespace: DXP · Assembly: Altium.SDK.Interfaces

Derived: IComponentLibraryDocument, IReleasedItemDocument, IServerDocument2, IHighlightedDocument, IMBA2_SDK_Document, IMBA_ServerDocument, IPCB_PadViaLibraryDocument

Remarks​

A view can be a design document form or a panel form.

Every document editor server (encapsulated by the IServerModule interface) that supports creation of documents will have a IServerDocument interface.

IServerDocument Methods and Properties Table

Properties​

PropertyTypeAccessDescription
BeingClosedboolget; setThe BeingClosed property denotes that this design document is being closed before this design document can be successfully destroyed.
FileModifiedDatedoubleget; setThis method returns the date and time of the modified file.
FileNamestringget; setThe FileName property returns the filename for the server document (not the corresponding server panel).
IsShownboolget; setThis property denotes whether or not this document is displayed in Altium Designer.
Modifiedboolget; setThe Modified property denotes whether this document has been modified or not, and can be taken as a "dirty" flag, that is a document has been modified and it has been marked dirty.

BeingClosed​

The BeingClosed property denotes that this design document is being closed before this design document can be successfully destroyed. This property is a read only property. You can check the status of the document before you attempt to modify or update the document before it is being closed.

bool GetBeingClosed();
void SetBeingClosed(bool argValue);

Type: bool · Access: read/write

This property is supported by the GetBeingClosed and SetBeingClosed methods.

See also: IServerDocument.GetCanClose, IServerDocument.Modified, IServerDocument.FileName, IServerDocument.DoFileSave, IClient

FileModifiedDate​

This method returns the date and time of the modified file.

double GetFileModifiedDate();
void SetFileModifiedDate(double argValue);

Type: double · Access: read/write

The method sets the modified date for the document if the document has been modified by an outside agent.

See also: IServerDocument.Modified

FileName​

The FileName property returns the filename for the server document (not the corresponding server panel). This property is a read-only property and is supported by the GetFileName method.

string GetFileName();
string SetFileName(string argFileName);

Type: string · Access: read/write

Note a server document can be a document view or a panel view, and thus if it is a panel view, the FileName property is invalid.

See also: IClient

Examples: Extension_CreatePCBLib

IsShown​

This property denotes whether or not this document is displayed in Altium Designer. This property is supported by the GetIsShown and SetIsShown methods.

bool GetIsShown();
void SetIsShown(bool argValue);

Type: bool · Access: read/write

See also: IClient

Modified​

The Modified property denotes whether this document has been modified or not, and can be taken as a "dirty" flag, that is a document has been modified and it has been marked dirty.

bool GetModified();
void SetModified(bool argValue);

Type: bool · Access: read/write

This property is supported by the GetModified and SetModified methods.

Example: Mark the document of the current view as modified.

using DXP;

IClient client = DXP.GlobalVars.Client;
if (client == null)
return;
// Get the current document view from the client.
IServerDocumentView view = client.GetCurrentView();
// Get the server document that owns the view.
IServerDocument serverDocument = view.GetOwnerDocument();
// Set the document dirty.
serverDocument.SetModified(true);

See also: IClient

Examples: Extension_ChangeOutputJobFile, Extension_CreatePCBLib

Methods​

MethodReturnsDescription
AcquireDataFileHandlevoidFor internal use only.
AcquireFileOwnershipvoidFor internal use only.
AddViewvoidThis method adds a IServerDocumentView object in the server document.
CanCreateSnippetbool
CanPlaceSnippetbool
CreateSnippetFilebool
DocumentDirectoryChangedvoid
DoFileLoadboolThis method allows the re-loading of the document.
DoFileSaveboolThis method provides you an option to save the document in a different format if the document supported by the specific document editor provides the option of saving in a different format other than…
DoSafeChangeFileNameAndSaveboolThe method determines whether the current document can be saved with the new file name and new document type or not.
DoSafeFileSaveboolThe method determines whether the document can be saved of specified document type safely.
FocusvoidThe method forces the document to be the focussed document in Altium Designer.
GetCanCloseboolThis method checks whether the document can be closed or not.
GetContextHelpTopicNamestringThe GetContextHelpTopicName method retrieves the help topic name for the document.
GetCountintThe Count property returns the number of views (of the same type) in the IServerDocument container.
GetDocumentModifiedDatedouble
GetKindstringThis method returns the Kind string for this document and this method is used for the Kind property.
GetServerModuleIServerModuleThe ServerModule is a read-only property which returns the IServerModule interface that the document is associated with.
GetSnippetViewIServerDocumentView
GetSupportsOwnSaveboolThe SupportsOwnSave property returns a boolean value whether a save routine has been provided to save these documents associated with the server.
GetViewIServerDocumentViewThe View property is an indexed property and represents a document or panel view.
GetViewByNameIServerDocumentViewThe GetViewByName method returns the View object which represents a document or panel view.
NotifyViewsvoidThis method sends a notification to all the views associated with the IServerDocument container.
OwnsFileboolThe OwnsFile method determines whether the document is owned by the Altium Designer product and thus this document can be saved or not.
PlaceSnippetvoid
ReleaseDataFileHandlevoidFor internal use only.
ReleaseFileOwnershipvoidFor internal use only.
SupportsReloadboolThis method determines whether the document in Altium Designer can be re loaded or not (to refresh and to make sure that the document state is the latest).
UpdateModifiedDatevoidThe method updates the modified document's date after this document has been modified.
WarnIfOwnedByOtherboolThis method determines whether the document is owned by another user.
ZoomSnippetContentsvoid

AcquireDataFileHandle​

For internal use only.

void AcquireDataFileHandle();

Returns: nothing (void)

AcquireFileOwnership​

For internal use only.

void AcquireFileOwnership();

Returns: nothing (void)

AddView​

This method adds a IServerDocumentView object in the server document. A IServerDocument object is a container containing views of document views and panel views.

void AddView(IServerDocumentView argView);
void AddView(object argView);
ParameterTypePassing
argViewIServerDocumentViewvalue

Returns: nothing (void)

The first overload is an extension method of IServerDocumentHelper (using DXP;) with typed parameters; the second is declared by the interface.

See also: IServerDocumentView

CanCreateSnippet​

No description yet.

bool CanCreateSnippet(IServerDocumentView argView, TSnippetCreationMode argMode, bool argContextSensitive);
bool CanCreateSnippet(object argView, int argMode, bool argContextSensitive);
ParameterTypePassing
argViewIServerDocumentViewvalue
argModeTSnippetCreationModevalue
argContextSensitiveboolvalue

Returns: bool

The first overload is an extension method of IServerDocumentHelper (using DXP;) with typed parameters; the second is declared by the interface.

CanPlaceSnippet​

No description yet.

bool CanPlaceSnippet(string argSnippetPath);
ParameterTypePassing
argSnippetPathstringvalue

Returns: bool

CreateSnippetFile​

No description yet.

bool CreateSnippetFile(IServerDocumentView argView, string argSnippetFilePath, TSnippetCreationMode argMode, bool argContextSensitive);
bool CreateSnippetFile(object argView, string argSnippetFilePath, int argMode, bool argContextSensitive);
ParameterTypePassing
argViewIServerDocumentViewvalue
argSnippetFilePathstringvalue
argModeTSnippetCreationModevalue
argContextSensitiveboolvalue

Returns: bool

The first overload is an extension method of IServerDocumentHelper (using DXP;) with typed parameters; the second is declared by the interface.

DocumentDirectoryChanged​

No description yet.

void DocumentDirectoryChanged();

Returns: nothing (void)

DoFileLoad​

This method allows the re-loading of the document. This is useful if the document has been modified and saved and it needs to be re-loaded to ensure that the document is in the latest state.

bool DoFileLoad();

Returns: bool

DoFileSave​

This method provides you an option to save the document in a different format if the document supported by the specific document editor provides the option of saving in a different format other than the default format. Normally these file formats are stored in the SaveFilters block within the EditorWindowKind section within a server installation file (with an INS extension).

bool DoFileSave(string argKind);
ParameterTypePassing
argKindstringvalue

Returns: bool

For example with PCB documents in Altium Designer, you can save them as a PCB ASCII format, PCB Binary 3 format etc - PCB Binary, PCB 3.0 Binary, PCB 4.0 Binary, PCB ASCII. By default its PCB Binary 5.0.

With Schematic documents, you can save them as a Advanced Schematic binary, Advanced Schematic ascii, Schematic binary 4.0, Orcad SDT Schematic, Advanced Schematic template.

Server Installation files

The file formats supported by editors can be found in the server installation files within the SaveFilters - End blocks.

See also: IServerDocument.GetCanClose, IServerDocument.Modified, IServerDocument.FileName

Examples: Extension_CreatePCBLib

DoSafeChangeFileNameAndSave​

The method determines whether the current document can be saved with the new file name and new document type or not.

bool DoSafeChangeFileNameAndSave(string argNewFileName, string argKind);
ParameterTypePassing
argNewFileNamestringvalue
argKindstringvalue

Returns: bool

DoSafeFileSave​

The method determines whether the document can be saved of specified document type safely.

bool DoSafeFileSave(string argKind);
ParameterTypePassing
argKindstringvalue

Returns: bool

Focus​

The method forces the document to be the focussed document in Altium Designer. A focussed document is the top level document and in view in Altium Designer workspace that responds to commands etc.

void Focus();

Returns: nothing (void)

GetCanClose​

This method checks whether the document can be closed or not. This method is used for the CanClose property.

bool GetCanClose();

Returns: bool

This CanClose property determines whether the document can be closed or not.

See also: IServerDocument.Modified, IServerDocument.FileName, IServerDocument.DoFileSave, IClient

GetContextHelpTopicName​

The GetContextHelpTopicName method retrieves the help topic name for the document. Normally the returned string would be the ServerModuleName.DocumentKind format for example 'SCH.SCH' Some servers provide more detailed information, for example Schematic Editor server returns Sch.Sheet.Port when the mouse is over the Port object on a schematic sheet.

string GetContextHelpTopicName();

Returns: string

Third party developers can use this method to provide context sensitive help.

To implement the help for your server, you should have a .HELPID file in the Help folder where the link between the string returned by the GetContextHelpTopicName and the actual help document is established.

For example the CXTSystemDesignCapture.HelpID contains a Sch.Sheet.Port = CXTSystemDesignCapture.chm,Document_Objects\Port.htm. This means when the F1 key is pressed and the Sch.Sheet.Port string is returned, it will use the CXTSystemDesignCapture.chm filename and display the Document_Objects\Port.htm topic.

GetCount​

The Count property returns the number of views (of the same type) in the IServerDocument container. Use in conjunction with the View property.

int GetCount();

Returns: int

This method is used for the Count property.

This property is supported by the GetCount method.

See also: IClient

GetDocumentModifiedDate​

No description yet.

double GetDocumentModifiedDate();

Returns: double

GetKind​

This method returns the Kind string for this document and this method is used for the Kind property. Examples include 'PCB', 'PCBLIB','SCH','SCHLIB' etc.

string GetKind();

Returns: string

The Kind reports the type of the document opened in Altium Designer.

See also: IClient

Examples: Extension_CreatePCBLib, Extension_PCBToImage

GetServerModule​

The ServerModule is a read-only property which returns the IServerModule interface that the document is associated with. The server module represents the server object installed and running in Altium Designer.

IServerModule GetServerModule();

Returns: IServerModule

Extension method of IServerDocumentHelper (using DXP;).

A server module manages its own documents and panels. This property is supported by the GetServerModule method.

See also: IServerModule, IClient

GetSnippetView​

No description yet.

IServerDocumentView GetSnippetView();

Returns: IServerDocumentView

Extension method of IServerDocumentHelper (using DXP;).

GetSupportsOwnSave​

The SupportsOwnSave property returns a boolean value whether a save routine has been provided to save these documents associated with the server. This is a read only property and is supported by the GetSupportsOwnSave method.

bool GetSupportsOwnSave();

Returns: bool

The SupportsOwnSave property returns a boolean value whether a save routine has been provided to save these documents associated with the server. Read only property.

See also: IClient

GetView​

The View property is an indexed property and represents a document or panel view. The IServerDocument.Count method returns the list of views (which could be document or panel windows) as part of the IServerDocument container.

IServerDocumentView GetView(int argIndex);
ParameterTypePassing
argIndexintvalue

Returns: IServerDocumentView

Extension method of IServerDocumentHelper (using DXP;).

This property is supported by the GetView method.

The View property is an indexed property and represents a document or panel view part of the IDocument container associated with a specific IServerModule interface. The IServerDocument.Count method returns the list of views (which could be document or panel windows) as part of the IServerDocument container.

See also: IClient

GetViewByName​

The GetViewByName method returns the View object which represents a document or panel view.

IServerDocumentView GetViewByName(string argViewName);
ParameterTypePassing
argViewNamestringvalue

Returns: IServerDocumentView

Extension method of IServerDocumentHelper (using DXP;).

See also: IServerDocumentView

NotifyViews​

This method sends a notification to all the views associated with the IServerDocument container.

void NotifyViews(INotification argNotification);
void NotifyViews(object argNotification);
ParameterTypePassing
argNotificationINotificationvalue

Returns: nothing (void)

The first overload is an extension method of IServerDocumentHelper (using DXP;) with typed parameters; the second is declared by the interface.

See also: INotification

OwnsFile​

The OwnsFile method determines whether the document is owned by the Altium Designer product and thus this document can be saved or not.

bool OwnsFile();

Returns: bool

PlaceSnippet​

No description yet.

void PlaceSnippet(string argSnippetAddress, IServerDocumentView argView);
void PlaceSnippet(string argSnippetAddress, object argView);
ParameterTypePassing
argSnippetAddressstringvalue
argViewIServerDocumentViewvalue

Returns: nothing (void)

The first overload is an extension method of IServerDocumentHelper (using DXP;) with typed parameters; the second is declared by the interface.

ReleaseDataFileHandle​

For internal use only.

void ReleaseDataFileHandle();

Returns: nothing (void)

ReleaseFileOwnership​

For internal use only.

void ReleaseFileOwnership();

Returns: nothing (void)

SupportsReload​

This method determines whether the document in Altium Designer can be re loaded or not (to refresh and to make sure that the document state is the latest).

bool SupportsReload();

Returns: bool

See also: IServerDocument.DoFileLoad

UpdateModifiedDate​

The method updates the modified document's date after this document has been modified.

void UpdateModifiedDate();

Returns: nothing (void)

See also: IServerDocument.Modified

WarnIfOwnedByOther​

This method determines whether the document is owned by another user. A document can be shared amongst other users but the other users cannot save this document when this document is owned solely by one user.

bool WarnIfOwnedByOther(TFileOwnershipWarningLevel argWarningLevel);
bool WarnIfOwnedByOther(int argWarningLevel);
ParameterTypePassing
argWarningLevelTFileOwnershipWarningLevelvalue

Returns: bool

The first overload is an extension method of IServerDocumentHelper (using DXP;) with typed parameters; the second is declared by the interface.

ZoomSnippetContents​

No description yet.

void ZoomSnippetContents();

Returns: nothing (void)

Returned by​

IClient.GetDocumentByPath, IClient.LastActiveDocumentOfType, IClient.OpenDocument, IClient.OpenDocumentShowOrHide, IClient.OpenNewDocument, IDataForDocumentNotification.GetServerDocument, IDataForDocumentRequest.GetServerDocument, IEDesignData_SupplyChainFrame.Document, IServerDocumentView.GetOwnerDocument, IServerModule.CreateDocument, IServerModule.CreateDocumentShowOrHide, IServerModule.GetDocuments, IServerModuleNativeImport.CreateDocumentWithId, IDocument.DM_ServerDocument, IProject.DM_ServerDocument, ILayerStackServerDocumentHelper.GetParentPcbDocument, IPCB_LayerStackupDocumentPainterView.DocumentToPaint, DataForDocumentNotification.GetServerDocumentImpl, ServerDocView.OwnerDocument, Utils.CreateNewDocumentFromDocumentKind

Accepted by​

IClient.CloseDocument, IClient.HideDocument, IClient.ShowDocument, IClient.ShowDocumentDontFocus, IDocumentPreviewManager.InvalidatePreview, IDocumentPreviewManager.SavePreview, IServerModule.CreateServerDocView, IServerModule.DestroyDocument, IEmbeddedModule.CompileAGUIDesign, ISch_ServerInterface.UpdateDocumentTemplate

Examples​

Used in the SDK examples: Ciiva, Ciiva, Extension_AddVariant, Extension_BOMManager, Extension_BlockAD_CS, Extension_ChangeOutputJobFile, Extension_ChangeOutputJobFile, Extension_CreatePCBLib, Extension_CreatePCBLib, Extension_CreateProject, Extension_CreateProject, Extension_CreateSchComponent.