Try this:
Code:
<CommandMethod("BatM")> _
Public Sub BlockAtMid()
Dim startpunt() As Double = New Double() {0.0, 0.0, 0.0}
Dim eindpunt() As Double = New Double() {0.0, 0.0, 0.0}
Dim midden() As Double = New Double() {0.0, 0.0, 0.0}
Dim aanlegjaar As AcadBlockReference
Dim streng As AcadLine
Dim ThisDrawing As AcadDocument = Autodesk.AutoCAD.ApplicationServices.Application. _
DocumentManager.MdiActiveDocument.AcadDocument
' Get the first point without entering a base point
startpunt = ThisDrawing.Utility.GetPoint(, "What is the beginning of the line?: ")
eindpunt = ThisDrawing.Utility.GetPoint(startpunt, "What is the end of the line?: ")
midden(0) = (startpunt(0) + eindpunt(0)) / 2
midden(1) = startpunt(1) / 2 + eindpunt(1) / 2
midden(2) = startpunt(2) / 2 + eindpunt(2) / 2
streng = ThisDrawing.ModelSpace.AddLine(startpunt, eindpunt)
aanlegjaar = ThisDrawing.ModelSpace.InsertBlock(midden, "C:\block 1.dwg", 1, 1, 1, 0)
End Sub
Bookmarks