Giter VIP home page Giter VIP 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.
  • Gist link downloads the content and compiles each file.

Compiler Limitations

Revit 2017 to 2020 the 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)

Revit 2021 to 2024 the CodeDom.Compiler uses the Roslyn version compiler. The Roslyn compiler is a new compiler that supports C# version 6 and above.

Revit 2025+ the CodeDom.Compiler uses the Microsoft.CodeAnalysis.CSharp to work with NET Core.

The RevitAddin.CommandLoader.Tests have some tests to make sure the compiler works in Net Framework and Net Core.

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

The command below show the version of Revit in a MessageBox.

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;
        }
    }
}

Gist Example

The RevitAddin.CommandLoader have the feature to download gist files from GitHub and compile the IExternalCommand with the gist file.

Just copy the gist link in the RevitAddin.CommandLoader compiler and execute.

Resources

Installation

Video

Videos in Portuguese with the creation of this project.

VideoIma1

Videos in English about this project.

VideoIma2 VideoIma3 VideoIma4

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

jeremytammik avatar ricaun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  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.