TheSwamp
Code Red => .NET => Topic started by: ahlzl on February 23, 2009, 08:12:47 AM
-
You can create an associative hatch with the help of ARX: http://www.theswamp.org/index.php?topic=24025.msg290732#msg290732
But without ARX,how to create an associative hatch using C#?
The following post gives you the answer:
http://www.objectarx.net/bbs/viewthread.php?tid=2883&extra=page%3D1
-
It must be a trick question but
public Hatch HatchPline(ObjectId id)
{
Database db=HostApplicationServices.WorkingDatabase;
Hatch h = new Hatch();
ObjectIdCollection hs = new ObjectIdCollection();
hs.Add(id);
using(Transaction tr=db.TransactionManager.StartTransaction())
{
Polyline p=tr.GetObject(id,OpenMode.ForRead) as Polyline;
h.SetDatabaseDefaults();
h.Elevation=p.Elevation;
h.Normal = p.Normal;
h.PatternScale = 1;
h.SetHatchPattern(HatchPatternType.PreDefined,"ANSI31");
}
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockTableRecord Cspace = tr.GetObject
(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord;
Cspace.AppendEntity(h);
tr.AddNewlyCreatedDBObject(h, true);
h.Associative = true;
h.AppendLoop(HatchLoopTypes.External, hs);
tr.Commit();
}
return h;
}
This makes associative hatch
-
I thought I'd posted one as well, but couldn't find it, so may have been dreaming :|