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
Hi,
within your DLLIMPORT-statement change "acad.exe" to "accore.dll" for AutoCAD 2013
- alfred -
Dank's,
Just for users, a sample project VS2010 TestCommand .NET
Can't find what you're looking for? Ask the community or share your knowledge.