Several steps need to be taken when installing a .NET Connection add-in for Revit.
The following files should be installed under the Steel Connections add-in program folder, which is under the AddIns folder in the Revit installation folder.
The sample code below is from a Windows console application. It will find the Revit 2022 install location and add the relative path to the SteelConnections folder under AddIns, then write the path to a text file in the same location as the executing assembly.
|
Code Region: Find the Revit install location for Steel Connections |
using Autodesk.RevitAddIns;
using System.Collections.Generic;
namespace GetInstallFolder
{
public class Program
{
static void Main(string[] args)
{
IList<RevitProduct> revitProducts = RevitProductUtility.GetAllInstalledRevitProducts();
foreach (RevitProduct revitProduct in revitProducts)
{
if (revitProduct.Product == ProductType.Revit &&
revitProduct.Version == RevitVersion.Revit2017)
{
string newDir = revitProduct.InstallLocation + "AddIns\\SteelConnections";
string ExecutingAssemblyPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
string directory = System.IO.Path.GetDirectoryName(ExecutingAssemblyPath);
string file = directory + "\\InstallLoc.txt";
System.IO.File.WriteAllText(file, newDir);
}
}
}
}
}
|
As discussed in previous sections, the AstorRules database and SteelConnectionsData.xml file needs to be updated for each country supported by the Steel Connections add-in for Revit.
In the SteelConnections install location found above, there is an ASSettings_Advance.xml file. This file contains the path to the location of the language folders which contain the SteelConnectionsData.xml and AstorRules database files which need to be edited. The DataPath contains the relevant path. The default is C:\ProgramData\Autodesk\Revit Steel Connections 2022.