Creating C# script for a button to insert a detail component
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all,
So lately I've been using pyRevit to try and complete this however the API just isn't clicking with me and i'm not a coder by nature. I've tried finding examples, of which I have found only 1 I think that may be close to what I'm wanting but I have no way to confirm. I am extremely familiar with revit and I can make my way through coding even without fully knowing it.
This is the example I've found.
UIApplication application = commandData.Application; UIDocument uiDocument = application.ActiveUIDocument; Document document = application.ActiveUIDocument.Document; FilteredElementCollector familyCollector = new FilteredElementCollector(document);familyCollector.OfClass(typeof(FamilySymbol)); FamilySymbol familySymbolToFind = null; foreach (FamilySymbol familySymbol in familyCollector) { //To search by FamilySymbol name if (familySymbol.Name == "[Name of FamilySymbol to find]") familySymbolToFind = familySymbol; //To search by Family name else if (familySymbol.Family.Name = "[Name of Family to find]") familySymbolToFind = familySymbol; }uiDocument.PromptForFamilyInstancePlacement(familySymbolToFind);
The pyRevit (python) examples i've followed seem rather simple, but it's just not clicking. How does this declare for example if I wanted it to be a "break line" that is already loaded into a template. This was there's no searching.
I already have the toolbar set up so I have my own ribbon tab and push button. Once I can get this to work then the next step is to create drop down lists for W beams by section/plan/etc.