Hi,
I ' m new to this forum and i have a problem while creating a hatch using traceboundaries().
After i creating my hatch and setting hatchstyle to outer i does not show up. The border polylines is displayed but the hatch only shows up if i click on
any object and change its property.
I have no idea what the issue could be. I 've set all my system variables to the default. I tried it on various drawings and even on other autocad versions.
Once the hatch appears everything is working fine.
This issue is driving me nuts. Here is my Hatch creation code. Maybe someone sees something i don't.
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
PromptPointResult ppr = ed.GetPoint("\nSelect internal point: ");
if (ppr.Status != PromptStatus.OK) return;
DBObjectCollection objs = ed.TraceBoundary(ppr.Value, true);
if (objs.Count == 0) return;
using (Transaction tr = doc.TransactionManager.StartTransaction())
{
BlockTable acBlkTbl;
acBlkTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
// Open the Block table record Model space for write
BlockTableRecord acBlkTblRec;
acBlkTblRec = tr.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
using (Hatch hat
= new Hatch
()) {
acBlkTblRec.AppendEntity(hat);
tr.AddNewlyCreatedDBObject(hat, true);
hat.HatchStyle = HatchStyle.Outer;
hat.SetDatabaseDefaults();
hat.SetHatchPattern(HatchPatternType.PreDefined, "SOLID");
hat.Associative = true;
foreach (DBObject obj in objs)
{
Curve c = obj as Curve;
if (c != null)
{
ObjectId curveId = acBlkTblRec.AppendEntity(c);
tr.AddNewlyCreatedDBObject(c, true);
hat
.AppendLoop(HatchLoopTypes
.Default,
new ObjectIdCollection
() { curveId
}); }
}
hat.EvaluateHatch(true);
var ds
= new DrawStream
(); }
tr.Commit();
}
Any help would be greatly appreciated since i 'm working on this for days.
edit kdub: code tag for
code=csharp added.