Hi ,
With below code you can start your project.

<CommandMethod("TRA")> Public Sub TriangleDraw()
'declare the form to open
Dim frmTriangle As TestTraingle = Nothing
If frmTriangle Is Nothing Then
frmTriangle = New TestTraingle()
ElseIf frmTriangle.IsDisposed Then
frmTriangle = New TestTraingle()
End If
'show the form
Application.ShowModelessDialog(Application.MainWindow.Handle, frmTriangle, False)
End Sub
Imports System.IO
Imports Microsoft.Office.Interop
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.DatabaseServices
Public Class TestTraingle
Dim tra_upperwidth As String = Nothing
Dim tra_lowerwidth As String = Nothing
Dim tra_height As String = Nothing
Private Sub TestTraingle_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Try
'place the excelfile path
Dim excelFilePath = "Place your excel file path"
If File.Exists(excelFilePath) Then
Call READEXCELFILE(excelFilePath)
End If
TextBox1.Text = tra_upperwidth
TextBox2.Text = tra_lowerwidth
TextBox3.Text = tra_height
Catch ex As System.Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
'get current document
Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim db As Database = doc.Database
'lock document as using modeless form
Using docLock As DocumentLock = doc.LockDocument
Using tx As Transaction = db.TransactionManager.StartTransaction()
'open blocktable
Dim bt As BlockTable = tx.GetObject(db.BlockTableId, OpenMode.ForRead)
'open model space for write
Dim ms As BlockTableRecord = tx.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
'converte text value
Dim uWidth As Double = CDbl(TextBox1.Text)
Dim base As Double = CDbl(TextBox2.Text)
Dim tHeight As Double = CDbl(TextBox3.Text)
Dim pt1 As Point2d = New Point2d(0, 0)
Dim pt2 As Point2d = New Point2d(base, 0)
Dim pt3 As Point2d = New Point2d(base / 2, tHeight)
'draw traiangle
Dim tra As Polyline = New Polyline()
tra.AddVertexAt(0, pt1, 0, 0, 0)
tra.AddVertexAt(1, pt2, 0, 0, 0)
tra.AddVertexAt(2, pt3, 0, 0, 0)
tra.Closed = True
'add triangle in model space
ms.AppendEntity(tra)
tx.AddNewlyCreatedDBObject(tra, True)
tx.Commit()
End Using
End Using
End Sub
Public Sub READEXCELFILE(filePath As String)
'read excel file
Try
Dim xlApp As New Excel.Application
Dim xlWorkBook As Excel.Workbook = xlApp.Workbooks.Open(filePath)
Dim xlSheet As Excel.Worksheet = xlWorkBook.Worksheets("Sheet1")
'get all cells value
tra_upperwidth = xlSheet.Cells(1, 2).Value
tra_lowerwidth = xlSheet.Cells(2, 2).Value
tra_height = xlSheet.Cells(3, 2).Value
xlWorkBook.Close()
'quit excel application
xlApp.Quit()
'relaese excel object
ReleaseExcelObject(xlWorkBook)
ReleaseExcelObject(xlApp)
Catch ex As System.Exception
MsgBox(ex.Message)
End Try
End Sub
Public Shared Sub ReleaseExcelObject(obj As Object)
'release excel object after finishing
Try
System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)
obj = Nothing
Catch ex As Autodesk.AutoCAD.Runtime.Exception
obj = Nothing
Finally
GC.Collect()
End Try
End Sub
End Class