-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jeremy Tammik
committed
Aug 20, 2014
1 parent
b9199e5
commit aeccae6
Showing
4 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#region Header | ||
// | ||
// CmdDocumentVersion.cs - list DocumentVersion data, i.e. document GUID and save count | ||
// | ||
// Copyright (C) 2014 by Jeremy Tammik, | ||
// Autodesk Inc. All rights reserved. | ||
// | ||
#endregion // Header | ||
|
||
#region Namespaces | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Autodesk.Revit.ApplicationServices; | ||
using Autodesk.Revit.Attributes; | ||
using Autodesk.Revit.DB; | ||
using Autodesk.Revit.UI; | ||
#endregion // Namespaces | ||
|
||
namespace BuildingCoder | ||
{ | ||
[Transaction( TransactionMode.ReadOnly )] | ||
class CmdDocumentVersion : IExternalCommand | ||
{ | ||
public Result Execute( | ||
ExternalCommandData revit, | ||
ref string message, | ||
ElementSet elements ) | ||
{ | ||
UIApplication uiapp = revit.Application; | ||
UIDocument uidoc = uiapp.ActiveUIDocument; | ||
Document doc = uidoc.Document; | ||
|
||
string path = doc.PathName; | ||
|
||
BasicFileInfo info = BasicFileInfo.Extract( | ||
path ); | ||
|
||
DocumentVersion v = info.GetDocumentVersion(); | ||
|
||
int n = v.NumberOfSaves; | ||
|
||
Util.InfoMsg( string.Format( | ||
"Document '{0}' has GUID {1} and {2} save{3}.", | ||
path, v.VersionGUID, n, | ||
Util.PluralSuffix( n ) ) ); | ||
|
||
return Result.Succeeded; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters