我这样写怎么不行,而且直线都画不出来,问题出在哪里? Sub lline() Dim linex As AcadLine Dim pnt1(2) As Double, pnt2(2) As Double pnt1(0) = 10: pnt1(1) = 25: pnt1(2) = 0 pnt2(0) = 100: pnt2(1) = 129: pnt2(2) = 0
Dim sset As AcadSelectionSet Set sset = ThisDrawing.SelectionSets.Add("temline") Dim FilterType As Variant, FilterData As Variant Dim gpCode(3) As Integer, dataValue(3) As Variant gpCode(0) = 0 dataValue(0) = "LINE"
gpCode(1) = 8 dataValue(1) = "LINE1"
gpCode(2) = 10 dataValue(2) = pnt1
gpCode(3) = 10 dataValue(3) = pnt2
FilterType = gpCode FilterData = dataValue
sset.Select acSelectionSetAll, FlterType, FilterData
If sset.Count = 0 Then Set linex = ThisDrawing.ModelSpace.AddLine(pt1, pt2) Else MsgBox "该线段已存在" End If End Sub |