.NET

Reply
New Member
Posts: 1
Registered: ‎04-17-2012
Message 1 of 3 (922 Views)

AcedCommand in Autocad 2013

922 Views, 2 Replies
04-17-2012 02:20 AM

Hello,

 

[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="acedCmd")]

 

Error : Autocad can not found EntryPoint >> AcedCmd !!!

 

Private Declare Function acedCmd Lib "acad.exe" Alias "AcedCommand" _

(ByVal vlist As System.IntPtr) As Integer

 

 

 

Imports AcApp = Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.DatabaseServices Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.EditorInput Imports Autodesk.AutoCAD.Geometry Public Enum CmdResult eNone = 5000 'No result eSuccess = 5100 'Request succeeded eError = -5001 'Nonspecific error eCancel = -5002 'User canceled the request with a CTRL-C eRejected = -5003 'AutoCAD rejected the request as invalid eFailed = -5004 'Link failure, possibly with the LISP interpreter eKeyword = -5005 'Keyword returned from a "get" routine eDirect = -5999 'Passed to endGetPoint() if the getpoint was nested within another geometric value prompt (such as for angle), 'and the response entered was such a value rather than a point End Enum Public Class CsAcedCmd Private Declare Function acedCmd Lib "acad.exe" Alias "AcedCommand" _ (ByVal vlist As System.IntPtr) As Integer Const RTSTR As Short = 5005 Const RTNORM As Short = 5100 Const RTNONE As Short = 5000 Const RTREAL As Short = 5001 Const RTPICKS As Short = 5007 Const RT3DPOINT As Short = 5009 Const RTLONG As Short = 5010 Const RTSHORT As Short = 5003 Const RTENAME As Short = 5006 Const RTPOINT As Short = 5002 ' /*2D point X and Y only */ Public Shared Function AcedCmd(ByVal CmdEcho As Boolean, ByVal ParamArray args As Object()) As CmdResult If AcApp.Application.DocumentManager.IsApplicationContext Then Return 0 End If Dim iResult As CmdResult = CmdResult.eNone Dim cnt As Integer = 0 ' Using Dim buffer As ResultBuffer = New ResultBuffer Try For Each o As Object In args Dim code As Integer = 0 If TypeOf o Is String Then code = RTSTR Else If TypeOf o Is Int32 Then code = RTLONG Else If TypeOf o Is Int16 Then code = RTSHORT Else If TypeOf o Is Double Then code = RTREAL Else If TypeOf o Is Point3d Then code = RT3DPOINT Else If TypeOf o Is ObjectId Then code = RTENAME End If End If End If End If End If End If If Not (code = 0) Then buffer.Add(New TypedValue(code, o)) System.Threading.Interlocked.Increment(cnt) End If Next If cnt > 0 Then Dim HldCmdecho As Object = AcApp.Application.GetSystemVariable("CMDECHO") If CmdEcho Then AcApp.Application.SetSystemVariable("CMDECHO", 1) Else AcApp.Application.SetSystemVariable("CMDECHO", 0) End If iResult = CType(AcedCmd(buffer.UnmanagedObject), CmdResult) AcApp.Application.SetSystemVariable("CMDECHO", HldCmdecho) End If Finally CType(buffer, IDisposable).Dispose() End Try Return iResult End Function

 

 

End Class

 

 

*Expert Elite*
Alfred.NESWADBA
Posts: 8,512
Registered: ‎06-29-2007
Message 2 of 3 (920 Views)

Re: AcedCommand in Autocad 2013

04-17-2012 02:25 AM in reply to: tech3

Hi,

 

within your DLLIMPORT-statement change "acad.exe" to "accore.dll" for AutoCAD 2013

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
New Member
Posts: 1
Registered: ‎04-13-2012
Message 3 of 3 (889 Views)

Re: AcedCommand in Autocad 2013

04-17-2012 09:49 AM in reply to: Alfred.NESWADBA

Dank's,

 

Just for users, a sample project VS2010 TestCommand .NET

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community