.NET

Reply
Valued Contributor
Matt S
Posts: 64
Registered: ‎05-05-2004
Message 1 of 6 (282 Views)

Troubles with EvaluateHatch()

282 Views, 5 Replies
03-02-2007 06:04 AM
I have found that if I have a small area to hatch, and the hatch scale is set too high, calls to EvaluateHatch throw eAmbiguousOutput exceptions, or maybe they are eAmbiguousInput. I don't remember exactly, but in any case, the docs don't mention this kind of beharior.

My question is this. I need to call evaluatehatch so the hatch shows up on the screen after it's placed in the database. Is there another way to force a screen update. I ahve tried doing a regen using ads_regen(), but that didn't work. As a workaround, I have reduced my hatchscale by 30%, and this seems to work in all cases, but I would rather not have to do this. This is all for Acad2006 btw.

Any advice is appreciated.
Valued Contributor
FFlix
Posts: 95
Registered: ‎11-15-2011
Message 2 of 6 (205 Views)

Re: Troubles with EvaluateHatch()

02-10-2012 10:15 AM in reply to: Matt S

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

Valued Contributor
Patch61
Posts: 100
Registered: ‎12-13-2005
Message 3 of 6 (194 Views)

Re: Troubles with EvaluateHatch()

02-24-2012 08:30 AM in reply to: Matt S

Just a shot in the dark here, but maybe you can evaluate the solid hatch and change the hatch pattern after?

 

Distinguished Contributor
mohnston
Posts: 184
Registered: ‎09-22-2006
Message 4 of 6 (188 Views)

Re: Troubles with EvaluateHatch()

02-24-2012 09:32 AM in reply to: Matt S

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.

CAD Programming Solutions
Valued Contributor
FFlix
Posts: 95
Registered: ‎11-15-2011
Message 5 of 6 (166 Views)

Re: Troubles with EvaluateHatch()

02-27-2012 06:01 AM in reply to: mohnston

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

New Member
NenaOlano
Posts: 1
Registered: ‎08-29-2012
Message 6 of 6 (118 Views)

Re: Troubles with EvaluateHatch()

08-29-2012 12:55 PM in reply to: Matt S

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 :smileywink:

 

Spoiler
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);

 

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community