Etichette

martedì 10 dicembre 2013

5th place Autodesk Apphack 2.0 - eVoxGconnect

Rieccomi di ritorno dall'Autodesk University!

5° posto all'autodesk apphack 2.0 superati i 2 round di selezione indenne mi sono fronteggiato con i team americani. Risultato comunque soddisfacente visto che il mio team era composto da me medesimo.

http://adndevblog.typepad.com/autocad/apphack-20-winners.html



domenica 20 ottobre 2013

Your Revit add-in with a new wonderful ribbon tab - template visual studio

In this article I will explain a simple way to build a solution with a customized ribbon tab inside revit.

Let's start opening the basic template here.

Take a look to the code:

The first thing you need to do is to set your application  for creating a new ribbon tab:

 public class Applicationclass : IExternalApplication  
   {  
     #region IExternalApplication Members  
     public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application)  
     {  
       string path = Assembly.GetExecutingAssembly().Location; //<-----The path of the dll file for your addin  
       //add code here if you want to run functions on Revit Startup  
       //Set the contextual help which show help file pushing "F1"  
       ContextualHelp help = new ContextualHelp(ContextualHelpType.Url, "YOUR URL HERE");  
       //Create a new Ribbon tab  
       application.CreateRibbonTab("THE_TAB_NAME");  
       //Create a new Ribbon Panel inside the ribbon tab  
       RibbonPanel panel = application.CreateRibbonPanel("THE_TAB_NAME", "THE_PANEL_NAME");  
       //Create a new button and insert it into the panel  
       //btn1 = a unique identifier for the button  
       //Name_Button= The name of the button you want to be shown  
       //path = the path of the addin dll file  
       //Classname = the full class name for your command  
       PushButtonData manag = new PushButtonData("btn1", "Name_BUTTON", path, "Revit_AppWithCustomRibbon.YOURCOMMAND");  
       //set the contextual help for your command  
       manag.SetContextualHelp(help);  
       //add the button to the panel  
       panel.AddItem(manag);  
       return Result.Succeeded;  
     }  
     public Autodesk.Revit.UI.Result OnShutdown(UIControlledApplication application)  
     {  
       //Remove events if needed  
       return Result.Succeeded;  
     }  
     #endregion  
   }  

Now you are able to create your commands as I shown here:

   //Add your external commands here or in another file  
   [Autodesk.Revit.Attributes.Transaction(  
   Autodesk.Revit.Attributes.TransactionMode.Manual)]  
   public class YOURCOMMAND : IExternalCommand  
   {  
     public Result Execute(  
   ExternalCommandData commandData,  
   ref string message,  
   ElementSet elements)  
     {  
       TaskDialog.Show("Hello", "Hello world!");  
       return Result.Succeeded;  
     }  
   }  



Here the Code

mercoledì 16 ottobre 2013

Revit API - Iexternal command template

In this article I would like to show a simple way to create and test your code using my basic template for Add-in avalaible here

Let's start opening visual studio and clicking on the Add-in template. You need to type a name for your solution as in the screenshot below.

I called my app "My first command"

Now we need to type some essentials strings:

 namespace My_first_command  
 {  
   [TransactionAttribute(TransactionMode.Manual)]  
   [RegenerationAttribute(RegenerationOption.Manual)]  
   public class MyCommand : IExternalCommand  
   {  
       public Result Execute(
              ExternalCommandData commandData,
              ref string message,
              ElementSet elements)
              {
                 //YOUR CODE HERE
              }
   }  
 }  

You just need to type the code for the function where I wrote "Your code here".
Let's start with a simple example....a Message with "Hello world!" showed clicking on a button in Revit.

 namespace My_first_command  
 {  
   [TransactionAttribute(TransactionMode.Manual)]  
   [RegenerationAttribute(RegenerationOption.Manual)]  
   public class MyCommand : IExternalCommand  
   {  
     public Result Execute(  
        ExternalCommandData commandData,  
        ref string message,  
        ElementSet elements)  
     {  
       TaskDialog.Show("Hello world!", "Hello");  
       return Result.Succeeded;  
     }  
   }  
 }  

Now you need to test the code.
In order to set your visual studio to start revit and to test the code you need to click on "Project" and to click on "My project properties" (in this case "My_first_command Properties").
You need to click on Debug and to set revit as external program, so click on "Start external program" and clicking on "..." you will be able to click on Revit.exe in C:\Programfiles\Autodesk\Revit2014\Revit.exe.

This is a screenshot which show the result:

Now you need to set the paths for your solution, because Revit will initialize only the addins located in some specific paths. 
Click on "Build" and set the path to C:\ProgramData\Autodesk\Revit\Addins\2014\
Click on save button.

Now you need to set your addin manifest. (THIS IS IMPORTANT)
Be sure that the name of the assembly is correct and also the class name for your application.

Download the source code at the link below to understand how to compile an addin manifest correctly.

You just need to click on "Start" in the toolbar and Revit will appear. Your command will be avalaible in the "Add-ins" ribbon tab clicking on external tools.







martedì 15 ottobre 2013

eVox Bill of quantities 2.6 features - video

Start develop your Revit Add-in - Revit add-in template for visual studio

In this article I would like to show the operations you need to do for developping your own add-in. Following this article you will be able to set your project for each addin you want to develop and you will be able to skip this steps.

In this article I used Visual Studio 2012.

Let's start opening visual studio and clicking on new project in File -> New and following the istructions below you will have a new fastest way to develop your add-ins!

1. The first thing you need to do is to select a template. This is the first time you develop an add-in so you need to create a template valid for all addins you will develop in future. In order to create a template you need to select "Class Library", to type the name below and to select the path clicking on "browse" button.


2. Just clicking on OK button you will be abel to set the visual studio project. You need to set the references to Revit api dll; To do this you need to click on References with right click and to click on "Add Reference..." as you can see in the snap


After that you need to click on "Browse" and to add the references to:
C:\Programfiles\Autodesk\Revit2014\Revitapi.dll
C:\Programfiles\Autodesk\Revit2014\RevitAPIUI.dll
C:\Programfiles\Autodesk\Revit2014\Revitaddinutility.dll

3. Now you are ready to start coding. To complete your addin template you need to call your references in the code. So at the top add these strings:
 using Autodesk.Revit.DB;  
 using Autodesk.Revit.DB.Architecture;  
 using Autodesk.Revit.UI;  
 using Autodesk.Revit.UI.Events;  
 using Autodesk.Revit.UI.Selection;  
 using Autodesk.Revit.ApplicationServices;  
 using Autodesk.Revit.Attributes;  

4. To complete the addin template we need also an addin manifest which will be generated automatically following these steps:

  1. Click on "Project" and click on "Add new item..."
  2. Select XML file, type the name in the textbox and click on "Add"
  3. Now in the solution explorer(the panel on the top right) click on the new xml file added and change the File name in properties to "Revit_app_template.addin"
  4. Follow this instructions to type the code for your addin
  5. In properties set "Copy to output directory" to "copy always"
5. Now you just need to click on file and to Export the template following the instructions.

At these link there is the complete code for the template.

This is just a basic template to start a revit addin. In the next articles I will explain how to set visual studio to test your apps and to build your solution successfully.




lunedì 14 ottobre 2013

eVox Bill of quantities 2.6 unofficial - BETA release

In questo articolo trovate disponibile un file dll contenente le funzioni della nuova release che sarà disponibile nelle prossime settimane in versione ufficiale. Non preoccupatevi, è stata già testata e viene resa disponibile vista la sua stabilità.

Senza troppe chiacchiere vi riporto le novità:
- Visualizzazione manager migliorata riportante nomi degli elementi computati e categoria


- Modifica e applicazione costi con possibilità di aggiungere più voci di computo per singolo elemento evitando di ripetere l'operazione dall'inizio

- Aggiunte impostazioni di esportazione
  • XPWE - possibilità di aggiungere commenti basati su famiglia e impostare i parametri in modo da condizionare l'inserimento nel file di primus (Larghezza,Lunghezza, Peso, ecc)
  • Excel, Six, Word - aggiunta di commenti personalizzati basati su famiglia
  • Correzione esportazione file six


Istruzioni per l'installazione
1. Scaricate la dll
2. Copiatela in C:\ProgramData\Autodesk\ApplicationPlugins\evoxbillofquantities.bundle\Contents\2014\evoxBOQ\
3. sostituite il file all'interno della cartella che avrà lo stesso nome di quello scaricato
4. avviate revit e iniziate il computo :)

N.B. Se nel percorso che vi ho suggerito non è presente il file che avete scaricato dovete cercarlo nel computer oppure scrivetemi che vedo come aiutarvi

Se quando avviate revit da errori:
1. Andate nel percorso che vi ho indicato sopra
2. cliccate col destro sul file "eVox_bill_of_quantities" o "eVox_bill_of_quantities.dll" e cliccando su proprietà dovreste avere la possibilità di cliccare su "sblocca" o "Unblock" (è un tasto da schiacciare)...nella scheda "Generale"

In caso contrario attendete la versione ufficiale sullo store.

Alla prossima!