- 积分
- 8888
- 明经币
- 个
- 注册时间
- 2012-8-7
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
奇葩图!按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[3 * LWPolylineCoords.Length / 2];
for (i = 0; i < LWPolylineCoords.Length / 2; i++)
{
selectionEdgePoints[3 * i] = LWPolylineCoords[2 * i];
selectionEdgePoints[3 * i + 1] = LWPolylineCoords[2 * i + 1];
selectionEdgePoints[3 * i + 2] = 0;
}
AcadSelectionSet mySelectionSet;
mySelectionSet = AcadDoc.SelectionSets.Add("NewSelectionSet06");
Int16[] FilterType = new Int16[1];
object[] FilterData = new object[1];
FilterType[0] = 0;
FilterData[0] = "*";
mySelectionSet.SelectByPolygon(AcSelect.acSelectionSetWindowPolygon, selectionEdgePoints,
FilterType, FilterData);
MessageBox.Show("范围内图形对象个数为:" + mySelectionSet.Count.ToString());
AcadDoc.SelectionSets.Item("NewSelectionSet06").Delete();
居然选不到实体!
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
|