|
发表于 2009-8-10 08:34:00
|
显示全部楼层
搞错:),终点DXF码是11
Sub test()
On Error Resume Next
Dim sset As AcadSelectionSet
ThisDrawing.SelectionSets("temline").Delete
Set sset = ThisDrawing.SelectionSets.Add("temline")
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 ft(3) As Integer, fd(3) As Variant
ft(0) = 0: fd(0) = "LINE"
ft(1) = 8: fd(1) = "LINE1"
ft(2) = 10: fd(2) = pnt1
ft(3) = 11: fd(3) = pnt2
sset.Select acSelectionSetAll, , , ft, fd
Dim linex As AcadLine
If sset.Count = 0 Then
Set linex = ThisDrawing.ModelSpace.AddLine(pnt1, pnt2)
linex.Layer = "LINE1"
Else
MsgBox "该线段已存在"
End If
End Sub
|
|