经典程序HellowWorld!
代码在这里
Public Sub ins_text()
Dim textObj As AcadText
Dim textString As String
Dim InsPnt(0 To 2) As Double
Dim Height As Double
textString = "Hellow World."
InsPnt(0) = 20: InsPnt(1) = 30: InsPnt(2) = 0
Height = 12
Set textObj = ThisDrawing.ModelSpace.AddText(textString, InsPnt, Height)
Dim lineObj As AcadLine
Dim startPnt(0 To 2) As Double
Dim endPnt(0 To 2) As Double
startPnt(0) = 20: startPnt(1) = 28: startPnt(2) = 0
endPnt(0) = 165: endPnt(1) = 28: endPnt(2) = 0
Set lineObj = ThisDrawing.ModelSpace.AddLine(startPnt, endPnt)
ZoomAll
End Sub
代码完。
从现在开始学习CAD二次开发,第一本书《VBA开发AutoCAD2000应用程序》。