- 积分
- 528
- 明经币
- 个
- 注册时间
- 2005-6-10
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2005-6-30 10:32:00
|
显示全部楼层
附上完成后的代码,或许以后哪位朋友能用到。
模块名:acad.dvb!Startup
Public Sub PlotPaging() Dim point1 As Variant, point2 As Variant Dim vpoint1 As Variant, vpoint2 As Variant On Error GoTo ErrorHandler_Cancel
point1 = ThisDrawing.Utility.GetPoint(, vbLf & "请点击打印区域的左下角:") vpoint1 = point1 ReDim Preserve point1(0 To 1) ReDim Preserve vpoint1(0 To 1) point2 = ThisDrawing.Utility.GetPoint(, "请点击打印区域的右上角:") vpoint2 = point2 ReDim Preserve point2(0 To 1) ReDim Preserve vpoint2(0 To 1) pagesX = ThisDrawing.Utility.GetInteger("请输入横向分页数:") pagesY = ThisDrawing.Utility.GetInteger("请输入纵向分页数:") pagesEdge = ThisDrawing.Utility.GetInteger("请输入页边缘扩展百分比(0-100):") bolConfirm = MsgBox("你是否确定分页打印以下区域:" & vbCrLf & vbCrLf & _ "左下角:X=" & CStr(CLng(point1(0))) & ",Y=" & CStr(CLng(point1(1))) & vbCrLf & _ "右上角:X=" & CStr(CLng(point2(0))) & ",Y=" & CStr(CLng(point2(1))) & vbCrLf & _ "横向分 " & pagesX & " 页;纵向分 " & pagesY & " 页。" & vbCrLf & _ "页边缘扩展 " & pagesEdge & "%", vbOKCancel) If bolConfirm = vbOK Then BACKGROUNDPLOT = ThisDrawing.GetVariable("BACKGROUNDPLOT") ThisDrawing.SetVariable "BACKGROUNDPLOT", 0 lenX = (point2(0) - point1(0)) / pagesX lenY = (point2(1) - point1(1)) / pagesY Dim bolNextPage As Integer For X = 1 To pagesX For Y = 1 To pagesY vpoint1(0) = point1(0) + lenX * (X - 1) vpoint1(1) = point1(1) + lenY * (Y - 1) vpoint2(0) = vpoint1(0) + lenX * (pagesEdge / 100 + 1) vpoint2(1) = vpoint1(1) + lenY * (pagesEdge / 100 + 1) ThisDrawing.ActiveLayout.SetWindowToPlot vpoint1, vpoint2 ThisDrawing.ActiveLayout.GetWindowToPlot vpoint1, vpoint2 ThisDrawing.ActiveLayout.PlotType = acWindow ThisDrawing.Plot.PlotToDevice Next Y If bolNextPage = vbCancel Then Exit For End If Next X ThisDrawing.SetVariable "BACKGROUNDPLOT", BACKGROUNDPLOT End If ErrorHandler_Cancel:
End Sub
Sub MenuExtend() Dim currMenuGroup As AcadMenuGroup For Each currMenuGroup In ACAD.Application.MenuGroups If currMenuGroup.Name = "ACAD" Then Exit For End If Next Dim currMenu As AcadPopupMenu Dim newMenuItem As AcadPopupMenuItem For Each currMenu In currMenuGroup.Menus If currMenu.Name = "文件(&F)" Then Set newMenuItem = currMenu.AddMenuItem(19, "分页打印", "-VBARUN acad.dvb!Startup.PlotPaging" & Chr(32)) End If Next End Sub
|
|