C# AutoCAD.SendstringToExciute尝试编辑未选择选定对象

C# AutoCAD.SendstringToExciute尝试编辑未选择选定对象,c#,autocad,autodesk,C#,Autocad,Autodesk,双击后尝试从命令行运行ATTEDIT,并让它选择以前选择的项目。我截获了双击事件,可以运行ATTEDIT,但当我尝试将位置传递到“ATTEDIT选择块”时,它什么也不做。但是,当我再次单击块时,它将起作用。我想这只是因为我有十进制单位,而不是建筑单位。但这并不管用。以下是我所拥有的: using Autodesk.AutoCAD; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using A

双击后尝试从命令行运行ATTEDIT,并让它选择以前选择的项目。我截获了双击事件,可以运行ATTEDIT,但当我尝试将位置传递到“ATTEDIT选择块”时,它什么也不做。但是,当我再次单击块时,它将起作用。我想这只是因为我有十进制单位,而不是建筑单位。但这并不管用。以下是我所拥有的:

using Autodesk.AutoCAD;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

public class DoubleClickProcess
{
// This function gets called when a block reference is double clicked on. It then checks to see if the block reference
// that was double clicked on was double clicked
[CommandMethod("DOUBLECLICK", CommandFlags.UsePickSet)]
public void ContinueDoubleClick()
{
  Document doc = Application.DocumentManager.MdiActiveDocument;
  Database database = HostApplicationServices.WorkingDatabase;
  Editor ed = doc.Editor;

  // Get the PickFirst selection set
  PromptSelectionResult acSSPrompt;
  acSSPrompt = ed.SelectImplied();

  SelectionSet selRes;

  // If the prompt status is OK, objects were selected before
  // the command was started
  if (acSSPrompt.Status == PromptStatus.OK)
  {
    selRes = acSSPrompt.Value;

    Transaction tr = doc.TransactionManager.StartTransaction();
    using (tr)
    {
      // Go through all of the objects that were selected...
      ObjectId[] objIds = selRes.GetObjectIds();
      foreach (ObjectId objId in objIds)
      {
        Entity theEnt = (Entity)tr.GetObject(objId, OpenMode.ForRead);

        // They must be block references...
        if (theEnt.GetType().Name.ToUpper() == "BLOCKREFERENCE")
        {
          BlockReference bRef = theEnt as BlockReference;

          BlockTableRecord btr = null;
          btr = tr.GetObject(bRef.DynamicBlockTableRecord, OpenMode.ForRead) as BlockTableRecord;

          if (bRef != null)
          {
            // If it is a specific block then we are interested in it
            if (btr.Name.ToString().ToUpper() == "specific")
            {
              doc.SendStringToExecute("SomeCommand ", true, false, true);
            }
            else
            {
              // It's not one we're interested in so do what double clicking would normally do
              String objPx = Autodesk.AutoCAD.Runtime.Converter.DistanceToString(bRef.Position.X);
              objPx = objPx.Replace(" ", "-");
              String objPy = Autodesk.AutoCAD.Runtime.Converter.DistanceToString(bRef.Position.Y);
              objPy = objPy.Replace(" ", "-");
              String objP =   objPx +","+ objPy;
              doc.SendStringToExecute("ATTEDIT "+ objP + " ", true, false, true);
            }
          }
        }
        theEnt.Dispose();
      }
      tr.Commit();
    }
  }

  // Clear the PickFirst selection set
  ObjectId[] idarrayEmpty = new ObjectId[0];
  ed.SetImpliedSelection(idarrayEmpty);
  }
 }
}

键入鼠标的架构位置(101'-6-7/8“,89'-5-1/2”),但如果键入块的实际位置,它不会选择块属性。

我认为它应该与SetImpliedSelection一起工作:

SelectionSet selset = SelectionSet.FromObjectIds(new ObjectId[] { bRef.ObjectId });
ed.SetImpliedSelection(selset);
doc.SendStringToExecute("ATTEDIT ", true, false, true);

似乎不起作用。selset值显示为:{(((8796087858048),不可用,0,)},但我认为它应该类似:{((8796087858048),PickPoint,1,)}。你知道怎么把检查站和1放进去吗?还有其他建议吗?