Sorry for asking this newbie question. I could not figure it out how to do this.
I found a sample project named RibbonSample in which by running a command, a new tab will be added to the ribbon.
I am trying to have that tab added upon loading the dll. So I added that command in the constructor of the dll, by "
SendStringToExecute" command. But the new tab did not show up. Then I added the method which creates the tab in the constructor, and I found the same thing. In both cases, when I type the command for creating the ribbon tab, a second tab, along with the first tab I added in the constructor, show up.
So I guess two possible options I have:
Your insights would be much appreciated.
No garuantees, but I have had success using ads_queueexpr in the initialize routine, and DocumentActivated event, to do things that I could not otherwise do, because of the state of the document or application.
It essentially puts a command on the command stack, which will then be executed when AutoCAD has become ready to execute commands. (I'm not sure why it is any different from SendStringToExecute, but I believe that it is)
It is an ARX command, which needs to be P/Invoked from .NET
e", CharSet:=System.Runtime.InteropServices.CharSet.Un icode, CallingConvention:=System.Runtime.InteropServices. CallingConvention.Cdecl, EntryPoint:="ads_queueexpr")> _ Public Shared Function ads_queueexpr(expression As String) As Integer End Function
[DllImport("acad.exe", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)] extern static private int ads_queueexpr(string strExpr);
Thanks for your response.
As I found in the ObjectArx help, it says:
Do not use ads_queueexpr() in any context other then the kLoadDwgMsg case of acrxEntryPoint()
Moreover, I found in another discussion that to use it in Acad 2013, we need to use "accore.dll" instead. But the sample code was in VB.NET, so I translated that to C# as following :
[DllImport("accore.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl, EntryPoint = "ads_queueexpr")]
public static extern int ads_queueexpr(string strExpr);
then added this line in the constructor:
But it seems it does not work.
Am I missing something?
Access a broad range of knowledge to help get the most out of your products and services.
Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.
Upgrading to a 2015 product? Make sure to check these out 1st!