-
Notifications
You must be signed in to change notification settings - Fork 0
Visualization TraceGeometry
Truong Giang Vu edited this page Feb 14, 2026
·
2 revisions
Beautiful transient geometry display directly in Revit 3D views, integrated with trace logging.
The Geometry Visualization system allows you to display transient geometry directly in the Revit 3D view, similar to Dynamo's preview functionality but integrated into your development workflow.
- Faces - Surface geometry from Revit elements
- Curves - Lines, arcs, splines, and complex curve geometry
- Solids - 3D solid geometry with volume
- Meshes - Triangulated mesh geometry
- Points (XYZ) - Individual points or point collections
- Bounding Boxes - Element bounding box visualization
- Collections - Multiple geometry objects at once
- Transient Display - Uses Revit's DirectContext3D for rendering (inspired by RevitLookup)
-
Manual Control - Use
ClearGeometryto remove geometry on demand - Performance Optimized - Efficient rendering and disposal
- Mixed Geometry Types - Trace collections of different geometry types in one call
-
Real-time Counter - Shows number of objects displayed in the
ClearGeometrybutton
Ensure the logger is started (geometry tracing is automatically enabled).
// Trace a face
Face face = GetSomeFace();
Trace.Write(face);
// Trace a curve
Curve curve = GetSomeCurve();
Trace.Write(curve);
// Trace a solid
Solid solid = GetSomeSolid();
Trace.Write(solid);
// Trace a mesh
Mesh mesh = GetSomeMesh();
Trace.Write(mesh);
// Trace a point
XYZ point = new XYZ(10, 20, 30);
Trace.Write(point);
// Trace a bounding box
BoundingBoxXYZ bbox = element.get_BoundingBox(null);
Trace.Write(bbox);// Trace multiple faces
var faces = new List<Face> { face1, face2, face3 };
Trace.Write(faces);
// Trace multiple curves
var curves = selectedElements.SelectMany(e => GetCurvesFromElement(e));
Trace.Write(curves);
// Trace multiple solids
var solids = elements.SelectMany(e => e.GetSolids());
Trace.Write(solids);
// Mixed geometry types
var geometries = new List<GeometryObject> { face, curve, solid };
Trace.Write(geometries);import clr
clr.AddReference("RevitAPI")
# For Revit 2025 onward:
clr.AddReference("System.Diagnostics.TraceSource")
from Autodesk.Revit.DB import *
from System.Diagnostics import Trace
from System.Collections.Generic import List
# Trace individual geometry
face = GetSomeFace() # Your method to get a face
Trace.Write(face)
# Trace collections
curves = List[Curve]()
curves.Add(curve1)
curves.Add(curve2)
Trace.Write(curves)
# Trace points
point = XYZ(10, 20, 30)
Trace.Write(point)See complete working examples in the repository:
C# Examples:
- CurveVisualization.cs - Lines, arcs, curves
- SolidVisualization.cs - 3D solids
- FaceVisualization.cs - Faces and surfaces
- MeshVisualization.cs - Mesh geometry
- XYZVisualization.cs - Points and axes
Python Examples:
- visualization_curve_script.py - Curve visualization
- visualization_solid_script.py - Solid visualization
- visualization_xyz_script.py - Point visualization
From UI:
- Click the Clear Geometry button in the Trace panel
- Number shown indicates how many objects are currently displayed
From Code:
// Clears all visualized geometry
// (Not exposed via API yet - use UI button)- Clear Regularly - Use Clear Geometry button to avoid cluttering the view
- Performance - Large geometry collections may impact performance
- 3D View Required - Geometry only appears in 3D views (not plans/sections)
- Document Workflow - Combine with trace logging for complete debugging
- Ensure logger is enabled
- Verify you're in a 3D view (not 2D plan/section)
- Try toggling Start/Stop Listener
- Use "Clear Geometry" button
- Restart listener if needed
- Reduce number of geometry objects traced simultaneously
- Clear geometry between operations
- Use simpler geometry types (curves instead of solids)
- Visualization Overview - Main visualization documentation
- Geometry Types - Detailed geometry processing