- UID
- 766226
- 积分
- 339
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2017-2-9
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 君是我的泪 于 2018-9-12 16:16 编辑
Sub pl()
Dim ad As AutoCAD.AcadApplication
Dim dr As AutoCAD.AcadDocument
Dim pl As AutoCAD.AcadPolyline
Dim i As Integer
Dim n As Integer
Dim arr() As Double
n = Range("a65536").End(xlUp).Row
If n > Range("b65536").End(xlUp).Row Then n = Range("b65536").End(xlUp).Row
ReDim arr(3 * n - 1)
i = 1
Do Until Cells(i, 1).Value = "" Or Cells(i, 2).Value = ""
arr((i - 1) * 3) = Cells(i, 1).Value
arr((i - 1) * 3 + 1) = Cells(i, 2).Value
arr((i - 1) * 3 + 2) = 0
i = i + 1
Loop
Set ad = New AutoCAD.AcadApplication
Set dr = ad.Documents.Add
Set pl = dr.ModelSpace.AddPolyline(arr)
pl.Color = 4
dr.SaveAs (InputBox("SaveAS?"))
dr.Close
Set pl = Nothing
Set dr = Nothing
Set ad = Nothing
End Sub
说明:在book1.xls,excel中使用点x,y,连多段线,见excel代码,可运行,引用(AutoCAD 2016 Type Library),dwg文件保存在C:\Windows\SysWOW64\
|
|