After I create my own ViewFamilyTypes I am unable to use them to create Floor Plans from (Red Arrows). I can create using blue arrow (Revit’s own Floor Plan FamilyViewType). I do not want to duplicate existing views. Can anyone help with this?
import clr
clr.AddReference("ProtoGeometry")
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitNodes") # Import RevitNodes
import Revit
from Revit.Elements import * # Import Revit elements
clr.AddReference("RevitServices") # Import DocumentManager
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference('RevitAPI') #import clr
from Autodesk.Revit.DB import * # Import ToDSType(bool) extension method
clr.ImportExtensions(Revit.Elements)
import System # Import System
import sys
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
prjViewFamilyTypes = IN[0] # ALL THE FAMILY TYPES IN THE PROJECT
xlsxViewFamilyTypeNames = IN[1] # CUSTOM VIEW TYPES THAT WERE CREATED FOR THE RPOJECT
xlsxSheetNumberDiscipline = IN[2] # THE DISCIPLINE CODE INTHE SHEET NAMES
xlsxSheetName = IN[3] # ALL THE SHEET NAMES THAT MUST BE CREATED FOR EACH LEVEL
xlsxLevels = IN[4] # ALL THE LEVELS THAT WERE CREATED FOR THIS PROJECT
Titleblock = IN[5] # THE TITLEBLOCK FAMILY TYPE THAT NEEDS TO BE USED TO CREATE THE SHEET
prjLevels = IN[6] # ALL THE LEVELS IN THE PROJECT
SheetList = [] # CONTATINER FOR THE SHEETS THAT ARE CREATED
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
Discipline =[]
TransactionManager.Instance.EnsureInTransaction(doc) # you need an active transaction as you will create elements
ViewFamilyTypeId = ElementId(prjViewFamilyTypes[0].Id)
# ViewFamilyTypeId = ElementId(prjViewFamilyTypes[10].Id) THIS DOES NOT WORK!
LevelId = ElementId(prjLevels[0].Id)
newViewPlan = ViewPlan.Create(doc, ViewFamilyTypeId, LevelId)
newViewPlan.Name = "1"
TransactionManager.Instance.TransactionTaskDone()
OUT = Discipline
import clr
clr.AddReference("ProtoGeometry")
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitNodes") # Import RevitNodes
import Revit
from Revit.Elements import * # Import Revit elements
clr.AddReference("RevitServices") # Import DocumentManager
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference('RevitAPI') #import clr
from Autodesk.Revit.DB import * # Import ToDSType(bool) extension method
clr.ImportExtensions(Revit.Elements)
import System # Import System
import sys
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
prjViewFamilyTypes = IN[0] # ALL THE FAMILY TYPES IN THE PROJECT
xlsxViewFamilyTypeNames = IN[1] # CUSTOM VIEW TYPES THAT WERE CREATED FOR THE RPOJECT
xlsxSheetNumberDiscipline = IN[2] # THE DISCIPLINE CODE IN THE SHEET NAMES
xlsxSheetName = IN[3] # ALL THE SHEET NAMES THAT MUST BE CREATED FOR EACH LEVEL
xlsxLevels = IN[4] # ALL THE LEVELS THAT WERE CREATED FOR THIS PROJECT
Titleblock = IN[5] # THE TITLEBLOCK FAMILY TYPE THAT NEEDS TO BE USED TO CREATE THE SHEET
prjLevels = IN[6] # ALL THE LEVELS IN THE PROJECT
SheetList = [] # CONTATINER FOR THE SHEETS THAT ARE CREATED
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
Discipline =[]
name = "PD - DRAINAGE - BELOW"
viewFamilyTypes = FilteredElementCollector(doc).OfClass(ViewFamilyType).ToElements()
id = -1
for viewType in viewFamilyTypes:
typeName = viewType.get_Parameter(BuiltInParameter.SYMBOL_NAME_PARAM).AsString()
if typeName == name:
id = viewType.Id
break
TransactionManager.Instance.EnsureInTransaction(doc) # you need an active transaction as you will create elements
ViewFamilyTypeId = ElementId(prjViewFamilyTypes[0].Id)
# ViewFamilyTypeId = ElementId(prjViewFamilyTypes[10].Id) THIS DOES NOT WORK!
LevelId = ElementId(prjLevels[0].Id)
newViewPlan = ViewPlan.Create(doc, id, LevelId)
#newViewPlan = ViewPlan.Create(doc, ViewFamilyTypeId, LevelId)
newViewPlan.Name = "2"
TransactionManager.Instance.TransactionTaskDone()
OUT = Discipline