- 精华
- 活跃值
-
- 积分
- 380
- 违规
-
- 印币
-
- 鲜花值
-
- 在线时间
- 小时
累计签到:311 天 连续签到:1 天
|
发表于 2016-12-19 23:22:14
|
显示全部楼层
Sub 添加标注()
Dim sr As ShapeRange
Set sr = ActiveSelectionRange
BeginOpt "添加标注"
BeginOptimization
Dim offset As Integer
offset = 5 '偏移量
Dim s As Shape
For Each s In sr
ActiveLayer.CreateLinearDimension 1, s.SnapPoints.Edge(1, 1#), s.SnapPoints.Edge(2, 1#), True, s.PositionX + s.SizeWidth / 2 + offset, 0 '垂直
ActiveLayer.CreateLinearDimension 0, s.SnapPoints.Edge(2, 1#), s.SnapPoints.Edge(3, 1#), True, 0, s.PositionY - s.SizeHeight / 2 - offset '水平
Next
EndOpt
End Sub
Function BeginOpt(Name$)
ActiveDocument.BeginCommandGroup Name
ActiveDocument.Unit = cdrMillimeter
ActiveDocument.ReferencePoint = cdrCenter
ActiveDocument.SaveSettings
ActiveDocument.PreserveSelection = False
End Function
Function BeginOptimization()
Optimization = True
EventsEnabled = False
End Function
Function EndOpt()
ActiveDocument.PreserveSelection = True
ActiveDocument.RestoreSettings
EventsEnabled = True
Optimization = False
Application.Refresh
ActiveDocument.EndCommandGroup
End Function |
|