Nacho
Automation & Design Engineer
Inventor Programmer (C#, VB.Net / iLogic)
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Hi, Nige,
If I understand you, you want to highlight four faces (600x20), but not to highlight two faces (600x600).
Did you tried with Faces object in SufaceBodies under PartDocumentDescription?
Best regards,
Nedeljko.
Nacho
Automation & Design Engineer
Inventor Programmer (C#, VB.Net / iLogic)
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Attached is some code to demonstrate how you might go about it. (Hasn't been tested.)
public class ShowFaces { //Compare Face by area public static int CompareByArea(Face face1, Face face2) { double area1 = face1.Evaluator.Area; double area2 = face2.Evaluator.Area; if (area1 < area2) { return -1; } else if (area1 > area2) { return 1; } else { return 0; } } //Get Panel Surfaces - Returns list of Panels public static ObjectCollection GetPanelSurfaces(SurfaceBody body) { Inventor.Application _appInventor = (Inventor.Application)body.Application; Faces faces = body.Faces; List<Face> lstFaces = new List<Face>((IEnumerable<Face>)faces); lstFaces.Sort(CompareByArea); ObjectCollection objCol = _appInventor.TransientObjects.CreateObjectCollection(); objCol.Add(lstFaces[0]); objCol.Add(lstFaces[1]); return objCol; } //Highlight entities public static void HighlightEntities(PartDocument ivDoc, ObjectCollection objCol) { if ((objCol != null) && (objCol.Count > 0)) { Inventor.Application _appInventor = (Application)ivDoc.Parent; HighlightSet hs = ivDoc.CreateHighlightSet(); Inventor.Color oRed = _appInventor.TransientObjects.CreateColor(255, 0, 0); oRed.Opacity = 0.8; foreach (object obj in objCol) { hs.AddItem(obj); } } } //Highlight the largest panels. public static void HighlightLargePanels(PartDocument pDoc) { SurfaceBodies sbs = pDoc.ComponentDefinition.SurfaceBodies; foreach (SurfaceBody sb in sbs) { HighlightEntities(pDoc, GetPanelSurfaces(sb)); } } }
Basically get the two largets surfaces on a surface body. Add them to a HighlightSet.