Creating Structural Rebar Schedule for Assembly Views

Hello I was Wondering if anyone could help me create a Structural rebar category schedule for my assemblies. I am creating views and Schedules using the Tool.Assemblyviews node from Steam Nodes but the schedules that get created are multi category schedules that cannot access the Structural Rebar schedule category fields. If anyone knows a way around this please let me know


Set up ^

Python

`#python nodes in dynamo 1.0
#proposed by Julien Benoit @jbenoit44 
#http://aecuandme.wordpress.com/
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

elt = []
for i in IN[0]:
	elt.append(UnwrapElement(i).Id)
	
tb=UnwrapElement(IN[17]).Id
	
catid=doc.GetElement(elt[0]).Category.Id
	
collection=List[ElementId](elt)
viewlist=[]
schedlist=[]
sheetlist=[]
# Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
for a in elt:
	views=[]
	if IN[1] == 1:
		v=AssemblyViewUtils.Create3DOrthographic(doc,a)
		views.append(v)
	if IN[2] == 1:	
		ds2=AssemblyViewUtils.CreateDetailSection(doc,a,AssemblyDetailViewOrientation.HorizontalDetail)
		views.append(ds2)
	if IN[3] == 1:	
		ds3=AssemblyViewUtils.CreateDetailSection(doc,a,AssemblyDetailViewOrientation.ElevationTop)
		views.append(ds3)
	if IN[4] == 1:	
		ds4=AssemblyViewUtils.CreateDetailSection(doc,a,AssemblyDetailViewOrientation.ElevationBottom)
		views.append(ds4)
	if IN[5] == 1:	
		ds5=AssemblyViewUtils.CreateDetailSection(doc,a,AssemblyDetailViewOrientation.ElevationLeft)
		views.append(ds5)
	if IN[6] == 1:	
		ds6=AssemblyViewUtils.CreateDetailSection(doc,a,AssemblyDetailViewOrientation.ElevationRight)
		views.append(ds6)
	if IN[7] == 1:	
		ds7=AssemblyViewUtils.CreateDetailSection(doc,a,AssemblyDetailViewOrientation.ElevationFront)
		views.append(ds7)
	if IN[8] == 1:	
		ds8=AssemblyViewUtils.CreateDetailSection(doc,a,AssemblyDetailViewOrientation.ElevationBack)
		views.append(ds8)
	if IN[9] == 1:	
		ds9=AssemblyViewUtils.CreatePartList(doc,a)
		views.append(ds9)
	if IN[10] == 1:	
		ds10=AssemblyViewUtils.CreateDetailSection(doc,a,AssemblyDetailViewOrientation.DetailSectionA)
		views.append(ds10)
	if IN[11] == 1:	
		ds11=AssemblyViewUtils.CreateDetailSection(doc,a,AssemblyDetailViewOrientation.DetailSectionB)
		views.append(ds11)
	if IN[12] == 1:	
		ds12=AssemblyViewUtils.CreateMaterialTakeoff(doc,a)
		views.append(ds12)
	if IN[13] == 1:	
		ds13=AssemblyViewUtils.CreatePartList(doc,a)
		views.append(ds13)
	if IN[14] == 1:	
		ds14=AssemblyViewUtils.CreatePartList(doc,a)
		views.append(ds14)
	if IN[15] == 1:	
		ds15=AssemblyViewUtils.CreatePartList(doc,a)
		views.append(ds15)
	viewlist.append(views)
	if IN[16] == 1:
		sh=AssemblyViewUtils.CreateSheet(doc,a,tb)
		for v in views:
			if Viewport.CanAddViewToSheet(doc,sh.Id,v.Id) == 1:
				Viewport.Create(doc,sh.Id,v.Id,XYZ(0,0,0))
			else:
				ScheduleSheetInstance.Create(doc,sh.Id,v.Id,XYZ(0,0,0))
		sheetlist.append(sh)
doc.Regenerate()
# End Transaction
TransactionManager.Instance.TransactionTaskDone()

OUT=viewlist,sheetlist`



Hello
it is necessary to use this method

here an example

import clr
import sys
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument


toList = lambda x : x if hasattr(x, '__iter__') else [x]

#Preparing input from dynamo to revit
lst_assemblies = toList(UnwrapElement(IN[0]))
category = UnwrapElement(IN[1])
schedule_template = UnwrapElement(IN[2])

out = []
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
for assemb in lst_assemblies:
	if DB.ViewSchedule.IsValidCategoryForSchedule(category.Id):
		scheduleViewAssemb = DB.AssemblyViewUtils.CreateSingleCategorySchedule (doc, assemb.Id, category.Id, schedule_template.Id, False)
		out.append(scheduleViewAssemb)

TransactionManager.Instance.TransactionTaskDone()

OUT = out
1 Like

THANK YOU!!
The schedule gets created however the view template doesn’t get applied for some reason. I just added an Add viewtemplate node after it to get around it and it works perfectly.


I have tried same way to create view but as per above image error found can any one Tell me why this error occured?How to fix this?