.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Hatch dialog box

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Alexey_Terno
832 Views, 2 Replies

Hatch dialog box

Is it possible to show hatch dialog box using .NET?

I have found one old issue (link) but it does not work with AutoCAD 2014.

2 REPLIES 2
Message 2 of 3

Hi,

 

Please try with this code

There is a commnet from MathewWebber in the same link where you find the code.

 

 

Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.EditorInput
Imports System.Runtime.InteropServices
Imports System

Namespace HatchDialogTest

    Public Class Commands

        Private Declare Auto Function acedHatchPalletteDialog _
        Lib "acad.exe" _
        Alias "?acedHatchPalletteDialog@@YA_NPEB_W_NAEAPEA_W@Z" _
        (ByVal currentPattern As String, _
        ByVal showcustom As Boolean, _
        ByRef newpattern As IntPtr) As Boolean

        <CommandMethod("SHD")> _
        Public Sub ShowHatchDialog()

            Dim sHatchType As String = "ANGLE"
            Dim ptr As IntPtr
            Dim bRet As Boolean = _
              acedHatchPalletteDialog(sHatchType, _
                True, ptr)
            If bRet Then
                Dim sNewHatchType As String = _
                  Marshal.PtrToStringAuto(ptr)
                If sNewHatchType.ToString.Length > 0 Then
                    Dim ed As Editor
                    ed = _
                      Application.DocumentManager.MdiActiveDocument.Editor
                    ed.WriteMessage( _
                      vbLf + "Hatch type selected: " + sNewHatchType)
                End If
            End If

        End Sub

    End Class

End Namespace

 

Message 3 of 3

Yes - it's works!!!
Thanks a lot!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost