Create Dependent Views and Set View Type


#1

Trying to change or set the view type of a list of ceilingplan and floorplan dependent views

This example was an attempt to grab a View Type from an existing view:

import clr clr.AddReference(‘RevitAPI’) from Autodesk.Revit.DB import * import Autodesk clr.AddReference(“RevitServices”) import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager doc = DocumentManager.Instance.CurrentDBDocument views = UnwrapElement(IN[0]) selectview = UnwrapElement(IN[1]) elementlist = list() typeid=View.GetTypeId(selectview) dupopt = Autodesk.Revit.DB.ViewDuplicateOption.AsDependent TransactionManager.Instance.EnsureInTransaction(doc) for view in views: newview = view.Duplicate(dupopt, typeid) view.ChangeTypeId(typeid); elementlist.append(doc.GetElement(newview)) TransactionManager.Instance.TransactionTaskDone() OUT = elementlist

This example was an attempt to grab a View Type that is in the project

import clr clr.AddReference(‘RevitAPI’) from Autodesk.Revit.DB import * import Autodesk clr.AddReference(“RevitServices”) import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager doc = DocumentManager.Instance.CurrentDBDocument views = UnwrapElement(IN[0]) vft = UnwrapElement(IN[1]) elementlist = list() dupopt = Autodesk.Revit.DB.ViewDuplicateOption.AsDependent TransactionManager.Instance.EnsureInTransaction(doc) for view in views: newview = view.Duplicate(dupopt) view.ChangeTypeId(vft.Id) elementlist.append(doc.GetElement(newview)) TransactionManager.Instance.TransactionTaskDone() OUT = elementlist


#2

Let’s try this again.

This example was an attempt to grab a View Type from an existing view:

From Existing View

This example was an attempt to grab a View Type that is in the project:

Select View Type

Thanks.


#3

I think clockwork already offers what you want. Just feed the node a view and it will report the type.

2015-09-14_13h28_33


#4

Thanks John. Appreciate your assistance.

Unless I’m missing something, that node seems to report only the family, not the family type and does not allow me to set the View Type for a given view, just a query.

David