Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Experts,
I am trying to draw polyline with hatch, here Polyline is working as expected but hatching is NOT happening and am getting error 'eInvalidInput' at 'hatch.AppendLoop(HatchLoopTypes.Default, ids);' i tried ids.Add(pline.ObjectId); and ids.Add(pline.Id); but no luck, Could you please help me where i did mistake then will learn accordingly, below is my some of the code.
Thanks in Advance.
Polyline pline = new Polyline(pts.Count);
pline.Normal = normal;
foreach (Point3d pt in pts)
{
Point3d transformedPt = pt.TransformBy(ucs);
pline.AddVertexAt(pline.NumberOfVertices, plane.ParameterOf(transformedPt), 0, 0, 0);
}
var ids = new ObjectIdCollection();
ids.Add(pline.ObjectId);
// Now let's add the polyline to the modelspace
Transaction tr = db.TransactionManager.StartTransaction();
using (tr)
{
BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
BlockTableRecord btr = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
ObjectId plineId = btr.AppendEntity(pline);
tr.AddNewlyCreatedDBObject(pline, true);
var hatch = new Hatch();
hatch.SetHatchPattern(HatchPatternType.PreDefined, "SOLID");
//hatch.LayerId = hatchlayerId;
btr.AppendEntity(hatch);
tr.AddNewlyCreatedDBObject(hatch, true);
hatch.Associative = true;
hatch.AppendLoop(HatchLoopTypes.Default, ids);
hatch.EvaluateHatch(true);
tr.Commit();
ed.WriteMessage("\nPolyline entity is: " + plineId.ToString());
}
Solved! Go to Solution.