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
| Property | Type | Access | Description |
|---|---|---|---|
| BeingClosed | bool | get; set | The BeingClosed property denotes that this design document is being closed before this design document can be successfully destroyed. |
| FileModifiedDate | double | get; set | This method returns the date and time of the modified file. |
| FileName | string | get; set | The FileName property returns the filename for the server document (not the corresponding server panel). |
| IsShown | bool | get; set | This property denotes whether or not this document is displayed in Altium Designer. |
| Modified | bool | get; set | 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. |
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
| Method | Returns | Description |
|---|---|---|
| AcquireDataFileHandle | void | For internal use only. |
| AcquireFileOwnership | void | For internal use only. |
| AddView | void | This method adds a IServerDocumentView object in the server document. |
| CanCreateSnippet | bool | |
| CanPlaceSnippet | bool | |
| CreateSnippetFile | bool | |
| DocumentDirectoryChanged | void | |
| DoFileLoad | bool | This method allows the re-loading of the document. |
| DoFileSave | bool | 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… |
| DoSafeChangeFileNameAndSave | bool | The method determines whether the current document can be saved with the new file name and new document type or not. |
| DoSafeFileSave | bool | The method determines whether the document can be saved of specified document type safely. |
| Focus | void | The method forces the document to be the focussed document in Altium Designer. |
| GetCanClose | bool | This method checks whether the document can be closed or not. |
| GetContextHelpTopicName | string | The GetContextHelpTopicName method retrieves the help topic name for the document. |
| GetCount | int | The Count property returns the number of views (of the same type) in the IServerDocument container. |
| GetDocumentModifiedDate | double | |
| GetKind | string | This method returns the Kind string for this document and this method is used for the Kind property. |
| GetServerModule | IServerModule | The ServerModule is a read-only property which returns the IServerModule interface that the document is associated with. |
| GetSnippetView | IServerDocumentView | |
| GetSupportsOwnSave | bool | The SupportsOwnSave property returns a boolean value whether a save routine has been provided to save these documents associated with the server. |
| GetView | IServerDocumentView | The View property is an indexed property and represents a document or panel view. |
| GetViewByName | IServerDocumentView | The GetViewByName method returns the View object which represents a document or panel view. |
| NotifyViews | void | This method sends a notification to all the views associated with the IServerDocument container. |
| OwnsFile | bool | The OwnsFile method determines whether the document is owned by the Altium Designer product and thus this document can be saved or not. |
| PlaceSnippet | void | |
| ReleaseDataFileHandle | void | For internal use only. |
| ReleaseFileOwnership | void | For internal use only. |
| SupportsReload | bool | 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). |
| UpdateModifiedDate | void | The method updates the modified document's date after this document has been modified. |
| WarnIfOwnedByOther | bool | This method determines whether the document is owned by another user. |
| ZoomSnippetContents | void |
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);
| Parameter | Type | Passing |
|---|---|---|
argView | IServerDocumentView | value |
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);
| Parameter | Type | Passing |
|---|---|---|
argView | IServerDocumentView | value |
argMode | TSnippetCreationMode | value |
argContextSensitive | bool | value |
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);
| Parameter | Type | Passing |
|---|---|---|
argSnippetPath | string | value |
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);
| Parameter | Type | Passing |
|---|---|---|
argView | IServerDocumentView | value |
argSnippetFilePath | string | value |
argMode | TSnippetCreationMode | value |
argContextSensitive | bool | value |
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);
| Parameter | Type | Passing |
|---|---|---|
argKind | string | value |
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);
| Parameter | Type | Passing |
|---|---|---|
argNewFileName | string | value |
argKind | string | value |
Returns: bool
DoSafeFileSave
The method determines whether the document can be saved of specified document type safely.
bool DoSafeFileSave(string argKind);
| Parameter | Type | Passing |
|---|---|---|
argKind | string | value |
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);
| Parameter | Type | Passing |
|---|---|---|
argIndex | int | value |
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);
| Parameter | Type | Passing |
|---|---|---|
argViewName | string | value |
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);
| Parameter | Type | Passing |
|---|---|---|
argNotification | INotification | value |
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);
| Parameter | Type | Passing |
|---|---|---|
argSnippetAddress | string | value |
argView | IServerDocumentView | value |
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);
| Parameter | Type | Passing |
|---|---|---|
argWarningLevel | TFileOwnershipWarningLevel | value |
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.