As far as I know there's no public API property that tells you the user accepted the intersect errors. We hit the same wall on a batch of ~150 parts and stopped asking Inventor if the flat pattern is valid. We check the flat result itself instead, with tests that don't depend on Inventor's error state.
Here's a function you can drop into your add-in and call for each part in your scan, after the checks you already have. It returns an empty string if the part looks OK, otherwise the reason, so you can show it in your report.
// Returns "" if the flat pattern looks usable, otherwise the reason.
private string CheckFlatPattern(Inventor.Application invApp, PartDocument partDoc)
{
SheetMetalComponentDefinition smDef = partDoc.ComponentDefinition as SheetMetalComponentDefinition;
if (smDef == null) return "not a sheet metal part";
if (!smDef.HasFlatPattern) return "no flat pattern";
SurfaceBody folded = smDef.SurfaceBodies[1];
SurfaceBody flat = smDef.FlatPattern.SurfaceBodies[1];
// 1. Flat plate or bent part? If folded and flat bodies are identical,
// the part has no bends, so there is nothing that can overlap.
ObjectCollection coll = invApp.TransientObjects.CreateObjectCollection();
coll.Add(folded);
coll.Add(flat);
ObjectCollection identical = invApp.TransientBRep.GetIdenticalBodies(coll);
if (identical.Count > 0) return "";
// 2. Bent part: compare volumes. Overlapping geometry that got merged
// into the flat solid makes the flat volume smaller than the folded one.
double vFolded = folded.get_Volume(0.001);
double vFlat = flat.get_Volume(0.001);
double diff = Math.Abs(vFlat - vFolded) / vFolded;
if (diff > 0.01)
return "flat volume differs from folded by " + (diff * 100).ToString("0.0") + " %";
return "";
}
Why these two. The first one splits flat plates from bent parts: a flat plate can't have overlapping bends, so you skip it. We use this on every job and it's cheap. The second one is the one aimed at your accepted-errors case. When Inventor accepts overlapping geometry the overlap gets merged into one solid, so the flat body should lose volume compared to the folded one. I haven't had one of your accepted-errors parts to test it on, so please try it on the test cases you already built and tune the 1 % tolerance. Volume needs the precision argument, that's why it's get_Volume(0.001) and not just Volume.
A third check we do outside Inventor, since you export DXF anyway: read the flat pattern DXF in python with ezdxf, build polygons from the outer profile with shapely, and flag the part if the outline doesn't close into one polygon or if polygon.is_valid is False, which is what a self-intersecting outline gives. It doesn't care about Inventor's error state at all.
If someone knows an API call that reads the accepted-errors state directly I'd like to know too.
Happy to help if you have more questions on the add-in or other automation stuff. I maintain an iLogic rule of over 10,000 lines for our drawings, so I've fought with the sheet metal API quite a bit.