Author Topic: Create an associative hatch using C#  (Read 2952 times)

0 Members and 1 Guest are viewing this topic.


  • Guest
Create an associative hatch using C#
« on: February 23, 2009, 08:12:47 AM »
You can create an associative hatch with the help of ARX:
But without ARX,how to create an associative hatch using C#?
The following post gives you the answer:


  • Water Moccasin
  • Posts: 1882
Re: Create an associative hatch using C#
« Reply #1 on: February 24, 2009, 05:16:20 PM »
It must be a  trick question but
Code: [Select]
public Hatch HatchPline(ObjectId id)
            Database db=HostApplicationServices.WorkingDatabase;
            Hatch h = new Hatch();
            ObjectIdCollection hs = new ObjectIdCollection();
            using(Transaction tr=db.TransactionManager.StartTransaction())
                Polyline p=tr.GetObject(id,OpenMode.ForRead) as Polyline;
                h.Normal = p.Normal;
                h.PatternScale = 1;
            using (Transaction tr = db.TransactionManager.StartTransaction())
                BlockTableRecord Cspace = tr.GetObject
                    (db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord;
                tr.AddNewlyCreatedDBObject(h, true);
                h.Associative = true;
                h.AppendLoop(HatchLoopTypes.External, hs);
            return h;

This makes associative hatch


  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2087
  • class keyThumper<T>:ILazy<T>
Re: Create an associative hatch using C#
« Reply #2 on: February 24, 2009, 06:46:53 PM »

I thought I'd posted one as well, but couldn't find it, so may have been dreaming    :|
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.