Tuesday, April 26, 2011

Revit 2012 Network Deployment Issues

With the release of the Revit 2012 platform, the first issue I found was with network deployments. The issues I found were that there is no method to define the Default Project Template. After installing the Deploy, the New Project Template it points to is 'Default.rte'. There is also not a method for altering the various library locations.

A few emails to the factory and I was provided with the following information. This is procedure is definitely a work-around and hopefully the actual network deployment is corrected soon.


Customizing Revit.ini
Rick Foster
4.22.2011

The Document

Revit.ini is created at install time using data from an xml document. By modifying that document you can distribute customizations with your deployment.
Identical copies of this document are potentially located in four places in your admin image:
\x86\RAC2013\inifile.xml
\x86\RAC2013\Program Files\Autodesk\Root\Program\Setup\Cache\inifile.xml
\x64\RAC2013\inifile.xml
\x64\RAC2013\Program Files\Autodesk\Root\Program\Setup\Cache\inifile.xml
You probably only have two of the copies in your admin image, either x86 or x64. That is fine.
Copy one of these locally and open it up. You'll notice that inifile.xml updates more than just revit.ini. Ignore the other ini files - those are mine.
It should be apparent what's going on. The elements are structured File->Section->Data. Knowing this you are ready to do some easy tasks. You can:
·       Change a value by updating an existing Data element
·       Add a key to a section by creating a Data element
·       Add a section to an ini file by creating a Section element
Example - Pointing to a custom Family Templates path
1.     Locate this Data element:
File Name="Revit.ini"
  Section Name="Directories"
    Data Key="FamilyTemplatePath"
2.     Set the text of that element to your custom Family Templates location.
Ok, I sense a few of you have already started searching for DefaultTemplate and encountered some oddities, like Product attributes and Condition elements, and that the values are set to bracketed properties. Not to mention that there’s a bunch of DefaultTemplate elements. Well, it’s about to get interesting.
Product
Ties a setting to a specific product
Condition
Evaluated as a Window Installer condition – beyond the scope of this document
[PROPERTY]
Windows Installer property. These properties are the internal state of the install
The Short Story:
You can delete all of those DefaultTemplate elements except for one. Remove the Product attribute and Condition element and set the value to wherever your template resides.
The Long Story:
Inifile.xml serves all Revit products, which the Product attributes reflect. Additionally, each product serves multiple disciplines. In order to point the DefaultTemplate to the correct file we created multiple DefaultTemplate elements tied to specific products, each with a condition that further binds it to the discipline selected at install time.
Whether you find that confusing or empowering will be determined by how well I communicate the next topic.

Using Properties in Revit.ini

Properties are the variables passed around in the install. Inifile.xml uses them to respond to user selections. Content Packs use them as well, and even have the ability to set them. Additionally, there is syntax for reading environment variables. Here is how you can leverage both.

Environment Variables

You can use environment variables in inifile.xml by using the syntax [%ENVVAR]. Danny, please test: The practical upshot: You can create a script to call setup.exe. If you set environment variable before doing so then those variables can be used in inifile.xml.
This is quite powerful, and may be all that you need for your customizations. But wait, there’s more…

Custom Content Packs

Revit distributes content using the Content Pack framework. Check out the sample below. Content Packs have an ApplicationDefaults section for setting properties. You can create your own Content Pack and add it to a deployment (or install). The install will process it and set the properties for you. The sample will set YOURCUSTOMPROPERTY to Your Custom Value. You can now use that in inifile.xml by referring to [YOURCUSTOMPROPERTY].
Add this custom Content Pack to your deployment by clicking the Add Content button in the Revit panel on the Select Products page. Then ensure that your Content Pack is selected in the Default Content combobox.
Is that useful? It may be if you have one admin image supporting multiple deployments. Each deployment can integrate a different custom Content Pack to set unique properties for inifile.xml to use. Or you could even use the stock inifile.xml and just create a Content Pack to manipulate the properties that you are interested in.

The End

That’s it. The power to greatly complicate a deployment is now yours. Enjoy!

Supplemental information

Editing XML documents

XML documents are highly structured. If you goof this one up then none of the ini files it defines will be created. Fortunately inifile.xml has a DTD, which is a formatting definition that instructs validation tools on how to check the consistency of a document. To operate on inifile.xml with confidence do one of two things.
·       Use an XML editor. Google up a free one. It will highlight your mistakes. (witticism placeholder)
·       If you don’t use an xml editor, but prefer Notepad or some such, validate your efforts here.

Custom Content Pack sample

Cut and paste the following into a blank xml file. Be sure to change Identification->ContentPackId and Identification->Name. The document.xsd referred to in the second line is a schema that will help you edit and validate this xml document. You can find it on the disk in Content/Revit/en.
xml version="1.0" encoding="utf-16"?>
<DocumentRoot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="document.xsd">
  <Identification>
    <ContentPackId>TemplateCPContentPackId>
    <Name>Content Pack template for custom settingsName>
  Identification>
  <ApplicationDefaults>
    <Property Name="RVT_PATH_LIBRARIES" Value="\\Server\Share\Custom Libraries"/>
    <Property Name="RVT_DEFAULTTEMPLATE_ARCHITECTURAL" Value="[C_TEMPLATES]\Custom Templates\default.rte" />
    <Property Name="RVT_DEFAULTTEMPLATE_CONSTRUCTION" Value="[C_TEMPLATES]\Custom Templates\Construction-Default.rte" />
    <Property Name="RVT_FAMILYTEMPLATEPATH" Value="[C_FAMTEM]" />
    <Property Name="YOURCUSTOMPROPERTY" Value="Your Custom Value" />
  ApplicationDefaults>
DocumentRoot>

No comments:

Is anyone using Deep Space for analytics? https://www.deepspacesync.com/