0
我想要做的事情与下面的代码类似。而不是从选择集中删除实体,我想添加包含某些xdata的实体。这是可能的还是我要求月亮?以下链接适用于此处显示的代码。将实体添加到Autocad命令选择集
public class MyCommands
{
[CommandMethod("MyReactor")]
public void MyReactor()
{
Editor ed = acApp.DocumentManager.MdiActiveDocument.Editor;
ed.SelectionAdded += new SelectionAddedEventHandler(ed_SelectionAdded);
}
void ed_SelectionAdded(object sender, SelectionAddedEventArgs e)
{
string cmds = (string)acApp.GetSystemVariable("CMDNAMES");
if (!cmds.StartsWith("COPY"))
return;
int i = 0;
List<int> indices = new List<int>();
foreach (SelectedObject selObj in e.AddedObjects)
{
if (selObj.ObjectId.ObjectClass == RXClass.GetClass(typeof(Circle)))
indices.Insert(0, i);
i++;
}
foreach (int current in indices)
e.Remove(current);
}
}
这样做的技巧谢谢你。我错误地使用了e.add。 –
用你的AutoCAD应用@WinslowNorth祝你好运! – EricM