How to call acedGetPoint from VB.NET.

Tip By Autodesk AutoCAD Developer – Albert Szilvasy

The code:

<StructLayout(LayoutKind.Sequential)> _

Public Structure ads_point

    Public x As Double

    Public
y As Double

    Public
z As Double

End
Structure

<DllImport(“acad.exe”, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl)> _

Public Shared Function acedGetPoint(<InAttribute(), MarshalAs(UnmanagedType.AsAny)> ByVal start As Object, ByVal prompt As String, ByRef result As ads_point) As Int32

End Function




<CommandMethod(“acedGetPoint”)> _

Public Sub test()

    Dim pt As New ads_point()

    acedGetPoint(
Nothing, “gimme a point:”, pt)

    acedGetPoint(pt, “gimme another one:”, pt)

End Sub

 
Shaan Hurley
Shaan Hurley
Articles: 4658

Discover more from Between the Lines Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading