Skip to content

Commit 9410857

Browse files
author
Jeremy Tammik
committed
replaced TransactionMode.Automatic by ReadOnly in CmdLibraryPaths
1 parent 26e7c1c commit 9410857

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

BuildingCoder/BuildingCoder/CmdLibraryPaths.cs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
namespace BuildingCoder
2222
{
23-
[Transaction( TransactionMode.Automatic )]
23+
[Transaction( TransactionMode.ReadOnly )]
2424
class CmdLibraryPaths : IExternalCommand
2525
{
2626
//void PrintMap( StringStringMap map, string description ) // 2011
@@ -53,10 +53,18 @@ public Result Execute(
5353
PrintMap( map, "Initial application options library paths" );
5454

5555
string key = "ImperialTestCreate";
56-
string value = @"C:\Documents and Settings\All Users\Application Data\Autodesk\RAC 2010\Imperial Library\Detail Components";
56+
//string value = @"C:\Documents and Settings\All Users\Application Data\Autodesk\RAC 2010\Imperial Library\Detail Components"; // 2010
57+
string value = @"C:\ProgramData\Autodesk\RAC 2015\Libraries\Imperial Library\Detail Components"; // 2015
5758

58-
//map.Insert( key, value ); // 2011
59-
map.Add( key, value ); // 2012
59+
if( map.ContainsKey( key ) )
60+
{
61+
map[key] = value;
62+
}
63+
else
64+
{
65+
//map.Insert( key, value ); // 2011
66+
map.Add( key, value ); // 2012
67+
}
6068

6169
PrintMap( map, "After adding 'ImperialTestCreate' key" );
6270

@@ -73,6 +81,11 @@ public Result Execute(
7381
//app.LibraryPaths = map; // 2011
7482
app.SetLibraryPaths( map ); // 2012
7583

84+
Debug.Print( "You might want to clean up your "
85+
+ "library paths manually via Revit > Options "
86+
+ "> File Locations > Places... after running "
87+
+ "this command..." );
88+
7689
return Result.Succeeded;
7790
}
7891
}

0 commit comments

Comments
 (0)