奇怪的添加块参照问题
<p>我对已有的一个块添加相应一个块参照,插入点由提示<font face="Verdana">PromptPointOptions</font>获取,但是插入后并不显示在那个点位置,而是有很大偏差,高手们帮我看看啊,谢谢</p><p><font face="Verdana">Dim ed As Editor = AcadApp.DocumentManager.MdiActiveDocument.Editor<br/> Dim db As Database = AcadApp.DocumentManager.MdiActiveDocument.Database<br/> ' 普通的点交互操作.<br/> Dim optPoint As New PromptPointOptions(vbCrLf & "请指定放置点:")<br/> Dim resPoint As PromptPointResult = ed.GetPoint(optPoint)<br/> If resPoint.Status <> PromptStatus.OK Then Return ObjectId.Null<br/> Dim obid As ObjectId<br/> Using trans As Transaction = db.TransactionManager.StartTransaction()<br/> ' 将块参照加入到图形数据库中.<br/> '以读的方式打开块表<br/> Dim bt As BlockTable = trans.GetObject(db.BlockTableId, OpenMode.ForRead)<br/> '如果没有blockName表示的块,则程序返回<br/> If (bt.Has(blockname) = False) Then<br/> Return ObjectId.Null<br/> End If<br/> '以读的方式打开blockName表示的块<br/> 'Dim block As BlockTableRecord = trans.GetObject(bt(blockname), OpenMode.ForRead)<br/> '创建一个块参照并设置插入点<br/> Dim mt As Matrix3d = ed.CurrentUserCoordinateSystem<br/> Dim p3 As Point3d = resPoint.Value.TransformBy(mt)<br/> Dim blockref As BlockReference = New BlockReference(p3, bt(blockname))<br/> 'Dim blockref As BlockReference = New BlockReference(resPoint.Value, bt(blockname))<br/> 'blockref.ScaleFactors = New Scale3d(1) '设置块参照的缩放比例<br/> 'blockref.Rotation = 0.5 * Math.PI<br/> '以写的方式打开当前空间(模型空间或图纸空间)<br/> Dim btr As BlockTableRecord = trans.GetObject(db.CurrentSpaceId, OpenMode.ForWrite)<br/> obid = btr.AppendEntity(blockref) '在当前空间加入创建的块参照<br/> '通知事务处理加入创建的块参照<br/> trans.AddNewlyCreatedDBObject(blockref, True)<br/> trans.Commit() '提交事务处理以实现块参照的真实加入<br/> End Using<br/> Return obid</font></p> <p>1,检查你的块定义插入点位置是否合适</p>
<p>2,试试把自动捕捉关掉后有没有变化</p> 说的太专业了,能不能具体点啊谢谢 <p>把你的包含块的dwg贴上吧</p> 哪位高手帮帮忙啊,急死了
页:
[1]