Synchronizing using custom VBScript functions is the most useful when you want to automate much of how the multiple title block attribute values are set. This method of synchronization uses two custom VBScript functions. The implementation of these functions is entirely up to you. The functions can have any valid names. The link simply calls the functions at the appropriate moment during standard title block synchronization. The functions should contain all of the logic necessary to read and write the appropriate attribute values in the drawings, such as with Visual Basic for Applications.
Both of the functions will be called by the AutoCAD link with one parameter. The parameter is an array of arrays that each contain strings in the following order:
Recommended logic for both functions to iterate through the parameter array is shown in the following example.
Function UpdateFromDoc(PropList) On Error Resume Next If IsArray(PropList) Then iSize = UBound(PropList) For i = 0 To iSize CurProp = PropList(i) If IsArray(CurProp) Then If UBound(CurProp) = 3 Then 'Read the corresponding attribute value or write 'the corresponding vault property here. End If End If Next End If UpdateFromDoc = True End Function
The title block reading function may return any value, the value is not checked by the link.
If the return value of the title block writing function is True, the link will check all new values provided by the function and will set the corresponding attributes. To set an empty value, use an empty string (""). When the function is called, all parameter elements are Empty.
To synchronize multiple title blocks per drawing using custom VBScript functions:
Following is an example of the preceding settings.
[Settings] UseTabOrderForScript=1 UpdatePropertiesToDocument=UpdateToDoc UpdatePropertiesFromDocument=UpdateFromDoc [BLOCK_1] PROJECT_NM=Custom.Projectname FIELD1=UseScriptFunction FIELD2=UseScriptFunction,WO FIELD3=UseScriptFunction,RO
In this example, layout tabs are referred to by their number in the custom script functions instead of by their names. The script function UpdateToDoc will be called to update the attributes FIELD1 and FIELD2 for all instances of the block BLOCK_1. Those two attributes are controlled by the default and the WO flag. The script function UpdateFromDoc will be called to update the properties that correspond to attributes FIELD1 and FIELD3 for all instances of the block BLOCK_1. Those two attributes are controlled by the default and the RO flag.