WSM API文档界面

您正在阅读的是 20.2. 版本。关于最新版本,请前往 WSM API文档界面 阅读 22 版本

Parent page: Technical Reference - Workspace Manager API

Please note that this documentation was last updated for an older version of Altium Designer. While many of the principles and approaches will remain the same, be aware that interfaces, objects, methods, properties, and the like will have changed since then, and will not reflect the entirety of those found in later versions of the software.

Workspace Manager API: Document interface

Overview
The IDocument interface represents an existing document in Altium Designer — this can be a Schematic, PCB, VHDL, PCB Library, etc document.

When the DM_DocumentKind method of the IDocument interface is invoked it returns the document type. A document can be part of a project or free documents project. An existing document can be queried to return its accociated project interface.

Notes
The IDocument interface is a standalone interface.

Methods and properties for the WSM API Document Interface reference:

IDocument methods
DM_BusCount
DM_Buses
DM_ChannelClassCount
DM_ChannelClasses
DM_ChannelIndex
DM_ChannelPrefix
DM_ChannelRoomNamingStyle
DM_ChildDocumentCount
DM_ChildDocuments
DM_Compile
DM_ComponentClassCount
DM_ComponentClasses
DM_ComponentCount
DM_Components
DM_ConstraintGroupCount
DM_ConstraintGroups
DM_CreateViolation
DM_CrossSheetConnectorCount
DM_CrossSheetConnectors
DM_CurrentInstanceNumber
DM_DifferentialPairs
DM_DifferentialPairCount
DM_DocumentIsLoaded
DM_DocumentIsTextual
DM_DocumentKind
DM_FileName
DM_FullPath
DM_IndentLevel
DM_IsPhysicalDocument
DM_IsPrimaryImplementationDocument
DM_LoadDocument
DM_LogicalDocument
DM_ModelKind
DM_NetClassCount
DM_NetClasses
DM_NetCount
DM_Nets
DM_ParentDocumentCount
DM_ParentDocuments
DM_PartCount
DM_Parts
DM_PhysicalDocumentCount
DM_PhysicalDocumentParent
DM_PhysicalInstanceName
DM_PhysicalInstancePath
DM_PhysicalRoomName
DM_PortCount
DM_Ports
DM_Project
DM_RoomCount
DM_Rooms
DM_RuleCount
DM_Rules
DM_ScrapCompile
DM_SheetSymbolCount
DM_SheetSymbols
DM_SignalManager
DM_TextFrameCount
DM_TextFrames
DM_UniqueComponentCount
DM_UniqueComponents
DM_UniquePartCount
DM_UniqueParts
DM_UpdateDateModified
DM_VHDLEntities
DM_VHDLEntityCount
IDocument properties

Methods

DM_BusCount method

(IDocument interface)
Syntax
Function DM_BusCount : Integer;
Description
The function returns the number of bus objects from this document. Use this in conjunction with the DM_Buses(Index) to go through each bus object.
See also
IDocument interface

DM_Buses method

(IDocument interface)
Syntax
Function DM_Buses (Index : Integer) : IBus;
Description
The function returns the indexed Bus instance from this document.
See also
IDocument interface

DM_ChannelClassCount method

(IDocument interface)
Syntax
Function DM_ChannelClassCount : Integer;
Description
The function denotes the number of Channel Classes from this document. Use this Channel Class count in conjunction with the DM_ChannelClasses(index) to go through each channel class.
See also
IDocument interface

DM_ChannelClasses method

(IDocument interface)
Syntax
Function DM_ChannelClasses (Index : Integer) : IChannelClass;
Description
The function returns the indexed ChannelClass instance from this document. Use this in conjunction with the DM_ChannelClassCount function
See also
IDocument interface

DM_ChannelIndex method

(IDocument interface)
Syntax
Function DM_ChannelIndex : Integer;
Description
The function returns the channel index of this document. This is especially for multi-channel designs where a single source document can be referenced multiple times.
See also
IDocument interface

DM_ChannelPrefix method

(IDocument interface)
Syntax
Function DM_ChannelPrefix : WideString;
Description
The function returns the channel prefix of this document. This is especially for multi-channel designs where a single source document can be referenced multiple times.
See also
IDocument interface

DM_ChannelRoomNamingStyle method

(IDocument interface)
Syntax
Function DM_ChannelRoomNamingStyle : TChannelRoomNamingStyle;
Description
The function returns the channel room naming style value.
See also
IDocument interface

DM_ChildDocumentCount method

(IDocument interface)
Syntax
Function DM_ChildDocumentCount : Integer;
Description
The function returns the number of child documents relative to this document.
See also
IDocument interface

DM_ChildDocuments method

(IDocument interface)
Syntax
Function DM_ChildDocuments (Index : Integer) : IDocument;
Description
The function returns the indexed child document. A hierarchical design consists of multi layered parent-child documents.
See also
IDocument interface

DM_Compile method

(IDocument interface)
Syntax
Function DM_Compile : LongBool;
Description
The function invokes the compiler to compile this document. If the compile was successful, a true value is returned.
See also
IDocument interface

DM_ComponentClassCount method

(IDocument interface)
Syntax
Function DM_ComponentClassCount : Integer;
Description
The function denotes the number of component classes from this document. Use this Component class count in conjunction with the DM_ComponentClasses(index) to go through each component class.
See also
IDocument interface

DM_ComponentClasses method

(IDocument interface)
Syntax
Function DM_ComponentClasses (Index : Integer) : IComponentClass;
Description
The function returns the indexed ComponentClass instance from this document. Use this in conjuniton with the DM_ComponentClassCount function.
See also
IDocument interface

DM_ComponentCount method

(IDocument interface)
Syntax
Function DM_ComponentCount : Integer;
Description
The function returns the number of component instances on this document.  Use this in conjunction with the DM_Components(Index) method to go through each component object.
See also
IDocument interface

DM_Components method

(IDocument interface)
Syntax
Function DM_Components (Index : Integer) : IComponent;
Description
The function returns the indexed component instance from this document. This is to be used in conjunction with the DM_ComponentCount method.
See also
IDocument interface

DM_ConstraintGroupCount method

(IDocument interface)
Syntax
Function DM_ConstraintGroupCount : Integer;
Description
The function denotes the number of constraint groups.
See also
IDocument interface

DM_ConstraintGroups method

(IDocument interface)
Syntax
Function DM_ConstraintGroups (Index : Integer) : IConstraintGroup;
Description
The function returns the indexed constraint group. Use the  DM_ConstraintGroupCount function to get the number of constraint groups.
See also
IDocument interface

DM_CreateViolation method

(IDocument interface)
Syntax
Function DM_CreateViolation (AErrorKind : TErrorKind;AErrorString : WideString) : IViolation;
Description
The function creates a violation based on the error kind and error string upon an incorrect design.
See also
IDocument interface

DM_CrossSheetConnectorCount method

(IDocument interface)
Syntax
Function DM_CrossSheetConnectorCount : Integer;
Description
The function returns the number of cross sheet connectors on this document. Use this in conjunction with the DM_CrossConnectors(index) to go through each cross connector object.
See also
IDocument interface

DM_CrossSheetConnectors method

(IDocument interface)
Syntax
Function DM_CrossSheetConnectors (Index : Integer) : ICrossSheet;
Description
The function returns the indexed cross sheet connector instance from this document. This is to be used in conjunction with the DM_CrossSheetConnectorCount method.
See also
IDocument interface

DM_CurrentInstanceNumber method

(IDocument interface)
Syntax
Function DM_CurrentInstanceNumber : Integer;
Description
The function returns the current instance number for this document (especially for multi–channel designs where a design document can be referenced multiple times).
Example
See also
IDocument

DM_DifferentialPairs method

(IDocument interface)
Syntax
Function DM_DifferentialPairs(Index : Integer) : IDifferentialPair;
Description
This function returns an indexed differential pair from a document in the project.
See also
IDocument interface
IDifferentialPair interface

DM_DifferentialPairCount method

(IDocument interface)
Syntax
Function    DM_DifferentialPairCount           : Integer;
Description
This function returns the number of differential pairs used in a document in the project.
See also
IDocument interface
IDifferentialPair interface

DM_DocumentIsLoaded method

(IDocument interface)
Syntax
Function DM_DocumentIsLoaded : Boolean;
Description
This function returns a boolean value whether this document has been loaded in Altium Designer or not.
See also
IDocument

DM_DocumentIsTextual method

(IDocument interface)
Syntax
Function DM_DocumentIsTextual : Boolean;
Description
The function denotes whether the document is a text document.
See also
IDocument interface

DM_DocumentKind method

(IDocument interface)
Syntax
Function DM_DocumentKind : WideString;
Description
This function returns the document kind for the current document. A document could be a Schematic document and thus the string returned is ‘SCH’. Check the installation file of each server for the Server Name.
Example
See also
IDocument

DM_FileName method

(IDocument interface)
Syntax
Function DM_FileName : WideString;
Description
This function returns the file name string of this document.
See also
IDocument

DM_FullPath method

(IDocument interface)
Syntax
Function DM_FullPath : WideString;
Description
This function returns the full path of where this document lives.
See also
IDocument

DM_IndentLevel method

(IDocument interface)
Syntax
Function DM_IndentLevel : Integer;
Description
The function returns the indent level for this current document with respect to the current project.
See also
IDocument interface

DM_IsPhysicalDocument method

(IDocument interface)
Syntax
Function DM_IsPhysicalDocument : Boolean;
Description
This function returns a Boolean value whether this document is a physical document or not. There are logical and physical documents; these terms are used to differentiate the documents in multi-channel projects. A multi channel design means that a single sheet is referenced repeatedly for a channel design. This sheet is called a logical document. A physical document (usually a PCB document) has components with unique names within a room which is mapped to a channel on a Schematic sheet. So a multi channel design translates to multiple rooms with components with unique physical designators on a PCB.

A physical designator of a PCB component is calculated to have the hierarchy path of a schematic project as well as the logical designator of the associated Schematic component to ensure that this designator for the PCB component is unique.
See also
IDocument

DM_IsPrimaryImplementationDocument method

(IDocument interface)
Syntax
Function DM_IsPrimaryImplementationDocument : Boolean;
Description
This function returns a Boolean value whether this document is a primary implementation document (namely a PCB document for instance). A schematic document is a source document and is centric to a design project.
Example
See also
IDocument

DM_LoadDocument method

(IDocument interface)
Syntax
Function DM_LoadDocument : Boolean;
Description
This function returns a Boolean value whether this document has been loaded or not.
Example
See also
IDocument

DM_LogicalDocument method

(IDocument interface)
Syntax
Function DM_LogicalDocument : IDocument;
Description
This function returns the logical document if valid. Otherwise a nil value is returned. There are logical and physical documents; these terms are used to differentiate the documents in multi-channel projects. A multi channel design means that a single sheet is referenced repeatedly for a channel design. This sheet is called a logical document. A physical document (usually a PCB document) has components with unique names within a room which is mapped to a channel on a Schematic sheet. So a multi channel design translates to multiple rooms with components with unique physical designators on a PCB.

A physical designator of a PCB component is calculated to have the hierarchy path of a schematic project as well as the logical designator of the associated Schematic component to ensure that this designator for the PCB component is unique.
See also
IDocument

DM_ModelKind method

(IDocument interface)
Syntax
Function DM_ModelKind : WideString;
Description
The function returns the model kind string related to this document.
See also
IDocument interface

DM_NetClassCount method

(IDocument interface)
Syntax
Function DM_NetClassCount : Integer;
Description
The function denotes the number of net classes on this document. Use this NetClass count in conjunction with the DM_NetClasses(Index) method to go through each net class.
See also
IDocument interface

DM_NetClasses method

(IDocument interface)
Syntax
Function DM_NetClasses (Index : Integer) : INetClass;
Description
The function returns the indexed NetClass instance from this document. Use this in conjunction with the DM_NetClassCount function.
See also
IDocument interface

DM_NetCount method

(IDocument interface)
Syntax
Function DM_NetCount : Integer;
Description
The function returns the number of nets from this document. Use this Net count in conjunction with the DM_Nets(Index) to go through each sheet symbol object
See also
IDocument interface

DM_Nets method

(IDocument interface)
Syntax
Function DM_Nets (Index : Integer) : INet;
Description
The function returns an indexed net associated with this document.
See also
IDocument interface

DM_ParentDocumentCount method

(IDocument interface)
Syntax
Function DM_ParentDocumentCount : Integer;
Description
The function returns the number of parent documents relative to this document.
See also
IDocument interface

DM_ParentDocuments method

(IDocument interface)
Syntax
Function DM_ParentDocuments (Index : Integer) : IDocument;
Description
The function returns the indexed parent document. A hierarchical design consists of multi layered parent-child documents.
See also
IDocument

DM_PartCount method

(IDocument interface)
Syntax
Function DM_PartCount : Integer;
Description
The function returns the number of part objects from this document. Use this PartCount in conjunction with the DM_Parts(Index) to go through each part object.
See also
IDocument interface

DM_Parts method

(IDocument interface)
Syntax
Function DM_Parts (Index : Integer) : IPart;
Description
The function returns an indexed part associated with this document.
See also
IDocument interface

DM_PhysicalDocumentCount method

(IDocument interface)
Syntax
Function DM_PhysicalDocumentCount : Integer;
Description
The function returns the number of physical documents associated with this document.
See also
IDocument interface

DM_PhysicalDocumentParent method

(IDocument interface)
Syntax
Function DM_PhysicalDocumentParent : IDocument;
Description
The function returns the IDocument interface for a parent physical document. Could be a VHDL or a PCB document for example.
See also
IDocument interface

DM_PhysicalInstanceName method

(IDocument interface)
Syntax
Function DM_PhysicalInstanceName : WideString;
Description
The function returns the name of this physical document if valid. Otherwise an empty string is returned.
Example
See also
IDocument

DM_PhysicalInstancePath method

(IDocument interface)
Syntax
Function DM_PhysicalInstancePath : WideString;
Description
The function returns the path to the physical document instance if valid. Otherwise an empty string is returned.
See also
IDocument interface

DM_PhysicalRoomName method

(IDocument interface)
Syntax
Function DM_PhysicalRoomName : WideString;
Description
The function returns the name of the room on this physical document if valid. Otherwise a nil value is returned.
See also
IDocument interface

DM_PortCount method

(IDocument interface)
Syntax
Function DM_PortCount : Integer;
Description
The function returns the number of port objects on this document. Use this in conjunction with the DM_Ports(index) to go through each port object.
See also
IDocument interface

DM_Ports method

(IDocument interface)
Syntax
Function DM_Ports (Index : Integer) : INetItem;
Description
The function returns the indexed port instance from this document. This is to be used in conjunction with the DM_PortCount method
See also
IDocument

DM_Project method

(IDocument interface)
Syntax
Function DM_Project : IProject;
Description
This function returns the IProject object interface that this document is associated with.
See also
IDocument

DM_RoomCount method

(IDocument interface)
Syntax
Function DM_RoomCount : Integer;
Description
The function denotes the number of rooms on this document. Use this RoomCount in conjunction with the DM_Rooms(Index) to go through each room object.
See also
IDocument interface

DM_Rooms method

(IDocument interface)
Syntax
Function DM_Rooms (Index : Integer) : IRoom;
Description
The function returns the indexed room instance from this document. Use this in conjunction with the DM_RoomCount function.
See also
IDocument interface

DM_RuleCount method

(IDocument interface)
Syntax
Function DM_RuleCount : Integer;
Description
The function returns the number of rules from this document. Use this Rule count in conjunction with the DM_Rules(Index) to go through each sheet symbol object
See also
IDocument interface

DM_Rules method

(IDocument interface)
Syntax
Function DM_Rules (Index : Integer) : IRule;
Description
The function denotes the indexed rule from this document. Use this DM_RuleCount in conjunction with the DM_Rules to go through each rule found from this document..
See also
IDocument interface

DM_ScrapCompile method

(IDocument interface)
Syntax
Function DM_ScrapCompile(ForceCompile : Boolean) : LongBool;
Description
The function invokes a scrap compile (by force or not). A scrap compile is the background compile in Altium Designer on a design document and does all the auto - junctions for bus and wire objects. Also the scrap compile does the online rule checks in schematics. It is totally separate from the main compile which compile projects.
See also
IDocument interface

DM_SheetSymbolCount method

(IDocument interface)
Syntax
Function DM_SheetSymbolCount : Integer;
Description
The function returns the number of sheet symbols from this document. Use this SheetSymbol count in conjunction with the DM_SheetSymbols(Index) to go through each sheet symbol object.
See also
IDocument interface

DM_SheetSymbols method

(IDocument interface)
Syntax
Function DM_SheetSymbols (Index : Integer) : ISheetSymbol;
Description
The function returns an indexed sheet symbol associated with this document.
See also
IDocument interface

DM_SignalManager method

(IDocument interface)
Syntax
Function DM_SignalManager : ISignalManager;
Description
The function returns the signal manager interface.
See also
IDocument interface
ISignalManager interface

DM_TextFrameCount method

(IDocument interface)
Syntax
Function DM_TextFrameCount : Integer;
Description
The function returns the number of text frame objects from this document. Use this TextFrame  count in conjunction with the DM_TextFrames(Index) to go through each sheet symbol object
See also
IDocument interface

DM_TextFrames method

(IDocument interface)
Syntax
Function DM_TextFrames (Index : Integer) : ITextFrame;
Description
The function returns an indexed textframe object associated with this document.
See also
IDocument interface

DM_UniqueComponentCount method

(IDocument interface)
Syntax
Function DM_UniqueComponentCount : Integer;
Description
The function returns the number of unique components according to the library (ies) they are placed from. A duplicate of components of the same component kind is counted as one (1). Use this in conjunction with the DM_UniqueComponents(Index) method to go through each unique component object.
See also
IDocument

DM_UniqueComponents method

(IDocument interface)
Syntax
Function DM_UniqueComponents (Index : Integer) : IComponent;
Description
The function returns the indexed unique component instance from this document. This function is to be used in conjunction with the DM_UniqueComponentCount method.
See also
IDocument interface

DM_UniquePartCount method

(IDocument interface)
Syntax
Function DM_UniquePartCount : Integer;
Description
The function denotes the number of unique parts from this document. Duplicates of the same part kind are only returned as a count of one (1).
See also
IDocument interface

DM_UniqueParts method

(IDocument interface)
Syntax
Function DM_UniqueParts (Index : Integer) : IPart;
Description
The function returns an indexed unique part associated with this document. Note, if multiple instances of the same part exist, then only one of these parts will be recognized.
See also
IDocument

DM_UpdateDateModified method

(IDocument interface)
Syntax
Procedure DM_UpdateDateModified;
Description
The procedure sets the modified date for this document.
See also
IDocument interface

DM_VHDLEntities method

(IDocument interface)
Syntax
Function DM_VHDLEntities (Index : Integer) : IVHDLEntity;
Description
The function returns the indexed VHDL entity instance from this document. Use this in conjunction with the DM_VHDLEntityCount function.
See also
IDocument interface
DM_VHDLEntityCount function

DM_VHDLEntityCount method

(IDocument interface)
Syntax
Function DM_VHDLEntityCount : Integer;
Description
The function denotes the number of VHDL entities from this document. Use this VHDL Entity count in conjunction with the DM_VHDLEntities(Index) to go through each VHDL entity.
See also
IDocument interface
DM_VHDLEntities method

If you find an issue, select the text/image and pressCtrl + Enterto send us your feedback.

软件的功能取决于您购买的Altium产品级别。您可以比较Altium Designer软件订阅的各个级别中包含的功能,以及通过Altium 365平台提供的应用程序所能实现的功能。

如果您在软件中找不到某个讨论过的功能,请联系Altium销售团队以获取更多信息。