Author Topic: SendCommand() with "insert" string during transaction  (Read 2006 times)

0 Members and 1 Guest are viewing this topic.

bchapman

  • Guest
SendCommand() with "insert" string during transaction
« on: February 10, 2013, 02:41:20 AM »
Can the SendCommand() with "insert" as string/command be used during a transaction? I need to insert a block during a transaction...and want to use the SendCommand() to do it.

Thanks!

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: SendCommand() with "insert" string during transaction
« Reply #1 on: February 10, 2013, 05:00:05 AM »
Hi,

Yes, you can.
But SendCommand() should be asynchronous (it will excute after all "hard coded" modifications to the drawing).

If you want to call an AutoCAD built-in command synchronously you'd have to P/Invoke the unmanaged acedInvoke() method or call the non-public RunCommand() method.

The other route (which I tended to follow while I used LISP, and tend to continue following since I started learning .NET) is to avoid calling AutoCAD built-in commands. You'd find many post showing how to insert a block reference here at TheSwamp:
.NET BLOCK Routines
BlockTesting2011
Speaking English as a French Frog

bchapman

  • Guest
Re: SendCommand() with "insert" string during transaction
« Reply #2 on: February 10, 2013, 05:14:15 AM »
Thank you very much! :)  Very helpful

TheMaster

  • Guest
Re: SendCommand() with "insert" string during transaction
« Reply #3 on: February 10, 2013, 04:22:25 PM »
Can the SendCommand() with "insert" as string/command be used during a transaction? I need to insert a block during a transaction...and want to use the SendCommand() to do it.

Thanks!

Take Gile's advice. Trying to mix the command line interface with transactions is asking for trouble. In fact, if I'm not mistaken, starting or ending commands while a transaction is active would probably crash AutoCAD.

bchapman

  • Guest
Re: SendCommand() with "insert" string during transaction
« Reply #4 on: February 10, 2013, 09:44:33 PM »
Thanks TT. I have...  I was fighting with using the SendCommand() so much I gave up. Inserting blocks with attributes will be a part of so many routines I'm re-writing from my lisp library that I figured I need to figure it out. I'm going over all the data he sent.