vba吧里的cad二次开发人有点少啊,我来答个……
‘cad里的图形基本都是线条连接起来的,这里有个多义线的范例。
’4个点坐标连接起来就是个矩形。
Sub Example_AddPolyline()
' This example creates a polyline in model space.
Dim plineObj As AcadPolyline
Dim points(0 To 14) As Double
' Define the 2D polyline points
points(0) = 5: points(1) = 5: points(2) = 0
points(3) = 15: points(4) = 5: points(5) = 0
points(6) = 15: points(7) = 20: points(8) = 0
points(9) = 5: points(10) = 20: points(11) = 0
points(12) = 5: points(13) = 5: points(14) = 0
' Create a lightweight Polyline object in model space
Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
ZoomAll
End Sub