兰州人 发表于 2008-12-2 15:47:00

布局间的切换

本帖最后由 作者 于 2008-12-14 22:20:24 编辑

在这个帖子http://bbs.mjtd.com/forum.php?mod=viewthread&tid=57581
ThisDrawing.SetVariable "CTAB", Layout.Name可以实现布局之间的切换?
在命令行中
输入setvar,再输入Ctab就可看到布局状态了。
输入“模型”,“布局1”或“布局2”就到了相应的layout中.Sub lls()
   Dim objLayoutArray As Variant, objViewArray As Variant
   'objLayoutArray = Array("主视图", "俯视图", "左视图", "西北等轴测视图", "西南等轴测视图", "东北等轴测视图", "东南等轴测视图", "多窗口打印", "任意角度")
   objLayoutArray = Array("主视图", "俯视图", "左视图", "西北等轴测视图", "西南等轴测视图", "东北等轴测视图", "东南等轴测视图")
   objViewArray = Array("Top", "Top", "Left", "NwISO", "SwISO", "NeISO", "SeISO")
   For ii = 0 To UBound(objLayoutArray)
   ''
   tt = "(command ""Layout"" ""S"" "
   tt = tt & Chr(34) & objLayoutArray(ii) & Chr(34) & ")" & vbCr
   ThisDrawing.SendCommand tt
   ''
   tt = "(Command ""Zoom"" ""E"")" & vbCr
   ThisDrawing.SendCommand tt
   ''
   tt = "(Command ""MsPace"")" & vbCr
   ThisDrawing.SendCommand tt
   Dim ObjLayerArray
   ObjLayerArray = Array("粗边框线", "细边框线", "标题栏", "粗实线", "细实线", "尺寸线", "中心线", "剖面线", "Defpoints", "文本", "虚线", "点划线", "主材料表", "件号标注线")
    Select Case objLayoutArray(ii)
       Case "西北等轴测视图", "西南等轴测视图", "东北等轴测视图", "东南等轴测视图"
         For jj = 0 To UBound(ObjLayerArray)
         tt = "(Command ""VPLayer"" ""F"" "
         tt = tt & Chr(34) & ObjLayerArray(jj) & Chr(34) & ")"
         ThisDrawing.SendCommand tt & vbCr & vbCr & vbCr
         Next jj
   End Select
   
   ''
   tt = "(Command ""-View"" "
   tt = tt & Chr(34) & objViewArray(ii) & Chr(34) & ")" & vbCr
   ThisDrawing.SendCommand tt
   Next ii
   
End Sub

你是否天使 发表于 2012-6-19 16:56:14


            Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
         
            doc.SendStringToExecute("layout s 布局2\r",false,false,false);
页: [1]
查看完整版本: 布局间的切换