Create Area Plan

Create Area Plan

Anonymous
Not applicable
1,014 Views
2 Replies
Message 1 of 3

Create Area Plan

Anonymous
Not applicable

My company made some decisions implement area plans for different Diagrams. I have a similar setup for setting up all the plans for floor and ceiling plans in my model. My code below does appear to work correctly when i try running for area plans.  Was there a change for area plans that does not allow me to do this? I have tested this in Revit 2015 and 2018

 

public void areaplans()
		{
		    Document doc = this.ActiveUIDocument.Document;
		    using (Transaction t = new Transaction(doc, "Create Views"))
		    {
		        t.Start();
		        foreach (ViewFamilyType vft in new FilteredElementCollector(doc)
		                 .OfClass(typeof(ViewFamilyType))
		                 .Cast<ViewFamilyType>()
		                 .Where(q => q.ViewFamily == ViewFamily.AreaPlan))
		        {
		            foreach (Level level in new FilteredElementCollector(doc)
		                     .OfClass(typeof(Level)))
		            {
		                ViewPlan newview = ViewPlan.Create(doc, vft.Id, level.Id);
		                newview.Name = level.Name + "-" + vft.Name;
		            }
		        }
		        t.Commit();
		    }
		}

Thanks in Advance

0 Likes
1,015 Views
2 Replies
Replies (2)
Message 2 of 3

JimJia
Alumni
Alumni

Dear blkscrpn5,

 

I am sorry we cannot reproduce your issue here.

 

can you provide a reproducible case for it?
In order to explore this matter further, we will need to provide a minimal reproducible case for the development team to analyse in depth.
In order to understand exactly what you mean and be able to research possible reasons for the discrepancy between the observed and expected behaviour, they require: 
· A short exact description of what you are trying to achieve.
· The behavior you observe versus what you expect, and why this is a problem.
· A complete yet minimal Revit sample model to run a test in.
· A complete yet minimal macro embedded in the sample model or Visual Studio solution with add-in manifest that can be compiled, loaded, run and debugged with a single click to analyse its behavior live in the sample model.
· Detailed step-by-step instructions for reproducing the issue, e.g. which element to pick, what command to launch etc.


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes
Message 3 of 3

aignatovich
Advisor
Advisor

Hi!

 

May be your created viewplan names are not unique (there are views with the same names in project or your combination of

level.Name + "-" + vft.Name

is not unique