I know this creates the tree node for each instance of view by its view type. Where(c => c.get_Parameter(BuiltInParameter.ELEM_TYPE_PARAM).AsValueString().Equals(s)).ToList() List elements = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Views) List vftlist = new FilteredElementCollector(doc).OfClass(typeof(ViewFamilyType)).Cast().Where(a =>a.ViewFamily = ViewFamily.StructuralPlan).ToList() I’m trying to do something very similar in a form in a macro, but having issues: If you make inside WPF form, an error will be raised. Note: if you want to make a transaction, you can only do in this “Execute method”. Now we have to call our WPF form from ” Class1.cs Execute method ” and build the project to get “RevitAddInsWPFSample.dll” file in ” bin/Debug/ ” folder. Next, collect all the views from the current Revit document, for each view create a TreeViewItem and attached it as second-level TreeViewItem in their associate ViewType first-level TreeViewItem. In this DisplayTreeViewItem first, we find all the ViewTypes from the current Revit document and create a first-level TreeViewItem. And call our DisplayTreeViewItem method too. In the Viewer Constructor, assign field value to the document which uses as an argument in our partial class constructor. (viewItem) įirst, we create a field to store the Document instance. TreeViewItem viewTypeItem = new TreeViewItem() ViewTypenames.Add(()) įoreach (string viewTypename in viewTypenames.Distinct().OrderBy(name => name).ToList()) List elements = new FilteredElementCollector(document).OfClass(typeof(View)).ToList() SortedDictionary ViewTypeDictionary = new SortedDictionary() viewtypename and treeviewitem dictionary
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |