diff --git a/.github/workflows/Publish.yml b/.github/workflows/Build.yml
similarity index 87%
rename from .github/workflows/Publish.yml
rename to .github/workflows/Build.yml
index 9118c29..bdf3eb4 100644
--- a/.github/workflows/Publish.yml
+++ b/.github/workflows/Build.yml
@@ -1,18 +1,20 @@
# ------------------------------------------------------------------------------
-# Publish.yml
+# Build.yml
# ------------------------------------------------------------------------------
-name: Publish
+name: Build
on:
push:
- branches:
+ pull_request:
+ branches-ignore:
- master
+ - main
workflow_dispatch:
jobs:
Publish:
- name: Publish
+ name: Build
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
diff --git a/.github/workflows/Develop.yml b/.github/workflows/Develop.yml
deleted file mode 100644
index e6b11f6..0000000
--- a/.github/workflows/Develop.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-# ------------------------------------------------------------------------------
-# Develop.yml
-# ------------------------------------------------------------------------------
-
-name: Develop
-
-on:
- push:
- branches-ignore:
- - master
- pull_request:
- branches-ignore:
- - master
- workflow_dispatch:
-
-jobs:
- Develop:
- name: Develop
- runs-on: windows-latest
- steps:
- - uses: actions/checkout@v1
- - name: Run './build/build.cmd'
- run: ./build/build.cmd --root ./build
- env:
- GitHubToken: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/Build/.nuke/build.schema.json b/Build/.nuke/build.schema.json
index 8f8f53f..e3e90fe 100644
--- a/Build/.nuke/build.schema.json
+++ b/Build/.nuke/build.schema.json
@@ -1,60 +1,170 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
- "title": "Build Schema",
- "$ref": "#/definitions/build",
"definitions": {
- "build": {
+ "Host": {
+ "type": "string",
+ "enum": [
+ "AppVeyor",
+ "AzurePipelines",
+ "Bamboo",
+ "Bitbucket",
+ "Bitrise",
+ "GitHubActions",
+ "GitLab",
+ "Jenkins",
+ "Rider",
+ "SpaceAutomation",
+ "TeamCity",
+ "Terminal",
+ "TravisCI",
+ "VisualStudio",
+ "VSCode"
+ ]
+ },
+ "IssConfiguration": {
"type": "object",
+ "description": "IssConfiguration",
"properties": {
- "Continue": {
- "type": "boolean",
- "description": "Indicates to continue a previously failed build attempt"
+ "Title": {
+ "type": [
+ "null",
+ "string"
+ ],
+ "description": "Title (default null)"
},
- "Folder": {
- "type": "string"
+ "Image": {
+ "type": [
+ "null",
+ "string"
+ ],
+ "description": "Image (default IMAGE)"
},
- "GitHubToken": {
- "type": "string",
- "default": "Secrets must be entered via 'nuke :secret [profile]'"
+ "ImageSmall": {
+ "type": [
+ "null",
+ "string"
+ ],
+ "description": "Small Image (default IMAGESMALL)"
},
- "Help": {
- "type": "boolean",
- "description": "Shows the help text for this build assembly"
+ "Icon": {
+ "type": [
+ "null",
+ "string"
+ ],
+ "description": "Icon (default ICON)"
},
- "Host": {
- "type": "string",
- "description": "Host for execution. Default is 'automatic'",
- "enum": [
- "AppVeyor",
- "AzurePipelines",
- "Bamboo",
- "Bitrise",
- "GitHubActions",
- "GitLab",
- "Jenkins",
- "Rider",
- "SpaceAutomation",
- "TeamCity",
- "Terminal",
- "TravisCI",
- "VisualStudio",
- "VSCode"
+ "Licence": {
+ "type": [
+ "null",
+ "string"
+ ],
+ "description": "Licence (default LICENSE)"
+ },
+ "Language": {
+ "description": "Language (default IssLanguage)",
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/definitions/IssLanguage"
+ }
]
},
- "InstallationFiles": {
- "type": "string"
+ "IssLanguageLicences": {
+ "type": [
+ "array",
+ "null"
+ ],
+ "description": "IssLanguages",
+ "items": {
+ "$ref": "#/definitions/IssLanguageLicence"
+ }
+ }
+ }
+ },
+ "IssLanguage": {
+ "type": "object",
+ "description": "IssLanguage",
+ "properties": {
+ "Name": {
+ "type": [
+ "null",
+ "string"
+ ],
+ "description": "Name (default \"en\")"
},
- "IssConfiguration": {
- "type": "string"
+ "MessagesFile": {
+ "type": [
+ "null",
+ "string"
+ ],
+ "description": "MessagesFile (default \"compiler:Default.isl\")"
+ }
+ }
+ },
+ "IssLanguageLicence": {
+ "type": "object",
+ "description": "IssLanguageLicence",
+ "properties": {
+ "Name": {
+ "type": [
+ "null",
+ "string"
+ ],
+ "description": "Name (default \"en\")"
},
- "MainName": {
- "type": "string"
+ "MessagesFile": {
+ "type": [
+ "null",
+ "string"
+ ],
+ "description": "MessagesFile (default \"compiler:Default.isl\")"
},
- "Name": {
- "type": "string"
+ "Licence": {
+ "type": [
+ "null",
+ "string"
+ ],
+ "description": "Licence (default LICENSE)"
+ }
+ }
+ },
+ "ExecutableTarget": {
+ "type": "string",
+ "enum": [
+ "Build",
+ "Clean",
+ "Compile",
+ "GitRelease",
+ "PackageBuilder",
+ "Release",
+ "Sign"
+ ]
+ },
+ "Verbosity": {
+ "type": "string",
+ "description": "",
+ "enum": [
+ "Verbose",
+ "Normal",
+ "Minimal",
+ "Quiet"
+ ]
+ },
+ "NukeBuild": {
+ "properties": {
+ "Continue": {
+ "type": "boolean",
+ "description": "Indicates to continue a previously failed build attempt"
},
- "NewVersions": {
- "type": "boolean"
+ "Help": {
+ "type": "boolean",
+ "description": "Shows the help text for this build assembly"
+ },
+ "Host": {
+ "description": "Host for execution. Default is 'automatic'",
+ "$ref": "#/definitions/Host"
},
"NoLogo": {
"type": "boolean",
@@ -75,83 +185,108 @@
"type": "string"
}
},
+ "Root": {
+ "type": "string",
+ "description": "Root directory during build execution"
+ },
+ "Skip": {
+ "type": "array",
+ "description": "List of targets to be skipped. Empty list skips all dependencies",
+ "items": {
+ "$ref": "#/definitions/ExecutableTarget"
+ }
+ },
+ "Target": {
+ "type": "array",
+ "description": "List of targets to be invoked. Default is '{default_target}'",
+ "items": {
+ "$ref": "#/definitions/ExecutableTarget"
+ }
+ },
+ "Verbosity": {
+ "description": "Logging verbosity during build execution. Default is 'Normal'",
+ "$ref": "#/definitions/Verbosity"
+ }
+ }
+ }
+ },
+ "allOf": [
+ {
+ "properties": {
+ "ApplicationType": {
+ "type": "string"
+ },
+ "EnableForkedRepository": {
+ "type": "boolean"
+ },
+ "Folder": {
+ "type": "string"
+ },
+ "GitHubToken": {
+ "type": "string",
+ "default": "Secrets must be entered via 'nuke :secrets [profile]'"
+ },
+ "InstallationFiles": {
+ "type": "string"
+ },
+ "IssConfiguration": {
+ "$ref": "#/definitions/IssConfiguration"
+ },
+ "MainName": {
+ "type": "string"
+ },
+ "MiddleVersions": {
+ "type": "boolean"
+ },
+ "Name": {
+ "type": "string"
+ },
+ "NewVersions": {
+ "type": "boolean"
+ },
"ProjectNameFolder": {
"type": "boolean"
},
+ "ProjectRemoveTargetFrameworkFolder": {
+ "type": "boolean"
+ },
"ProjectVersionFolder": {
"type": "boolean"
},
"ReleaseBundle": {
"type": "boolean"
},
- "ReleasePackageBuilder": {
+ "ReleaseFolder": {
+ "type": "string"
+ },
+ "ReleaseNameVersion": {
"type": "boolean"
},
- "Root": {
- "type": "string",
- "description": "Root directory during build execution"
+ "ReleasePackageBuilder": {
+ "type": "boolean"
},
"SignFile": {
"type": "string",
- "default": "Secrets must be entered via 'nuke :secret [profile]'"
+ "default": "Secrets must be entered via 'nuke :secrets [profile]'"
},
"SignPassword": {
"type": "string",
- "default": "Secrets must be entered via 'nuke :secret [profile]'"
- },
- "Skip": {
- "type": "array",
- "description": "List of targets to be skipped. Empty list skips all dependencies",
- "items": {
- "type": "string",
- "enum": [
- "Build",
- "Clean",
- "Compile",
- "GitRelease",
- "PackageBuilder",
- "Release",
- "Sign"
- ]
- }
+ "default": "Secrets must be entered via 'nuke :secrets [profile]'"
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
},
- "Target": {
- "type": "array",
- "description": "List of targets to be invoked. Default is '{default_target}'",
- "items": {
- "type": "string",
- "enum": [
- "Build",
- "Clean",
- "Compile",
- "GitRelease",
- "PackageBuilder",
- "Release",
- "Sign"
- ]
- }
- },
"VendorDescription": {
"type": "string"
},
"VendorId": {
"type": "string"
- },
- "Verbosity": {
- "type": "string",
- "description": "Logging verbosity during build execution. Default is 'Normal'",
- "enum": [
- "Minimal",
- "Normal",
- "Quiet",
- "Verbose"
- ]
}
}
+ },
+ {
+ "$ref": "#/definitions/NukeBuild"
}
- }
-}
\ No newline at end of file
+ ]
+}
diff --git a/Build/Build.cs b/Build/Build.cs
index ab40a25..a26ecc4 100644
--- a/Build/Build.cs
+++ b/Build/Build.cs
@@ -3,7 +3,6 @@
using ricaun.Nuke;
using ricaun.Nuke.Components;
-[CheckBuildProjectConfigurations]
class Build : NukeBuild, IPublishRevit
{
string IHazRevitPackageBuilder.Application => "Revit.App";
diff --git a/Build/Build.csproj b/Build/Build.csproj
index b55853a..40b00ac 100644
--- a/Build/Build.csproj
+++ b/Build/Build.csproj
@@ -1,7 +1,7 @@
Exe
- net5.0
+ net8.0
CS0649;CS0169
.
@@ -15,7 +15,8 @@
-
-
+
+
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b443ee6..07f0171 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,11 +4,21 @@ 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).
+## [1.1.0] / 2025-01-04
+- Update to Revit 2025
+- Update `ClickHandler`
+
+## [1.0.2] / 2024-03-04
+- Update references
+- Test in Revit 2024
+
## [1.0.1] / 2022-04-26
- Add Installation Files
## [1.0.0] / 2022-04-25
- First Release
+[1.1.0]: ../../compare/1.0.1...1.1.0
+[1.0.2]: ../../compare/1.0.1...1.0.2
[1.0.1]: ../../compare/1.0.0...1.0.1
[1.0.0]: ../../compare/1.0.0
\ No newline at end of file
diff --git a/README.md b/README.md
index 730ebb5..453ea4b 100644
--- a/README.md
+++ b/README.md
@@ -4,12 +4,13 @@ RevitAddin Example to work with [TemporaryGraphicsManager] a new feature of Revi
[TemporaryGraphicsManager] enables the ability to show the image on the view, a click event on the image could be created.
+* [Revit_API_Revit_API_Developers_Guide_Basic_Interaction_with_Revit_Elements_Views_Temporary_Graphics](https://help.autodesk.com/view/RVT/2024/ENU/?guid=Revit_API_Revit_API_Developers_Guide_Basic_Interaction_with_Revit_Elements_Views_Temporary_Graphics_html)
+
[](../..)
-[](../..)
+[](../..)
[](https://nuke.build/)
[](LICENSE)
-[](../../actions)
-[](../../actions)
+[](../../actions)
## Release
@@ -17,7 +18,7 @@ RevitAddin Example to work with [TemporaryGraphicsManager] a new feature of Revi
## License
-This project is [licensed](LICENSE) under the [MIT Licence](https://en.wikipedia.org/wiki/MIT_License).
+This project is [licensed](LICENSE) under the [MIT License](https://en.wikipedia.org/wiki/MIT_License).
---
diff --git a/RevitAddin.TemporaryGraphicsExample/Revit/App.cs b/RevitAddin.TemporaryGraphicsExample/Revit/App.cs
index d27ef46..1cb3bee 100644
--- a/RevitAddin.TemporaryGraphicsExample/Revit/App.cs
+++ b/RevitAddin.TemporaryGraphicsExample/Revit/App.cs
@@ -5,22 +5,35 @@
namespace RevitAddin.TemporaryGraphicsExample.Revit
{
- [Console]
+ [AppLoader]
public class App : IExternalApplication
{
private static RibbonPanel ribbonPanel;
+ public ClickHandler clickHandle = new ClickHandler();
public Result OnStartup(UIControlledApplication application)
{
ribbonPanel = application.CreatePanel("Graphics");
- ribbonPanel.AddPushButton("Temporary")
+
+ //ribbonPanel.CreatePushButton("Frames")
+ // .SetLargeImage("/UIFrameworkRes;component/ribbon/images/revit.ico");
+
+ ribbonPanel.CreatePushButton("Temporary")
+ .SetLargeImage("/UIFrameworkRes;component/ribbon/images/revit.ico");
+
+ ribbonPanel.CreatePushButton("Clear")
.SetLargeImage("/UIFrameworkRes;component/ribbon/images/revit.ico");
+ clickHandle.AddServer();
+
return Result.Succeeded;
}
public Result OnShutdown(UIControlledApplication application)
{
ribbonPanel?.Remove();
+
+ clickHandle.RemoveServer();
+
return Result.Succeeded;
}
}
diff --git a/RevitAddin.TemporaryGraphicsExample/Revit/ClickHandler.cs b/RevitAddin.TemporaryGraphicsExample/Revit/ClickHandler.cs
new file mode 100644
index 0000000..e877312
--- /dev/null
+++ b/RevitAddin.TemporaryGraphicsExample/Revit/ClickHandler.cs
@@ -0,0 +1,77 @@
+using Autodesk.Revit.DB.ExternalService;
+using Autodesk.Revit.UI;
+using System;
+using System.Collections.Generic;
+
+namespace RevitAddin.TemporaryGraphicsExample.Revit
+{
+ public class ClickHandler : ITemporaryGraphicsHandler
+ {
+ private Guid serverId;
+ public ClickHandler() : this(Guid.NewGuid())
+ {
+ }
+ public ClickHandler(Guid serverId)
+ {
+ this.serverId = serverId;
+ }
+
+ public void AddServer()
+ {
+ Guid guid = GetServerId();
+ var services = (MultiServerService)ExternalServiceRegistry.GetService(GetServiceId());
+
+ if (services.IsRegisteredServerId(guid))
+ return;
+
+ services.AddServer(this);
+ var activeServerIds = services.GetActiveServerIds();
+ activeServerIds.Add(guid);
+ services.SetActiveServers(activeServerIds);
+ }
+
+ public void RemoveServer()
+ {
+ Guid guid = GetServerId();
+ var services = (MultiServerService)ExternalServiceRegistry.GetService(GetServiceId());
+
+ if (services.IsRegisteredServerId(guid))
+ {
+ var activeServerIds = services.GetActiveServerIds();
+ activeServerIds.Remove(guid);
+ services.SetActiveServers(activeServerIds);
+ services.RemoveServer(guid);
+ }
+ }
+
+ public string GetDescription()
+ {
+ return "Click Temporary Graphics Handler";
+ }
+
+ public string GetName()
+ {
+ return "Click Temporary Graphics Handler";
+ }
+
+ public Guid GetServerId()
+ {
+ return serverId;
+ }
+
+ public ExternalServiceId GetServiceId()
+ {
+ return ExternalServices.BuiltInExternalServices.TemporaryGraphicsHandlerService;
+ }
+
+ public string GetVendorId()
+ {
+ return "ricaun";
+ }
+
+ public void OnClick(TemporaryGraphicsCommandData data)
+ {
+ System.Windows.MessageBox.Show($"TemporaryGraphics {data.Index} {data.Document.Application.ActiveAddInId?.GetAddInName()}");
+ }
+ }
+}
diff --git a/RevitAddin.TemporaryGraphicsExample/Revit/Commands/Command.cs b/RevitAddin.TemporaryGraphicsExample/Revit/Commands/Command.cs
index f406aae..abc0884 100644
--- a/RevitAddin.TemporaryGraphicsExample/Revit/Commands/Command.cs
+++ b/RevitAddin.TemporaryGraphicsExample/Revit/Commands/Command.cs
@@ -1,10 +1,8 @@
-using Autodesk.Revit.Attributes;
+using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
-using Autodesk.Revit.DB.ExternalService;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using System;
-using System.Collections.Generic;
using System.IO;
using System.Reflection;
@@ -13,73 +11,38 @@ namespace RevitAddin.TemporaryGraphicsExample.Revit.Commands
[Transaction(TransactionMode.Manual)]
public class Command : IExternalCommand
{
+ private Random Random = new Random();
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
{
UIApplication uiapp = commandData.Application;
+
UIDocument uidoc = uiapp.ActiveUIDocument;
Document document = uidoc.Document;
+ View view = uidoc.ActiveView;
Selection selection = uidoc.Selection;
- var clickHandle = new ClickHandler();
- clickHandle.AddServer();
-
- using (var temporaryGraphicsManager = TemporaryGraphicsManager.GetTemporaryGraphicsManager(document))
+ try
{
- temporaryGraphicsManager.Clear();
- var point = selection.PickPoint();
- var imagePath = Path.Combine(Location, "image.bmp");
- var data = new InCanvasControlData(imagePath, point);
- var indexClick = temporaryGraphicsManager.AddControl(data, ElementId.InvalidElementId);
+ using (var temporaryGraphicsManager = TemporaryGraphicsManager.GetTemporaryGraphicsManager(document))
+ {
+ while (true)
+ {
+ var point = selection.PickPoint();
+
+ var imagePath = Images[Index++ % Images.Length];
+ var data = new InCanvasControlData(imagePath, point);
+ var indexClick = temporaryGraphicsManager.AddControl(data, ElementId.InvalidElementId);
+ }
+ }
}
+ catch { }
return Result.Succeeded;
}
+ public static int Index = 0;
public string Location => Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
- }
-
- public class ClickHandler : ITemporaryGraphicsHandler
- {
- public void AddServer()
- {
- Guid guid = GetServerId();
- var services = (MultiServerService)ExternalServiceRegistry.GetService(GetServiceId());
-
- if (services.IsRegisteredServerId(guid))
- services.RemoveServer(guid);
-
- services.AddServer(this);
- services.SetActiveServers(new List { guid });
- }
-
- public string GetDescription()
- {
- return "Click Temporary Graphics Handler";
- }
-
- public string GetName()
- {
- return "Click Temporary Graphics Handler";
- }
+ public string[] Images => Directory.GetFiles(Location, "*.bmp");
- public Guid GetServerId()
- {
- return new Guid("7B469077-9F7C-4CCF-9746-BD0DE41D3610");
- }
-
- public ExternalServiceId GetServiceId()
- {
- return ExternalServices.BuiltInExternalServices.TemporaryGraphicsHandlerService;
- }
-
- public string GetVendorId()
- {
- return "ricaun";
- }
-
- public void OnClick(TemporaryGraphicsCommandData data)
- {
- System.Windows.MessageBox.Show($"TemporaryGraphics {data.Index}");
- }
}
}
diff --git a/RevitAddin.TemporaryGraphicsExample/Revit/Commands/CommandClear.cs b/RevitAddin.TemporaryGraphicsExample/Revit/Commands/CommandClear.cs
new file mode 100644
index 0000000..4a424fc
--- /dev/null
+++ b/RevitAddin.TemporaryGraphicsExample/Revit/Commands/CommandClear.cs
@@ -0,0 +1,24 @@
+using Autodesk.Revit.Attributes;
+using Autodesk.Revit.DB;
+using Autodesk.Revit.UI;
+
+namespace RevitAddin.TemporaryGraphicsExample.Revit.Commands
+{
+ [Transaction(TransactionMode.Manual)]
+ public class CommandClear : IExternalCommand
+ {
+ public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
+ {
+ UIApplication uiapp = commandData.Application;
+
+ Document document = uiapp.ActiveUIDocument.Document;
+ using (var temporaryGraphicsManager = TemporaryGraphicsManager.GetTemporaryGraphicsManager(document))
+ {
+ temporaryGraphicsManager.Clear();
+ }
+
+ return Result.Succeeded;
+ }
+ }
+
+}
diff --git a/RevitAddin.TemporaryGraphicsExample/Revit/Commands/CommandFrames.cs b/RevitAddin.TemporaryGraphicsExample/Revit/Commands/CommandFrames.cs
new file mode 100644
index 0000000..9b72131
--- /dev/null
+++ b/RevitAddin.TemporaryGraphicsExample/Revit/Commands/CommandFrames.cs
@@ -0,0 +1,58 @@
+using Autodesk.Revit.Attributes;
+using Autodesk.Revit.DB;
+using Autodesk.Revit.UI;
+using System;
+using System.IO;
+using System.Reflection;
+
+namespace RevitAddin.TemporaryGraphicsExample.Revit.Commands
+{
+ [Transaction(TransactionMode.Manual)]
+ public class CommandFrames : IExternalCommand
+ {
+ public string Location => Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
+ public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
+ {
+ UIApplication uiapp = commandData.Application;
+
+ var framesDirectory = "D:\\Downloads\\Download\\Bad Apple\\frames-bmp"; // 3 GB of files...
+ var frames = Directory.GetFiles(framesDirectory, "*.bmp");
+
+ int i = 0;
+ int indexClick = -1;
+ Document document = uiapp.ActiveUIDocument.Document;
+ using (var temporaryGraphicsManager = TemporaryGraphicsManager.GetTemporaryGraphicsManager(document))
+ {
+ temporaryGraphicsManager.Clear();
+ foreach (var frame in frames)
+ {
+ i++;
+ if (i % 10 == 0)
+ {
+ using var data = new InCanvasControlData(frame);
+ if (indexClick == -1)
+ {
+ indexClick = temporaryGraphicsManager.AddControl(data, ElementId.InvalidElementId);
+ }
+ else
+ {
+ temporaryGraphicsManager.UpdateControl(indexClick, data);
+ }
+ uiapp.ActiveUIDocument.RefreshActiveView();
+ RevitRibbonController.ApplicationIdle();
+ }
+ if (i % 150 == 0)
+ {
+ if (Console.CapsLock)
+ {
+ break;
+ }
+ }
+ }
+ }
+
+
+ return Result.Succeeded;
+ }
+ }
+}
diff --git a/RevitAddin.TemporaryGraphicsExample/Revit/ImageConverter.cs b/RevitAddin.TemporaryGraphicsExample/Revit/ImageConverter.cs
new file mode 100644
index 0000000..5e3ef4a
--- /dev/null
+++ b/RevitAddin.TemporaryGraphicsExample/Revit/ImageConverter.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Drawing;
+using System.Drawing.Imaging;
+
+namespace RevitAddin.TemporaryGraphicsExample.Revit
+{
+ public class ImageConverter
+ {
+ public static void ConvertPngToBmp(string inputPngPath, string outputBmpPath)
+ {
+ try
+ {
+ // Load the PNG image from the input path
+ using (Image image = Image.FromFile(inputPngPath))
+ {
+ // Save the image as a BMP to the output path
+ image.Save(outputBmpPath, ImageFormat.Bmp);
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Error during conversion: " + ex.Message);
+ }
+ }
+
+ public static void ConvertPngToBmpWithBackground(string inputPngPath, string outputBmpPath, Color backgroundColor)
+ {
+ try
+ {
+ // Load the PNG image from the input path
+ using (Image originalImage = Image.FromFile(inputPngPath))
+ {
+ // Create a new bitmap with the same dimensions as the original image
+ using (Bitmap newImage = new Bitmap(originalImage.Width, originalImage.Height))
+ {
+ // Create a Graphics object to draw on the new bitmap
+ using (Graphics graphics = Graphics.FromImage(newImage))
+ {
+ // Fill the background with the specified background color
+ graphics.Clear(backgroundColor);
+
+ // Draw the original image on top of the background
+ graphics.DrawImage(originalImage, 0, 0);
+ }
+
+ // Save the new image as a BMP file
+ newImage.Save(outputBmpPath, ImageFormat.Bmp);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Error during conversion: " + ex.Message);
+ }
+ }
+ }
+}
diff --git a/RevitAddin.TemporaryGraphicsExample/Revit/RevitRibbonController.cs b/RevitAddin.TemporaryGraphicsExample/Revit/RevitRibbonController.cs
new file mode 100644
index 0000000..82f1fba
--- /dev/null
+++ b/RevitAddin.TemporaryGraphicsExample/Revit/RevitRibbonController.cs
@@ -0,0 +1,15 @@
+namespace RevitAddin.TemporaryGraphicsExample.Revit
+{
+ public class RevitRibbonController
+ {
+ ///
+ /// RibbonControl
+ ///
+ public static UIFramework.RevitRibbonControl RibbonControl => UIFramework.RevitRibbonControl.RibbonControl;
+ ///
+ /// Enable
+ ///
+ public static void ApplicationIdle() => UIFramework.RevitRibbonControl.RibbonControl.Dispatcher.Invoke(NoneMethod, System.Windows.Threading.DispatcherPriority.ApplicationIdle);
+ private static void NoneMethod() { }
+ }
+}
diff --git a/RevitAddin.TemporaryGraphicsExample/RevitAddin.TemporaryGraphicsExample.csproj b/RevitAddin.TemporaryGraphicsExample/RevitAddin.TemporaryGraphicsExample.csproj
index c589fdd..0f72f6d 100644
--- a/RevitAddin.TemporaryGraphicsExample/RevitAddin.TemporaryGraphicsExample.csproj
+++ b/RevitAddin.TemporaryGraphicsExample/RevitAddin.TemporaryGraphicsExample.csproj
@@ -2,68 +2,41 @@
- net46
Library
AnyCPU
true
- 9
+ Latest
false
None
Debug; Release
+
+ net48;net8.0-windows
+ true
+ None
+
-
-
- 2017
- net46
-
-
-
-
- 2018
- net46
-
-
-
-
- 2019
- net47
-
-
-
-
- 2020
- net47
-
-
-
-
- 2021
- net48
-
-
-
+
2022
- net48
-
-
-
-
- 2023
- net48
- 2022
- net48
+ 2025
+
+
+ true
+ true
+ false
+
+
true
@@ -90,7 +63,7 @@
RevitAddin.TemporaryGraphicsExample
- 1.0.1
+ 1.1.0
{A3399E68-62E1-4C44-8313-FFBBD8A9272F}
@@ -103,8 +76,8 @@
- Company
- Authors
+ ricaun
+ Luiz Henrique Cassettari
Revit Add-In Description for $(PackageId).
$([System.DateTime]::Now.ToString('yyyy'))
@@ -121,7 +94,6 @@
-
@@ -139,14 +111,26 @@
+
+
+
Always
+
+ Always
+
Always
+
+ Always
+
+
+ Always
+
\ No newline at end of file
diff --git a/RevitAddin.TemporaryGraphicsExample/circle.bmp b/RevitAddin.TemporaryGraphicsExample/circle.bmp
new file mode 100644
index 0000000..f03c559
Binary files /dev/null and b/RevitAddin.TemporaryGraphicsExample/circle.bmp differ
diff --git a/RevitAddin.TemporaryGraphicsExample/device_power_browser.bmp b/RevitAddin.TemporaryGraphicsExample/device_power_browser.bmp
new file mode 100644
index 0000000..2727ce1
Binary files /dev/null and b/RevitAddin.TemporaryGraphicsExample/device_power_browser.bmp differ
diff --git a/RevitAddin.TemporaryGraphicsExample/image16.bmp b/RevitAddin.TemporaryGraphicsExample/image16.bmp
new file mode 100644
index 0000000..67c845d
Binary files /dev/null and b/RevitAddin.TemporaryGraphicsExample/image16.bmp differ
diff --git a/RevitAddin.TemporaryGraphicsExample/point.bmp b/RevitAddin.TemporaryGraphicsExample/point.bmp
new file mode 100644
index 0000000..0c35315
Binary files /dev/null and b/RevitAddin.TemporaryGraphicsExample/point.bmp differ