<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Hatch C# in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/hatch-c/m-p/2038156#M77329</link>
    <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
I'm writing some code that lets to create Hatch programmatically&lt;BR /&gt;
something like this -&amp;gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
public Hatch hat;&lt;BR /&gt;
&lt;BR /&gt;
public void mtHatchobject(ObjectIdCollection myobjects, string lay)&lt;BR /&gt;
	    {&lt;BR /&gt;
	    	&lt;BR /&gt;
&lt;BR /&gt;
            hat = new Hatch();&lt;BR /&gt;
&lt;BR /&gt;
            hat.Associative = true;&lt;BR /&gt;
&lt;BR /&gt;
            hat.AppendLoop(0,myobjects );&lt;BR /&gt;
&lt;BR /&gt;
            hat.EvaluateHatch(true);&lt;BR /&gt;
            &lt;BR /&gt;
	    	 &lt;BR /&gt;
	    }&lt;BR /&gt;
Does anybody have a clue how I can do it ?</description>
    <pubDate>Tue, 07 Aug 2007 10:53:15 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2007-08-07T10:53:15Z</dc:date>
    <item>
      <title>Hatch C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/hatch-c/m-p/2038156#M77329</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
I'm writing some code that lets to create Hatch programmatically&lt;BR /&gt;
something like this -&amp;gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
public Hatch hat;&lt;BR /&gt;
&lt;BR /&gt;
public void mtHatchobject(ObjectIdCollection myobjects, string lay)&lt;BR /&gt;
	    {&lt;BR /&gt;
	    	&lt;BR /&gt;
&lt;BR /&gt;
            hat = new Hatch();&lt;BR /&gt;
&lt;BR /&gt;
            hat.Associative = true;&lt;BR /&gt;
&lt;BR /&gt;
            hat.AppendLoop(0,myobjects );&lt;BR /&gt;
&lt;BR /&gt;
            hat.EvaluateHatch(true);&lt;BR /&gt;
            &lt;BR /&gt;
	    	 &lt;BR /&gt;
	    }&lt;BR /&gt;
Does anybody have a clue how I can do it ?</description>
      <pubDate>Tue, 07 Aug 2007 10:53:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/hatch-c/m-p/2038156#M77329</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-08-07T10:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: Hatch C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/hatch-c/m-p/2038157#M77330</link>
      <description>This code allways works for me:&lt;BR /&gt;
&lt;BR /&gt;
public static void drawHatch(ObjectIdCollection idcBoundary, string pattern,&lt;BR /&gt;
 double angle, double scale, ObjectId layerid, int color)&lt;BR /&gt;
{&lt;BR /&gt;
 //Lock the document&lt;BR /&gt;
 ...&lt;BR /&gt;
&lt;BR /&gt;
 Database db = HostApplicationServices.WorkingDatabase;&lt;BR /&gt;
 Transaction trans = db.TransactionManager.StartTransaction();&lt;BR /&gt;
&lt;BR /&gt;
 Hatch oHatch = new Hatch();&lt;BR /&gt;
&lt;BR /&gt;
 //Define style&lt;BR /&gt;
 oHatch.PatternAngle = angle;&lt;BR /&gt;
 oHatch.PatternScale = scale;&lt;BR /&gt;
 oHatch.SetHatchPattern(HatchPatternType.PreDefined, pattern);&lt;BR /&gt;
 oHatch.LayerId = layerid;&lt;BR /&gt;
 oHatch.Color = caAcColors.getAciColorByNumber(color);&lt;BR /&gt;
&lt;BR /&gt;
 //Add to database&lt;BR /&gt;
 if (!btr.IsWriteEnabled) btr.UpgradeOpen();&lt;BR /&gt;
 id = btr.AppendEntity(oHatch);&lt;BR /&gt;
 trans.AddNewlyCreatedDBObject(oHatch, true);&lt;BR /&gt;
&lt;BR /&gt;
 oHatch.Associative = true;&lt;BR /&gt;
&lt;BR /&gt;
 //Define loops&lt;BR /&gt;
 oHatch.AppendLoop(HatchLoopTypes.Default, idcBoundary);&lt;BR /&gt;
&lt;BR /&gt;
 //Evaluate&lt;BR /&gt;
 oHatch.EvaluateHatch(true);&lt;BR /&gt;
&lt;BR /&gt;
 trans.Commit();&lt;BR /&gt;
&lt;BR /&gt;
 //Unlock the document&lt;BR /&gt;
 ...&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;TINT68&gt; schreef in bericht news:5681777@discussion.autodesk.com...&lt;BR /&gt;
Hello,&lt;BR /&gt;
&lt;BR /&gt;
I'm writing some code that lets to create Hatch programmatically&lt;BR /&gt;
something like this -&amp;gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
public Hatch hat;&lt;BR /&gt;
&lt;BR /&gt;
public void mtHatchobject(ObjectIdCollection myobjects, string lay)&lt;BR /&gt;
    {&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
            hat = new Hatch();&lt;BR /&gt;
&lt;BR /&gt;
            hat.Associative = true;&lt;BR /&gt;
&lt;BR /&gt;
            hat.AppendLoop(0,myobjects );&lt;BR /&gt;
&lt;BR /&gt;
            hat.EvaluateHatch(true);&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
    }&lt;BR /&gt;
Does anybody have a clue how I can do it ?&lt;/TINT68&gt;</description>
      <pubDate>Wed, 08 Aug 2007 10:13:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/hatch-c/m-p/2038157#M77330</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-08-08T10:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: Hatch C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/hatch-c/m-p/2038158#M77331</link>
      <description>I saw I did forgot something: before you can acces the blocktablerecord &lt;BR /&gt;
(btr) you first have to define it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
In the code below I did this by getting the "owner" of the first entity in &lt;BR /&gt;
the list of boundaries (usually this is modelspace).&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, &lt;BR /&gt;
OpenMode.ForRead);&lt;BR /&gt;
&lt;BR /&gt;
Entity ent = (Entity)trans.GetObject(idcBoundary[0], OpenMode.ForRead);&lt;BR /&gt;
&lt;BR /&gt;
BlockTableRecord btr = (BlockTableRecord)trans.GetObject(ent.BlockId, &lt;BR /&gt;
OpenMode.ForWrite);</description>
      <pubDate>Wed, 08 Aug 2007 12:12:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/hatch-c/m-p/2038158#M77331</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-08-08T12:12:00Z</dc:date>
    </item>
  </channel>
</rss>

