Git Product home page Git Product logo

revitaddin.commandloader's Introduction

RevitAddin.CommandLoader

Revit 2017 Visual Studio 2022 Nuke License MIT Build

CommandLoader

RevitAddin.CommandLoader project compiles IExternalCommand with Revit open using CodeDom.Compiler and creates a PushButton on the Revit ribbon.

This project was generated by the AppLoader Revit plugin.

Features

  • Compile multiple IExternalCommand at once with Revit opened.
  • Generate PushButton with the compiled IExternalCommand with IExternalCommandAvailability.
  • AutoUpdate plugin using ricaun.Revit.Github.

Limitations

In Revit 2021+ the CodeDom.Compiler uses the (Roslyn)[https://github.com/aspnet/RoslynCodeDomProvider] version compiler. The Roslyn compiler is a new compiler that supports C# version 6 and above.

CodeDom.Compiler only work with C# compiler version v4.0 maximum, the following features do not work in C# version 4.

  • Async Features (C# version 5)
  • String interpolation (C# version 6)

Customize IExternalCommand

Using System.ComponentModel attributes is possible to customize the IExternalCommand that is generated in the Revit ribbon.

  • DisplayNameAttribute: Set the Text in the PushButton.
  • DescriptionAttribute: Set the Tooltip in the PushButton.
  • DesignerAttribute: Set the LargeImage in the PushButton. (Works with component, URL, and base64)

If IExternalCommandAvailability is added in the same IExternalCommand class the availability gonna be applied in the PushButton.

Example

using System;
using System.ComponentModel;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace RevitAddin
{
    [DisplayName("Revit\rVersion")]
    [Description("Show a Window with the Revit VersionName.")]
    [Designer("/UIFrameworkRes;component/ribbon/images/revit.ico")]
    [Transaction(TransactionMode.Manual)]
    public class Command : IExternalCommand, IExternalCommandAvailability
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
        {
            UIApplication uiapp = commandData.Application;
            System.Windows.MessageBox.Show(uiapp.Application.VersionName);
            return Result.Succeeded;
        }
        public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
        {
            return true;
        }
    }
}

Resources

Installation

Video

Videos in portuguese with the creation of this project.

VideoIma1

License

This project is licensed under the MIT Licence.


Do you like this project? Please star this project on GitHub!

revitaddin.commandloader's People

Contributors

ricaun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.