Scuffle w AutoCAD programming using VB.NET (mainly)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Martha Pagka
    New Member
    • Apr 2011
    • 1

    Scuffle w AutoCAD programming using VB.NET (mainly)

    Hello. Me and my colleagues are trying to program an AutoCAD application using VB.NET (actually, VB 2008). We followed the below procedure closely:

    AutoCAD programming using VB.Net, C#.Net, AutoCAD Customization using Net


    You can program AutoCAD using VB.Net/C#.Net using following methos:

    1. Using ObjectARX managed wrapper classes
    2. Using AutoCAD COM APIs
    3. Using combination of both

    If you are currently using AutoCAD VBA then you can use AutoCAD COM APIs to start AutoCAD programming using .Net immediately.

    Procedure to use AutoCAD COM API with .Net is explained below:

    - Start Microsoft Visual Studio 2005
    - Create a new Class Library project in VB.Net
    - Add reference to AutoCAD Type Library (acax17enu.tlb) , AutoCAD / ObjectDBX Common Type Library (axdb17enu.tlb) , acdbmgd.dll and acmgd.dll.
    - Type the following code (This code creates a line)

    Imports Autodesk.AutoCA D.Runtime

    Public Class Class1
    <'CommandMethod ("MyLine")> _
    Public Shared Sub CreateLine()

    Dim AcadApp As Autodesk.AutoCA D.Interop.AcadA pplication
    Dim acaddoc As Autodesk.AutoCA D.Interop.AcadD ocument
    Dim pt As Object
    Dim pt1 As Object

    AcadApp = GetObject(, "Autocad.Applic ation")
    acaddoc = AcadApp.ActiveD ocument

    pt = acaddoc.Utility .GetPoint(, "Pick point:")
    pt1 = acaddoc.Utility .GetPoint(pt, "Pick second point:")

    acaddoc.ModelSp ace.AddLine(pt, pt1)

    End Sub
    End Class

    - Build Solutions
    - Start AutoCAD
    - Give NetLoad command
    - Select dll file created by above application
    - Once the loading is completed you can give MyLine command to take the trial of above program.

    _______________ _______________ _______________ _________

    However, with all the necessary adage of references intact, we encountered this error:

    "A project with an Output Type of Class Library cannot be started directly. In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project"

    What could be the solution to this? We foremost tried building the project without clicking F5 after creating a Windows app and changing the startup page, left with scant measures (i.e. double-checking the references if they are complete)to determine the best possible solution instantly.
Working...