DirectShape.ByGeometry operation failed. The type initializer for 'Revit.Elements.DirectShape' threw an exceptionDirectShape.ByGeometry operation failed. The type initializer for 'Revit.Elements.DirectShape' threw an exception

Issue: DirectShape.ByGeometry Error in Revit Dynamo

Hello everyone,

My team is facing an issue when working with DirectShape.ByGeometry in Revit through Dynamo. Here’s a detailed description of the problem:


Error Message

The type initializer for 'Revit.Elements.DirectShape' threw an exception DirectShape.ByGeometry operation failed.


Key Observations

  1. When the error occurs:
  • Using DirectShape.ByGeometry to create DirectShapes in Dynamo.
  • Fetching elements through Get All Elements of Category node in Dynamo.
  1. Inconsistent behavior:
  • The same script and geometry work on one machine but fail on another.
  • Restarting the machine occasionally resolves the issue temporarily.
  1. Environment details:
  • We have the pyRevit add-in installed across all affected machines.

Troubleshooting Attempts

  • Verified the same geometry on different machines—works on some but fails on others.
  • Restarting Revit/Dynamo or the system temporarily resolves the issue.
  • Ensured all machines are on the same Revit version and Dynamo version.

I’m not sure if this node was part of the Spring package a few years ago and was merged into the Dynamo master branch. If so, maybe you could prepare a minimal case and post it on GitHub. This would help the developers reopen this issue.

Dynamo fails to return DirectShape elements not created through Dynamo. · Issue #1719 · DynamoDS/DynamoRevit