Skip to content

Commit

Permalink
Merge pull request #17 from ricaun-io/develop
Browse files Browse the repository at this point in the history
Version 0.1.2
  • Loading branch information
ricaun authored May 17, 2022
2 parents 15a6c7a + e68f217 commit 2a9e36b
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.1.2] / 2022-05-17
### Added
- Add `IExternalCommandAvailability` on `NewPushButtonData` Command

## [0.1.1] / 2022-05-07
### Features
- IsLanguageExtension for each Language
Expand Down
2 changes: 1 addition & 1 deletion ricaun.Revit.UI.Example/Revit/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public Result OnStartup(UIControlledApplication application)
{
ribbonPanel = application.CreatePanel(TabName, PanelName);

ribbonPanel.AddPushButton<Commands.Command<Enum>>("Revit")
ribbonPanel.AddPushButton<Commands.CommandWithAvailability>("Revit")
.SetLargeImage("/UIFrameworkRes;component/ribbon/images/revit.ico");

var button = ribbonPanel.AddPushButton<Commands.Command>();
Expand Down
20 changes: 20 additions & 0 deletions ricaun.Revit.UI.Example/Revit/Commands/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,24 @@ public Result Execute(ExternalCommandData commandData, ref string message, Eleme
return Result.Succeeded;
}
}


[Transaction(TransactionMode.Manual)]
public class CommandWithAvailability : IExternalCommand, IExternalCommandAvailability
{
private static bool available = true;

public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
{
UIApplication uiapp = commandData.Application;
available = false;
return Result.Succeeded;
}

public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
{
return available;
}
}

}
2 changes: 1 addition & 1 deletion ricaun.Revit.UI.Example/ricaun.Revit.UI.Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

<PropertyGroup>
<PackageId>ricaun.Revit.UI.Example</PackageId>
<Version>1.1.1</Version>
<Version>1.1.2</Version>
<ProjectGuid>{f736f68f-7101-4640-9093-8715f88ccb95}</ProjectGuid>
</PropertyGroup>

Expand Down
3 changes: 3 additions & 0 deletions ricaun.Revit.UI/RibbonButtonExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public static PushButtonData NewPushButtonData(this RibbonPanel ribbonPanel, Typ

PushButtonData currentBtn = new PushButtonData(targetName, targetText, assemblyName, className);

if (typeof(IExternalCommandAvailability).IsAssignableFrom(commandType))
currentBtn.AvailabilityClassName = commandType.FullName;

if (text == "") currentBtn.Text = "-";

return currentBtn;
Expand Down
2 changes: 1 addition & 1 deletion ricaun.Revit.UI/ricaun.Revit.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

<PropertyGroup>
<PackageId>ricaun.Revit.UI</PackageId>
<Version>0.1.1</Version>
<Version>0.1.2</Version>
<ProjectGuid>{2064ba4d-5527-41e9-8b76-0cbfefa35900}</ProjectGuid>
</PropertyGroup>

Expand Down

0 comments on commit 2a9e36b

Please sign in to comment.