RepathReferences Method
Description
Attempts to correct external reference paths when the specified object has changed from a Single File Document (SFD) to a Multi File Document (MFD) or vice versa. When Xrefs are attached using relative paths, the change from SFD to MFD or MDF to SFD changes the location of the parent drawing resulting in the relative reference paths being broken. This method will attempt to fix the broken links if the SFD/MFD state has changed between versions. The repathing can be forced by setting the ForceRepath parameter to True. The DWG file is saved back as the same file version as the original file.
A log file is generated if a LogIdentifier is provided, no log file is created if the LogIdentifier is Nothing. Please see Log Files for more information.
If no DWG file with the specified Drawing Name exists, then an error is raised.
Syntax
Sub RepathReferences(Vault As Vault, DrawingObjVer As ObjVer, DrawingName As String, ForceRepath As Boolean, LogIdentifier As Object)
Parameters
Name |
Data Type |
Description |
Vault |
The Vault object provided by the event handler. |
|
DrawingObjVer |
ObjVer of object containing a DWG file to process. This could be provided by the event handler or created dynamically using CreateObject("MFilesAPI.ObjVer"). |
|
DrawingName |
String |
The name of the DWG file to process (excluding the file extension). Use with Multi File Document (MFD) objects containing more than one DWG file. |
ForceRepath |
Boolean |
If False, the repathing only occurs if the SFD/MFD state has changed. The repathing can be forced by setting this parameter to True. |
LogIdentifier |
String or TypedValue |
Used to determine the filename of the log file. To create a log file for the current activity pass in the provided ActivityID. If this parameter is Nothing, then no log file is generated. |
Return
No return value.
Example
'create ExcitechDOCS DWG Processor object
Set dwgProcessor = GetExtensionObject("ExcitechDOCS.DWGProcessor")
'bind References
dwgProcessor.RepathReferences Vault, ObjVer, "A Drawing Name", True, ActivityID
The resulting log file would contain the following information:
01/01/2019 09:00:00:1014 - Repath References
01/01/2019 09:00:00:1094 - DWG File Count: 1
01/01/2019 09:00:00:1114 - Forcing Reference Repath.
01/01/2019 09:00:00:1114 - Creating RealDWG COM Object. (dllhost.exe)
01/01/2019 09:00:00:3545 - Call RepathReferences COM method.
01/01/2019 09:00:00:3895 - Processing Object: ID 1 Version 12
01/01/2019 09:00:00:3951 - DrawingName: A Drawing Name
01/01/2019 09:00:00:4145 - Filename: A Drawing Name (ID 1).dwg
01/01/2019 09:00:00:4165 - Virtual Path: \\ID2\1f1d833b-6c4c-46d8-a558-7c5c6d9b6df9\0\0-999\1\S\v12\Example Drawing (ID 1).dwg
01/01/2019 09:00:00:4165 - FileVer: ID 1 Version 5
01/01/2019 09:00:00:4175 - Download DWG to temp file: C:\ProgramData\Excitech Docs\DWG Processor\Temp\hck2quex.dwg
01/01/2019 09:00:00:4525 - Open DWG file
01/01/2019 09:00:00:5395 - Repath DWG References
01/01/2019 09:00:00:5455 - Repath Image References
01/01/2019 09:00:00:5475 - Repath PDF References
01/01/2019 09:00:00:7365 - Nothing to Repath, file not updated.
01/01/2019 09:00:00:7365 - Delete temp files from server
01/01/2019 09:00:00:7375 - Releasing COM object.