Replace ExtrudeDefinition Profile leads to Exception
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, quite new to Inventor programming'. I have following problem (C# AddIn project), thank you for your help:
I want to replace the profile of an existing extrude. As a first try, I just want to reproduce that sample: https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=ExtrudeFeature_Profile_Sample
Meaning:
1- create a rectangle in the existing sketch:
var pt1 = inventorApplication.TransientGeometry.CreatePoint2d(0, 0);
var pt2 = inventorApplication.TransientGeometry.CreatePoint2d(30, 10);
var lines = sketch.SketchLines.AddAsTwoPointRectangle(pt1, pt2);
2- create the object collection:
var pathSegments = inventorApplication.TransientObjects.CreateObjectCollection();
foreach (var line in lines)
pathSegments.Add(line);
3- create the new profile and reset the extrude definition:
var profile = sketch.Profiles.AddForSolid(false, pathSegments);
myExtrude.Definition.Profile = profile;
Actually basic. But I get an exception at the last line (Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))). Any ideas what's going wrong? Thank you.