明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2991|回复: 7

[求助]acdbtable::select 的参数view direction, view orientation是啥意思?

[复制链接]
发表于 2009-6-10 15:34 | 显示全部楼层 |阅读模式
如题,这两个参数有啥区别?
发表于 2009-6-10 16:17 | 显示全部楼层

一个Z方向,一个Y方向?

View设置是有这两个方向的

试下吧

还在研究Table?

 楼主| 发表于 2009-6-10 16:55 | 显示全部楼层
是呀,总觉得Table这东西跟ACAD里其它的东西不像是一家的,搞不明白,帮助文档里也说得不清楚。.net的文档里没说清楚的,就只能到objectARX文档里去找,可我对ObjectARX和C++都没有实际运用的经验,搞起来很困难。而且这个方法里的最后一个参数也很混乱,AcDbFullSubentPathArray* pPaths到底是个输入参数还是个输出参数?2007版的.net和objectARX文档里的说法有矛盾。如果是输出参数,那为什么用 * 而不是用 & 呢,这个问题可能是因为我太初级,但我确实搞不明白。正在继续实验中。
发表于 2009-6-10 17:29 | 显示全部楼层
pPaths是指针,数组的首地址,不矛盾
 楼主| 发表于 2009-6-10 18:10 | 显示全部楼层
恩,明白了,数组的名字就是个指针,对吧?
看看我的试验:
  1.     ''表格单元格亮显试验
  2. &#160;&#160;&#160; <CommandMethod("test")> _
  3. &#160;&#160;&#160; Public Sub test_cell_highlight()
  4. &#160;&#160;&#160;&#160;&#160;&#160;&#160; Dim db As Database = HostApplicationServices.WorkingDatabase
  5. &#160;&#160;&#160;&#160;&#160;&#160;&#160; Dim ed As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
  6. &#160;&#160;&#160;&#160;&#160;&#160;&#160; Dim tm As DatabaseServices.TransactionManager = db.TransactionManager
  7. &#160;&#160;&#160;&#160;&#160;&#160;&#160; Dim myT As Transaction = tm.StartTransaction
  8. &#160;&#160;&#160;&#160;&#160;&#160;&#160; Try
  9. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Dim resTbl As PromptEntityResult = ed.GetEntity("选择表格图元")
  10. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Dim oTbl As Table = CType(myT.GetObject(resTbl.ObjectId, DatabaseServices.OpenMode.ForWrite), Table)
  11. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Dim p1 As Point3d = ed.GetPoint("选择表格内一点").Value
  12. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Dim oPaths() As FullSubentityPath
  13. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Dim oHit As TableHitTestInfo = oTbl.Select(p1, New Vector3d(0, 0, 1), New Vector3d(0, 1, 0), True, False, oPaths)
  14. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; For Each oPath As FullSubentityPath In oPaths
  15. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; oTbl.Highlight(oPath, False)
  16. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Next
  17. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; myT.Commit()
  18. &#160;&#160;&#160;&#160;&#160;&#160;&#160; Catch ex As System.Exception
  19. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ed.WriteMessage(ex.Message)
  20. &#160;&#160;&#160;&#160;&#160;&#160;&#160; Finally
  21. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; myT.Dispose()
  22. &#160;&#160;&#160;&#160;&#160;&#160;&#160; End Try
  23. &#160;&#160;&#160; End Sub
我想让选中的单元格亮显,可是oPaths总是空值,能帮忙看看错在哪儿了吗?
发表于 2009-6-10 19:20 | 显示全部楼层
试了下,返回值有点击的信息,但确实没有subentity
VBNet不习惯了:0
  1.         [CommandMethod("t6")]
  2.         public static void Test6()
  3.         {
  4.             Document doc = Application.DocumentManager.MdiActiveDocument;
  5.             Database db = doc.Database;
  6.             Editor ed = doc.Editor;
  7.             PromptEntityResult res = ed.GetEntity("选择表格图元");
  8.             using (Transaction tr = db.TransactionManager.StartTransaction())
  9.             {
  10.                 Table oTbl = (Table)tr.GetObject(res.ObjectId, OpenMode.ForWrite);
  11.                 Point3d pnt = ed.GetPoint("选择表格内一点").Value;
  12.                 FullSubentityPath[] paths = new FullSubentityPath[0];
  13.                 TableHitTestInfo hitinfo = oTbl.Select(pnt, (pnt+Vector3d.ZAxis).GetAsVector(), Vector3d.YAxis, true, false, paths);
  14.                 ed.WriteMessage("Row{0} Col{1}", hitinfo.Row, hitinfo.Column);
  15.                 foreach (FullSubentityPath subpath in paths)
  16.                 {
  17.                     if (subpath != null)
  18.                     {
  19.                         oTbl.Highlight(subpath, false);
  20.                     }
  21.                 }
  22.             }
  23.         }

 楼主| 发表于 2009-6-14 22:13 | 显示全部楼层
那就是说,用这个方法来把选择到的单元格亮显是不可能了?不知道ACAD内部是怎样将单元格亮显的?
发表于 2009-6-14 22:23 | 显示全部楼层

试过paths设空值或定长数组,没有任何反应

极度怀疑Table类是自动桌子买来的,所以不予维护

而且Table类编辑时没有命令显示,这和其他的类不一样

可以试下自己实现亮显,即用ed对象直接在屏幕上把目标单元格重描一遍

不过这样意义不大

建议还是窗体操作,这样可操作性要好多了

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

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-4 07:59 , Processed in 0.253441 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表