TheSwamp

Code Red => .NET => Topic started by: bchapman on February 03, 2013, 09:52:22 AM

Title: .dll to reference for SendCommand
Post 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!
Title: Re: .dll to reference for SendCommand
Post by: Jeff_M on February 03, 2013, 11:06:30 AM
SendCommand() is an Autocad COM Interop method of the AcadDocument object.

SendStringToExecute() is an Autocad .NET API method of the Document object
Title: Re: .dll to reference for SendCommand
Post by: bchapman on February 03, 2013, 06:12:57 PM
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:

Code: [Select]
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 :)
Title: Re: .dll to reference for SendCommand
Post by: bchapman on February 03, 2013, 06:59:26 PM
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.


Code: [Select]
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);       
        }
    }
}