.NET

Reply
Contributor
Sined99
Posts: 15
Registered: ‎04-26-2013
Message 1 of 6 (472 Views)
Accepted Solution

autoloader dont work

472 Views, 5 Replies
09-26-2013 07:21 AM

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!

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

*Expert Elite*
Keith.Brown
Posts: 1,152
Registered: ‎03-13-2008
Message 2 of 6 (460 Views)

Re: autoloader dont work

09-26-2013 08:00 AM 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.

 


Keith Brown AutoCAD MEP BLOG | RSS Feed
AutoCAD MEP 2014 | Revit 2014 | EastCoast CAD/CAM V6.1 | Visual Studio 2013
────────────────────────────────────
⁞|⁞ Please use Mark Solutions!.Accept as Solution and Give Kudos!Give Kudos as appropriate. Thank you!
New Member
pepepepepppp
Posts: 2
Registered: ‎05-10-2012
Message 3 of 6 (407 Views)

Re: autoloader dont work

10-01-2013 03:48 AM 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.

Active Member
daniel.balogh
Posts: 10
Registered: ‎10-31-2012
Message 4 of 6 (398 Views)

Re: autoloader dont work

10-01-2013 04:09 AM in reply to: pepepepepppp

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

Contributor
Sined99
Posts: 15
Registered: ‎04-26-2013
Message 5 of 6 (386 Views)

Re: autoloader dont work

10-01-2013 07:11 AM 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!

Active Member
daniel.balogh
Posts: 10
Registered: ‎10-31-2012
Message 6 of 6 (360 Views)

Re: autoloader dont work

10-02-2013 12:06 AM in reply to: Sined99
Your're welcome J
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.