Problem With Hatch Showing Solid

Problem With Hatch Showing Solid

Anonymous
Not applicable
423 Views
1 Reply
Message 1 of 2

Problem With Hatch Showing Solid

Anonymous
Not applicable

For some reason, When I add a hatch entity to my drawing from the API it shows up solid. If i click on it and bounce between pattern types it shows up normal... Any ideas? Below is the code snippet where I generate the hatch:

using (Polyline HatchL = new Polyline())
{
    HatchL.AddVertexAt(0, new Point2d(Top.StartPoint.X, Top.StartPoint.Y), 0, 0, 0);
    HatchL.AddVertexAt(1, new Point2d(PanODL.StartPoint.X, PanODL.StartPoint.Y), 0, 0, 0);
    HatchL.AddVertexAt(2, new Point2d(PanODL.EndPoint.X, PanODL.EndPoint.Y), 0, 0, 0);
    HatchL.AddVertexAt(3, new Point2d(PanIDL.EndPoint.X, PanIDL.EndPoint.Y), 0, 0, 0);
    HatchL.AddVertexAt(4, new Point2d(PanIDL.StartPoint.X, PanIDL.StartPoint.Y), 0, 0, 0);
    HatchL.AddVertexAt(5, new Point2d(RingIDL.StartPoint.X, RingIDL.StartPoint.Y), 0, 0, 0);
    HatchL.AddVertexAt(6, new Point2d(RingIDL.EndPoint.X, RingIDL.EndPoint.Y), 0, 0, 0);
    HatchL.AddVertexAt(7, new Point2d(LeftSide.EndPoint.X, LeftSide.EndPoint.Y), 0, 0, 0);
    HatchL.AddVertexAt(8, new Point2d(Top.StartPoint.X, Top.StartPoint.Y), 0, 0, 0);

    blkRecord.AppendEntity(HatchL);
    tr.AddNewlyCreatedDBObject(HatchL, true);

    ObjectIdCollection col = new ObjectIdCollection();
    col.Add(HatchL.ObjectId);

    using (Hatch h = new Hatch())
    {
        blkRecord.AppendEntity(h);
        tr.AddNewlyCreatedDBObject(h, true);
        h.SetDatabaseDefaults();
        h.SetHatchPattern(HatchPatternType.PreDefined, "ANSI32");
        h.Associative = true;
        h.AppendLoop(HatchLoopTypes.Outermost, col);
        h.EvaluateHatch(true);
        h.Layer = "10";
    }
}

 

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

Virupaksha_aithal
Autodesk Support
Autodesk Support

Hi,

 

Your code looks fine to me...The blog https://adndevblog.typepad.com/autocad/2012/07/hatch-using-the-autocad-net-api.html shows adding Hatch... see if the devblog sample is working at your end.

 

 



Virupaksha Aithal KM
Developer Technical Services
Autodesk Developer Network

0 Likes