private void UpdateUpstream()
        {
            OnClear();

            var gathered = new List<NodeModel>();
            watchNode.VisibleUpstreamNodes(gathered);

            gathered.ForEach(n => n.WasInvolvedInExecution = true);
            gathered.ForEach(n => n.RequestVisualUpdateAsync(scheduler, engineManager.EngineController, renderPackageFactory));
        }
Esempio n. 2
0
        void mi_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (AllElements.Count == 0)
                return;

            //select the elements
            dynRevitSettings.Doc.Selection.Elements.Clear();

            var existingElements = new List<Element>();

            foreach (var id in AllElements)
            {
                Element el;
                if (dynUtils.TryGetElement(id, typeof (Element), out el))
                {
                    existingElements.Add(el);
                }
            }

            existingElements.ForEach(x => dynRevitSettings.Doc.Selection.Elements.Add(x));

            //show the elements
            dynRevitSettings.Doc.ShowElements(existingElements.Select(x => x.Id).ToList());
        }
Esempio n. 3
0
 /// <summary>
 /// Build a string tag from a list of ints. i.e "1,2,3,4"
 /// </summary>
 /// <param name="tags"></param>
 /// <returns></returns>
 private static string TagFromList(List<int> tags)
 {
     var sb = new StringBuilder();
     tags.ForEach(x => sb.Append(string.Format("{0},", x)));
     if(sb.Length > 1)
         sb.Remove(sb.Length - 1, 1);    //remove the last ,
     return sb.ToString();
 }
Esempio n. 4
0
        /// <summary>
        ///     Adds a local DynNode to search
        /// </summary>
        /// <param name="dynNode">A Dynamo node object</param>
        public void Add(Type t)
        {
            // get name, category, attributes (this is terribly ugly...)
            var attribs = t.GetCustomAttributes(typeof (NodeNameAttribute), false);
            var name = "";
            if (attribs.Length > 0)
            {
                name = (attribs[0] as NodeNameAttribute).Name;
            }

            attribs = t.GetCustomAttributes(typeof (NodeCategoryAttribute), false);
            var cat = "";
            if (attribs.Length > 0)
            {
                cat = (attribs[0] as NodeCategoryAttribute).ElementCategory;
            }

            attribs = t.GetCustomAttributes(typeof (NodeSearchTagsAttribute), false);
            var tags = new List<string>();
            if (attribs.Length > 0)
            {
                tags = (attribs[0] as NodeSearchTagsAttribute).Tags;
            }

            attribs = t.GetCustomAttributes(typeof (NodeDescriptionAttribute), false);
            var description = "";
            if (attribs.Length > 0)
            {
                description = (attribs[0] as NodeDescriptionAttribute).ElementDescription;
            }

            var searchEle = new NodeSearchElement(name, description, tags);

            attribs = t.GetCustomAttributes(typeof(NodeSearchableAttribute), false);
            bool searchable = true;
            if (attribs.Length > 0)
            {
                searchable = (attribs[0] as NodeSearchableAttribute).IsSearchable;
            }

            searchEle.SetSearchable(searchable);

            // if it's a revit search element, keep track of it
            if ( cat.Equals(BuiltinNodeCategories.REVIT_API) )
            {
                this.RevitApiSearchElements.Add(searchEle);
                if (!IncludeRevitAPIElements)
                {
                    return;
                }
            }

            if (!string.IsNullOrEmpty(cat))
            {
                SearchDictionary.Add(searchEle, cat + "." + searchEle.Name);
            }

            TryAddCategoryAndItem(cat, searchEle);

            SearchDictionary.Add(searchEle, searchEle.Name);
            if (tags.Count > 0)
            {
                // reduce the weight in search by adding white space
                tags.ForEach(x => SearchDictionary.Add(searchEle, x + "++++++++"));
            }
            SearchDictionary.Add(searchEle, description);
        }
Esempio n. 5
0
        /// <summary>
        ///     Adds a local DynNode to search
        /// </summary>
        /// <param name="dynNode">A Dynamo node object</param>
        public void Add(Type t)
        {
            // get name, category, attributes (this is terribly ugly...)
            var attribs = t.GetCustomAttributes(typeof(NodeNameAttribute), false);
            var name = "";
            if (attribs.Length > 0)
            {
                name = (attribs[0] as NodeNameAttribute).Name;
            }

            attribs = t.GetCustomAttributes(typeof(NodeCategoryAttribute), false);
            var cat = "";
            if (attribs.Length > 0)
            {
                cat = (attribs[0] as NodeCategoryAttribute).ElementCategory;
            }

            attribs = t.GetCustomAttributes(typeof(NodeSearchTagsAttribute), false);
            var tags = new List<string>();
            if (attribs.Length > 0)
            {
                tags = (attribs[0] as NodeSearchTagsAttribute).Tags;
            }

            attribs = t.GetCustomAttributes(typeof(NodeDescriptionAttribute), false);
            var description = "";
            if (attribs.Length > 0)
            {
                description = (attribs[0] as NodeDescriptionAttribute).ElementDescription;
            }

            var searchEle = new NodeSearchElement(name, description, tags, t.FullName);
            searchEle.Executed += this.OnExecuted;

            attribs = t.GetCustomAttributes(typeof(NodeSearchableAttribute), false);
            bool searchable = true;
            if (attribs.Length > 0)
            {
                searchable = (attribs[0] as NodeSearchableAttribute).IsSearchable;
            }

            searchEle.SetSearchable(searchable);

            attribs = t.GetCustomAttributes(typeof(NotSearchableInHomeWorkspace), false);
            if (attribs.Length > 0)
            {
                this.NodesHiddenInHomeWorkspace.Add(searchEle);
                if (this.DynamoModel != null && this.DynamoModel.CurrentWorkspace != null &&
                    this.DynamoModel.CurrentWorkspace is HomeWorkspaceModel)
                {
                    searchEle.SetSearchable(false);
                }
            }

            attribs = t.GetCustomAttributes(typeof(NotSearchableInCustomNodeWorkspace), false);
            if (attribs.Length > 0)
            {
                this.NodesHiddenInCustomNodeWorkspace.Add(searchEle);
                if (this.DynamoModel != null && this.DynamoModel.CurrentWorkspace != null &&
                    this.DynamoModel.CurrentWorkspace is CustomNodeWorkspaceModel)
                {
                    searchEle.SetSearchable(false);
                }
            }

            if (!string.IsNullOrEmpty(cat))
            {
                SearchDictionary.Add(searchEle, cat + "." + searchEle.Name);
            }

            TryAddCategoryAndItem(cat, searchEle);

            SearchDictionary.Add(searchEle, searchEle.Name);
            if (tags.Count > 0)
            {
                // reduce the weight in search by adding white space
                tags.ForEach(x => SearchDictionary.Add(searchEle, x + "++++++++"));
            }
            SearchDictionary.Add(searchEle, description);

        }