five years down the line, i've come across very much the same problem.
kean walmsley tends to use the solid fill, which seems to avoid the issue altogether, although in one example he mentions setting the hatchpattern.objecttype. unfortunately, i've not noticed any difference myself by doing so, i.e. evaluatehatch(true) still either throws an exeption or it doesn't. even programming values which i used satisfactorily in the drawing, i.e. scale and hatch area, is no guarantee for a pass.
the really frustrating thing about this is, that despite the awareness, i still have no idea how to deal with this exception type other than resort to solid fill.
matt posted this in 2007, comments welcome
I had a similar problem when trying to access the "area" property.
I got this suggestion from Philippe Leefsma.
Try specifying the loop as “External” instead of “OuterMost”, that will fix the exception while calculating the area:
acHatch.AppendLoop(HatchLoopTypes.External, acObjIdColl)
It solved my problem.
i tried a couple of type/scale configurations that did recently throw an exception and it appears that, as you state, specifying 'external' (as opposed to outermost) gets it through. many thanks
I had the same problem, I modified scales, angles and more, but the same error appeared, I never knew why. So, I placed EvaluateHacth (false); and "worked" ... Greetings from Venezuela
Polyline PiedraPicadaFA1 = new Polyline(); PiedraPicadaFA1.AddVertexAt(0, new Point2d(Origen_CorteFA1_X, Origen_CorteFA1_Y), 0, 0, 0); PiedraPicadaFA1.AddVertexAt(0, new Point2d(Origen_CorteFA1_X, Origen_CorteFA1_Y - Epp), 0, 0, 0); PiedraPicadaFA1.AddVertexAt(0, new Point2d(Origen_CorteFA1_X + FA1_Bx, Origen_CorteFA1_Y - Epp), 0, 0, 0); PiedraPicadaFA1.AddVertexAt(0, new Point2d(Origen_CorteFA1_X + FA1_Bx, Origen_CorteFA1_Y), 0, 0, 0); PiedraPicadaFA1.Closed = true; DibujarModelSpace.AppendEntity(PiedraPicadaFA1); TransaccionActual.AddNewlyCreatedDBObject(PiedraPicadaFA1, true); PiedraPicadaFA1.ColorIndex = 8; ObjectIdCollection PiedraPicadaFA1_Obj = new ObjectIdCollection(); PiedraPicadaFA1_Obj.Add(PiedraPicadaFA1.ObjectId); Hatch PiedraPicadaFA1_Hatch = new Hatch(); DibujarModelSpace.AppendEntity(PiedraPicadaFA1_Hatch); TransaccionActual.AddNewlyCreatedDBObject(PiedraPicadaFA1_Hatch, true); PiedraPicadaFA1_Hatch.SetHatchPattern(HatchPatternType.PreDefined, "GRAVEL"); PiedraPicadaFA1_Hatch.Associative = true; PiedraPicadaFA1_Hatch.AppendLoop(HatchLoopTypes.Outermost, PiedraPicadaFA1_Obj); PiedraPicadaFA1_Hatch.PatternScale = PiedraPicadaFA1_Hatch.PatternScale - 0.99; PiedraPicadaFA1_Hatch.SetHatchPattern(PiedraPicadaFA1_Hatch.PatternType, PiedraPicadaFA1_Hatch.PatternName); PiedraPicadaFA1_Hatch.ColorIndex = 8;
PiedraPicadaFA1_Hatch.EvaluateHatch(false);