Real_King 发表于 2015-4-1 13:52:13

奇葩图!按acSelectionSetWindowPolygon在地块范围PL线内选不到实体!什么原因!?

奇葩图!按acSelectionSetWindowPolygon在地块范围PL线内选不到实体!什么原因!?
代码和图都付上,请大神指教!
Autodesk.AutoCAD.Interop.AcadApplication AcadApp;
          Autodesk.AutoCAD.Interop.AcadDocument AcadDoc;
          AcadApp = (AcadApplication)System.Runtime.InteropServices.Marshal.GetActiveObject("AutoCAD.Application");
          AcadDoc = AcadApp.ActiveDocument;
      handle01:
          Microsoft.VisualBasic.Interaction.AppActivate(AcadApp.Caption);
          object returnObj, pickPoint;
          string pickPrompt = "选取Polyline对象!";
          AcadDoc.Utility.GetEntity(out returnObj, out pickPoint, pickPrompt);
          AcadObject returnCADObj = (AcadObject)returnObj;
          if (returnCADObj.ObjectName != "AcDbPolyline") goto handle01;
          AcadLWPolyline returnLWPolyline = (AcadLWPolyline)returnCADObj;
          if (!returnLWPolyline.Closed)
          {
            MessageBox.Show("选取的多段线没有闭合!");
            goto handle01;
          }
          Double[] selectionEdgePoints, LWPolylineCoords;
          LWPolylineCoords = (Double[])returnLWPolyline.Coordinates;
          int i;
          selectionEdgePoints = new Double;
          for (i = 0; i < LWPolylineCoords.Length / 2; i++)
          {
            selectionEdgePoints = LWPolylineCoords;
            selectionEdgePoints = LWPolylineCoords;
            selectionEdgePoints = 0;
          }
          AcadSelectionSet mySelectionSet;
          mySelectionSet = AcadDoc.SelectionSets.Add("NewSelectionSet06");
          Int16[] FilterType = new Int16;
          object[] FilterData = new object;
          FilterType = 0;
          FilterData = "*";
          mySelectionSet.SelectByPolygon(AcSelect.acSelectionSetWindowPolygon, selectionEdgePoints,
          FilterType, FilterData);
          MessageBox.Show("范围内图形对象个数为:" + mySelectionSet.Count.ToString());
          AcadDoc.SelectionSets.Item("NewSelectionSet06").Delete();


居然选不到实体!

雪山飞狐_lzh 发表于 2015-4-1 18:09:44

右边那条线应该是重线

Real_King 发表于 2015-4-1 20:42:15

雪山飞狐_lzh 发表于 2015-4-1 18:09 static/image/common/back.gif
右边那条线应该是重线

找到了原因,重复点的缘故
页: [1]
查看完整版本: 奇葩图!按acSelectionSetWindowPolygon在地块范围PL线内选不到实体!什么原因!?