Search This Blog

Thursday, January 17, 2008

Maintain Revit Font Map Standards - VBScript Function

One of the problems with supporting multiple users of Revit is to ensure that they are all accessing the same consistent set of standard support files. Some of those files are hardcoded and stored on the users local hard drive. One such file is the shxfontmap.txt file that controls how Revit assigns windows fonts to AutoCAD fonts when importing dwg files.

Note: it is critical for all your users on the same project to have the same font map or every save to central (STC) has the potential to remap fonts throught out your linked Acad files.

Here is a VBScript function that will solve the problem for you. Put it inside your "local copy" routine or call it from your startup icon to ensure that all your users always have the latest version of your company standard fontmap file.:

Make sure that you change the path to the local file if you installed into a different diretory or are running MEP or Structures. Also, change the path pointing to the master file to reflect the folder that your master copy is in.

‘‘‘ FILENAME:Update_FontMap.vbs
‘‘‘====================================================================
‘‘‘ AUTHOR: Richard Binning
‘‘‘ DATE: 01/16/2008
‘‘‘ DEVNOTE: Initial Build for 2008 products
‘‘‘
‘‘‘ DISCLAIMER:
‘‘‘ Permission to use, copy, modify, and distribute this software
‘‘‘ for any purpose and without fee is hereby granted, provided
‘‘‘ that the above copyright notice appears in all copies and that
‘‘‘ both that copyright notice and this permission notice appear in
‘‘‘ all supporting documentation.
‘‘‘
‘‘‘ THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
‘‘‘ WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
‘‘‘ PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
‘‘‘
‘‘‘====================================================================
‘‘‘ DESCRIPTION: Update_FontMap.vbs – Routine compares local fontmap with
‘‘‘ Office master fontmap file of same name
‘‘‘
‘‘‘ CALLED FROM:
‘‘‘ USAGE: 1.) Ensure Place this function in scripted startup routine.
‘‘‘ PREREQ: None.
‘‘‘ VERSION: This version hard coded for Revit Architecture, modify product
‘‘‘ for MEP or Structures See “strClientFontMap” variable
‘‘‘====================================================================
Sub Update_Fontmap()
Dim fs, objMasterFolder, objMasterFiles, objMasterFile
Dim strClientFontMap, objClientFile

Set fs = CreateObject("Scripting.FileSystemObject")
Set objMasterFolder = fs.GetFolder("x:\RevitStds")
Set colFiles = objMasterFolder.Files

For Each objMasterFile in colFiles
strClientFontMap = _
"C:\Program Files\Revit Architecture 2008\Data\shxfontmap.txt"
Set objClientFile = fs.GetFile(strClientFontMap)
If objMasterFile.Name = objClientFile.Name then
' Got Match
If objClientFile.DateLastModified<objMasterFile.DateLastModified Then
'copy standard fontmap to local client because Master File os newer
objMasterFile.Copy(strClientFontMap)
Else
' do nothing because Local File Newer
End If
End If
Set objClientFile = Nothing
Next

Set colFiles = Nothing
Set objMasterFolder = Nothing
Set fs = Nothing
end sub

No comments: