明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2183|回复: 1

请版主指导一下我这段代码,将实体前置、后置均无效果,即无反应。

[复制链接]
发表于 2009-9-7 17:42:00 | 显示全部楼层 |阅读模式

        [CommandMethod("g")]//让光栅自动置前置后无反应
        public static void g()
        {
            BlockTableRecord 块表记录;
            DrawOrderTable dot;
            ObjectIdCollection oo;

            Document acDoc = Application.DocumentManager.MdiActiveDocument;
            Database acCurDb = acDoc.Database;
            Editor ed = acDoc.Editor;

            PromptSelectionOptions rp = new PromptSelectionOptions();
            rp.MessageForAdding = "请选择光栅";
            PromptSelectionResult res = acDoc.Editor.GetSelection(rp);
            if (res.Status == PromptStatus.OK)
            {
                SelectionSet acSSet = res.Value;
                using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
                {
                    BlockTable 块表 = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) as BlockTable;
                    块表记录 = acTrans.GetObject(块表["*Model_Space"], OpenMode.ForRead) as BlockTableRecord;
                    dot = (DrawOrderTable)acTrans.GetObject(块表记录.DrawOrderTableId, OpenMode.ForWrite, false);
                    oo = Ldyh.LdyhAutoCAD.Tools.CollectBlockEnts(块表记录);
                    dot.MoveBelow(oo, acSSet[0].ObjectId);
                    acTrans.Commit();
                }
            }
        }
用MoveToTop、MoveToBottom、MoveBelow、MoveBelow均无反应,
但手工在AutoCAD中操作是可以的,操作顺序是:选择光栅-右键菜单-绘图次序-后置。这样,其它实体都浮在了光栅表面上,即不再被光栅所覆盖了。

发表于 2009-9-7 17:59:00 | 显示全部楼层

看下VBA的帮助http://www.mjtd.com/object/acad2004/ex_SortentsTable.htm

或者你应该下载ObjectArx2010 sdk,里面有函数的用法说明

Public
		Function
		MoveToTop(
    collection
		As ObjectIdCollection
) As void

Places all the entities specified in the input object ID array at the ending of the draw order. The entities being moved retain their relative draw order.

这里似乎文档有点问题:)

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

本版积分规则

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

GMT+8, 2024-11-26 04:49 , Processed in 0.145502 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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