Exemplo n.º 1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            bool runCommand = false;
            int category = 3;
            DA.GetData(0, ref runCommand);
            DA.GetData(1, ref category);

            try
            {
                ElementIdCategory eicTemp = (ElementIdCategory)category;
                if (eic != eicTemp)
                {
                    eic = (ElementIdCategory)category;
                }
            }
            catch { }
            
            if (runCommand)
            {
                try
                {
                    elements = new List<string>();
                    elements.Clear();
                    // Open the Channel to Revit
                    
                    LyrebirdChannel channel = new LyrebirdChannel(appVersion);
                    
                    channel.Create();
                    
                    if (channel != null)
                    {
                        string documentName = channel.DocumentName();
                        if (documentName != null)
                        {
                            elements = channel.GetCategoryElements(eic);
                        }

                        channel.Dispose();
                    }
                }
                catch (Exception ex)
                {
                    System.Windows.Forms.MessageBox.Show("Error\n" + ex.Message);
                }
            }
            DA.SetDataList(0, elements);
        }