Message 1 of 5

Not applicable
06-16-2015
06:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
In the process of developing a Revit 2015 add-in I have encountered a road block with the ViewDrafting.Create() method. More specifically, I am not sure how to generate the ElementId viewFamilyTypeId parameter. I have experimented with ViewType.DraftingView as well as the view family type class without any success. As I understand the API, ElementId objects can be retrieved using the .Id function for element items, and the element view family is where I need to be operating. Does anyone have ideas about how to receive a reference to this viewFamilyTypeId? For context, my current code:
[Transaction(TransactionMode.Automatic)] public class Command : IExternalCommand { // Add-in requried Execute method called on button press. public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { // generate form, organize returned doors list, and draw details ArrayList list = UserInterface.generate(); if (list != null) { // create new draft view for detailing UIDocument uidoc = commandData.Application.ActiveUIDocument; Document doc = uidoc.Document; ElementId id = ViewFamily.Drafting.; ViewDrafting draftView = ViewDrafting.Create(doc, id); uidoc.ActiveView = draftView; // create organizer to manage construction of all details Organizer organizer = new Organizer(list, commandData); } // return to revit process return Result.Succeeded; } }
Solved! Go to Solution.