引线标注如何赋三维点的Z值?
<p><font size="2">请教各位:</font></p><p><font size="2"> 创建引线标注时创建了一个AcDbMText和一个AcDbLeader ,Leader如何赋三维点的Z值?</font></p>
<p><font size="2"> 我直接采用AutoCAD.NET开发手册的CODE,更改Z值如-10时,Leader的Z值仍为0,而且无法建立两者的<span lang="EN-US">关联性(提示运行错误!)。代码如下:</span></font></p>
<p> </p>
<p><<span class="SpellE"><span class="GramE">CommandMethod</span>("AddLeaderAnnotation")> _</span></p>
<p> <font size="2"> Public Sub AddLeaderAnnotation()<br/> '' Get the current database<br/> Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument</font></p>
<p><font size="2"> Dim acCurDb As Database = acDoc.Database<br/> '' Start a transaction<br/> Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()<br/> '' Open the Block table for read<br/> Dim acBlkTbl As BlockTable<br/> acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, _<br/> OpenMode.ForRead)<br/> '' Open the Block table record Model space for write<br/> Dim acBlkTblRec As BlockTableRecord<br/> acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), _<br/> OpenMode.ForWrite)<br/> '' Create the MText annotation<br/> Dim acMText As MText = New MText()<br/> acMText.SetDatabaseDefaults()<br/> acMText.C<br/> acMText.Location = New Point3d(5, 5, -10)<br/> acMText.Width = 2<br/> '' Add the new object to Model space and the transaction<br/> acBlkTblRec.AppendEntity(acMText)<br/> acTrans.AddNewlyCreatedDBObject(acMText, True)<br/> '' Create the leader with annotation<br/> Dim acLdr As Leader = New Leader()<br/> acLdr.SetDatabaseDefaults()<br/> acLdr.AppendVertex(New Point3d(0, 0, -10))<br/> acLdr.AppendVertex(New Point3d(4, 4, -10))<br/> acLdr.AppendVertex(New Point3d(4, 5, -10))</font></p>
<p><font size="2"> acLdr.HasArrowHead = True<br/> '' Add the new object to Model space and the transaction<br/> acBlkTblRec.AppendEntity(acLdr)<br/> acTrans.AddNewlyCreatedDBObject(acLdr, True)</font></p>
<p><font size="2"> '' Attach the annotation after the leader object is added<br/> acLdr.Annotation = acMText.ObjectId<br/> acLdr.EvaluateLeader()<br/> '' Commit the changes and dispose of the transaction</font></p>
<p><font size="2"> acTrans.Commit()</font></p>
<p><font size="2"> End Using</font></p>
<p><font size="2"> End Sub</font></p>
<p><font size="2"></font> </p>
页:
[1]