Skip to content

Commit

Permalink
implemented CmdDocumentVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Tammik committed Aug 20, 2014
1 parent b9199e5 commit aeccae6
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 2 deletions.
8 changes: 8 additions & 0 deletions BcSamples.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

1 change: 1 addition & 0 deletions BuildingCoder/BuildingCoder/BuildingCoder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
<Compile Include="CmdDimensionWallsFindRefs.cs" />
<Compile Include="CmdDimensionWallsIterateFaces.cs" />
<Compile Include="CmdDisallowJoin.cs" />
<Compile Include="CmdDocumentVersion.cs" />
<Compile Include="CmdDuplicateElements.cs" />
<Compile Include="CmdDutAbbreviation.cs" />
<Compile Include="CmdEllipticalArc.cs" />
Expand Down
51 changes: 51 additions & 0 deletions BuildingCoder/BuildingCoder/CmdDocumentVersion.cs
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;
}
}
}
5 changes: 3 additions & 2 deletions BuildingCoder/BuildingCoder/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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" )]

0 comments on commit aeccae6

Please sign in to comment.