Hi everyone,
I am trying to change the formatting calculate from No calculation to Calculate totals. I am using the Orcid node Schedule.Fomatting and it’s asking for a string I tried to set it with a “Calculate totals” as string but nothing happened. The default is “standard” does anyone know what string I should be putting in there to get “Calculate totals”
@V-nom20 ,
where should the calculate total happen in dynamo? in the schedule? stored in a Parameter ?
in python you simple can sum
even string formats you can convert und sum…
OUT = sum(IN[0])
My apologies, I guess I should be more thorough on my explanation so the specific part I am talking about is in a schedule view. shown like this:
As you can see the length shows up as “varies” my script which is doing a couple of things is making this schedule but the issue is within the properties of that schedule under formatting (showing in the picture below) the calculation part is showing " No calculation " I am trying to make that say " Calculate totals " using scripts to finish up my creation of the schedule.
Thank you in by the way for any help given
As far as I’m aware this isn’t doable with OOTB nodes, I’m also not aware of any packages that do this.
You’ll need the following from the API:
field.DisplayType = ScheduleFieldDisplayType.Totals
I do have the following stashed away:
import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
schedule = UnwrapElement(IN[0])
colName = IN[1]
schedDef = schedule.Definition
countParameters = schedDef.GetFieldCount()
for i in range(countParameters):
paramName = schedDef.GetField(i).ColumnHeading
if paramName == colName:
index = i
field = schedDef.GetField(index)
TransactionManager.Instance.EnsureInTransaction(doc)
field.DisplayType = ScheduleFieldDisplayType.Totals
TransactionManager.Instance.TransactionTaskDone()
OUT = paramName
Thank you, I was trying to find something in the API before but obviously didn’t find anything. I am still trying to learn the art of the API. I really appreciate your input.
This is if you want to add "Grand totals" (AI-assisted).
import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
schedule = UnwrapElement(IN[0])
colName = IN[1]
schedDef = schedule.Definition
countParameters = schedDef.GetFieldCount()
for i in range(countParameters):
paramName = schedDef.GetField(i).ColumnHeading
if paramName == colName:
index = i
field = schedDef.GetField(index)
TransactionManager.Instance.EnsureInTransaction(doc)
field.DisplayType = ScheduleFieldDisplayType.Totals
# Added code to show grand total in the schedule.
schedDef.ShowGrandTotal = True
# Added code to show grand total title in the schedule.
schedDef.ShowGrandTotalTitle = True
TransactionManager.Instance.TransactionTaskDone()
OUT = paramName