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

autoloader dont work

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Sined99
1470 Views, 5 Replies

autoloader dont work

Hello,

 

I Will autoload a .NET assembly in autocad 2013, I have try it with the .XML file but it doesn`t works. I Will that when the autocad Starts load an custom ribbon tab that I develop. If I load the .dll with the NETLOAD function it works and appear the ribbontab. The content of the XML file is the following:

 

<?xml version="1.0" encoding="utf-8"?>
<ApplicationPackage SchemaVersion="1.0" AutodeskProduct="AutoCAD" Name="Crear" Description="Genera nombre acorde con la númeracion de Vault" AppVersion="1.0.0" ProductType="Application" AppNameSpace="AutoCADRibbon">
  <CompanyDetails Name="Test" />
  <Components>
    <RuntimeRequirements OS="Win64|Win32" Platform="AutoCAD*" SeriesMin="R19.0" SeriesMax="R19.0" />
    <ComponentEntry AppName="AutoCADRibbon" ModuleName=".\Contents\AutoCADRibbon.dll">
      <Commands GroupName="Crear">
        <Command Local="Crear" Global="Crear" StartupCommand="True" />
      </Commands>
    </ComponentEntry>
  </Components>
</ApplicationPackage>

 

 

And the .NET Code is:

 

[

CommandMethod("Crear", CommandFlags.Transparent)]

       

publicvoid Testme()

        {

           

RibbonControl ribbon = ComponentManager.Ribbon;

           

if (ribbon != null)

            {

               

RibbonTab rtab = ribbon.FindTab("Crear Nombre");

               

if (rtab != null)

                {

                    ribbon.Tabs.Remove(rtab);

                }

                rtab =

newRibbonTab();

                rtab.Title =

"Crear Nombre";

                rtab.Id =

"Nombre";

               

                ribbon.Tabs.Add(rtab);

                addContent(rtab);

            }

        }

       

publicvoid addContent(RibbonTab rtab)

        {

            rtab.Panels.Add(AddOnePanel());

        }

       

publicRibbonPanel AddOnePanel()

        {

           

RibbonButton rb;

           

RibbonPanelSource rps = newRibbonPanelSource();

            rps.Title =

"Nombre documento";

           

RibbonPanel rp = newRibbonPanel();

            rp.Source = rps;

           

RibbonButton rci = newRibbonButton();

            rci.Name =

"TestCommand";

            rb =

newRibbonButton();

            rb.ShowImage =

true;

            rb.LargeImage =

newBitmapImage(newUri(@"C:\Program Files\Autodesk\ApplicationPlugins\GeneradorNombresVault\Contents\bt32.PNG"));

            rb.Orientation = System.Windows.Controls.

Orientation.Vertical;

            rb.Size =

RibbonItemSize.Large;

            rb.Name =

"btNombre";

            rb.ShowText =

true;

            rb.MouseLeft += (sender, e) =>

            {

               

            };

            rb.Text =

"Crear Nombre..."; //Add the Button to the Tab

            rps.Items.Add(rb);

           

return rp;

        }

 

Some help?

 

Thank you very much!

5 REPLIES 5
Message 2 of 6
Keith.Brown
in reply to: Sined99

I had this issue at one point also with the autoload and a ribbon.  My solution was to place the method to create the ribbon in an event handler for the Application.idle event.  something like this.

 

 

void IExtensionApplication.Initialize()  
{            
     Application.Idle += callback_Idle;        
}         

void IExtensionApplication.Terminate()        
{}         

private void callback_Idle(Object sender, EventArgs e)       
{ Application.Idle -+ callback_idle; CreateRibbon(); }

 

 

After making the change my code for the ribbon worked fine.

 

You might also check out these threads at the swamp for a technical explanation.

 

http://www.theswamp.org/index.php?topic=44252.msg495093#msg495093

http://www.theswamp.org/index.php?topic=44440.msg496962#msg496962

 

Tony does a good job of explaining why they do not work.

 

Message 3 of 6
Denis99
in reply to: Keith.Brown

Hello,

 

Thank you for the answear, I have read the links and I have make the changes, but it doesnt works. I dont know if I have to use the .XML file to autoload the content If yes I dont know if the xml file is correct... if I only must have the .NET .dll in the applicationPlugins folder... I really dont know. I only Will that the custom ribbon that I create appears when I start the Autocad 2013. How can I do that? Some help?

 

Thank you very much.

Tags (3)
Message 4 of 6
daniel.balogh
in reply to: Denis99

Hi, 

 

The autoloader gets the files from 2 locations: %Appdata%\Autodesk\Applicationplugins (for user-spec) and %programdata%\autodesk\applicationplugins (for everyone on the machine)

Here you have to provide a folder with "mypluginorwhatever.bundle" <- ".BUNDLE" is the trigger to load by autoloader

In this you need the "PackageContents.xml" which contains the info you provided...

In this Folder you also create the Folder "Contents" where you put your dll(s) in... Note, that you can build a more complex Fodlerstructure as long you describe it in the xml (different versions for x64/x86, lang.... )

 

I'm not sure, wether this is an issue, you provide in your XML a Commandgroup, in your plugin you don't. As you describe you want the Ribbon to be shown on Load, you may place the Method in your initialization.

...

      <Commands GroupName="Crear">
        <Command Local="Crear" Global="Crear" StartupCommand="True" />
      </Commands>

...

 

Since you work with 2013 (and nobody with acad 2012- get's your app)  you can simplify the whole thing to:

 

<?xml version="1.0" encoding="utf-8"?>
<ApplicationPackage SchemaVersion="1.0" AutodeskProduct="AutoCAD" Name="Crear" Description="Genera nombre acorde con la númeracion de Vault" AppVersion="1.0.0" ProductType="Application" >
    <Components>
    <ComponentEntry AppName="AutoCADRibbon" ModuleName="./Contents/AutoCADRibbon.dll">
      <Commands>
        <Command Local="Crear" Global="Crear" StartupCommand="True" />
      </Commands>
    </ComponentEntry>
  </Components>
</ApplicationPackage>

 

HTH,

Daniel

Message 5 of 6
Sined99
in reply to: daniel.balogh

Hello,

 

Thank you so much, finally it works, I changed the .XML file and the name of the forlder and it works.

 

Thank you so much!

Message 6 of 6
daniel.balogh
in reply to: Sined99

Your're welcome J

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