Issues with SurfaceBody.CalculateFacets in Inventor 2025 Add-in (.NET 8 / x64)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
I’m working on an Inventor 2025 add-in in C# (targeting .NET 8, x64) that fingerprints parts by falling back to a mesh-based hash via the SurfaceBody.CalculateFacets API. Although I can successfully compile against Autodesk.Inventor.Interop.dll, at runtime every call to CalculateFacets fails with a type-mismatch error and returns zero vertices:
My environment:
Inventor: 2025 (fully updated)
Visual Studio: 17.8+, targeting .NET 8 SDK
Platform: x64 build
Interop settings:
Embed Interop Types = False
Copy Local = True
What I’ve tried so far:
Confirmed the add-in DLL is loaded in the x64 Inventor process.
Referencing the Inventor 2025 interop DLL from C:\Program Files\Autodesk\Inventor 2025\Bin.
Various overloads, including:
csharpbody.CalculateFacets( 0.01, out int vertexCount, out int facetCount, out double[] vertexCoords, out double[] normalVectors, out int[] vertexIndices );Using out object parameters then casting.
Verifying that each SurfaceBody actually has faces.
Questions:
Is there a different COM signature or overload for CalculateFacets in Inventor 2025/.NET 8?
Do I need to pre-allocate arrays or use a special marshalling attribute?
Has anyone successfully used CalculateFacets under .NET 8/x64 with Inventor 2025? A minimal working example would be hugely appreciated.
Attachment:
I’ve included the full SmartCopyExporter.cs source as a TXT attachment for reference.
Thanks in advance for any pointers!