PentagonDocs Assistant provides a scripting environment triggered at document and process events.

Objects and Events

The drop down lists the Objects and Events exposed to define the VBScript. Double clicking an entry will add the associated code at the location of the cursor.


Example Script editing

The example script runs at the Sheet_SyncFromVault event and reads the version of Revit and writes the value to an M-Files property.


Sample Script:

' Called when synchronising properties from Pentagon DOCS on Revit ribbon

Sub Sheet_SyncFromVault(ObjVer, Properties, Parameters)

    Dim RevitVersion : RevitVersion = Application.VersionNumber

    Dim objVersion : Set objVersion = Vault.ObjectOperations.CheckOut(ObjVer.ObjID)

    CoreScript.SetPropertyValue objVersion.ObjVer"ExDOCS.Property.RevitVersion", RevitVersion 

    CoreScript.CheckIn objVersion.ObjVer

End Sub


WARNING: This is an example script and should not be used in a production vault without being fully tested for your application.


Result of sample script:

The Revit Version property is set to the version of Revit. This could be mapped to the drawing sheet if necessary. See Property Mapping

Default Revit Event Script Events


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

' Set CONST variables for workflow states in order to make script more user friendly

'

' CDE prefix, states from the CDE WIP workflow.

' CAR prefix, states from the Check Approve Release workflow.


CONST CDE_WIP = 108

CONST CDE_WIPApproved = 101

CONST CDE_WIPforApproval = 125

CONST CAR_WIP = 158

CONST CAR_Check = 159

CONST CAR_Approval = 162

CONST CAR_Released = 160


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

' Called to determine if the Sheet can be published

' Set AllowPublish to false to disable the row in the Publish Sheets dialog

' Use the Message argument to inform the user why the sheet cannnot be publshed

Sub PublishSheets_AllowPublishSheet(SheetInfo, AllowPublish, Message)


End Sub


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

' Called to determine the available Target States of the selected sheet 

' Use the Options argument to specify the available options e.g. Options.Add("A - new option")

Sub PublishSheets_TargetStatesForSheet(SheetInfo, Options)


End Sub


' Called before publishing the selected batch

Sub PublishSheets_InitialisePublish(Batch)


End Sub


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

' Called before each sheet is published allowing the Temporary Publish Object and Revit Parameters to be modified

' Add publish parameters to the Parameter dictionary e.g. Parameters.Add "REVISION","C01"

' Note: Parameter names are case sensitive

Sub PublishSheets_BeforePublishSheet(TempObjVer, SheetInfo, Parameters, Batch)


End Sub


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'GetPublishFilename - Gets the Publish filename based on selected filename format

Function GetPublishFilename(TempObjVer, FilenameFormat, Suitability, Revision)


End Function


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'GetCprefixRevision - Gets the C prefix revision based on version history of Issue document object

Function GetCprefixRevision(ObjVer)


End Function