<?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: create hatch - valid values for PatternAngle in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6664553#M33961</link>
    <description>&lt;P&gt;hi !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the current version will be ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards Jan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    Public Function DrawTBLineStringHatch_Work(ByVal PolyFID As Long, _
                                     ByVal TbDoc As Autodesk.Map.IM.Forms.Document, _
                                     ByVal CreateHatch As Boolean, _
                                     Optional LineScale As Double = 1.0, _
                                     Optional RealDimension As Boolean = False, _
                                     Optional LineWidth As Double = 0.0, _
                                     Optional HatchColor As Integer = 256, _
                                     Optional HatchPatternName As String = "SOLID", _
                                     Optional HatchAssociative As Boolean = True, _
                                                                         Optional PatternScale As Double = 1.0, _
                                                                         Optional PatternAngle As Double = 0.0) As Integer

        Dim GeoCal As New EBL.MapService.Geometrie()
        Dim MapData As New EBL.MapService.MapData(TbDoc)
        Dim Delimeter As Integer = 0

        Dim LineStringPoint As Autodesk.Map.IM.Graphic.LinePoint = Nothing
        Dim LineStringPointStart As Autodesk.Map.IM.Graphic.LinePoint = Nothing

        Dim LinesStringFeature As Autodesk.Map.IM.Data.Feature
        Dim LinesStringTabelle As Autodesk.Map.IM.Data.FeatureClass

        ' Fehlerabfragen
        If HatchColor &amp;lt; 1 Or HatchColor &amp;gt; 256 Then HatchColor = 256
        If LineWidth &amp;lt; 0 Then LineWidth = 0
        If HatchPatternName.Length = 0 Then HatchPatternName = "SOLID"
        If PatternScale &amp;lt; 0 Then PatternScale = 1

        If RealDimension = True Then
            Delimeter = CInt(MapData.GetFeatureAttribut(PolyFID, "DIMENSION_2", "0", MapService.MapData.Genauigkeit.Meter))
            LineWidth = Delimeter / 1000
        End If

        LinesStringTabelle = TbDoc.Connection.FeatureClasses.GetFeatureClassWithFID(PolyFID)
        LinesStringFeature = LinesStringTabelle.GetFeature(PolyFID)

        Dim LineStringGeom As Autodesk.Map.IM.Graphic.Geometry
        Dim LineStringLine As Autodesk.Map.IM.Graphic.LineString

        LineStringGeom = LinesStringFeature.Geometry
        LineStringLine = CType(LineStringGeom, Autodesk.Map.IM.Graphic.LineString)

        If LineStringLine.Count = 1 Then
            Return 2
        End If

        LineStringPointStart = LineStringLine.Item(0)

        '' Get the current document and database
        Dim acDoc As Autodesk.AutoCAD.ApplicationServices.Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
        Dim acCurDb As Database = acDoc.Database
        Dim ErrDetail As String = ""

        Try
            ErrDetail = "Start a transaction"
            Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()

                ErrDetail = "Open the Block table for read"
                Dim acBlkTbl As BlockTable

                ErrDetail = "lock document"
                Using acDoc.LockDocument

                    acBlkTbl = CType(acTrans.GetObject(acCurDb.BlockTableId, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForRead), BlockTable)

                    ErrDetail = "Open the Block table record Model space for write"
                    Dim acBlkTblRec As BlockTableRecord

                    acBlkTblRec = CType(acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), Autodesk.AutoCAD.DatabaseServices.OpenMode.ForWrite), BlockTableRecord)

                    ErrDetail = "Create a PolyLine"
                    Using acPoly As Polyline = New Polyline()
                        acPoly.LinetypeScale = LineScale
                        acPoly.ConstantWidth = LineWidth

                        For i As Integer = 0 To LineStringLine.Count - 1
                            LineStringPoint = LineStringLine.Item(i)

                            ' handelt es sich um eine geschlossene Polylinie ?
                            If i = LineStringLine.Count - 1 Then
                                ' Endpunkt = Startpunkt
                                If GeoCal.GeomCalculation(LineStringPoint.X, LineStringPoint.Y, LineStringPointStart.X, LineStringPointStart.Y, MapService.Geometrie.WhatToCalculate.Länge2D) &amp;lt;= 0.001 Then
                                    ' geschlossene Polylinie
                                    acPoly.Closed = vbYes
                                Else
                                    ' offene Polylinie
                                    acPoly.AddVertexAt(0, New Point2d(LineStringPoint.X, LineStringPoint.Y), 0, 0, 0)

                                End If
                            Else
                                'normaler Stützpunkt
                                acPoly.AddVertexAt(0, New Point2d(LineStringPoint.X, LineStringPoint.Y), 0, 0, 0)

                            End If
                        Next i

                        Dim pLineId As ObjectId
                        pLineId = acBlkTblRec.AppendEntity(acPoly)
                        acTrans.AddNewlyCreatedDBObject(acPoly, True)

                        ' ------------------------------- erstellen einer Schraffur -------------------

                        If CreateHatch = True Then
                            ErrDetail = "Create Hatch-Object"

                            Dim ObjIds As New ObjectIdCollection()
                            ObjIds.Add(pLineId)

                            Dim oHatch As New Hatch()
                            acBlkTblRec.AppendEntity(oHatch)
                            acTrans.AddNewlyCreatedDBObject(oHatch, True)

                            Dim normal As Vector3d = Vector3d.ZAxis
                            ErrDetail = "Create Hatch-Object - Set HatchPatterName"
                            oHatch.SetHatchPattern(HatchPatternType.PreDefined, HatchPatternName)
                            oHatch.Normal = normal
                            oHatch.Elevation = 0.0
                            ErrDetail = "Create Hatch-Object - Set PatternScale"
                            oHatch.PatternScale = PatternScale
                            ErrDetail = "Create Hatch-Object - Set PatternAngle"
                            'oHatch.PatternAngle = PatternAngle
                            oHatch.PatternAngle = 2.0
                            ErrDetail = "Create Hatch-Object - Set HatchColor"
                            oHatch.ColorIndex = HatchColor
                            ErrDetail = "Create Hatch-Object - Set Associative"
                            oHatch.Associative = HatchAssociative
                            ErrDetail = "Create Hatch-Object - Append Loop"
                            oHatch.AppendLoop(HatchLoopTypes.Default, ObjIds)

                            'ErrDetail = "Create Hatch-Object - Create"
                            'acBlkTblRec.AppendEntity(oHatch)

                            'acTrans.AddNewlyCreatedDBObject(oHatch, True)
                            oHatch.EvaluateHatch(True)

                        End If ' CreateHatch

                    End Using 'Polyline


                End Using 'acDoc.LockDocument
                ErrDetail = "Save the changes and dispose of the transaction"
                acTrans.Commit()
            End Using 'acTrans

        Catch ex As Exception
            _TryReport.Show("unerwarteter Fehler in EBL.MapService &amp;gt; cls_Acad &amp;gt; DrawTBLineStringHatch_Work", "ErrDetail: " &amp;amp; ErrDetail &amp;amp; vbCrLf &amp;amp; vbCrLf &amp;amp; _
                            "PolyFID: " &amp;amp; PolyFID.ToString &amp;amp; vbCrLf &amp;amp; _
        "LineWidth: " &amp;amp; LineWidth.ToString &amp;amp; vbCrLf &amp;amp; _
                                "HatchColor: " &amp;amp; HatchColor.ToString &amp;amp; vbCrLf &amp;amp; _
        "HatchPatternName: " &amp;amp; HatchPatternName &amp;amp; vbCrLf &amp;amp; _
        "HatchAssociative: " &amp;amp; HatchAssociative.ToString &amp;amp; vbCrLf &amp;amp; _
        "PatternScale: " &amp;amp; PatternScale.ToString &amp;amp; vbCrLf &amp;amp; _
        "PatternAngle: " &amp;amp; PatternAngle.ToString &amp;amp; vbCrLf &amp;amp; ex.ToString
        )

            Return 1
        End Try


        Return 0
    End Function&lt;/PRE&gt;</description>
    <pubDate>Thu, 03 Nov 2016 11:13:36 GMT</pubDate>
    <dc:creator>jan_tappenbeck</dc:creator>
    <dc:date>2016-11-03T11:13:36Z</dc:date>
    <item>
      <title>create hatch - valid values for PatternAngle</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6660044#M33953</link>
      <description>&lt;P&gt;hi !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i try to create hatch by vb.net and i define the value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;oHatch.PatternAngle = PatternAngle&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in my try PatternAngle=0.0 and i get the message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Autodesk.AutoCAD.Runtime.Exception: eInvalidInput &amp;nbsp;&amp;nbsp; bei Autodesk.AutoCAD.DatabaseServices.Hatch.set_PatternAngle(Double angle)&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the error-catch will work direct behind the code-line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when i recommand the line it will be work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;could someone tell me the possible values?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;reagards Jan&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2016 15:18:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6660044#M33953</guid>
      <dc:creator>jan_tappenbeck</dc:creator>
      <dc:date>2016-11-01T15:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: create hatch - valid values for PatternAngle</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6660052#M33954</link>
      <description>&lt;P&gt;Are you setting &lt;SPAN&gt;oHatch.SetHatchPattern&lt;/SPAN&gt;(...) before oHatch.PatternAngle = PatternAngle&amp;nbsp; ?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2016 15:26:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6660052#M33954</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2016-11-01T15:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: create hatch - valid values for PatternAngle</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6661570#M33955</link>
      <description>&lt;P&gt;hi !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;no - here is the complet code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;...
Dim ObjIds As New ObjectIdCollection()
                        ObjIds.Add(pLineId)

                        Dim oHatch As New Hatch()
                        Dim normal As New Vector3d(0.0, 0.0, 1.0)
                        oHatch.Normal = normal
                        oHatch.Elevation = 0.0
                        oHatch.PatternScale = PatternScale
                        oHatch.PatternAngle = PatternAngle
                        oHatch.PatternAngle = 2.0

                        oHatch.SetHatchPattern(HatchPatternType.PreDefined, HatchPatternName)
                        oHatch.ColorIndex = HatchColor
                        acBlkTblRec.AppendEntity(oHatch)

                        acTrans.AddNewlyCreatedDBObject(oHatch, True)

                        oHatch.Associative = HatchAssociative

                        oHatch.AppendLoop(HatchLoopTypes.Default, ObjIds)
                        oHatch.EvaluateHatch(True)
...&lt;/PRE&gt;&lt;P&gt;regards Jan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 06:30:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6661570#M33955</guid>
      <dc:creator>jan_tappenbeck</dc:creator>
      <dc:date>2016-11-02T06:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: create hatch - valid values for PatternAngle</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6662210#M33956</link>
      <description>&lt;P&gt;Sorry, but you not given the full code, but some piece of code. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Compare with this test code and see video:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Imports System
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.EditorInput

&amp;lt;Assembly: CommandClass(GetType(Rivilis.TestHatch))&amp;gt; 
Namespace Rivilis
  Public Class TestHatch
    &amp;lt;CommandMethod("TestHatch")&amp;gt;
    Public Sub MyCommand()
      Dim doc As Document = Application.DocumentManager.MdiActiveDocument
      Dim ed As Editor = doc.Editor
      Dim per As PromptEntityResult = ed.GetEntity(vbCrLf + "Select closed polyline: ")
      If (per.Status &amp;lt;&amp;gt; PromptStatus.OK) Then
        Return
      End If
      Dim pLineId As ObjectId = per.ObjectId
      If Not pLineId.ObjectClass.IsDerivedFrom(RXClass.GetClass(GetType(Polyline))) Then
        ed.WriteMessage(vbCrLf + "It is not a Pilyline")
        Return
      End If

      Dim ObjIds As New ObjectIdCollection()
      ObjIds.Add(pLineId)

      Dim PatternScale As Double = 10
      Dim PatternAngle As Double = 2 ' In radians 
      Dim HatchPatternName As String = "LINE"
      Dim HatchColor As Integer = 1

      Dim tr As Transaction = doc.TransactionManager.StartTransaction

      Using (tr)
        Dim acBlkTblRec As BlockTableRecord = tr.GetObject(doc.Database.CurrentSpaceId, OpenMode.ForWrite)
        Dim oHatch As New Hatch()
        acBlkTblRec.AppendEntity(oHatch)
        tr.AddNewlyCreatedDBObject(oHatch, True)
        Dim normal As Vector3d = Vector3d.ZAxis
        oHatch.SetHatchPattern(HatchPatternType.PreDefined, HatchPatternName)
        oHatch.Normal = normal
        oHatch.Elevation = 0.0
        oHatch.PatternScale = PatternScale
        oHatch.PatternAngle = PatternAngle
        oHatch.ColorIndex = HatchColor
        oHatch.Associative = True

        oHatch.AppendLoop(HatchLoopTypes.Default, ObjIds)
        oHatch.EvaluateHatch(True)

        tr.Commit()
      End Using

    End Sub

  End Class

End Namespace&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="iframe-container"&gt;&lt;IFRAME src="https://screencast.autodesk.com/Embed/Timeline/1f9035e2-9585-4c1b-862a-d30470907bd9" scrolling="no" allowfullscreen="allowfullscreen" webkitallowfullscreen="webkitallowfullscreen" style="display: inline;" height="620" frameborder="0" width="640"&gt;&lt;/IFRAME&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 02 Nov 2016 13:01:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6662210#M33956</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2016-11-02T13:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: create hatch - valid values for PatternAngle</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6664399#M33957</link>
      <description>&lt;P&gt;hi !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for this very great example - but my problem is to recode this in my source.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here my whole code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; ''' &amp;lt;summary&amp;gt;
    ''' Zeichnen einer Polylinie nach den Definitionen eines LineString mit der Option auch eine Flächenfüllung zu erzeugen
    ''' &amp;lt;/summary&amp;gt;
    ''' &amp;lt;param name="PolyFID"&amp;gt;FID der Polylinie&amp;lt;/param&amp;gt;
    ''' &amp;lt;param name="LineScale"&amp;gt;optional Objektlinienfaktor (default: 1)&amp;lt;/param&amp;gt;
    ''' &amp;lt;param name="RealDimension"&amp;gt;optional maßstäbliche Darstellung der Rohrbreite (default: false)&amp;lt;/param&amp;gt;
    ''' &amp;lt;param name="LineWidth"&amp;gt;optional Linienbreite (default: 0)&amp;lt;/param&amp;gt;
    ''' &amp;lt;param name="HatchColor"&amp;gt;optional AcadIndexFarbe (default: 256 ... vonLayer)&amp;lt;/param&amp;gt;
    ''' &amp;lt;param name="HatchPatternName"&amp;gt;optional Schraffurmustername (default: Solid)&amp;lt;/param&amp;gt;
    ''' &amp;lt;param name="HatchAssociative"&amp;gt;optional Assoziativität (default: true)&amp;lt;/param&amp;gt;
    ''' &amp;lt;param name="PatternScale"&amp;gt;optional SchraffurMaszstab (default: 1.0)&amp;lt;/param&amp;gt;
    ''' &amp;lt;param name="PatternAngle"&amp;gt;optional SchraffurAusrichtungswinkel im ARC (default: 0.0)&amp;lt;/param&amp;gt;
    ''' &amp;lt;returns&amp;gt;Status 0 ... OK / 1 ... Fehler / 2... Polylinie mit einem Punkt&amp;lt;/returns&amp;gt;
    Public Function DrawTBLineStringHatch_Work(ByVal PolyFID As Long, _
                                     ByVal TbDoc As Autodesk.Map.IM.Forms.Document, _
                                     Optional LineScale As Double = 1.0, _
                                     Optional RealDimension As Boolean = False, _
                                     Optional LineWidth As Double = 0.0, _
                                     Optional HatchColor As Integer = 256, _
                                     Optional HatchPatternName As String = "SOLID", _
                                     Optional HatchAssociative As Boolean = True, _
                                                                         Optional PatternScale As Double = 1.0, _
                                                                         Optional PatternAngle As Double = 0.0) As Integer

        Dim GeoCal As New EBL.MapService.Geometrie()
        Dim MapData As New EBL.MapService.MapData(TbDoc)
        Dim Delimeter As Integer = 0

        Dim LineStringPoint As Autodesk.Map.IM.Graphic.LinePoint = Nothing
        Dim LineStringPointStart As Autodesk.Map.IM.Graphic.LinePoint = Nothing

        Dim LinesStringFeature As Autodesk.Map.IM.Data.Feature
        Dim LinesStringTabelle As Autodesk.Map.IM.Data.FeatureClass

        ' Fehlerabfragen
        If HatchColor &amp;lt; 1 Or HatchColor &amp;gt; 256 Then HatchColor = 256
        If LineWidth &amp;lt; 0 Then LineWidth = 0
        If HatchPatternName.Length = 0 Then HatchPatternName = "SOLID"
        If PatternScale &amp;lt; 0 Then PatternScale = 1

        If RealDimension = True Then
            Delimeter = CInt(MapData.GetFeatureAttribut(PolyFID, "DIMENSION_2", "0", MapService.MapData.Genauigkeit.Meter))
            LineWidth = Delimeter / 1000
        End If

        LinesStringTabelle = TbDoc.Connection.FeatureClasses.GetFeatureClassWithFID(PolyFID)
        LinesStringFeature = LinesStringTabelle.GetFeature(PolyFID)

        Dim LineStringGeom As Autodesk.Map.IM.Graphic.Geometry
        Dim LineStringLine As Autodesk.Map.IM.Graphic.LineString

        LineStringGeom = LinesStringFeature.Geometry
        LineStringLine = CType(LineStringGeom, Autodesk.Map.IM.Graphic.LineString)

        If LineStringLine.Count = 1 Then
            Return 2
        End If

        LineStringPointStart = LineStringLine.Item(0)

        '' Get the current document and database
        Dim acDoc As Autodesk.AutoCAD.ApplicationServices.Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
        Dim acCurDb As Database = acDoc.Database
        Dim ErrDetail As String = ""

        Try
            ErrDetail = "Start a transaction"
            Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()

                ErrDetail = "Open the Block table for read"
                Dim acBlkTbl As BlockTable

                ErrDetail = "lock document"
                Using acDoc.LockDocument

                    acBlkTbl = CType(acTrans.GetObject(acCurDb.BlockTableId, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForRead), BlockTable)

                    ErrDetail = "Open the Block table record Model space for write"
                    Dim acBlkTblRec As BlockTableRecord

                    acBlkTblRec = CType(acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), Autodesk.AutoCAD.DatabaseServices.OpenMode.ForWrite), BlockTableRecord)

                    ErrDetail = "Create a PolyLine"
                    Using acPoly As Polyline = New Polyline()
                        acPoly.LinetypeScale = LineScale
                        acPoly.ConstantWidth = LineWidth

                        For i As Integer = 0 To LineStringLine.Count - 1
                            LineStringPoint = LineStringLine.Item(i)

                            ' handelt es sich um eine geschlossene Polylinie ?
                            If i = LineStringLine.Count - 1 Then
                                ' Endpunkt = Startpunkt
                                If GeoCal.GeomCalculation(LineStringPoint.X, LineStringPoint.Y, LineStringPointStart.X, LineStringPointStart.Y, MapService.Geometrie.WhatToCalculate.Länge2D) &amp;lt;= 0.001 Then
                                    ' geschlossene Polylinie
                                    acPoly.Closed = vbYes
                                Else
                                    ' offene Polylinie
                                    acPoly.AddVertexAt(0, New Point2d(LineStringPoint.X, LineStringPoint.Y), 0, 0, 0)

                                End If
                            Else
                                'normaler Stützpunkt
                                acPoly.AddVertexAt(0, New Point2d(LineStringPoint.X, LineStringPoint.Y), 0, 0, 0)

                            End If
                        Next i

                        Dim pLineId As ObjectId
                        pLineId = acBlkTblRec.AppendEntity(acPoly)
                        acTrans.AddNewlyCreatedDBObject(acPoly, True)

                        ' ------------------------------- erstellen einer Schraffur -------------------

                        ErrDetail = "Create Hatch-Object"

                        Dim ObjIds As New ObjectIdCollection()
                        ObjIds.Add(pLineId)

                        Dim oHatch As New Hatch()
                        Dim normal As Vector3d = Vector3d.ZAxis
                        ErrDetail = "Create Hatch-Object - Set HatchPatterName"
                        oHatch.SetHatchPattern(HatchPatternType.PreDefined, HatchPatternName)
                        oHatch.Normal = normal
                        oHatch.Elevation = 0.0
                        ErrDetail = "Create Hatch-Object - Set PatternScale"
                        oHatch.PatternScale = PatternScale
                        ErrDetail = "Create Hatch-Object - Set PatternAngle"
                        'oHatch.PatternAngle = PatternAngle
                        oHatch.PatternAngle = 2.0
                        ErrDetail = "Create Hatch-Object - Set HatchColor"
                        oHatch.ColorIndex = HatchColor
                        ErrDetail = "Create Hatch-Object - Set Associative"
                        oHatch.Associative = HatchAssociative
                        ErrDetail = "Create Hatch-Object - Append Loop"
                        oHatch.AppendLoop(HatchLoopTypes.Default, ObjIds)

                        ErrDetail = "Create Hatch-Object - Create"
                        acBlkTblRec.AppendEntity(oHatch)

                        acTrans.AddNewlyCreatedDBObject(oHatch, True)


                        oHatch.EvaluateHatch(True)

                    End Using 'Polyline


                End Using 'acDoc.LockDocument
                ErrDetail = "Save the changes and dispose of the transaction"
                acTrans.Commit()
            End Using 'acTrans

        Catch ex As Exception
            _TryReport.Show("unerwarteter Fehler in EBL.MapService &amp;gt; cls_Acad &amp;gt; DrawTBLineStringHatch_Work", "ErrDetail: " &amp;amp; ErrDetail &amp;amp; vbCrLf &amp;amp; vbCrLf &amp;amp; _
                            "PolyFID: " &amp;amp; PolyFID.ToString &amp;amp; vbCrLf &amp;amp; _
        "LineWidth: " &amp;amp; LineWidth.ToString &amp;amp; vbCrLf &amp;amp; _
                                "HatchColor: " &amp;amp; HatchColor.ToString &amp;amp; vbCrLf &amp;amp; _
        "HatchPatternName: " &amp;amp; HatchPatternName &amp;amp; vbCrLf &amp;amp; _
        "HatchAssociative: " &amp;amp; HatchAssociative.ToString &amp;amp; vbCrLf &amp;amp; _
        "PatternScale: " &amp;amp; PatternScale.ToString &amp;amp; vbCrLf &amp;amp; _
        "PatternAngle: " &amp;amp; PatternAngle.ToString &amp;amp; vbCrLf &amp;amp; ex.ToString
        )

            Return 1
        End Try


        Return 0
    End Function&lt;/PRE&gt;&lt;P&gt;In this current version the error-function will start in the line&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;dim HatchAssociative as boolean = true
....
oHatch.Associative = HatchAssociative&lt;/PRE&gt;&lt;P&gt;could you look again ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the source to create the border-polyline will work!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards Jan &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 10:01:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6664399#M33957</guid>
      <dc:creator>jan_tappenbeck</dc:creator>
      <dc:date>2016-11-03T10:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: create hatch - valid values for PatternAngle</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6664415#M33958</link>
      <description>&lt;P&gt;Maybe you compare my code with your?&lt;/P&gt;
&lt;P&gt;In my code:&lt;/P&gt;
&lt;PRE&gt;Dim oHatch As New Hatch()
acBlkTblRec.AppendEntity(oHatch)
tr.AddNewlyCreatedDBObject(oHatch, True)
' After then I set other oHatch properties&lt;/PRE&gt;
&lt;P&gt;In your code you:&lt;/P&gt;
&lt;PRE&gt;Dim oHatch As New Hatch()
' Here you set other oHatch properties
acBlkTblRec.AppendEntity(oHatch)
acTrans.AddNewlyCreatedDBObject(oHatch, True)
&lt;/PRE&gt;
&lt;P&gt;There is different order of settings.&lt;/P&gt;
&lt;P&gt;Also I recommend to split transaction on two parts:&lt;/P&gt;
&lt;P&gt;1. First transaction have to create Polyline.&lt;/P&gt;
&lt;P&gt;2. Second transaction have to create Hatch used ObjectId of created Polyline in first transaction.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 10:13:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6664415#M33958</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2016-11-03T10:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: create hatch - valid values for PatternAngle</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6664481#M33959</link>
      <description>&lt;P&gt;hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;know it look like it will works!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks! or i call back again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards Jan&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 10:37:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6664481#M33959</guid>
      <dc:creator>jan_tappenbeck</dc:creator>
      <dc:date>2016-11-03T10:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: create hatch - valid values for PatternAngle</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6664537#M33960</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3357387"&gt;@jan_tappenbeck&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;...thanks! or i call back again...&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In any case, please, inform me about results.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 11:06:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6664537#M33960</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2016-11-03T11:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: create hatch - valid values for PatternAngle</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6664553#M33961</link>
      <description>&lt;P&gt;hi !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the current version will be ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards Jan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    Public Function DrawTBLineStringHatch_Work(ByVal PolyFID As Long, _
                                     ByVal TbDoc As Autodesk.Map.IM.Forms.Document, _
                                     ByVal CreateHatch As Boolean, _
                                     Optional LineScale As Double = 1.0, _
                                     Optional RealDimension As Boolean = False, _
                                     Optional LineWidth As Double = 0.0, _
                                     Optional HatchColor As Integer = 256, _
                                     Optional HatchPatternName As String = "SOLID", _
                                     Optional HatchAssociative As Boolean = True, _
                                                                         Optional PatternScale As Double = 1.0, _
                                                                         Optional PatternAngle As Double = 0.0) As Integer

        Dim GeoCal As New EBL.MapService.Geometrie()
        Dim MapData As New EBL.MapService.MapData(TbDoc)
        Dim Delimeter As Integer = 0

        Dim LineStringPoint As Autodesk.Map.IM.Graphic.LinePoint = Nothing
        Dim LineStringPointStart As Autodesk.Map.IM.Graphic.LinePoint = Nothing

        Dim LinesStringFeature As Autodesk.Map.IM.Data.Feature
        Dim LinesStringTabelle As Autodesk.Map.IM.Data.FeatureClass

        ' Fehlerabfragen
        If HatchColor &amp;lt; 1 Or HatchColor &amp;gt; 256 Then HatchColor = 256
        If LineWidth &amp;lt; 0 Then LineWidth = 0
        If HatchPatternName.Length = 0 Then HatchPatternName = "SOLID"
        If PatternScale &amp;lt; 0 Then PatternScale = 1

        If RealDimension = True Then
            Delimeter = CInt(MapData.GetFeatureAttribut(PolyFID, "DIMENSION_2", "0", MapService.MapData.Genauigkeit.Meter))
            LineWidth = Delimeter / 1000
        End If

        LinesStringTabelle = TbDoc.Connection.FeatureClasses.GetFeatureClassWithFID(PolyFID)
        LinesStringFeature = LinesStringTabelle.GetFeature(PolyFID)

        Dim LineStringGeom As Autodesk.Map.IM.Graphic.Geometry
        Dim LineStringLine As Autodesk.Map.IM.Graphic.LineString

        LineStringGeom = LinesStringFeature.Geometry
        LineStringLine = CType(LineStringGeom, Autodesk.Map.IM.Graphic.LineString)

        If LineStringLine.Count = 1 Then
            Return 2
        End If

        LineStringPointStart = LineStringLine.Item(0)

        '' Get the current document and database
        Dim acDoc As Autodesk.AutoCAD.ApplicationServices.Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
        Dim acCurDb As Database = acDoc.Database
        Dim ErrDetail As String = ""

        Try
            ErrDetail = "Start a transaction"
            Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()

                ErrDetail = "Open the Block table for read"
                Dim acBlkTbl As BlockTable

                ErrDetail = "lock document"
                Using acDoc.LockDocument

                    acBlkTbl = CType(acTrans.GetObject(acCurDb.BlockTableId, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForRead), BlockTable)

                    ErrDetail = "Open the Block table record Model space for write"
                    Dim acBlkTblRec As BlockTableRecord

                    acBlkTblRec = CType(acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), Autodesk.AutoCAD.DatabaseServices.OpenMode.ForWrite), BlockTableRecord)

                    ErrDetail = "Create a PolyLine"
                    Using acPoly As Polyline = New Polyline()
                        acPoly.LinetypeScale = LineScale
                        acPoly.ConstantWidth = LineWidth

                        For i As Integer = 0 To LineStringLine.Count - 1
                            LineStringPoint = LineStringLine.Item(i)

                            ' handelt es sich um eine geschlossene Polylinie ?
                            If i = LineStringLine.Count - 1 Then
                                ' Endpunkt = Startpunkt
                                If GeoCal.GeomCalculation(LineStringPoint.X, LineStringPoint.Y, LineStringPointStart.X, LineStringPointStart.Y, MapService.Geometrie.WhatToCalculate.Länge2D) &amp;lt;= 0.001 Then
                                    ' geschlossene Polylinie
                                    acPoly.Closed = vbYes
                                Else
                                    ' offene Polylinie
                                    acPoly.AddVertexAt(0, New Point2d(LineStringPoint.X, LineStringPoint.Y), 0, 0, 0)

                                End If
                            Else
                                'normaler Stützpunkt
                                acPoly.AddVertexAt(0, New Point2d(LineStringPoint.X, LineStringPoint.Y), 0, 0, 0)

                            End If
                        Next i

                        Dim pLineId As ObjectId
                        pLineId = acBlkTblRec.AppendEntity(acPoly)
                        acTrans.AddNewlyCreatedDBObject(acPoly, True)

                        ' ------------------------------- erstellen einer Schraffur -------------------

                        If CreateHatch = True Then
                            ErrDetail = "Create Hatch-Object"

                            Dim ObjIds As New ObjectIdCollection()
                            ObjIds.Add(pLineId)

                            Dim oHatch As New Hatch()
                            acBlkTblRec.AppendEntity(oHatch)
                            acTrans.AddNewlyCreatedDBObject(oHatch, True)

                            Dim normal As Vector3d = Vector3d.ZAxis
                            ErrDetail = "Create Hatch-Object - Set HatchPatterName"
                            oHatch.SetHatchPattern(HatchPatternType.PreDefined, HatchPatternName)
                            oHatch.Normal = normal
                            oHatch.Elevation = 0.0
                            ErrDetail = "Create Hatch-Object - Set PatternScale"
                            oHatch.PatternScale = PatternScale
                            ErrDetail = "Create Hatch-Object - Set PatternAngle"
                            'oHatch.PatternAngle = PatternAngle
                            oHatch.PatternAngle = 2.0
                            ErrDetail = "Create Hatch-Object - Set HatchColor"
                            oHatch.ColorIndex = HatchColor
                            ErrDetail = "Create Hatch-Object - Set Associative"
                            oHatch.Associative = HatchAssociative
                            ErrDetail = "Create Hatch-Object - Append Loop"
                            oHatch.AppendLoop(HatchLoopTypes.Default, ObjIds)

                            'ErrDetail = "Create Hatch-Object - Create"
                            'acBlkTblRec.AppendEntity(oHatch)

                            'acTrans.AddNewlyCreatedDBObject(oHatch, True)
                            oHatch.EvaluateHatch(True)

                        End If ' CreateHatch

                    End Using 'Polyline


                End Using 'acDoc.LockDocument
                ErrDetail = "Save the changes and dispose of the transaction"
                acTrans.Commit()
            End Using 'acTrans

        Catch ex As Exception
            _TryReport.Show("unerwarteter Fehler in EBL.MapService &amp;gt; cls_Acad &amp;gt; DrawTBLineStringHatch_Work", "ErrDetail: " &amp;amp; ErrDetail &amp;amp; vbCrLf &amp;amp; vbCrLf &amp;amp; _
                            "PolyFID: " &amp;amp; PolyFID.ToString &amp;amp; vbCrLf &amp;amp; _
        "LineWidth: " &amp;amp; LineWidth.ToString &amp;amp; vbCrLf &amp;amp; _
                                "HatchColor: " &amp;amp; HatchColor.ToString &amp;amp; vbCrLf &amp;amp; _
        "HatchPatternName: " &amp;amp; HatchPatternName &amp;amp; vbCrLf &amp;amp; _
        "HatchAssociative: " &amp;amp; HatchAssociative.ToString &amp;amp; vbCrLf &amp;amp; _
        "PatternScale: " &amp;amp; PatternScale.ToString &amp;amp; vbCrLf &amp;amp; _
        "PatternAngle: " &amp;amp; PatternAngle.ToString &amp;amp; vbCrLf &amp;amp; ex.ToString
        )

            Return 1
        End Try


        Return 0
    End Function&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Nov 2016 11:13:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6664553#M33961</guid>
      <dc:creator>jan_tappenbeck</dc:creator>
      <dc:date>2016-11-03T11:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: create hatch - valid values for PatternAngle</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6664572#M33962</link>
      <description>&lt;P&gt;No errors and exceptions?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 11:22:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-hatch-valid-values-for-patternangle/m-p/6664572#M33962</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2016-11-03T11:22:18Z</dc:date>
    </item>
  </channel>
</rss>

