Message 1 of 2
Stitch a composite surface via API

Not applicable
10-10-2018
09:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
After I load a STEP file containing a single surface, it appears in Inventor as a part with a single Work Surface coming from a "Composite Feature".
I want to stitch it via the API as the first step in an automation process, so I do:
// Get last added document PartDocument doc = app.Documents[1] as PartDocument; PartComponentDefinition compDef = doc.ComponentDefinition; // Stitch all faces in the surface ObjectCollection args = app.TransientObjects.CreateObjectCollection(); foreach (Face face in compDef.WorkSurfaces[1].SurfaceBodies[1].Faces) { args.Add(face.SurfaceBody); } compDef.Features.KnitFeatures.Add(args);
However, the call to
KnitFeatures.Add
just throws an exception and I don't know what's wrong. Via the UI, it's as easy as clicking on the composite surface to select the composite.
I've tried passing the WorkSurface directly instead of all the faces, but still the same result. Any ideas?
Thanks!