Su.Revit.HelixToolkit.SharpDX
2026.1.0
dotnet add package Su.Revit.HelixToolkit.SharpDX --version 2026.1.0
NuGet\Install-Package Su.Revit.HelixToolkit.SharpDX -Version 2026.1.0
<PackageReference Include="Su.Revit.HelixToolkit.SharpDX" Version="2026.1.0" />
<PackageVersion Include="Su.Revit.HelixToolkit.SharpDX" Version="2026.1.0" />
<PackageReference Include="Su.Revit.HelixToolkit.SharpDX" />
paket add Su.Revit.HelixToolkit.SharpDX --version 2026.1.0
#r "nuget: Su.Revit.HelixToolkit.SharpDX, 2026.1.0"
#:package Su.Revit.HelixToolkit.SharpDX@2026.1.0
#addin nuget:?package=Su.Revit.HelixToolkit.SharpDX&version=2026.1.0
#tool nuget:?package=Su.Revit.HelixToolkit.SharpDX&version=2026.1.0
๐ Su.Revit.HelixToolkit.SharpDX User Guide
๐ Project Repository
GitHub: https://github.com/ViewSuSu/Su.Revit.HelixToolkit.SharpDX
Gitee: https://gitee.com/SususuChang/su.-revit.-helix-toolkit.-sharp-dx
๐ฆ Installation
Via NuGet (Recommended)
# Package Manager
Install-Package Su.Revit.HelixToolkit.SharpDX
# .NET CLI
dotnet add package Su.Revit.HelixToolkit.SharpDX
Compatibility
- โ Supported Versions: Revit 2011 - Revit 2026
- โ .NET Framework: 4.8+
- โ Dependencies: HelixToolkit.Wpf.SharpDX, Revit API
๐ Introduction
Su.Revit.HelixToolkit.SharpDX is a high-performance 3D visualization toolkit specifically designed for Revit plugin development. Built on HelixToolkit.Wpf.SharpDX, it provides simple and easy-to-use APIs to create feature-rich 3D viewport windows in Revit plugins.
Core Features:
- ๐ High-Performance Rendering: Index optimization for Solid triangular faces, capable of handling massive triangular face data in Solid models
- ๐ฏ Complete Interaction: Supports mouse hover highlighting, click selection, multi-selection, rotation, zoom, pan, and other complete interaction functions
- ๐ Coordinate System Adaptation: Automatic handling of coordinate system conversion between Revit and Helix for seamless integration
- ๐จ Material System: Supports multiple rendering methods including native Revit materials, custom colors, and texture materials
- โก Memory Optimization: Efficient geometric data management and memory release mechanisms
๐ฏ Quick Start
โก Basic Usage
// 1. ๐ฆ Initialize the builder
var builder = HelixViewport3DBuilder.Init(
revitDocument,
geometryObjects,
new Viewport3DXOptions()
);
// 2. ๐ฅ๏ธ Get the 3D viewport control
Viewport3DX viewport = builder.Viewport;
// 3. ๐ Add viewport to your WPF window
๐ฅ Complete Example
// Prepare geometry objects to display
var geometryObjects = new List<GeometryObjectOptions>
{
// Add your geometry objects...
};
// ๐จ Configure viewport options
var visualOptions = new Viewport3DXOptions
{
BackgroundColor = System.Windows.Media.Colors.LightGray,
FXAALevel = 4 // Anti-aliasing level
};
// ๐๏ธ Create builder
var builder = HelixViewport3DBuilder.Init(
document,
geometryObjects,
visualOptions
);
// ๐ Set camera view
builder.SetCamera(revitView);
// โจ Enable interaction features
builder.SetHoverHighlightEnabled(true)
.SetClickHighlightEnabled(true);
๐ฎ Interaction Features
๐ฑ๏ธ Mouse Operations
| Operation | Function | Icon |
|---|---|---|
| ๐ฑ๏ธ Middle Double-Click | Zoom to extent | ๐ |
| ๐ฑ๏ธ Middle Drag | Pan view | ๐ |
| ๐ฑ๏ธ Shift + Right Click | Rotate view | ๐ |
| ๐ฑ๏ธ Mouse Hover | Semi-transparent highlight | ๐ |
| ๐ฑ๏ธ Left Click | Select model | โ |
| ๐ฑ๏ธ Ctrl + Click | Multi-select models | ๐ |
๐จ Highlight Features
// ๐ Set highlight color
builder.SetHighlightColor(Colors.Red, 0.8f); // Red highlight
// ๐ซ Enable blinking effect
builder.SetHighlightBlinking(true, 100); // 100ms blink interval
// ๐ง Programmatically highlight specific objects
builder.HighlightGeometryObject(specificGeometry);
๐ View Control
๐ฅ Camera Settings
// Method 1: Use Revit view
builder.SetCamera(revitView);
// Method 2: Custom camera
builder.SetCamera(
new XYZ(0, 0, 10), // ๐ Camera position
new XYZ(0, 0, -1), // ๐ Look direction
new XYZ(0, 1, 0) // โฌ๏ธ Up direction
);
๐งญ Navigation Controls
- โ View Cube: Displayed at top-right, click for quick view switching
- โ Auto Zoom: Automatically adjusts to suitable view range on load
- โ Anti-aliasing: Configurable graphics quality settings
๐ ๏ธ Advanced Features
๐ก Event Listening
// ๐ Listen to model selection events
builder.OnModelSelected += (sender, args) =>
{
var selectedModel = args.SelectedModel;
var geometryObject = args.GeometryObject;
var hitPoint = args.HitPoint;
// ๐ฏ Handle selection logic
Console.WriteLine($"Selected model: {geometryObject}");
};
// ๐ Listen to deselection events
builder.OnModelDeselected += (sender, args) =>
{
// ๐๏ธ Clear selection state
};
๐ Selection Management
// ๐ Get currently selected models
var selectedModels = builder.GetSelectedModels();
// ๐ Get currently selected geometry objects
var selectedGeometry = builder.GetSelectedGeometryObjects();
// ๐งน Clear all selections
builder.ClearHighlight();
โ๏ธ Configuration Options
๐จ Visual Configuration
var options = new Viewport3DXOptions
{
BackgroundColor = Colors.Black, // ๐จ Background color
FXAALevel = 8, // ๐ Anti-aliasing level (0-8)
EnableRenderFrustum = true // ๐ฏ Frustum culling
};
๐ง Feature Toggles
// Enable/disable hover highlight
builder.SetHoverHighlightEnabled(true);
// Enable/disable click highlight
builder.SetClickHighlightEnabled(true);
๐จ GeometryObjectOptions Usage Guide
๐ Basic Configuration
GeometryObjectOptions is used to configure how geometry objects are rendered:
Using Revit Material
var options = new GeometryObjectOptions(
geometryObject, // ๐ Revit geometry object
revitMaterial // ๐จ Revit material (optional)
);
Using Custom Color
var options = new GeometryObjectOptions(
geometryObject, // ๐ Revit geometry object
Colors.Blue, // ๐ต Custom color
0.8f // ๐ง Transparency (0-1)
);
Using Texture Material
var options = new GeometryObjectOptions(
geometryObject, // ๐ Revit geometry object
textureStream, // ๐ผ๏ธ Texture stream
Colors.White, // โช Emissive color
1.0f // ๐ง Transparency
);
โ๏ธ Rendering Parameter Configuration
var options = new GeometryObjectOptions(geometryObject, material)
{
LevelOfDetail = 0.8, // ๐ฏ Detail level (0-1)
MinAngleInTriangle = 0, // ๐ Minimum triangle angle
MinExternalAngleBetweenTriangles = Math.PI / 4, // ๐ Minimum external angle between triangles
IsDrawSolidEdges = true, // ๐ Draw outline edges
SolidEdgeThickness = 2f, // ๐๏ธ Edge thickness
SolidEdgeSmoothness = 10f // โจ Edge smoothness
};
๐ง Parameter Description
| Parameter | Description | Default | Impact |
|---|---|---|---|
LevelOfDetail |
Rendering detail level | 0.5 | Higher values create denser meshes, better precision but higher performance cost |
MinAngleInTriangle |
Minimum angle in triangle | 0 | Controls smoothness during mesh generation |
MinExternalAngleBetweenTriangles |
Minimum external angle between adjacent triangles | 2ฯ | Determines smooth transition between surfaces |
IsDrawSolidEdges |
Whether to draw outline edges | true | Display boundary lines |
SolidEdgeThickness |
Edge line thickness | 2f | Line width in pixels |
SolidEdgeSmoothness |
Edge line smoothness | 10f | Higher values create smoother edges |
๐ก Usage Tips
๐ Performance Optimization
- โ
Use
EnableSwapChainRenderingto improve rendering performance - โ
Set appropriate
FXAALevelto balance quality and performance - โ
Call
Clear()promptly to release resources - โ
Adjust
LevelOfDetailbased on requirements to avoid unnecessary details - โ Utilize Solid triangular face index optimization to handle massive data
๐ฏ Best Practices
- ๐ฑ Responsive Design: Viewport automatically adapts to container size
- ๐ Real-time Updates: Support dynamic add/remove of geometry objects
- ๐ฎ User Friendly: Provide intuitive mouse interaction feedback
- ๐จ Visual Consistency: Maintain visual style similar to Revit
- โก Performance Balance: Adjust rendering parameters based on scene complexity
- ๐พ Memory Management: Timely cleanup of unused geometry objects
๐ Scene Management
// ๐งน Clear scene
builder.Clear();
// ๐ฆ Re-add objects
builder.Add(newGeometryObjects);
// ๐ฏ Reset camera
builder.SetCamera(newView);
โ Frequently Asked Questions
โ How to change highlight color?
builder.SetHighlightColor(Colors.Blue, 0.7f); // ๐ต Blue highlight
โ How to disable all interactions?
builder.SetHoverHighlightEnabled(false)
.SetClickHighlightEnabled(false);
โ How to get world coordinates of click position?
builder.OnModelSelected += (sender, args) =>
{
var worldPosition = args.HitPoint; // ๐ World coordinates
};
โ How to optimize performance for complex models?
var options = new GeometryObjectOptions(geometryObject, material)
{
LevelOfDetail = 0.3, // ๐ฏ Reduce detail level
IsDrawSolidEdges = false // ๐ Disable edge drawing
};
โ How to handle material transparency?
// Method 1: Use color transparency
var options = new GeometryObjectOptions(geometryObject, Colors.Red, 0.5f);
// Method 2: Use Revit material transparency
var material = document.GetElement(materialId) as Autodesk.Revit.DB.Material;
var options = new GeometryObjectOptions(geometryObject, material);
โ How to handle Solid models with massive triangular faces?
// The library has built-in triangular face index optimization, automatically handling massive data
// Just create GeometryObjectOptions normally
var options = new GeometryObjectOptions(largeSolidModel, material);
๐ Technical Support
If you encounter issues during use, please check:
- โ Revit document object is correctly passed
- โ Geometry object collection contains valid data
- โ Viewport control is properly added to WPF visual tree
- โ Event handlers are correctly registered and unregistered
- โ Rendering parameters are within reasonable ranges
- โ Memory usage is normal, call Clear() promptly to release resources
๐ Debugging Tips
// Check selected models
var selected = builder.GetSelectedModels();
Console.WriteLine($"Selected {selected.Count()} models");
// Check geometry object mapping
var geometryObjects = builder.GetSelectedGeometryObjects();
foreach (var geoObj in geometryObjects)
{
Console.WriteLine($"Geometry object type: {geoObj.GetType()}");
}
๐ Additional Resources
- ๐ Full Source Code: Visit the GitHub or Gitee repository above
- ๐ Issue Reporting: Welcome to submit issues in the repository
- ๐ก Feature Suggestions: Welcome to submit Pull Requests or feature suggestions
- ๐ Release Notes: Check the repository's Release page for latest version information
๐ Start using Su.Revit.HelixToolkit.SharpDX to create outstanding 3D visualization experiences!
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows7.0 is compatible. net9.0-windows was computed. net10.0-windows was computed. |
-
net8.0-windows7.0
- HelixToolkit.Wpf.SharpDX (>= 3.1.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.1.0 | 209 | 11/24/2025 |
| 2025.1.0 | 196 | 11/24/2025 |
| 2024.1.0 | 200 | 11/24/2025 |
| 2023.1.0 | 194 | 11/24/2025 |
| 2022.1.0 | 197 | 11/24/2025 |
| 2021.1.0 | 194 | 11/24/2025 |
| 2020.1.0 | 198 | 11/24/2025 |
| 2019.1.0 | 195 | 11/24/2025 |
| 2018.1.0 | 197 | 11/24/2025 |
| 2017.1.0 | 193 | 11/24/2025 |
| 2016.1.0 | 198 | 11/24/2025 |
| 2015.1.0 | 204 | 11/24/2025 |
| 2014.1.0 | 194 | 11/24/2025 |
| 2013.1.0 | 198 | 11/24/2025 |