I am using Application.Invoke() to invoke AutoLisp commands in AutoCad synchronously. Most of my commands work fine, but there are several that come up with the error
Error: AutoCAD command rejected: "_.UNDO"
The commands in particular are AutoCad Electrical commands such as c:ace_insertwire and c:wd_insym2.
Here's my code:
Using rb As New ResultBuffer()
rb.Add(New TypedValue(LispDataType.Text, "c:wd_insym2"))
rb.Add(New TypedValue(LispDataType.Text, name))
rb.Add(New TypedValue(LispDataType.ListBegin))
rb.Add(New TypedValue(LispDataType.Double, coords(0)))
rb.Add(New TypedValue(LispDataType.Double, coords(1)))
rb.Add(New TypedValue(LispDataType.ListEnd))
rb.Add(New TypedValue(LispDataType.Nil))
rb.Add(New TypedValue(LispDataType.Nil))
Autodesk.AutoCAD.ApplicationServices.Application.Invoke(rb)
End Using
This is the equivalent of
(c:wd_insym2 "C:/ace_blocks/HT00_001.dwg" '(150 230) nil nil)
which works fine.
When I use the same method for ace_insert_wire it gives me an additional error:
Error: AutoCAD command rejected: "_.UNDO" AutoCAD command rejected: "_.REDRAW"
Any ideas what could be causing this? I certainly did not call either UNDO or REDRAW!