intelfox 发表于 2005-9-3 11:27:00

请教:关于选择集构建及图层空间的问题

<P>1.VBA可否象(ssget "x" '((0. "MTEXT")))这样不用鼠标选就选择当前图纸中所有同一类别(比如MTEXT)的图元,怎么实现?</P>
<P>2.编一个自动生成3个图纸空间(Layout1 Layout2 Layout3),并修改其视口大小为420,297的程序</P>
<P>代码如下:</P>
<P>Sub AddLayout()</P>
<P>Dim LayoutObj As AcadLayout<BR>Dim I As Integer<BR>Dim LayoutName As String<BR>Dim Viewports As AcadPViewport<BR>Dim ViewCenPoint(0 To 2) As Double<BR>Dim acPaperSpace As Integer</P>
<P>ViewCenPoint(0) = 210<BR>ViewCenPoint(1) = 148.5<BR>ViewCenPoint(2) = 0<BR>For I = 1 To 3</P>
<P>LayoutName = "Layout" + Mid(Str(I), 2, Int(I / 10 + 1))</P>
<P>On Error Resume Next<BR>Set LayoutObj = ThisDrawing.Layouts.Item(LayoutName)<BR>If Err.Number = -2145386476 Then<BR>Err.Clear<BR>Set LayoutObj = ThisDrawing.Layouts.Add(LayoutName)<BR>Else<BR>LayoutObj.Delete<BR>Set LayoutObj = ThisDrawing.Layouts.Add(LayoutName)<BR>End If</P>
<P>ThisDrawing.ActiveSpace = acPaperSpace<BR>ThisDrawing.MSpace = True<BR>ThisDrawing.ActivePViewport.Width = 420<BR>ThisDrawing.ActivePViewport.Height = 297<BR>Next<BR>End Sub<BR></P>
<P>结果图纸空间如愿生成但是仅修改了Layout1 的Pviewport其它的视口没变,是不是因为acPaperSpace仅仅默认转换到第一个图层空间呢?那通过什么办法实现自动更改所有视口的属性呢,望释疑,非常感谢</P>

雪山飞狐_lzh 发表于 2005-9-3 16:19:00

<P>1、Select方法</P>

intelfox 发表于 2005-9-6 14:09:00

谢谢lzh版主了,那么第二个问题呢,有没有知道原因,帮忙释疑,谢谢了
页: [1]
查看完整版本: 请教:关于选择集构建及图层空间的问题