### Install RxBim Project Templates Source: https://github.com/reactivebim/rxbim/wiki/Getting-Started Installs the RxBim templates pack, which provides project templates for creating external applications and commands for CAD/BIM software. This command allows you to use `dotnet new` with RxBim-specific project types. ```bash dotnet new --install RxBim.Templates ``` -------------------------------- ### Create New Solution with dotnet new sln Source: https://github.com/reactivebim/rxbim/wiki/Getting-Started Initializes a new solution file using the .NET CLI. This command creates an empty solution that can later host multiple projects. ```bash dotnet new sln ``` -------------------------------- ### Create New Project using RxBim Templates Source: https://github.com/reactivebim/rxbim/wiki/Getting-Started Creates a new project for either an application or a command, specifically tailored for Revit or AutoCAD. These commands utilize the installed RxBim templates to scaffold new projects. ```bash dotnet new rvtapp dotnet new rvtcmd dotnet new acadapp dotnet new acadcmd ``` -------------------------------- ### Create Revit Application with RxBim Source: https://github.com/reactivebim/rxbim/wiki/Manual-bootstraping This snippet demonstrates how to create a basic Revit application using RxBim. It requires installing RxBim.Application.Revit and RxBim.Di.SimpleInjector packages. The application class must inherit from RxBimApplication and implement Start() and Shutdown() methods. ```csharp using RxBim.Application.Revit; using RxBim.Shared; public class MyApp : RxBimApplication { public PluginResult Start() { TaskDialog.Show("MyApp", "App Started"); return PluginResult.Succeeded; } public PluginResult Shutdown() { TaskDialog.Show("MyApp", "App finished"); return PluginResult.Succeeded; } } ``` -------------------------------- ### C# Revit Integration Test with DI Container Setup Source: https://github.com/reactivebim/rxbim/wiki/Testing Demonstrates how to write integration tests for Revit using C# and NUnit. It shows the setup of a DI container with mocked configurations using `TestingDiConfigurator` and `RevitTestFramework`, and includes an example test case for setting a comment on a Revit wall element. ```csharp [TestFixture] public class Tests { private IContainer _container; [SetUp] public void Setup() { var testingDiConfigurator = new TestingDiConfigurator(RevitTestExecutive.CommandData); testingDiConfigurator.Configure( Assembly .GetExecutingAssembly()); // if you are using mocked configuration from current tests assembly. // You should understand that you must add all dependencies // in the test configuration /* or use: testingDiConfigurator.Configure(typeof(ITestService).Assembly); if you are using real configuration from the application. */ _container = testingDiConfigurator.Container; } [Test] [TestModel("./model.rvt")] public void CommentShouldBeSetAndNotThrowsException() { var testService = _container.GetService(); var element = new FilteredElementCollector(_container.GetService()) .WhereElementIsNotElementType() .OfClass(typeof(Wall)) .FirstOrDefault(); Assert.NotNull(element, "element != null"); Assert.DoesNotThrow(() => testService.SetComment(element)); var comment = element.get_Parameter(BuiltInParameter.ALL_MODEL_TYPE_COMMENTS) .AsValueString(); Assert.NotNull(comment, "comment != null"); Assert.IsNotEmpty(comment); } } ``` -------------------------------- ### Initialize Nuke.Build Project and Add RxBim Package Source: https://github.com/reactivebim/rxbim/wiki/Getting-Started Initializes a new build project using Nuke.Build and adds the necessary RxBim package for Revit or AutoCAD integration. This step sets up build automation for your project. ```bash nuke dotnet add package RxBim.Nuke.Revit ``` -------------------------------- ### Install RxBim Revit Package Source: https://github.com/reactivebim/rxbim/wiki/UI-integration Command to install the RxBim package for Autodesk Revit using the .NET CLI. This allows for the creation of custom ribbon elements within Revit. ```bash dotnet add package RxBim.Application.Ribbon.Revit ``` -------------------------------- ### Install RxBim Autocad Package Source: https://github.com/reactivebim/rxbim/wiki/UI-integration Command to install the RxBim package for Autodesk Autocad using the .NET CLI. This enables custom ribbon elements within Autocad. ```bash dotnet add package RxBim.Application.Ribbon.Autocad ``` -------------------------------- ### Define RxBim Ribbon UI with JSON Source: https://github.com/reactivebim/rxbim/wiki/UI-integration JSON configuration file example for defining the RxBim ribbon interface. This includes setting up tabs, panels, and individual command items with properties like text, images, and descriptions. ```json { "Ribbon": { "DisplayVersion": true, "VersionPrefix": "Version: ", "Tabs": [ { "Name": "RxBim_Tab_FromConfig", "Panels": [ { "Name": "RxBim_Panel_1", "Items": [ { "Name": "Command1_Large_WithText", "CommandType": "RxBim.Application.Menu.Config.Revit.Sample.Commands.Cmd1", "HelpUrl": "https://github.com/ReactiveBIM/RxBim", "Text": "Command\n#1", "Description": "Description: This is command #1", "ToolTip": "Tooltip: I'm run command #1. Push me!", "LargeImage": "img\num1_32.png" }, { "LayoutElementType": "Separator" }, { "Name": "Pulldown", "Text": "Pulldown", "LargeImage": "img\command_32.png", "CommandButtonsList": [ { "Name": "Command1_Pulldown", "CommandType": "RxBim.Application.Menu.Config.Revit.Sample.Commands.Cmd1", "HelpUrl": "https://github.com/ReactiveBIM/RxBim", "Text": "Command\n#1", "Description": "Description: This is command #1", "ToolTip": "Tooltip: I'm run command #1. Push me!", "LargeImage": "img\num1_32.png" }, { "Name": "Command2_Pulldown", "CommandType": "RxBim.Application.Menu.Config.Revit.Sample.Commands.Cmd2", "HelpUrl": "https://github.com/ReactiveBIM/RxBim", "Text": "Command\n#2", "Description": "Description: This is command #2", "ToolTip": "Tooltip: I'm run command #2. Push me!", "LargeImage": "img\num2_32.png" }, { "Name": "Command3_Pulldown", "CommandType": "RxBim.Application.Menu.Config.Revit.Sample.Commands.Cmd3", "HelpUrl": "https://www.autodesk.com/", "Text": "Command\n#3", "Description": "Description: This is command #3", "ToolTip": "Tooltip: I'm run command #3. Push me!", "LargeImage": "img\num3_32.png" } ] } ] }, { "Name": "RxBim_Panel_2", "Items": [ { "Items": [ { "Name": "Command1_Stacked3", "HelpUrl": "https://github.com/ReactiveBIM/RxBim", "CommandType": "RxBim.Application.Menu.Config.Revit.Sample.Commands.Cmd1", "Text": "Command #1", "Description": "Description: This is command #1", "ToolTip": "Tooltip: I'm run command #1. Push me!", "SmallImage": "img\num1_16.png" }, { "Name": "Command2_Stacked3", "HelpUrl": "https://github.com/ReactiveBIM/RxBim", "CommandType": "RxBim.Application.Menu.Config.Revit.Sample.Commands.Cmd2", "Text": "Command #2", "Description": "Description: This is command #2", "ToolTip": "Tooltip: I'm run command #2. Push me!", "SmallImage": "img\num2_16.png" }, { "Name": "Command3_Stacked3", "HelpUrl": "https://github.com/ReactiveBIM/RxBim", "CommandType": "RxBim.Application.Menu.Config.Revit.Sample.Commands.Cmd3", "Text": "Command #3", "Description": "Description: This is command #3", "ToolTip": "Tooltip: I'm run command #3. Push me!", "SmallImage": "img\num3_16.png" } ] } ] } ] } ] } } ``` -------------------------------- ### Create Revit Command Project using dotnet CLI Source: https://github.com/reactivebim/rxbim/wiki/Templates Creates a new project for a ReactiveBIM command specifically for Revit. This command requires the RxBim.Templates to be installed. ```bash dotnet new rvtcmd ``` -------------------------------- ### Inject Service into RxBimApplication Start Method (C#) Source: https://github.com/reactivebim/rxbim/wiki/Dependecy-injection Demonstrates injecting a Document object into the Start method of an RxBimApplication. This allows access to the current document within the application's startup logic. Requires the RxBim framework. ```csharp public class MyApp : RxBimApplication { public PluginResult Start(Document doc) { TaskDialog.Show("MyApp", doc.Title); return PluginResult.Succeeded; } public PluginResult Shutdown(ISomeService service) { TaskDialog.Show("MyApp", service.SayGoodBye()); return PluginResult.Succeeded; } } ``` -------------------------------- ### Create Autocad Application with RxBim Source: https://github.com/reactivebim/rxbim/wiki/Manual-bootstraping This snippet illustrates the creation of an Autocad application using RxBim. It requires the RxBim.Application.Autocad and RxBim.Di.SimpleInjector packages. The application class must inherit from RxBimApplication and implement Start() and Shutdown() methods, with an ExtensionApplication attribute. ```csharp using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices.Core; using RxBim.Application.Autocad; using RxBim.Shared; [assembly: ExtensionApplication(typeof(MyApp))] public class MyApp : RxBimApplication { public PluginResult Start() { Application.ShowAlertDialog($"{GetType().FullName} started!"); return PluginResult.Succeeded; } public PluginResult Shutdown() { Application.ShowAlertDialog($"{GetType().FullName} finished!"); return PluginResult.Succeeded; } } ``` -------------------------------- ### Create Revit Application Project using dotnet CLI Source: https://github.com/reactivebim/rxbim/wiki/Templates Creates a new project for a ReactiveBIM external application specifically for Revit. This command requires the RxBim.Templates to be installed. ```bash dotnet new rvtapp ``` -------------------------------- ### Create Autocad Command Project using dotnet CLI Source: https://github.com/reactivebim/rxbim/wiki/Templates Creates a new project for a ReactiveBIM command specifically for Autocad. This command requires the RxBim.Templates to be installed. ```bash dotnet new acadcmd ``` -------------------------------- ### Transactional Method Implementation (Revit Example) Source: https://github.com/reactivebim/rxbim/wiki/Transactions This code illustrates the underlying implementation generated by the RxBim Transactions Framework for a transactional method in Autodesk Revit. It manually creates, starts, commits, or rolls back a Revit `Transaction` using a `using` statement. ```csharp public class TestService : ITestService { private Document _doc; public TestService(Document doc) { _doc = doc; } public void SetComment(Element element) { using var t = new Transaction(_doc); try { t.Start("Test"); var parameter = element.get_Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS); parameter?.Set("blah-blah-blah"); t.Commit(); } catch { t.Rollback(); throw; } } } ``` -------------------------------- ### C# Revit Test Execution with Nuke.Build Wrapper Source: https://github.com/reactivebim/rxbim/wiki/Testing Provides an example of using the `RxBim.Nuke.Revit` package to run Revit integration tests. This C# snippet demonstrates configuring the `RevitTestTasks.RevitTest` wrapper with settings such as the path to Revit, output directory, and assembly path. ```csharp using RxBim.Nuke.Revit; ... RevitTestTasks.RevitTest(settings => settings .SetRevit("path to revit.exe") .SetResults(results) .SetDir(outputDirectory) .SetProcessWorkingDirectory(outputDirectory) .EnableContinuous() .SetAssembly(assemblyPath)); ``` -------------------------------- ### Run Nuke Build Targets Source: https://github.com/reactivebim/rxbim/wiki/Nuke Example command to execute a specific target within the Nuke build system. Replace '' with the desired target, such as 'compile' or 'publish'. ```bash nuke ``` -------------------------------- ### Install RxBim Nuke Revit Package Source: https://github.com/reactivebim/rxbim/wiki/Nuke Command to install the RxBim Nuke Revit package using .NET CLI. This package is required for automating builds for Autodesk Revit plugins. ```bash dotnet add package RxBim.Nuke.Revit ``` -------------------------------- ### Create Revit Command with RxBim Source: https://github.com/reactivebim/rxbim/wiki/Manual-bootstraping This snippet shows how to create a custom command for Revit using RxBim. It involves installing RxBim.Command.Revit and RxBim.Di.SimpleInjector. The command class should inherit from RxBimCommand and implement the ExecuteCommand() method. ```csharp using Autodesk.Revit.Attributes; using Autodesk.Revit.UI; using RxBim.Command.Revit; using RxBim.Shared; [Transaction(TransactionMode.Manual)] public class MyCmd : RxBimCommand { public PluginResult ExecuteCommand() { TaskDialog.Show("MyCmd", "Hello Revit!!!"); return PluginResult.Succeeded; } } ``` -------------------------------- ### Create Autocad Application Project using dotnet CLI Source: https://github.com/reactivebim/rxbim/wiki/Templates Creates a new project for a ReactiveBIM external application specifically for Autocad. This command requires the RxBim.Templates to be installed. ```bash dotnet new acadapp ``` -------------------------------- ### Install RxBim Nuke Autocad Package Source: https://github.com/reactivebim/rxbim/wiki/Nuke Command to install the RxBim Nuke Autocad package using .NET CLI. This package is necessary for automating builds for Autodesk Autocad plugins. ```bash dotnet add package RxBim.Nuke.Autocad ``` -------------------------------- ### Set up NUnit Test Project for Revit Integration Tests Source: https://github.com/reactivebim/rxbim/wiki/Testing This snippet outlines the steps to create a new NUnit test project for Revit integration testing. It includes installing necessary NuGet packages like RevitTestFramework and RxBim.Di.SimpleInjector, and configuring the project to copy a Revit model to the output directory for use in tests. ```xml PreserveNewest ``` -------------------------------- ### Create Autocad Command with RxBim Source: https://github.com/reactivebim/rxbim/wiki/Manual-bootstraping This snippet demonstrates how to create a custom command for Autocad using RxBim. Install RxBim.Command.Autocad and RxBim.Di.SimpleInjector. The command class should inherit from RxBimCommand and implement the ExecuteCommand() method, optionally using the RxBimCommandClass attribute. ```csharp using Autodesk.AutoCAD.ApplicationServices.Core; using RxBim.Command.Autocad; using RxBim.Shared; [RxBimCommandClass("MyCmd")] public class MyCmd : RxBimCommand { public PluginResult ExecuteCommand() { Application.ShowAlertDialog("Hello Autocad!!!"); return PluginResult.Succeeded; } } ``` -------------------------------- ### Configure RxBim Transactions for Revit/Autocad Source: https://github.com/reactivebim/rxbim/wiki/Transactions This snippet shows how to configure the RxBim Transactions package within a plugin's container setup for either Autodesk Revit or Autodesk Autocad. It requires the RxBim.Transactions.Revit or RxBim.Transactions.Autocad NuGet package and the `AddTransactions()` extension method. ```csharp public class TestConfig : ICommandConfiguration { public void Configure(IContainer container) { container.AddTransactions(); } } ``` -------------------------------- ### Apply Transactional Attribute to Revit Method Source: https://github.com/reactivebim/rxbim/wiki/Transactions Demonstrates how to mark a method for transactional execution in Autodesk Revit using the `[Transactional]` attribute. The `TransactionName` parameter can be set to specify the transaction name; otherwise, the method's name is used. This example sets a comment on a Revit element. ```csharp public class TestService : ITestService { [Transactional(TransactionName = "Test")] public void SetComment(Element element) { var parameter = element.get_Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS); parameter?.Set("blah-blah-blah"); } } ``` -------------------------------- ### Add Configuration Extension Method Source: https://github.com/reactivebim/rxbim/wiki/Configuration An extension method to register additional configuration sources with the DI container. This allows for custom configuration providers beyond the default settings. ```csharp public static class ConfigurationExtensions { public static void AddConfiguration(this IContainer container) { // Implementation to add custom configuration providers } } ``` -------------------------------- ### Configure DI Container with RxBim Logging (C#) Source: https://github.com/reactivebim/rxbim/wiki/Logs Demonstrates how to add the RxBim logging service to the dependency injection container using the AddLogs() extension method. This makes the ILogger available for injection in other services. Requires the RxBim.Logs.Revit or RxBim.Logs.Autocad package. ```csharp using RxBim.Di; using RxBim.Logs; public class Config : IApplicationConfiguration { public void Configure(IContainer container) { container.AddLogs(); } } ``` -------------------------------- ### Configure Revit Menu with Fluent API in C# Source: https://github.com/reactivebim/rxbim/wiki/UI-integration This C# code snippet demonstrates how to configure a Revit application's menu using the RxBim fluent API. It shows how to add a ribbon tab with panels and various button types (CommandButton, PullDownButton, StackedItems, SlideOut). This configuration is typically done within the plugin's application configuration class. ```csharp public class Config : IApplicationConfiguration { public void Configure(IContainer container) { container.AddRevitMenu(ribbon => ribbon .EnableDisplayVersion() .SetVersionPrefix("Version: ") .Tab( title: "RxBim_Tab_FromAction", tab => tab .Panel( title: "RxBim_Panel_1", panel => panel .CommandButton( name: "Command1_Large_WithText", commandType: typeof(Cmd1), builder: button => button .ToolTip("Tooltip: I'm run command #1. Push me!") .Text("Command\n#1") .Description("Description: This is command #1") .SmallImage(@"img\num1_16.png") .LargeImage(@"img\num1_32.png") .HelpUrl("https://github.com/ReactiveBIM/RxBim")) .Separator() .PullDownButton( "Pulldown1", pulldown => pulldown .CommandButton( "Command1_Pulldown1", typeof(Cmd1), button => button .ToolTip("Tooltip: I'm run command #1. Push me!") .Text("Command\n#1") .Description("Description: This is command #1") .LargeImage(@"img\num1_32.png") .HelpUrl("https://github.com/ReactiveBIM/RxBim")) .CommandButton( "Command2_Pulldown1", typeof(Cmd2), button => button .ToolTip("Tooltip: I'm run command #2. Push me!") .Text("Command\n#2") .Description("Description: This is command #2") .LargeImage(@"img\num2_32.bmp") .HelpUrl("https://github.com/ReactiveBIM/RxBim")) .LargeImage(@"img\command_32.ico") .Text("Pulldown\n#1")) .StackedItems(items => items .CommandButton( "Command1_Stacked1", typeof(Cmd1), button => button .ToolTip("Tooltip: I'm run command #1. Push me!") .Text("Command #1") .Description("Description: This is command #1") .SmallImage(@"img\num1_16.png") .HelpUrl("https://github.com/ReactiveBIM/RxBim")) .CommandButton( "Command2_Stacked1", typeof(Cmd2), button => button .ToolTip("Tooltip: I'm run command #2. Push me!") .Text("Command #2") .Description("Description: This is command #2") .SmallImage(@"img\num2_16.bmp") .HelpUrl("https://github.com/ReactiveBIM/RxBim"))) .SlideOut() .CommandButton( "Command1_SlideOut", typeof(Cmd1), button => button .ToolTip("Tooltip: I'm run command #1. Push me!") .Text("Command\n#1") .Description("Description: This is command #1") .LargeImage(@"img\num1_32.png")))), Assembly.GetExecutingAssembly()); } } ``` -------------------------------- ### Configure RxBim Menu with C# Source: https://github.com/reactivebim/rxbim/wiki/UI-integration C# code snippet demonstrating how to configure the RxBim menu within an application using the fluent API. This code is typically placed within an application's configuration class. ```csharp public class Config : IApplicationConfiguration { public void Configure(IContainer container) { container.AddRevitMenu(); } } ``` -------------------------------- ### Configure RxBIM Command Ribbon Parameters using Attributes (C#) Source: https://github.com/reactivebim/rxbim/wiki/UI-integration This snippet demonstrates how to define command ribbon parameters using the RxBimCommand attribute in C#. It sets properties such as ToolTip, Text, Description, LargeImage, SmallImage, and HelpUrl directly on the command class. The attribute provides a declarative way to configure the appearance and behavior of commands in the ribbon. ```csharp using ReactiveBIM.Commands; // ... [RxBimCommand( ToolTip = "Tooltip: I'm run command #1. Push me!", Text = "Command\n#1", Description = "Description: This is command #1", LargeImage = @"img\num1_32.png", SmallImage = @"img\num1_16.png", HelpUrl = "https://github.com/ReactiveBIM/RxBim")] public class Cmd1 : RxBimCommand { // Command implementation } ``` ```csharp // in configuration class panel.CommandButton("Command1_Large_WithText"); ``` -------------------------------- ### DI Container Configuration Interface Source: https://github.com/reactivebim/rxbim/wiki/Configuration Defines the interface for configuring dependencies within the DI container. Implementations receive the container instance to register services. This is crucial for customizing application behavior. ```csharp public interface ICommandConfiguration { void Configure(IContainer container); } public interface IApplicationConfiguration { void Configure(IContainer container); } ``` -------------------------------- ### C# Convert RevitTestFramework Results to HTML/Console Output Source: https://github.com/reactivebim/rxbim/wiki/Testing Shows how to use the `ResultConverter` class to process the XML output from `RevitTestFrameworkConsole`. This C# snippet demonstrates converting the test results to a more human-readable format for console output and HTML reports. ```csharp using RxBim.Nuke.Revit.TestHelpers; ... await new ResultConverter() .Convert(rtfResultPath, convertedResultPath); ``` -------------------------------- ### Inject Service into RxBimCommand ExecuteCommand Method (C#) Source: https://github.com/reactivebim/rxbim/wiki/Dependecy-injection Shows how to inject an ISomeService into the ExecuteCommand method of an RxBimCommand. This enables dependency injection for command execution logic. Requires the RxBim framework and associated services. ```csharp [Transaction(TransactionMode.Manual)] public class MyCmd : RxBimCommand { public PluginResult ExecuteCommand(Document doc, ISomeService service) { service.CloseDocument(doc); return PluginResult.Succeeded; } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.