明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 775|回复: 1

请教为何无法选择?

[复制链接]
发表于 2014-9-28 11:27 | 显示全部楼层 |阅读模式
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.EditorInput;
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Geometry;
using Application = Autodesk.AutoCAD.ApplicationServices.Application;
using Document = Autodesk.AutoCAD.ApplicationServices.Document;
using System.Linq;
using System.Diagnostics;

namespace ClassLibrary5
{
    public class Class1
    {
        [CommandMethod("SEL")]
        public void sel()
        {

            Autodesk.AutoCAD.EditorInput.Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            SelectionFilter acSelFtr = new SelectionFilter(new TypedValue[] {
                     new TypedValue((int)DxfCode.Operator, "<or"),
                        new TypedValue((int)DxfCode.Start, "DIMENSION") ,
                        new TypedValue((int)DxfCode.Start, "insert") ,
                        new TypedValue((int)DxfCode.Operator, ">or")
                    });

            PromptSelectionResult res2 = ed.GetSelection(acSelFtr);
            if (res2.Status != PromptStatus.OK)
            {
                return;
            }
            else
            {
                ed.SetImpliedSelection(res2.Value.GetObjectIds());

            }


        }
    }
}
加载后,运行SEL,命令不执行,如果我把过滤条件改成单个,可以正常选择,请教老大们是哪里出了问题?
            SelectionFilter acSelFtr = new SelectionFilter(new TypedValue[] {
                        new TypedValue((int)DxfCode.Start, "DIMENSION")
                    });
 楼主| 发表于 2014-9-28 11:42 | 显示全部楼层
哎原来是这句写错了new TypedValue((int)DxfCode.Operator, ">or"); 应该是"or>"!我这个大晕蛋
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-5 21:51 , Processed in 0.308836 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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