.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ActiveDocument.SendCommand(Chr(27) give invalid input error in AutoCAD 2015

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
2868 Views, 6 Replies

ActiveDocument.SendCommand(Chr(27) give invalid input error in AutoCAD 2015

I have a plugin that works fine from Acad 2010 up to 2015 (recompiling with the appropriate libraries of course

 

However, when running in 2015 (also recompiled with the 2015 librarires), it give an Invalid Input error when using

ActiveDocument.SendCommand(Chr(27)

 

Before somebody asks, yes, I am in a drawing...

 

Any idea ?

6 REPLIES 6
Message 2 of 7
Littlerubarb
in reply to: Anonymous

Please post the code for the Activedocument.send string, sounds like a minor API change but the code is needed to resolve.

Message 3 of 7
Anonymous
in reply to: Littlerubarb

Dim oApp As Object = Application.AcadApplication

oApp.ActiveDocument.SendCommand(Chr(27) & Chr(27))

 

this works with 2010 up to 2014 (included)...

Message 4 of 7
Littlerubarb
in reply to: Anonymous

2015 was modifed and this command isn't avaliable, here is a link to the doc that explains it.

 

http://through-the-interface.typepad.com/through_the_interface/2014/03/autocad-2015-calling-commands...

 

 

Here's the sample from that page in vb.net

 

Public Sub InsertBlockSync()
Dim doc = Application.DocumentManager.MdiActiveDocument
Dim ed = doc.Editor

' Our insertion point is hardcoded at 10,10

ed.Command("_.INSERT", "TEST", "10,10", 1, 1, 0)

ed.WriteMessage(vbLf & "We have inserted our block.")
End Sub

 

If this does solve it post more of the code, as there may be alternatives to was your try to accomplish.

 

 

Message 5 of 7
Anonymous
in reply to: Littlerubarb

 

Quote from this blog

"For VBA – which has now been updated to VBA 7.1 and is still available as a separate download – I don’t think anything has changed: it still has the AcadDocument.SendCommand() method, which seems to work with partial commands (I’ll update this post if I hear anything different on that front)."

 

Well, as far as I can see from this blog, it still exists and actually, I use it to start other commands and it works. Only the chr(27) doesn't

 

I also tested in VBA, not even talking about .NET and same

 

ThisDrawing.SendCommand chr(27) works from autoCAD 2010 up to 2014, gives the input error in 2015.

 

 Also, the purpose of sending chr(27) is to simulate hitting the ESC key. How would you do it with Editor.Command....?

Message 6 of 7
Littlerubarb
in reply to: Anonymous

Sorry, I assumed you were using .net as the forum is for .net users. You may have better luck in the Visual Basic Customization.

http://forums.autodesk.com/t5/visual-basic-customization/bd-p/33

 

 

To answer your last question, you would use Editor.SelectImplied() is one method, but with .net the are lost of solution just search the forums for "AutoCad esc using .net site:forums.autodesk.com"

Message 7 of 7
rodrigohbm
in reply to: Littlerubarb

 

result:  Autocad 2015

 

change chr(27)   to  ( "exit" & vbCr)

 

AcadApp.Application.ActiveDocument.SendCommand("_DIM" & vbCr & "UPDATE" & vbCr & "P" & vbCr & vbCr & "exit" & vbCr)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost