乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 15|回复: 0

引线标注如何赋三维点的Z值?

[复制链接]

16

主题

47

帖子

4

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
111
发表于 2010-10-9 16:37:00 | 显示全部楼层 |阅读模式
请教各位:
  创建引线标注时创建了一个AcDbMText和一个AcDbLeader ,Leader如何赋三维点的Z值?
  我直接采用.NET开发手册的CODE,更改Z值如-10时,Leader的Z值仍为0,而且无法建立两者的关联性(提示运行错误!)。代码如下:

_
    Public Sub AddLeaderAnnotation()
        '' Get the current database
        Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
        Dim acCurDb As Database = acDoc.Database
        '' Start a transaction
        Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
            '' Open the Block table for read
            Dim acBlkTbl As BlockTable
            acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, _
                                         OpenMode.ForRead)
            '' Open the Block table record Model space for write
            Dim acBlkTblRec As BlockTableRecord
            acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), _
                                           OpenMode.ForWrite)
            '' Create the MText annotation
            Dim acMText As MText = New MText()
            acMText.SetDatabaseDefaults()
            acMText.C
            acMText.Location = New Point3d(5, 5, -10)
            acMText.Width = 2
            '' Add the new object to Model space and the transaction
            acBlkTblRec.AppendEntity(acMText)
            acTrans.AddNewlyCreatedDBObject(acMText, True)
            '' Create the leader with annotation
            Dim acLdr As Leader = New Leader()
            acLdr.SetDatabaseDefaults()
            acLdr.AppendVertex(New Point3d(0, 0, -10))
            acLdr.AppendVertex(New Point3d(4, 4, -10))
            acLdr.AppendVertex(New Point3d(4, 5, -10))
            acLdr.HasArrowHead = True
            '' Add the new object to Model space and the transaction
            acBlkTblRec.AppendEntity(acLdr)
            acTrans.AddNewlyCreatedDBObject(acLdr, True)
            '' Attach the annotation after the leader object is added
            acLdr.Annotation = acMText.ObjectId
            acLdr.EvaluateLeader()
            '' Commit the changes and dispose of the transaction
            acTrans.Commit()
        End Using
    End Sub
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-6-29 03:56 , Processed in 0.773046 second(s), 54 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表