.NET

Reply
Active Contributor
DesignProQuig
Posts: 32
Registered: ‎03-02-2012
Message 1 of 9 (907 Views)
Accepted Solution

ads_queueexp

907 Views, 8 Replies
04-20-2012 03:02 AM

Hi there,

Does anyone know how to get “ads_queueexpr” to work under AutoCAD 2013?

 

Private Declare Auto Function ads_queueexpr Lib "acad.exe" (ByVal strExpr As String) As Integer

ads_queueexpr("(command""_dtext"" p1 8 0)")

 

I asked ADN and they said it's now part of "accore.dll"

But I'm still not sure how to reference it.

 

Regards,

 

Martin.

http://www.designprosoftware.co.uk/
*Expert Elite*
Alfred.NESWADBA
Posts: 8,888
Registered: ‎06-29-2007
Message 2 of 9 (905 Views)

Re: ads_queueexp

04-20-2012 03:24 AM in reply to: DesignProQuig

Hi,

 

change the read part (if you are speaking about AutoCAD 2013)

Private Declare Auto Function ads_queueexpr Lib "accore.dll" (ByVal strExpr As String) As Integer

ads_queueexpr("(command""_dtext"" p1 8 0)")

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Active Contributor
DesignProQuig
Posts: 32
Registered: ‎03-02-2012
Message 3 of 9 (904 Views)

Re: ads_queueexp

04-20-2012 03:31 AM in reply to: Alfred.NESWADBA

Hi,

I feel a little silly for not spotting that ;-).  Thanks for the help.

That has helpped, it now sort of works but now I receive this error:

 

A call to PInvoke function <Mydll>::ads_queueexpr' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

 

ADN sent me this code in C#, I write only in VB.net & cou;dn't onvert using one of the on-line converters:

 

using System.Text;

       

[DllImport("accore.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl, EntryPoint = "ads_queueexpr")]

extern static int ads_queueexpr(byte[] command);

 

 

UnicodeEncoding uEncode = new UnicodeEncoding();

ads_queueexpr(uEncode.GetBytes("(Command \"StartOverrule\")"));

 

 

Chers,

 

Martin.

http://www.designprosoftware.co.uk/
Moderator
Alexander.Rivilis
Posts: 1,398
Registered: ‎04-09-2008
Message 4 of 9 (893 Views)

Re: ads_queueexp

04-20-2012 06:41 AM in reply to: DesignProQuig
Imports System
Imports System.Text
Imports System.Runtime.InteropServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.EditorInput
<Assembly: CommandClass(GetType(AutoCAD_VB_plug_in1.MyCommands))> 
Namespace AutoCAD_VB_plug_in1
    Public Class MyCommands
        <DllImport("accore.dll", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl, EntryPoint:="ads_queueexpr")>
        Public Shared Function ads_queueexpr(command As Byte()) As Integer
        End Function
        <CommandMethod("MyGroup", "MyCommand", "MyCommandLocal", CommandFlags.Modal)> _
        Public Sub MyCommand() ' This method can have any name
            Dim uEncode As UnicodeEncoding = New UnicodeEncoding
            Call ads_queueexpr(uEncode.GetBytes( _
               "(command " + Chr(34) + "_ZOOM" + Chr(34) + " " + Chr(34) + "_Extents" + Chr(34) + ")"))
        End Sub
    End Class
End Namespace

 


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Active Contributor
DesignProQuig
Posts: 32
Registered: ‎03-02-2012
Message 5 of 9 (887 Views)

Re: ads_queueexp

04-20-2012 07:29 AM in reply to: Alexander.Rivilis

Thank you very much for the help everyone, ;-).

 

Martin.

http://www.designprosoftware.co.uk/
Moderator
Alexander.Rivilis
Posts: 1,398
Registered: ‎04-09-2008
Message 6 of 9 (885 Views)

Re: ads_queueexp

04-20-2012 07:38 AM in reply to: DesignProQuig

DesignProQuig wrote:

Thank you very much for the help everyone, ;-).

 

Martin.


Kudos and Accepted Solutions will be helpful. ;-)


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Active Contributor
DesignProQuig
Posts: 32
Registered: ‎03-02-2012
Message 7 of 9 (881 Views)

Re: ads_queueexp

04-20-2012 07:48 AM in reply to: Alexander.Rivilis

LOL, Done! :smileyvery-happy:

http://www.designprosoftware.co.uk/
Board Manager
StephenPreston
Posts: 368
Registered: ‎05-22-2006
Message 8 of 9 (862 Views)

Re: ads_queueexp

04-20-2012 04:49 PM in reply to: DesignProQuig

Hi Martin,

 

An alternative to ads_queueexpr for running a command at startup - http://adndevblog.typepad.com/autocad/2012/04/autoloader-the-startupcommand-parameter.html.

 

BTW If you asked this question through ADN support, whoever answered you should have made sure you understood the specific changes required to your code. If you send me a private message with the Case number, I'll check the casenotes and 'educate' :smileywink: whoever answered you.

 

Cheers,

Stephen Preston
Autodesk Developer Network
Active Contributor
DesignProQuig
Posts: 32
Registered: ‎03-02-2012
Message 9 of 9 (838 Views)

Re: ads_queueexp

04-21-2012 03:28 AM in reply to: StephenPreston

Hi Stephen,

I did get an answer and it was perfect.  I was flapping because it was getting close to 5pm, and I didn't know if I would get my answer for the weekend.  So no need to put the smack down. ;-).

 

Regards,

 

Martin.

http://www.designprosoftware.co.uk/

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
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

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

Ask the Community