Dim mysel As AcadSelectionSet Dim lay As AcadLayer Dim zb(0 To 2) As Double If ThisDrawing.SelectionSets.count = 0 Then Set mysel = ThisDrawing.SelectionSets.Add("mysel") AppActivate ThisDrawing.Application.Caption mysel.SelectOnScreen Else ThisDrawing.SelectionSets.Item(0).Delete Set mysel = ThisDrawing.SelectionSets.Add("mysel") AppActivate ThisDrawing.Application.Caption mysel.SelectOnScreen End If On Error GoTo dd cv = ThisDrawing.Utility.GetString(0, "请输入离散点间距:") If Val(cv) > 0 Then Set lay = ThisDrawing.Layers.Add("离散点") ThisDrawing.ActiveLayer = lay For Each selentity In mysel If selentity.EntityType = 2 Then zuob = selentity.Coordinates zb(0) = zuob(3): zb(1) = zuob(4): zb(2) = zuob(5) ThisDrawing.Application.ZoomCenter zb, 1 ThisDrawing.SendCommand "_measure" & vbCr & zb(0) & "," & zb(1) & "," & zb(2) & vbCr & cv & vbCr selentity.Delete End If Next ThisDrawing.Application.ZoomExtents End If mysel.Delete dd: Dim mysel As AcadSelectionSet Dim lay As AcadLayer Dim zb(0 To 2) As Double If ThisDrawing.SelectionSets.count = 0 Then Set mysel = ThisDrawing.SelectionSets.Add("mysel") AppActivate ThisDrawing.Application.Caption mysel.SelectOnScreen Else ThisDrawing.SelectionSets.Item(0).Delete Set mysel = ThisDrawing.SelectionSets.Add("mysel") AppActivate ThisDrawing.Application.Caption mysel.SelectOnScreen End If On Error GoTo dd cv = ThisDrawing.Utility.GetString(0, "请输入离散点间距:") If Val(cv) > 0 Then Set lay = ThisDrawing.Layers.Add("离散点") ThisDrawing.ActiveLayer = lay For Each selentity In mysel If selentity.EntityType = 2 Then zuob = selentity.Coordinates zb(0) = zuob(3): zb(1) = zuob(4): zb(2) = zuob(5) ThisDrawing.Application.ZoomCenter zb, 1 ThisDrawing.SendCommand "_divide" & vbCr & zb(0) & "," & zb(1) & "," & zb(2) & vbCr & cv & vbCr selentity.Delete End If Next ThisDrawing.Application.ZoomExtents End If mysel.Delete dd: |