diff --git a/BcSamples.txt b/BcSamples.txt index 9e222e26..3b51a77c 100644 --- a/BcSamples.txt +++ b/BcSamples.txt @@ -947,3 +947,11 @@ Image: C:\a\lib\revit\2015\bc\BuildingCoder\BuildingCoder\bin\Debug\BuildingCoder.dll BuildingCoder.CmdViewsShowingElements # version 2015.0.110.0 +ADN Bc A-I +Document Version +List DocumentVersion data, i.e. document GUID and save count +LargeImage: +Image: +C:\a\lib\revit\2015\bc\BuildingCoder\BuildingCoder\bin\Debug\BuildingCoder.dll +BuildingCoder.CmdDocumentVersion # version 2015.0.110.0 + diff --git a/BuildingCoder/BuildingCoder/BuildingCoder.csproj b/BuildingCoder/BuildingCoder/BuildingCoder.csproj index c5a52d8e..fa8606ef 100644 --- a/BuildingCoder/BuildingCoder/BuildingCoder.csproj +++ b/BuildingCoder/BuildingCoder/BuildingCoder.csproj @@ -110,6 +110,7 @@ + diff --git a/BuildingCoder/BuildingCoder/CmdDocumentVersion.cs b/BuildingCoder/BuildingCoder/CmdDocumentVersion.cs new file mode 100644 index 00000000..2ee86794 --- /dev/null +++ b/BuildingCoder/BuildingCoder/CmdDocumentVersion.cs @@ -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; + } + } +} diff --git a/BuildingCoder/BuildingCoder/Properties/AssemblyInfo.cs b/BuildingCoder/BuildingCoder/Properties/AssemblyInfo.cs index 4603e33c..164010ac 100644 --- a/BuildingCoder/BuildingCoder/Properties/AssemblyInfo.cs +++ b/BuildingCoder/BuildingCoder/Properties/AssemblyInfo.cs @@ -37,6 +37,7 @@ // 2014-07-21 2015.0.110.1 AddFaceBasedFamilyToLinks // 2014-08-19 2015.0.110.2 removed obsolete API usage: reduced warning count from 71 to 67 // 2014-08-20 2015.0.110.3 added code in CmdUnrotateNorth to determine angle to north from project base point +// 2014-08-20 2015.0.111.0 implemented CmdDocumentVersion // -[assembly: AssemblyVersion( "2015.0.110.3" )] -[assembly: AssemblyFileVersion( "2015.0.110.3" )] +[assembly: AssemblyVersion( "2015.0.111.0" )] +[assembly: AssemblyFileVersion( "2015.0.111.0" )]