I actually group some commands like ZOOM Extents and QSAVE in the end of my routine. So I wanted to add to my list of Commands to run to include the PLANTCONNECTJOINT and feed it the two ObjectIds that I already have. I did try:
const string TESTPLANTCONNECTJOINTname = "TESTPLANTCONNECTJOINT";
[CommandMethod(TESTPLANTCONNECTJOINTname)]
public static void RunTESTPLANTCONNECTJOINT()
{
var acDoc = acApp.DocumentManager.MdiActiveDocument;
var acDb = acDoc.Database;
var acEd = acDoc.Editor;
try
{
var peo = new PromptEntityOptions("\nSelect first Part");
peo.SetRejectMessage("Object must be an Part");
peo.AddAllowedClass(typeof(Part), false);
var per = acEd.GetEntity(peo);
if (per.Status != PromptStatus.OK) return;
var id1 = per.ObjectId;
peo = new PromptEntityOptions("\nSelect second Part");
peo.SetRejectMessage("Object must be an Part");
peo.AddAllowedClass(typeof(Part), false);
per = acEd.GetEntity(peo);
if (per.Status != PromptStatus.OK) return;
var id2 = per.ObjectId;
//
acEd.Command("_.PLANTCONNECTJOINT", id1, id2);
}
catch (Autodesk.AutoCAD.Runtime.Exception aex)
{
acEd.WriteMessage("\n" + aex.Message);
}
catch (System.Exception ex)
{
acEd.WriteMessage("\n" + ex.Message);
}
}
Above works, but requires that I select (manual labor) the two parts. I already have the two ObjectIds, so wanted to figure out the SendStringToExecute string, but I can't figure out how to pass the IDs. They keep coming out as strings. For example if I could SendStringToExecute the above CommandMethod with the IDs as arguments, then that would do it.
I will keep working some other ideas I have, but if you have an idea I would appreciate it.