[求助]新建一个布局,在这个布局上新建一个视口,应该怎么做呢?
如题。Dim acBlkTbl As BlockTable
acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, _
OpenMode.ForRead)
Dim acLayoutMgr As LayoutManager
acLayoutMgr = LayoutManager.Current
Dim acLayout As Layout '= acLayoutMgr.CreateLayout("0")
acLayout = acTrans.GetObject(acLayoutMgr.CreateLayout("0"), OpenMode.ForRead)
Dim acBlkTblRec As BlockTableRecord
'acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.PaperSpace), OpenMode.ForWrite)
acBlkTblRec = acTrans.GetObject(acLayout.BlockTableRecordId, OpenMode.ForWrite)
'' Create a Viewport
Dim acVport As Viewport = New Viewport()
acVport.SetDatabaseDefaults()
acVport.CenterPoint = New Point3d(220, 148.5, 0)
acVport.Width = 420
acVport.Height = 297
acBlkTblRec.AppendEntity(acVport)
acTrans.AddNewlyCreatedDBObject(acVport, True)
Dim Mtxt_h As New MText
Mtxt_h.C
Mtxt_h.TextHeight = 2
Mtxt_h.Width = 5
Mtxt_h.Location = New Point3d(0, 0, 0)
Mtxt_h.Attachment = AttachmentPoint.MiddleLeft
acBlkTblRec.AppendEntity(Mtxt_h)
acTrans.AddNewlyCreatedDBObject(Mtxt_h, True)
奇怪的,视口建不了 ,但MText加进去了,也不报错??
<p>see</p>
<div class="Element5">ViewportTableRecord Class</div>
[求助]新建一个布局,在这个布局上新建一个视口,应该怎么做呢?
<p>acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.PaperSpace), OpenMode.ForWrite) </p><p>用这个可以的 但是 不能选到我建的那个布局上 ,不知道 该怎么弄 才能在自己建 的布局上建视口</p> <p>在手册的 【定义布局和打印】 部分找找</p>
<p><font face="Verdana"><a href="http://www.mjtd.com/helpcenter/netguide/">http://www.mjtd.com/helpcenter/netguide/</a></font></p>
<p> </p> 我谢谢 飞狐版主 就是从那里找来这些代码的,没说切换到新建的布局上 啊 我想到一个变通的办法 用vba里 的
Dim layout As AcadLayout = ThisDrawing.Layouts.Item("0")
ThisDrawing.ActiveLayout = layout
居然可以了
.net 还要vba来辅助 我无语.....
看看说明 acLayoutMgr.CreateLayout("0")这个有点问题
<p class="Element10">This function creates a new Layout object given a unique layout name. The default viewports for the new layout are not created until the layout is first activated.</p> <div class="Element5">LayoutManager.CurrentLayout Property</div>
[求助]新建一个布局,在这个布局上新建一个视口,应该怎么做呢?
<p>谢谢 飞狐版主 又解决我的一个难题 呵呵</p> 请问版主不使用LayoutManager.CurrentLayout可以吗?使用LayoutManager.CurrentLayout的话程序运行起来效率比较低。既然可以添加Mtext为何添加不了视口?
页:
[1]
2