VB编程编辑AutoCAD轻量多义线
2011-06-12 21:57 精诚所至 金石为开 阅读(898) 评论(0) 编辑 收藏 举报创建一条轻量多义线并将第二段修改为圆弧。
Private Sub Command1_Click()
Dim plineobj As AcadLWPolyline
Dim points(0 To 9) As Double
points(0) = 1: points(1) = 1
points(2) = 1: points(3) = 2
points(4) = 2: points(5) = 2
points(6) = 3: points(7) = 2
points(8) = 4: points(9) = 4
Set plineobj = acadapp.ActiveDocument.ModelSpace.AddLightWeightPolyline(points)
plineobj.SetBulge 2, 1
plineobj.Update
ZoomExtents
End Sub
给轻量多义线添加新定点,设置线宽,封闭多义线,计算多义线围成的面积。
Private Sub Command1_Click()
Dim plineobj As AcadLWPolyline
Dim points(0 To 9) As Double
points(0) = 1: points(1) = 1
points(2) = 1: points(3) = 2
points(4) = 2: points(5) = 2
points(6) = 3: points(7) = 2
points(8) = 4: points(9) = 4
Set plineobj = acadapp.ActiveDocument.ModelSpace.AddLightWeightPolyline(points)
plineobj.SetBulge 2, 1
plineobj.Update
ZoomExtents
Dim newvertex(0 To 1) As Double
newvertex(0) = 4: newvertex(1) = 1
plineobj.AddVertex 5, newvertex
plineobj.SetWidth 4, 0.1, 0.5
plineobj.Closed = True
MsgBox "多义线围成的面积=" & plineobj.Area
plineobj.Update
End Sub