- UID
- 4930
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-5-11
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
请问:晓东为什么我的这个程序对于如下图所示的多义线有的向外偏移,有的向里偏移?
程序如下:
Public Sub main()
Call InRdsComp
Call OutRdsComp
End Sub
Sub InRdsComp()
Dim rds As Double
rds = InputBox("请输入偏移距离", "输入")
Dim Insets As AcadSelectionSet
Dim snum As Integer
Dim existf As Boolean
For snum = 0 To ThisDrawing.SelectionSets.Count - 1
If ThisDrawing.SelectionSets.Item(snum).Name = "InEnts" Then
existf = True
Exit For
End If
Next
If existf = True Then
Set Insets = ThisDrawing.SelectionSets.Item("InEnts")
Insets.Clear
Else
Set Insets = ThisDrawing.SelectionSets.Add("InEnts")
End If
Dim gpCode(0) As Integer
gpCode(0) = 8
Dim dataValue(0) As Variant
dataValue(0) = "InlayerBAid"
Dim groupCode, dataCode As Variant
groupCode = gpCode
dataCode = dataValue
Insets.Select acSelectionSetAll, , , groupCode, dataCode
Dim i, entsnum As Integer
Dim ent As AcadEntity
Dim entry As Variant
entsnum = Insets.Count
For i = 0 To entsnum - 1
Set ent = Insets.Item(i)
ent.Highlight (True)
MsgBox "this is" & ent.ObjectName
If StrComp(ent.ObjectName, "AcDbCircle", 1) = 0 Or StrComp(ent.ObjectName, "AcDbEllipse", 1) = 0 Then
entry = ent.Offset(-rds)
entry(0).Color = acRed
Else
entry = ent.Offset(rds)
entry(0).Color = acRed
End If
Next
End Sub
Sub OutRdsComp()
Dim rds As Double
rds = InputBox("请输入偏移距离", "输入")
Dim Outsets As AcadSelectionSet
Dim snum As Integer
Dim existf As Boolean
For snum = 0 To ThisDrawing.SelectionSets.Count - 1
If ThisDrawing.SelectionSets.Item(snum).Name = "OutEnts" Then
existf = True
Exit For
End If
Next
If existf = True Then
Set Outsets = ThisDrawing.SelectionSets.Item("OutEnts")
Outsets.Clear
Else
Set Outsets = ThisDrawing.SelectionSets.Add("OutEnts")
End If
Dim gpCode(0) As Integer
gpCode(0) = 8
Dim dataValue(0) As Variant
dataValue(0) = "OutlayerBAid"
Dim groupCode, dataCode As Variant
groupCode = gpCode
dataCode = dataValue
Outsets.Select acSelectionSetAll, , , groupCode, dataCode
Dim i, entsnum As Integer
Dim ent As AcadEntity
Dim entry As Variant
entsnum = Outsets.Count
For i = 0 To entsnum - 1
Set ent = Outsets.Item(i)
ent.Highlight (True)
MsgBox "this is" & ent.ObjectName
If StrComp(ent.ObjectName, "AcDbCircle", 1) = 0 Or StrComp(ent.ObjectName, "AcDbEllipse", 1) = 0 Then
entry = ent.Offset(rds)
entry(0).Color = acBlue
Else
entry = ent.Offset(-rds)
entry(0).Color = acBlue
End If
Next
End Sub |
|