Stitch a composite surface via API

Stitch a composite surface via API

Anonymous
Not applicable
466 Views
1 Reply
Message 1 of 2

Stitch a composite surface via API

Anonymous
Not applicable

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!

0 Likes
467 Views
1 Reply
Reply (1)
Message 2 of 2

YuhanZhang
Autodesk
Autodesk

Can you attach a sample data to reproduce the problem? Don't upload confidential data.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes