Duplicating PlanView and dependent views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
HI guys,
I posted this same issue on Augi but im not sure they have the same talent as you guys 🙂
I am pretty new to programming and the revit API but i under stand the program and its user unterface very well.
What i am trying to make is a add-in that automates a process of creating views for loadbearing under views, the idea is that the addin create a duplicate of a selected view and applies a view template for the correct view settings then adds it to the selected sheet.
This is the process i want to follow:
a. User to select API tool in add-ins tab in revit,
b. Prompt user to select view <Host View>,
//Duplicate view
//rename view to “<Host View> Under & Over”
//apply view template “Profile Under & Over”
//move view type to “Profile Under & Over” or duplicate view type and rename to “Profile Under & Over”
//(if Host View has dependent views apply sequence b1 otherwise proceed to sequence c)
b1.
//Apply dependent views from Host View
//rename dependent views “<Host View> Under & Over - Part <1>”
c. Prompt user to select “sheet” or “create new sheet” in dialog,
if selected “sheet”
//move “<Host View> Under & Over” or if dependent “<Host View> Under & Over - Part <1>”centre to centre on sheet
if selected “create new sheet”
//create new sheet
//rename sheet to “<Host View>” or if dependent “<Host View> - Sheet <1>
//move “<Host View> Under & Over” or if dependent “<Host View> Under & Over - Part <1>”centre to centre on sheet
Now there are lots of steps between all the listed steps that im still learning to get the end resault.
This is the start of what i have done with regards to the code to select the view:
using System;
using System.Collections.Generic;
using System.Linq;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Architecture;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
[TransactionAttribute(TransactionMode.Manual)]
[RegenerationAttribute(RegenerationOption.Manual)]
public class Lab1PlaceGroup : IExternalCommand
{
public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
//Get application and document objects
UIApplication uiApp = commandData.Application;
Document doc = uiApp.ActiveUIDocument.Document;
//Define a Reference object to accept the pick result.
Reference pickedRef = null;
//Pick a view
Selection sel = uiApp.ActiveUIDocument.Selection;
pickedRef = sel.PickObject(ObjectType.Element, "Please select a view");
Element elem = pickedRef.Element;
ViewPlan profileplan = elem as ViewPlan;Now i am stuck here.. What i want to do next is duplicate the view but i am not sure how to apply duplicate () and how to check / apply that to dependent views, do i do this in a new class or can i do it in the current class?
Any help would be much appreciated
Thanks heaps
Dave