Document Object Methods
The Document object methods affect the current document object.
AddRendition Method
Adds rendition content from the specified file to the current document.
Syntax
Sub AddRendition (File As String, [NewRevision As Boolean = True])
Name | Description |
---|---|
File |
Path to a file outside the vault to import as rendition content for the current document. |
NewRevision |
If True (default), creates a new revision of the rendition. |
Remarks
Rendition revisions are separate from the parent document revisions. They need not be synchronized and there may be many of one related to one of the other.
AddReorderingComment Method
Adds a reordering comment to the Project Copy.
Syntax
AddReorderingComment(reorderingComment as String)
Name | Description |
---|---|
reorderingComment | A string containing the comment to be added to the project copy. |
ApplyPropertyValues method
Saves the current property values to the current document object.
Syntax
ApplyPropertyValues()
Parameters
This method accepts no parameters.
AttachWaitingProjectCopy Method
Attaches an existing document as a waiting Project Copy. This updates waiting priority and retains the creation date of the existing document. You can also use the AddReorderingComment method to add a reordering comment to the Project Copy.
Syntax
AttachWaitingProjectCopy(ProjectCopy as Object) As IASDocument15
Name | Description |
---|---|
ProjectCopy |
An object representing the project copy to which the document is to be attached. |
CalculateFileType method
Resets the FileType property of the current document object.
Syntax
CalculateFileType()
Parameters
This method accepts no parameters.
CallRemote Method
Executes a remote procedure call.
Syntax
CallRemote(URL As String, Username As String, _ Password As String, RemoteVault As String, _ Script As String, [Args], [Flags As Long = 2])
Name | Description |
---|---|
URL |
Location of the server with which to connect. |
Username |
User account to use to connect to the server. |
Password |
Password of the user account. |
RemoteVault |
Name of the remote vault with which to connect. |
Script |
Name of the procedure to execute on the remote server. |
Args |
Optional arguments for the procedure to execute. |
Flags |
Optional flags from the AS_CALLREMOTE_FLAGSS enumeration. |
Example
The following examples show how to use this method.
Example function defined in the called vault:
Function RemoteTest (First, Second, Third) RemoteTest = "RemoteTest returns: " & First & ", " & Second & ", " & Third End Function
Example procedure defined in the calling vault:
Sub Test_Execute(Batch)
vArg = Array ("One ", "Two", "Three")
vRes = Vault.CallRemote ("http://MyServer/Meridian", "MyUserName", _
"MyPassword", "MyVaultName", "RemoteTest", VArg, AS_CRF_MULTIARGS)
WinMsgBox vRes
End Sub
ChangeDocumentType Method
Changes the document type of the current document object.
Syntax
ChangeDocumentType(DocType)
Name | Description |
---|---|
DocType |
An object that represents the new document type |
Remarks
For events to occur for this method, the ChangeDocTypeEvents setting in the [ScriptEvents] section on the Application Integration tab of Application Settings in Configurator must be set to Y(default).
ChangeForgeURL Method
If a rendition is already available in Autodesk Forge, changes the ForgeURL property of the document based on the parts that you specify.
Syntax
ChangeForgeURL(ForgeURL1, ForgeURL2)
Name | Description |
---|---|
ForgeURL1 |
A string that represents the first part of the Forge URL for the document, for example, the base URL. |
ForgeURL2 | A string that represents the second part of the Forge URL for the document, for example, the Forge file ID. |
ChangeManager Method
Changes the workflow manager of the document type workflow of the current document object.
Syntax
ChangeManager(User As String)
Name | Description |
---|---|
User |
The user name of the new workflow manager |
Remarks
For events to occur for this method, the SDWFEvents setting in the [ScriptEvents] section on the Application Integration tab of Application Settings in Configurator must be set to Y. The default is N.
ChangeTodoPerson Method
Changes the to-do person of the document type workflow of the current document object.
Syntax
ChangeTodoPerson(User As String, Comment As String)
Name | Description |
---|---|
User |
The user name of the new workflow manager |
Comment |
The comment to append to the comment log |
Remarks
For events to occur for this method, the SDWFEvents setting in the [ScriptEvents] section on the Application Integration tab of Application Settings in Configurator must be set to Y. The default is N.
ChangeWorkflowState Method
Changes the document type workflow state of the current document object.
Syntax
ChangeWorkflowState(NewWorkflowState As AS_WF_STATE, User As String, Comment As String)
Remarks
For events to occur for this method, the SDWFEvents setting in the [ScriptEvents] section on the Application Integration tab of Application Settings in Configurator must be set to Y. The default is N.
ClearRedlines Method
Clears the current redlines of the document object. If the document includes a rendition, its redlines are also deleted.
Syntax
ClearRedlines()
Parameters
This method accepts no parameters.
CreateWaitingProjectCopy Method
Adds the document as a new waiting Project Copy to the waiting list if the document is a master document with concurrent engineering options which allow creation of a waiting Project Copy. All properties in custom property sets are copied from the master document to the new Project Copy. Waiting project copies are created in the workflow state Unchanged.
Syntax
CreateWaitingProjectCopy(TargetProject as IASFolder9) As IASDocument15
Name | Description |
---|---|
TargetProject |
A project folder where the waiting project copy is to reside. |
ConfirmMerged Method
Prompts the user to confirm that the selected project copy document has been merged with the master document.
Syntax
ConfirmMerged()
Parameters
This method accepts no parameters.
ConfirmSuperceded Method
Prompts the user to confirm that the selected project copy document has been superceded by changes made to the master document.
Syntax
ConfirmSuperceded()
Parameters
This method accepts no parameters.
ContentFromReport Method
Replaces content of the document with the output of the report with the specified name, scope, and template. This only works for reports that generate HTML content. You can use this method in a custom command.
We recommend that you do not use this for locked documents as it can result in the new report being lost.
Syntax
ContentFromReport(ReportName as String, ReportScope, TemplateName as String)
Name | Description |
---|---|
ReportName |
Internal name of the report definition. |
ReportScope | Array of document IDs that represents the scope of the report. |
TemplateName | XLST stylesheet to use for the report. |
CopyProperties Method
Copies all of the property values of the current document to a specified document except for an optional array of property names.
Syntax
CopyProperties(PropertySetName As String, TargetDocument As Document, [ExcludeProperties] As String)
Name | Description |
---|---|
PropertySetName |
Name of the property set to copy. |
TargetDocument |
Document object to which to copy the properties. |
ExcludeProperties |
Optional one dimension array of a property names to exclude from copying. |
Remarks
The following example copies all properties in the property set MyPropSet to the specified document object except for the properties named Prop1 and Prop2.
Document.CopyProperties "MyPropSet", Document, Array("Prop1", "Prop2")
CreateHybridPart Method
Creates a hybrid for the current document with the specified name. After creation, content for the new hybrid part can be loaded with the LoadFromFile or LoadFromTemplate methods.
Syntax
CreateHybridPart(PartName as String) As IASDocument11
Name | Description |
---|---|
PartName |
The name with which to create the new hybrid part. |
Return Value
A new Document object.
Remarks
Use this method to create a new hybrid part before loading file content with the LoadFromFile or LoadFromTemplate methods. Consider using the ImportHybridPart method instead.
For events to occur for this method, the HybridEvents setting in the [ScriptEvents] section on the Application Integration tab of Application Settings in Configurator must be set to Y (default).
Delete Method
Deletes the current document.
Syntax
Delete()
Parameters
This method accepts no parameters.
Remarks
The confirmation dialogs that are normally shown during document deletion can be suppressed as described in Confirmation property.
DeleteHotspots method
Deletes the type of hotspots that you specify.
Syntax
DeleteHotspots(AS_HOTSPOTS_TYPE)
Name | Description |
---|---|
AS_HOTSPOTS_TYPE |
An enumeration that determines whether to delete manual or automatic hotspots. You can use |
DeleteHybridPart Method
Deletes the hybrid part of the current document with the specified name.
Syntax
DeleteHybridPart(PartName as String)
Name | Description |
---|---|
PartName |
The name of the hybrid part to delete. |
Remarks
For events to occur for this method, the HybridEvents setting in the [ScriptEvents] section on the Application Integration tab of Application Settings in Configurator must be set to Y (default).
DeleteRendition Method
Deletes the content of the current rendition revision for the current document.
Syntax
Sub DeleteRendition()
Parameters
This method accepts no parameters.
Remarks
This method does not actually delete the rendition file but marks it as deleted. The Document.Rendition property will then return the path of the orphaned file.
ExecTransition Method
Executes the specified workflow definition transition for the current document object.
Syntax
ExecTransition(WorkflowTransition As IASWorkflowTransition, [Comments As String], [TodoPersons As String])
Name | Description |
---|---|
WorkflowTransition |
An object that represents the workflow definition transition to execute |
Comments |
Optional comments to append to the comment log |
TodoPersons |
Optional user names to assign as the new to-do persons |
Remarks
-
For events to occur for this method, the CWFEvents setting in the [ScriptEvents] section on the Application Integration tab of Application Settings in Configurator must be set to Y (default).
-
Wizard pages are not shown when this method is invoked. Property value assignments should be performed by script instead.
-
If the Release project copies of documents as master revisions option of a workflow transition is enabled and the transition changes the status of the document to Released, executing the transition on a project copy with this method will create a new revision of the project copy as expected but it will not release it as a new master document revision.
ExportRendition Method
Exports the content of the current rendition revision for the current document to a specified file.
Syntax
Sub ExportRendition (File As String)
Name | Description |
---|---|
File |
Path and filename outside the vault where to export the rendition content of the current document. |
ExtractTags Method
Gets text strings from the full-text index of the current document that match the specified regular expression.
Syntax
ExtractTags(RegExp)
Name | Description |
---|---|
RegExp |
A regular expression that matches the text strings to be found in the full-text index of vault documents. For help calculating a regular expression, see Regular Expression Language - Quick Reference in the MSDN Library. |
Return Value
An array of text tokens that match the specified regular expression.
Remarks
This method is intended for finding object tag IDs for use with the Meridian Asset Management Module.
GetDocumentRevisions
Returns an array of revision IDs.
Syntax
GetDocumentRevisions() As Array
Parameters
This method accepts no parameters.
Example
Dim prt
prt= Document.GetDocumentRevisions()
If IsArray(prt) Then
Document.Log "array prt"
Dim i
For Each i in prt
Document.Log i
Next
Else
Document.Log "not array"
End If
GetExpectedTransitionResult Method
Returns the expected result of executing the specified workflow definition transition for the current document object.
Syntax
GetExpectedTransitionResult(Transition As IASWorkflowTransition) As AS_WORKFLOW_TRANS_RES
Name | Description |
---|---|
Transition |
An object that represents the workflow definition transition to execute |
Return Value
Returns a long integer that is equivalent to one or more of the AS_WORKFLOW_TRANS_RES constants that represents the expected results. Use this method to determine the current consensus status of parallel workflows.
GetHybridPart Method
Gets a document object for the hybrid part with the specified name.
Syntax
GetHybridPart(PartName as String) As IASDocument6
Name | Description |
---|---|
PartName |
The name of the hybrid part for which to get a document object. |
Return Value
A Document object.
GetLog Method
Gets the workflow comment log for the current document object.
Syntax
GetLog() As String
Parameters
This method accepts no parameters.
Return Value
A single string containing the entire Comment property value.
Remarks
This method can be useful to append the workflow history of one document to another that is being replaced or superceded.
Example
Sub DocProjectCopyEvent_AfterReleaseToMaster(Batch, MasterDoc, ProjectCopyChanged) MasterDoc.Log Document.GetLog() MasterDoc.ApplyPropertyValues End Sub
GetNavigationViewLevelPath Method
Gets the path of the current document object within a specified navigation view.
Syntax
Function GetNavigationViewLevelPath(ViewName)
Name | Description |
---|---|
ViewName |
Name of the view to get the path from. |
Return Value
Array containing the names of each level of the path.
GetReferences Method
Gets the references of the specified type for the current document object.
Syntax
GetReferences(RefTypeName As String, [InComing As Boolean = False]) As IASReferences
Name | Description |
---|---|
RefTypeName |
The name of the reference type to retrieve. |
InComing |
If True, returns only incoming references. If False, returns only outgoing references. |
Return Value
A collection of references as described in References Object.
HasHotspots method
Returns a boolean indicating whether automatic or manual hotspots exist on the document.
Syntax
HasHotspots(AS_HOTSPOTS_TYPE)
Name | Description |
---|---|
AS_HOTSPOTS_TYPE |
An enumeration that determines whether to check for manual or automatic hotspots. You can use |
HybridMainDocument Method
Returns the main document object for the current hybrid part document.
Syntax
HybridMainDocument As IASDocument6
Return Value
The main document object for the current hybrid part document.
Remarks
Only returns an object if the current document is a part of a hybrid document. Otherwise, it returns Nothing.
ImportHybridPart Method
Creates a new hybrid part for the current document and loads content from the specified file path.
Syntax
ImportHybridPart(FilePath as String) As IASDocument11
Name | Description |
---|---|
FilePath |
The path of a file from which to import document content for the new hybrid part. |
Return Value
A Document object.
Remarks
This method is equivalent to the combination of the CreateHybridPart and LoadFromFile methods.
For events to occur for this method, the HybridEvents setting in the [ScriptEvents] section on the Application Integration tab of Application Settings in Configurator must be set to Y (default).
LinkToMaster Method
Links the selected document to a specified master document from which it was not originally copied.
Syntax
LinkToMaster(MasterDocument As Object, [LockMaster As Boolean=False])
Name | Description |
---|---|
MasterDocument |
A document object to which to link the selected document. |
LockMaster |
If True, locks the master document after the link has been made. Optional. |
Remarks
Ideally, this method should not be used under the same conditions as the Link to Master command.
LoadFromFile Method
Loads content for the current document from the specified file.
Syntax
LoadFromFile(FileName as String)
Name | Description |
---|---|
FileName |
If specified, the file to load from the specified location outside the vault. If absent, the file is loaded from the Local Workspace with its current name. |
Return Value
The name of the file that was loaded.
Remarks
Use this method to load content for a newly created hybrid part.
LoadFromTemplate Method
Loads content for the current document from the specified document type template.
Syntax
LoadFromTemplate(TemplateName as String)
Name | Description |
---|---|
TemplateName |
If specified, the file is saved in the specified location outside the vault. If absent, the file is saved in the Local Workspace with its current name. |
Remarks
Use this method to load content for a newly created hybrid part.
LockLWS Method
Locks the current document object in the user's local workspace.
Syntax
LockLWS()
Parameters
This method accepts no parameters.
Return Value
The path of the file that was locked.
LockMasterDocument Method
Locks the master document from which the current project copy was made.
Syntax
LockMasterDocument()
Parameters
This method accepts no parameters.
Log Method
Appends a line of text to the Comments property of the current document object.
Syntax
Log(Line As String)
Name | Description |
---|---|
Line |
A line of text to add to the document's comment log |
Migrate Method
Migrates the current document object from an active document type workflow state to the specified workflow definition state.
Syntax
Migrate(Workflow As String, [WorkFlowState], [Comments])
Name | Description |
---|---|
Workflow |
The name of the workflow definition to which to migrate the document. |
WorkFlowState |
Optional workflow definition state name to which to migrate the document. |
Comments |
Optional text to append to the document's comment log. |
MoveTo Method
Moves the current document to the specified folder.
Syntax
MoveTo(TargetFolder As IASFolder3, [Options As Long = 0])
Remarks
If this method is called within the AfterExecuteTransition event, the text Copy of is prepended to the filename if the document already resides in the target folder. This method does not support Field-Path definition levels.
When this method is called, any property values set by code are reset to their original values.
If this method is used in event procedures such as DocGenericEvent_AfterNewDocument, an unhandled exception Cannot delete a relation. The object is already being edited by another session can occur. This can happen if the folder to which the document is being moved is locked, such as by another new document wizard in use by another user at the same time. This is likely to happen if event procedures are customized to provide automatic document storage together with the Meridian Advanced Project Workflow Module so that it works similar to a Field-Path definition.
For the wizard events to occur for this method, the MoveEvents setting in the [ScriptEvents] section on the Application Integration tab of Application Settings in Configurator must be set to Y (default).
To use this method to move documents to folders that users are not granted Create Document privilege, grant them the Create Document from Script privilege for the destination folder. The privilege may only be granted for custom folder types , not normal folders.
ReassignManagers Method
Reassigns the workflow definition managers of the current document object.
Syntax
ReassignManagers(Managers, [Comments])
Name | Description |
---|---|
Managers |
The user names of the new workflow managers. |
Comments |
Optional comments to add to the document's Comments property. |
Remarks
For events to occur for this method, the CWFEvents setting in the [ScriptEvents] section on the Application Integration tab of Application Settings in Configurator must be set to Y (default).
ReassignTodoPersons Method
Reassigns the workflow definition to-do persons of the current document object.
Syntax
ReassignTodoPersons(Persons, [Comments])
Name | Description |
---|---|
Persons |
The user names of the new to-do persons. |
Comments |
Optional comments to add to the document's Comments property. |
Remarks
For events to occur for this method, the CWFEvents setting in the [ScriptEvents] section on the Application Integration tab of Application Settings in Configurator must be set to Y (default).
ReleaseChange Method
Releases the working copy or Quick Change of the current document object.
Syntax
ReleaseChange()
Parameters
This method accepts no parameters.
Remarks
For events to occur for this method, the QuickChangeEvents setting in the [ScriptEvents] section on the Application Integration tab of Application Settings in Configurator must be set to Y. The default is N.
Reroute Method
Reroutes the current document object to a specified workflow definition state.
Syntax
Reroute(WorkFlowState, [Comments], [ToDoPersons])
Name | Description |
---|---|
WorkFlowState |
The name of the state to which to reroute the document. |
Comments |
Optional comments to add to the document's Comments property. |
ToDoPersons |
Optional user names of the new to-do persons. |
Remarks
For events to occur for this method, the CWFEvents setting in the [ScriptEvents] section on the Application Integration tab of Application Settings in Configurator must be set to Y (default).
ResetPropertyValues Method
Resets the properties of the current document object.
Syntax
ResetPropertyValues()
Parameters
This method accepts no parameters.
RevokeChange Method
Revokes the working copy or Quick Change of the current document object.
Syntax
RevokeChange()
Parameters
This method accepts no parameters.
Remarks
For events to occur for this method, the QuickChangeEvents setting in the [ScriptEvents] section on the Application Integration tab of Application Settings in Configurator must be set to Y. The default is N.
RevokeWorkflow Method
Revokes the active workflow definition of the current document object.
Syntax
RevokeWorkflow()
Parameters
This method accepts no parameters.
Remarks
For events to occur for this method, the SDWFEvents setting in the [ScriptEvents] section on the Application Integration tab of Application Settings in Configurator must be set to Y. The default is N.
SaveToFile Method
Saves the current document content to an external file or Local Workspace file.
Syntax
SaveToFile([FileName as String])
Name | Description |
---|---|
FileName |
If specified, the file is saved in the specified location outside the vault. If absent, the file is saved in the Local Workspace with its current name. |
Return Value
The path of the file that was saved.
Remarks
Use this method to temporarily save the content of a non-hybrid part document before creating a new hybrid part and then loading the file created by this method as the new part's content.
SendToPortal Method
Sends the current document to the Meridian Portal project to which the document's parent folder is linked.
Syntax
SendToPortal(Recipient As String, IncludeContent As AS_INCLUDE_CONTENT_OPTIONS, Description As String, Options As AS_PORTAL_OPTIONS)
Name | Description |
---|---|
Recipient | A string containing name of recipient in Portal project. |
IncludeContent | A long integer that represents one or more AS_INCLUDE_CONTENT_OPTIONS constants. |
Description | A string containing the package description. |
Options |
A long integer that represents one or more AS_PORTAL_OPTIONS constants. |
Remarks
To learn more about sending documents to Meridian Portal and the parameters in the table above, see Send Documents To Meridian Portal.
SetModified Method
Changes the internal Modified property of a document.
Syntax
SetModified(ModifiedDate As Date)
Name | Description |
---|---|
ModifiedDate |
The date to set for the Modified property. |
Remarks
This method can be useful in DocProjectCopy_*ReleaseToMaster event procedures when a project copy is released as a new master document but the document has no content, such as asset tags. Setting the Modified property of a project copy causes Meridian to consider the document as changed and the master document is replaced.
StartChange Method
Initiates a working copy or Quick Change of the current document object.
Syntax
StartChange()
Parameters
This method accepts no parameters.
Remarks
For events to occur for this method, the QuickChangeEvents setting in the [ScriptEvents] section on the Application Integration tab of Application Settings in Configurator must be set to Y. The default is N.
StartWorkflow Method
Initiates a workflow definition of the current document object.
Syntax
StartWorkflow(Workflow As String, [Transition], [Comments], [TodoPersons], [Managers])
Name | Description |
---|---|
Workflow |
The name of the workflow definition to initiate. |
Transition |
Optional name of a transition to execute. |
Comments |
Optional comments to add to the document's Comments property. |
ToDoPersons |
Optional user names of the to-do persons. |
Managers |
Optional user names of the workflow managers. |
Remarks
For events to occur for this method, the CWFEvents setting in the [ScriptEvents] section on the Application Integration tab of Application Settings in Configurator must be set to Y (default).
Subscribe Method
Registers the specified user to receive notifications of events for the current document.
Syntax
Subscribe(User As String, Notification As String)
Name | Description |
---|---|
User |
User (To-Do list) name or array of names. |
Notification |
Internal name or array of internal names of event notification definitions to send to the specified users. |
Unsubscribe Method
Unregisters the specified user from receiving notifications of events for the current document.
Syntax
Unsubscribe(User As String, Notification As String)
Name | Description |
---|---|
User |
User (To-Do list) name or array of names. |
Notification |
Internal name or array of internal names of event notification definitions to unregister for the specified users. |
UnlockLWS Method
Unlocks the current document object from the user's local workspace.
Syntax
UnlockLWS()
Parameters
This method accepts no parameters.
Return Value
The path of the file that was unlocked.
UnLockMasterDocument Method
Unlocks the master document from which the current project copy was made.
Syntax
UnLockMasterDocument()
Parameters
This method accepts no parameters.