|

楼主 |
发表于 2010-9-25 14:20
|
显示全部楼层
其中的核心代码如下:
5 s: E$ a% U5 s# JFor Each returnobj In doc.ModelSpace" P6 K6 t3 G4 y1 o. s) x% |9 Y
If returnobj.ObjectName = "AcDb2dPolyline" Then
/ P$ N g8 l2 n0 k% L+ I6 {5 Y If Round(returnobj.Area, 4) >= 62370 Then
6 t4 t! o9 ]+ @9 @$ ~9 V returnobj.GetBoundingBox minext, maxext
9 Z1 E' J4 l. g: F8 u. i( g" G) W1 ^8 M
point1(0) = minext(0): point1(1) = minext(1)
3 n% f; J& q! y) G: f point2(0) = maxext(0): point2(1) = maxext(1)
+ |2 W% w* [; ]* }4 B* {% i5 F3 ~+ N8 vdoc.ActiveLayout.CenterPlot = True '中心打印( B9 n0 M$ E" @6 G: ^# ^
doc.ActiveLayout.StandardScale = acScaleToFit '合适比例
( t! `' E b) {+ w9 }doc.ActiveLayout.SetWindowToPlot point1, point2
3 w8 x. U, [, w6 Adoc.ActiveLayout.PlotRotation = ac0degrees '旋转90度7 o c' W6 M+ x# ^, h' n ~
doc.ActiveLayout.PlotType = acWindow
/ h, j. z Y- Zdoc.Plot.PlotToDevice "D:\plot\pdfFactory Pro.pc3" '打印机pc3文件,或者打印机名称,我这里用到的事PDFfactory pro/ l! w; Y% p" U* M
End If* \# n( E) h( o
End If: A' z( R- r4 N
Next
( b0 [6 A# [$ @+ ?上面的代码是搜索面积大于一定值的2dPolyline,并以他的最大点和最小点作为Window打印模式的边界点 doc是autcad.activedocument |
|