TheSwamp
Code Red => .NET => Topic started by: bchapman on February 03, 2013, 09:52:22 AM
-
Anyone know which .dll I need to add to references to make SendCommand work?
ThankS!
-
SendCommand() is an Autocad COM Interop method of the AcadDocument object.
SendStringToExecute() is an Autocad .NET API method of the Document object
-
Thanks Jeff... can you show me how to set my doc =... it's apparent I am trying to use the .NET API method of the document object... not sure how to get the COM Interop method of the AcadDocument object. Also, I'm not sure if I need the "true,false,true" below... this command works fine with SendCommandtoExecute but I need one that will do this asynchronously. Code I'm working with is below:
namespace BCInsertBLock
{
public class BCIBlock
{
[CommandMethod("BCC:INSERTBLOCK")]
static public void BCinBLock()
{
Document Doc = Application.DocumentManager.MdiActiveDocument;
string strSend = "-insert " + "ELVTAG" + "\n" + "0,0 1 45 \n";
Doc.SendCommand(strSend, true, false, true);
}
}
}
Any help tremendously appreciated and rewarded by donations to the swamp :)
-
Think I might have found it...haven't tested.... also the reference files I needed were Interop and InteropCommon dll's found in the C:\ObjectARX 2012 folder.
namespace BCInBLock
{
public class BCCInBLock
{
[CommandMethod("BCC:InBlock")]
static public void BCInsertBlock()
{
Document curDoc = Application.DocumentManager.MdiActiveDocument;
AcadDocument curAcadDoc = (AcadDocument)curDoc.AcadDocument;
string strSend = "-insert ELVTAG \n 0,0 1 45 \n ";
curAcadDoc.SendCommand(strSend);
}
}
}