The code is just a snippet, used for testing.
Imports Autodesk.AutoCAD
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.ApplicationServices.Application
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.Interop
Imports Autodesk.AutoCAD.LayerManager
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.Windows
Imports System.Runtime.InteropServices
Public Class myClass
<CommandMethod("addline")> _
Public Sub addline()
Dim podTransMan As DatabaseServices.TransactionManager
Dim podTrans As DatabaseServices.Transaction
Dim podDwg As Document
podDwg = Application.DocumentManager.MdiActiveDocument
podTransMan = podDwg.TransactionManager
podTrans = podTransMan.StartTransaction
Dim X As Double
Dim newTransMan As DatabaseServices.TransactionManager = podDwg.TransactionManager
Dim newTrans As Transaction = newTransMan.StartTransaction
Dim BT As BlockTable = newTrans.GetObject(podDwg.Database.BlockTableId, OpenMode.ForRead)
Dim BTR As BlockTableRecord = newTrans.GetObject(BT("*Model_Space"), OpenMode.ForWrite)
Dim PtA As New Point3d(0, 0, 0)
Dim PtB As Point3d
For X = -3 To 3
PtB = New Point3d(X, 4, 0)
Dim newLine As New Line(PtA, PtB)
BTR.AppendEntity(newLine)
newTrans.AddNewlyCreatedDBObject(newLine, True)
Next
newTrans.Commit()
newTrans.Dispose()
newTransMan.Dispose()
End Sub
End Class
In the Application tab of properties, under application type, it only allows "WPF Application", "WPF Class Library", or "WPF Console Application".
In other programs I used "Class Library" as it was the default option. Those programs were writen a while ago on another computer. I got a new computer and installed the new template from AutoDesk. This new template just doesn't seem right.