<?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 Re: Associative Hatch Error in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/3565430#M83582</link>
    <description>&lt;P&gt;Try add PatternAngle right after this line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MyHatch.AppendLoop(HatchLoopTypes.Outermost, IDS)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just an idea, sorry, I can't check it now&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Aug 2012 22:07:07 GMT</pubDate>
    <dc:creator>Hallex</dc:creator>
    <dc:date>2012-08-03T22:07:07Z</dc:date>
    <item>
      <title>Associative Hatch Error</title>
      <link>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/1451955#M83573</link>
      <description>Hi, &lt;BR /&gt;
  I am writing a function to create Hatch. Everything works just fine except Associative. if I put the &lt;BR /&gt;
  oHatch.Associative = true;&lt;BR /&gt;
  get a error message: &lt;BR /&gt;
  eNotInDatabase&lt;BR /&gt;
  It will work if I remove this line. &lt;BR /&gt;
  does anybody know how to fix it? thank you very much. &lt;BR /&gt;
&lt;BR /&gt;
Here is the code:&lt;BR /&gt;
public static Hatch CreateHatch(Entity pline,  BlockTableRecord btr, short HatchColor,&lt;BR /&gt;
			string HatchLayer, string HatchPattern, double HatchScale, double HatchAngle, bool HatchAssociate)&lt;BR /&gt;
		{&lt;BR /&gt;
			if (pline == null) return null;&lt;BR /&gt;
&lt;BR /&gt;
			Database db = HostApplicationServices.WorkingDatabase;&lt;BR /&gt;
			Transaction trans = db.TransactionManager.StartTransaction();&lt;BR /&gt;
			Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;  &lt;BR /&gt;
&lt;BR /&gt;
			BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId,OpenMode.ForWrite);&lt;BR /&gt;
&lt;BR /&gt;
			bool IsSolid = (HatchPattern == "SOLID");&lt;BR /&gt;
&lt;BR /&gt;
			LayerLibrary.IsLayerLocked(HatchLayer);&lt;BR /&gt;
&lt;BR /&gt;
			if (HatchPattern.Substring(0,3).Equals("ISO")) {HatchPattern = "ACAD_" + HatchPattern;}&lt;BR /&gt;
&lt;BR /&gt;
			ObjectId oId;&lt;BR /&gt;
			if (HatchAssociate)&lt;BR /&gt;
			{&lt;BR /&gt;
				Entity pline2 = (Entity)trans.GetObject(pline.ObjectId,OpenMode.ForWrite);&lt;BR /&gt;
				oId = pline2.ObjectId;&lt;BR /&gt;
			}&lt;BR /&gt;
			else { oId = pline.ObjectId;}&lt;BR /&gt;
&lt;BR /&gt;
			ObjectIdCollection ObjIds = new ObjectIdCollection();&lt;BR /&gt;
			ObjIds.Add(oId);&lt;BR /&gt;
&lt;BR /&gt;
			Hatch oHatch = new Hatch();&lt;BR /&gt;
			try &lt;BR /&gt;
			{&lt;BR /&gt;
				oHatch.SetHatchPattern(HatchPatternType.PreDefined,HatchPattern);&lt;BR /&gt;
				oHatch.AppendLoop(0, ObjIds);&lt;BR /&gt;
&lt;BR /&gt;
				oHatch.Layer = HatchLayer;&lt;BR /&gt;
				oHatch.ColorIndex = HatchColor;&lt;BR /&gt;
				oHatch.Associative = HatchAssociate;&lt;BR /&gt;
&lt;BR /&gt;
				if (!IsSolid)&lt;BR /&gt;
				{&lt;BR /&gt;
					oHatch.PatternAngle = HatchAngle;&lt;BR /&gt;
					oHatch.PatternScale = HatchScale;&lt;BR /&gt;
				}&lt;BR /&gt;
&lt;BR /&gt;
				oHatch.EvaluateHatch(true);&lt;BR /&gt;
				btr.AppendEntity(oHatch);&lt;BR /&gt;
				trans.AddNewlyCreatedDBObject(oHatch,true);&lt;BR /&gt;
				trans.Commit();&lt;BR /&gt;
			}&lt;BR /&gt;
			catch (System.Exception caught)&lt;BR /&gt;
			{&lt;BR /&gt;
				// ddebug &lt;BR /&gt;
				ed.WriteMessage(caught.Message.ToString());&lt;BR /&gt;
				oHatch = null;&lt;BR /&gt;
			}&lt;BR /&gt;
			finally&lt;BR /&gt;
			{&lt;BR /&gt;
				trans.Dispose();&lt;BR /&gt;
			}&lt;BR /&gt;
			return oHatch;&lt;BR /&gt;
		}&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Wes</description>
      <pubDate>Wed, 05 Oct 2005 21:04:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/1451955#M83573</guid>
      <dc:creator>wesbird</dc:creator>
      <dc:date>2005-10-05T21:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: Associative Hatch Error</title>
      <link>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/1451956#M83574</link>
      <description>The error message is telling you exactly what to do. &lt;BR /&gt;
&lt;BR /&gt;
The hatch must be added to the database first so the objectId of the hatch can be used to establish the relation between it and the boundary entities.&lt;BR /&gt;
&lt;BR /&gt;
Try calling AddNewlyCreated first then set the associative flag to true. &lt;BR /&gt;
&lt;BR /&gt;
You also should call Trans.Abort() in your catch block and also call oHatch.Dispose when you are done with the hatch object. &lt;BR /&gt;
&lt;BR /&gt;
Chris Arps</description>
      <pubDate>Thu, 06 Oct 2005 12:29:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/1451956#M83574</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-06T12:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: Associative Hatch Error</title>
      <link>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/1451957#M83575</link>
      <description>Thank you, Chris.&lt;BR /&gt;
I move &lt;BR /&gt;
oHatch.Associative = HatchAssociate;&lt;BR /&gt;
right after &lt;BR /&gt;
trans.AddNewlyCreatedDBObject(oHatch,true);&lt;BR /&gt;
it do create Hatch without error message but the hatch is non-associated. &lt;BR /&gt;
&lt;BR /&gt;
so I add &lt;BR /&gt;
oHatch.EvaluateHatch(true);&lt;BR /&gt;
after Associative&lt;BR /&gt;
still not associated. &lt;BR /&gt;
&lt;BR /&gt;
I go back and check AutoCAD Managed Class Reference, under AcDbHatch Class, there are sample code in C++, which did not required Associate after add to database. &lt;BR /&gt;
&lt;BR /&gt;
here is the code: &lt;BR /&gt;
Acad::ErrorStatus acqHatch1() &lt;BR /&gt;
{&lt;BR /&gt;
    AcDbHatch* pHatch = new AcDbHatch();&lt;BR /&gt;
&lt;BR /&gt;
    // Set hatch plane&lt;BR /&gt;
    //&lt;BR /&gt;
    AcGeVector3d normal(0.0, 0.0, 1.0);&lt;BR /&gt;
    pHatch-&amp;gt;setNormal(normal);&lt;BR /&gt;
    pHatch-&amp;gt;setElevation(0.0);&lt;BR /&gt;
&lt;BR /&gt;
    // Set non associative hatch&lt;BR /&gt;
    //&lt;BR /&gt;
    pHatch-&amp;gt;setAssociative(Adesk::kFalse);&lt;BR /&gt;
&lt;BR /&gt;
    // Set hatch pattern to SolidFill type&lt;BR /&gt;
    //&lt;BR /&gt;
    pHatch-&amp;gt;setPattern(AcDbHatch::kPreDefined, "SOLID");&lt;BR /&gt;
&lt;BR /&gt;
    // Set hatch style to kNormal&lt;BR /&gt;
    //&lt;BR /&gt;
    pHatch-&amp;gt;setHatchStyle(AcDbHatch::kNormal);&lt;BR /&gt;
&lt;BR /&gt;
   ...&lt;BR /&gt;
&lt;BR /&gt;
    // Append an external loop (rectangle) to hatch boundary&lt;BR /&gt;
    &lt;BR /&gt;
    pHatch-&amp;gt;appendLoop(AcDbHatch::kExternal, vertexPts, vertexBulges); &lt;BR /&gt;
&lt;BR /&gt;
    ...&lt;BR /&gt;
    // Append an internal circular loop to hatch boundary &lt;BR /&gt;
    //&lt;BR /&gt;
    AcGeIntArray edgeTypes;&lt;BR /&gt;
    AcGeVoidPointerArray edgePtrs;&lt;BR /&gt;
    edgeTypes.append(AcDbHatch::kCirArc);&lt;BR /&gt;
    edgePtrs.append((void*)cirArc);&lt;BR /&gt;
    pHatch-&amp;gt;appendLoop(AcDbHatch::kDefault, edgePtrs, edgeTypes);&lt;BR /&gt;
    &lt;BR /&gt;
    // Elaborate solid fill&lt;BR /&gt;
    //&lt;BR /&gt;
    pHatch-&amp;gt;evaluateHatch();&lt;BR /&gt;
&lt;BR /&gt;
   ...&lt;BR /&gt;
&lt;BR /&gt;
Any idea? Thank you very much. &lt;BR /&gt;
Wes&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Update: &lt;BR /&gt;
In same help file, Property Associative is wrapped from AcDbHatch::associative and AcDbHatch::setAssociative, &lt;BR /&gt;
in help item for AcDbHatch::setAssociative&lt;BR /&gt;
"This function sets the associativity flag to true or false for the hatch entity. To create an associative hatch entity, you must use this function and set the associativity flag to true before you begin to build the boundary loops using the appendLoop(loopType, dbObjIds) or insertLoopAt(loopIndex, loopType, dbObjIds) functions. "&lt;BR /&gt;
so I move &lt;BR /&gt;
oHatch.Associative = HatchAssociate;&lt;BR /&gt;
before &lt;BR /&gt;
oHatch.AppendLoop(0, ObjIds);&lt;BR /&gt;
error message:&lt;BR /&gt;
eNotInDatabase&lt;BR /&gt;
Message was edited by: weslleywang

Message was edited by: weslleywang</description>
      <pubDate>Thu, 06 Oct 2005 13:37:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/1451957#M83575</guid>
      <dc:creator>wesbird</dc:creator>
      <dc:date>2005-10-06T13:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: Associative Hatch Error</title>
      <link>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/1451958#M83576</link>
      <description>Since you are adding loops by objectid,  then the hatch must be added to the database before calling appendLoop. &lt;BR /&gt;
&lt;BR /&gt;
If you set the associative property to true, then the hatch tries to setup a reactor/relationship to the polyline. &lt;BR /&gt;
&lt;BR /&gt;
Try AddObject, set associative to true, then Addloops. &lt;BR /&gt;
&lt;BR /&gt;
Chris Arps</description>
      <pubDate>Thu, 06 Oct 2005 14:52:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/1451958#M83576</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-06T14:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: Associative Hatch Error</title>
      <link>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/1451959#M83577</link>
      <description>Not working. error message: eAmbiguousOutput&lt;BR /&gt;
Here is the code:&lt;BR /&gt;
Hatch oHatch = new Hatch();&lt;BR /&gt;
			try &lt;BR /&gt;
			{&lt;BR /&gt;
				oHatch.SetHatchPattern(HatchPatternType.PreDefined,HatchPattern);&lt;BR /&gt;
&lt;BR /&gt;
				oHatch.Layer = HatchLayer;&lt;BR /&gt;
				oHatch.ColorIndex = HatchColor;&lt;BR /&gt;
&lt;BR /&gt;
				if (!IsSolid)&lt;BR /&gt;
				{&lt;BR /&gt;
					oHatch.PatternAngle = HatchAngle;&lt;BR /&gt;
					oHatch.PatternScale = HatchScale;&lt;BR /&gt;
				}&lt;BR /&gt;
&lt;BR /&gt;
				oHatch.EvaluateHatch(true);&lt;BR /&gt;
				btr.AppendEntity(oHatch);&lt;BR /&gt;
				trans.AddNewlyCreatedDBObject(oHatch,true);&lt;BR /&gt;
&lt;BR /&gt;
				// todo &lt;BR /&gt;
				oHatch.Associative = HatchAssociate;&lt;BR /&gt;
				oHatch.AppendLoop(0, ObjIds);&lt;BR /&gt;
&lt;BR /&gt;
				oHatch.EvaluateHatch(true);&lt;BR /&gt;
				&lt;BR /&gt;
				trans.Commit();&lt;BR /&gt;
				oHatch.Dispose();&lt;BR /&gt;
			}</description>
      <pubDate>Thu, 06 Oct 2005 15:14:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/1451959#M83577</guid>
      <dc:creator>wesbird</dc:creator>
      <dc:date>2005-10-06T15:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Associative Hatch Error</title>
      <link>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/1451960#M83578</link>
      <description>There is a sample of adding a hatch in ObjectArx sdk, but it works differently in dotnet. &lt;BR /&gt;
&lt;BR /&gt;
Here is VB code that works: &lt;BR /&gt;
&lt;BR /&gt;
        Public Sub TestHatch()&lt;BR /&gt;
        ' method was gleaned from ObjectArx2006 samples, file EntMakeTest.cpp &lt;BR /&gt;
        ' &lt;BR /&gt;
        Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database&lt;BR /&gt;
        Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor&lt;BR /&gt;
        Dim selOpts As New PromptSelectionOptions()&lt;BR /&gt;
        Dim res As PromptSelectionResult&lt;BR /&gt;
&lt;BR /&gt;
        selOpts.SingleOnly = True&lt;BR /&gt;
        selOpts.MessageForAdding = "Select a closed polyline"&lt;BR /&gt;
&lt;BR /&gt;
        res = ed.GetSelection(selOpts)&lt;BR /&gt;
        If res.Status &amp;lt;&amp;gt; PromptStatus.OK Then Return&lt;BR /&gt;
        Dim selId As ObjectId = res.Value.GetObjectIds(0)&lt;BR /&gt;
        Dim tm As Autodesk.AutoCAD.DatabaseServices.TransactionManager = db.TransactionManager&lt;BR /&gt;
        Dim trans As Transaction = tm.StartTransaction&lt;BR /&gt;
        Try&lt;BR /&gt;
            Dim objIds As New ObjectIdCollection()&lt;BR /&gt;
            objIds.Add(selId)&lt;BR /&gt;
&lt;BR /&gt;
            Dim hat As New Hatch()&lt;BR /&gt;
            With hat&lt;BR /&gt;
                .SetDatabaseDefaults()&lt;BR /&gt;
                .Layer = "0"&lt;BR /&gt;
                .PatternAngle = 0.0&lt;BR /&gt;
                .PatternScale = 100.0  ' I use ADT Imperial, so this works mo betta &lt;BR /&gt;
                ' DEFECT: must set pattern last or angle and scale do not work &lt;BR /&gt;
                .SetHatchPattern(HatchPatternType.PreDefined, "ANGLE")&lt;BR /&gt;
            End With&lt;BR /&gt;
            Dim bt As BlockTable = trans.GetObject(db.BlockTableId, OpenMode.ForRead, False)&lt;BR /&gt;
            Dim btr As BlockTableRecord = trans.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite, False)&lt;BR /&gt;
&lt;BR /&gt;
            btr.AppendEntity(hat)&lt;BR /&gt;
            trans.AddNewlyCreatedDBObject(hat, True)&lt;BR /&gt;
            'enum HatchLoopType &lt;BR /&gt;
&lt;BR /&gt;
            'kDefault 0 	The loop type hasn't been specified yet. &lt;BR /&gt;
            '		        It turns to a "real" value as soon as some real loops get created. &lt;BR /&gt;
            'kExternal 1 	A loop that consists of external entities (derived from AcDbEntity and owned by &lt;BR /&gt;
            '               an AcDbDatabase). The hatch might be associative to these entities. &lt;BR /&gt;
            'kPolyline 2 	The hatch loop consists of a polyline (AcGe geometry, not AcDb geometry). &lt;BR /&gt;
            'kDerived 4 	A loop that was derived by AutoCAD's boundary tracer from a picked point. &lt;BR /&gt;
            'kTextbox 8 	A loop that consists of a box around an existing text object (AcDbText). &lt;BR /&gt;
            'kOutermost 	0x10 The outermost loop of this hatch. &lt;BR /&gt;
            'kNotClosed 	0x20 A loop that is not closed. &lt;BR /&gt;
            'kSelfIntersecting 0x40 A loop that intersects with itself. &lt;BR /&gt;
            'kTextIsland 0x80 Text loops that are surrounded by even number of outer loops. &lt;BR /&gt;
            '		Text island loops are avoided when performing solid fill. &lt;BR /&gt;
&lt;BR /&gt;
            hat.Associative = True&lt;BR /&gt;
            hat.AppendLoop(1, objIds)&lt;BR /&gt;
            hat.EvaluateHatch(False)&lt;BR /&gt;
            hat.Dispose()&lt;BR /&gt;
            trans.Commit()&lt;BR /&gt;
        Catch ex As Exception&lt;BR /&gt;
            MsgBox(ex.Message)&lt;BR /&gt;
            trans.Abort()&lt;BR /&gt;
        Finally&lt;BR /&gt;
            trans.Dispose()&lt;BR /&gt;
            tm.Dispose()&lt;BR /&gt;
        End Try&lt;BR /&gt;
    End Sub</description>
      <pubDate>Thu, 06 Oct 2005 18:42:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/1451960#M83578</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-06T18:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Associative Hatch Error</title>
      <link>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/1451961#M83579</link>
      <description>Thank you, this time it works. &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Wes</description>
      <pubDate>Thu, 06 Oct 2005 19:55:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/1451961#M83579</guid>
      <dc:creator>wesbird</dc:creator>
      <dc:date>2005-10-06T19:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Associative Hatch Error</title>
      <link>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/3565412#M83580</link>
      <description>&lt;P&gt;I'm trying to add a hatch to a block I'm creating.&amp;nbsp; Whenever I try to set the hatch's "PatternAngle", I get a 'eInvalidInput' exception.&amp;nbsp; I'm just trying to set it to 45 degrees, which works fine creating a hatch manually in the GUI.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Try&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim myDWG As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim myDB As Database = myDWG.Database&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim myTrans As Transaction = myDB.TransactionManager.StartTransaction&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim BlockName As String = "MyBlock"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim BasePoint As New Point3d(0, 0, 0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim docloc As DocumentLock = myDWG.LockDocument&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Using (docloc)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Using (myTrans)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Layers.SetLayer("MODULES-HATCH")&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim MyBT As BlockTable = CType(myTrans.GetObject(myDB.BlockTableId, OpenMode.ForWrite), BlockTable)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For Each ObjID As ObjectId In MyBT&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Dim MyBTR As BlockTableRecord = CType(myTrans.GetObject(ObjID, OpenMode.ForWrite), BlockTableRecord)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;If (MyBTR.Name = BlockName) Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim MyPL2 As New Polyline&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' bounding rectangle&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyPL2.AddVertexAt(0, New Point2d(LowerLeft.X + 1, LowerLeft.Y + 1), 0, 0, 0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyPL2.AddVertexAt(1, New Point2d(UpperRight.X - 1, LowerLeft.Y + 1), 0, 0, 0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyPL2.AddVertexAt(2, New Point2d(UpperRight.X - 1, UpperRight.Y - 1), 0, 0, 0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyPL2.AddVertexAt(3, New Point2d(LowerLeft.X + 1, UpperRight.Y - 1), 0, 0, 0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyPL2.AddVertexAt(4, New Point2d(LowerLeft.X + 1, LowerLeft.Y + 1), 0, 0, 0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyBTR.AppendEntity(MyPL2)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myTrans.AddNewlyCreatedDBObject(MyPL2, True)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim IDS As ObjectIdCollection = New ObjectIdCollection()&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IDS.Add(MyPL2.ObjectId)&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim MyHatch As Hatch = New Hatch()&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyBTR.AppendEntity(MyHatch)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myTrans.AddNewlyCreatedDBObject(MyHatch, True)&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyHatch.SetDatabaseDefaults()&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'MyHatch.PatternAngle = 45.0&amp;nbsp; &amp;lt;--- causes "eInvalidInput" exception&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyHatch.PatternScale = 64.0&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyHatch.SetHatchPattern(HatchPatternType.PreDefined, "ANSI37")&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyHatch.Associative = True&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyHatch.AppendLoop(HatchLoopTypes.Outermost, IDS)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyHatch.EvaluateHatch(False)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyHatch.Dispose()&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;End If&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;'EntLib.Debug("Block Name = " &amp;amp; MyBTR.Name)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myTrans.Commit()&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;End Using&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Using&lt;BR /&gt;Catch ex As System.Exception&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog(ex.Message)&lt;BR /&gt;End Try&lt;BR /&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Aug 2012 21:39:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/3565412#M83580</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-03T21:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Associative Hatch Error</title>
      <link>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/3565414#M83581</link>
      <description>&lt;P&gt;BTW, the angle itself doesn't matter, even with "0.0" as the angle, still get the exception.&amp;nbsp; Also tried 45 degrees converted to radians (Math.PI / 180.0) * 45.0.&amp;nbsp; Same result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gary&lt;/P&gt;</description>
      <pubDate>Fri, 03 Aug 2012 21:44:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/3565414#M83581</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-03T21:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: Associative Hatch Error</title>
      <link>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/3565430#M83582</link>
      <description>&lt;P&gt;Try add PatternAngle right after this line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MyHatch.AppendLoop(HatchLoopTypes.Outermost, IDS)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just an idea, sorry, I can't check it now&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Aug 2012 22:07:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/3565430#M83582</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-08-03T22:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: Associative Hatch Error</title>
      <link>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/3565788#M83583</link>
      <description>&lt;P&gt;This link is in C#.&amp;nbsp; But anyway, check it out.&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://adndevblog.typepad.com/autocad/2012/07/hatch-using-the-autocad-net-api.html"&gt;http://adndevblog.typepad.com/autocad/2012/07/hatch-using-the-autocad-net-api.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Aug 2012 02:23:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/associative-hatch-error/m-p/3565788#M83583</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-05T02:23:39Z</dc:date>
    </item>
  </channel>
</rss>

