这是一段选择闭合多段线内图元的代码,多段线在函数外已被确定是闭合的,现在问题是这段代码一个图元都选择不到,而同一份数据我在vba里是能选择到的 private void SetAnnoInLWPolyLine(AcadDocument cadDoc, AcadLWPolyline cadLine, string strLayer) { double[] coods = cadLine.Coordinates as double[]; int coodCount = coods.Length / 2; if (coodCount < 3) return; double[] coodsPolygon = new double[coodCount * 3]; for (int i = 0; i < coodCount; i++) { coodsPolygon[3 * i] = coods[2 * i]; coodsPolygon[(3 * i) + 1] = coods[(2 * i) + 1]; coodsPolygon[(3 * i) + 2] = 0; } AcadSelectionSet SeleSets = cadDoc.SelectionSets.Add("Temp"); SeleSets.SelectByPolygon(AcSelect.acSelectionSetWindowPolygon, coodsPolygon, missobj, missobj); for (int i = 0; i < SeleSets.Count; i++) { AcadEntity ent = SeleSets.Item(i);
......................... } SeleSets.Delete(); } |