Monday, May 19, 2008

Revit startup script to swap INI file

Last week I had written a blog about a simple installation script for Revit. Somebody had asked about a startup script.  We use a script to launch Revit.  This allows us to change the Revit.ini (if need be), keyboardshortcuts file, add API extensions, etc in individual boxes as and when we want it, even after the initial installation. This helps people using laptops too, making the whole process transparent. (The laptop person has to borrow licenses to use Revit fully or should have a standalone license)

To set this up, we typically create two INI files: Revit.ini - points to network resources and Revit.loc - points to local resources. Both these files are copied to "C:\Program Files\Revit Architecture 2009\Program". The script checks for a network file. If it finds it, (= network is available) then Revit launches with REVIT.INI. If the script does not find the network, then it renames REVIT.INI to REVIT.NET and then renames REVIT.LOC to REVIT.INI and opens Revit.  While in the business of swapping INI files, we also run a BATCH file whenever Revit is launched. Currently this batch file is empty, but we could add commands as and when we need them!

Currently, when an user opens a RVT file directly from Windows explorer, the startup script for Revit does NOT run. We have not YET gone that far to link the RVT extension, etc to go through the batch file, but encourage users to open Revit first and then open the project within Revit. Here is the sample batch file, please use it at your own risk.

**********************

@echo off
if not exist "Z:\REVIT\Support\RAC2009Start.bat" goto RevitnoNet

:RevitNet
call Z:\REVIT\Support\RAC2009Start.bat
if exist "C:\Program Files\Revit Architecture 2009\Program\Revit.loc" goto Revit
rename "C:\Program Files\Revit Architecture 2009\Program\Revit.ini" Revit.loc
rename "C:\Program Files\Revit Architecture 2009\Program\Revit.net" Revit.ini
goto Revit

:RevitnoNet
@echo off
cls
@echo.
@echo.
@echo.
@echo.
@echo Please wait... Network connection is NOT detected...
@echo.
@echo.
@echo Please open 'Windows Explorer' to check if Z drive is present.
@echo.
@echo.
@echo If you are working on a laptop and off the network then,
@echo.
@echo.
pause
if not exist "Z:\REVIT\Support\RAC2009Start.bat" goto Revitlocal
goto RevitNet

:Revitlocal
if exist "C:\Program Files\Revit Architecture 2009\Program\Revit.net" goto Revit
rename "C:\Program Files\Revit Architecture 2009\Program\Revit.ini" Revit.net
rename "C:\Program Files\Revit Architecture 2009\Program\Revit.loc" Revit.ini
goto Revit

:Revit
rem sTART REVIT
"C:\Program Files\Revit Architecture 2009\Program\Revit.exe.lnk" %1
exit

**********************

1 comment:

Prashi said...

Hello,
I know we can convert(using export option) Revit (*.rvt) file to AutoCAD (*.dwg) file one at a time, Like i have
mentioned below
File > Export > CAD Formats
a dialog box pops up where we can select place to save the CAD file in required format..
i.e., in save as option, i was selecting *.dwg & i use to select wire frame.
Since i have to convert more number of files, I request you to provide any scripts for the above mentioned repetitive process to get automated.
Any help is appreciated
Sorry, If it is not right place to ask help

Thanking You
Prashanth