CAD得到当前已经选择的实体

IMxDrawSelectionSet::Select 方法

构造选择集。

参数 

说明 

[in] MCAD_McSelect Mode 

构造选择集方式 

[in] IMxDrawPoint* point1 

构造择择集时需要使用到的点对象 

[in] IMxDrawPoint* point2 

构造择择集时需要使用到的点对象 

[in,defaultvalue(NULL)] IMxDrawResbuf* filterData 

构造选择集的过滤数据 

可以取如下值 

mcSelectionSetWindow = 0, mcSelectionSetCrossing = 1, mcSelectionSetFence = 2, mcSelectionSetPrevious = 3, mcSelectionSetLast = 4, mcSelectionSetAll = 5, 选择图面上的所有实体 mcSelectionSetWindowPolygon = 6, mcSelectionSetCrossingPolygon = 7, mcSelectionSetUserSelect = 8 mcSelectionImpliedSelectSelect = 9,_I 返回当前图上已经选择的实体 

例如: 得到当前已经选择的实体,Delphi代码:

    procedure TForm1.Button1Click(Sender: TObject);
    var
      ss              :  IMxDrawSelectionSet;
      ii,iNum         : Integer;
      pEnt            : IMxDrawEntity;
    begin
             iNum := 0;
             ss :=  CoMxDrawSelectionSet.Create();


             ss.Select(9,EmptyParam,EmptyParam,EmptyParam,EmptyParam);

             // 遍历选择集实体,
             for ii := 0 to ss.Count -1 do
             begin
                  pEnt := ss.Item(ii);
                  iNum := iNum + 1;
             end;
             showmessage('当前选择了' + IntToStr(iNum) + '个对象');
    end;

 

上一篇:包机制&JavaDoc


下一篇:VMWare安装centos7