"Insert column" in a schedule with "Calculated Value"

hey all, happy holiday! :partying_face:

Is there a way in dynamo i can insert a column in revit schedule using the option of “calculated value” ? of course i want to name it of my choice, and also make total of the values in the that column in the last row!

@AmolShah

@uaftab.cem19 I’m not 100% sure but I think we don’t have access to the Calculated Value via the API. So, I won’t be able to help you on this.

@c.poupin Do you think this can be achieved via Dynamo?

1 Like

Hello
Apparently it’s not possible


maybe a solution would be to copy a CellCalculatedValue from another table already defined manually with the same parameters.
With this methods:
GetCellCalculatedValue
SetCellCalculatedValue

but i never tried it

3 Likes

ah… that is a disappointment.

Well, is it possible that i can add a parameter which is derived from a formula including multiplication of two other parameters of the family??

like i want to add a column in the schedule named “Total Cost”, i would make it a parameter in the project giving it a formula = Area * Unit Cost. and then i can get that parameter as a “Scheduleable field” in dynamo?

@AmolShah @c.poupin

@uaftab.cem19 Like this?

2 Likes

wow… yes i guess thats what i want… :heart_eyes: can you please send this python script?! @Kulkul

Mark the post as solved @uaftab.cem19 .

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# 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

# To Handle List
toList = lambda x : x if hasattr(x, '__iter__') else [x]
# Inputs
schedule = UnwrapElement(IN[0])
field_name = toList(IN[1])

# "Start" the transaction
TransactionManager.Instance.EnsureInTransaction(doc)
		
#count the number of rows and columns in the schedule
table = schedule.GetTableData().GetSectionData(SectionType.Body)
nRows = table.NumberOfRows
nColumns = table.NumberOfColumns

#Collect all of data from the schedule
dataListRow = []
for row in range(nRows): #Iterate through the rows. The second row is always a blank space
	dataListColumn = []
	for column in range(nColumns): #Iterate through the columns
		dataListColumn.Add( TableView.GetCellText(schedule, SectionType.Body, row, column) )
	dataListRow.Add( dataListColumn );

# "End" the transaction
TransactionManager.Instance.TransactionTaskDone()

OUT = [x for x in map(list, zip(*dataListRow)) if any(f in x for f in field_name)]
1 Like

@uaftab.cem19
Glad that it solved your issue.
Just curious to how the python script resolved your issue?
It doesn’t insert anything in the schedule :thinking:

actually i was busy and i just didnt try it yet. i dont understand the revit API thats why i just marked as solution. was it not right @AmolShah ?

@uaftab.cem19 For me it just reads the values of the column whose name you put in IN[1].

lol, no i wanted something else. i wanted to make a column using dynamo.

@AmolShah that’s why i asked to confirm before dropping the code.

You’re confusing me and others :upside_down_face:. Is this what you want?

2 Likes

yes that is exactly what i want @Kulkul , but i want this field to be a “calculated value”. means; i want to put a formula in this. like i want this w = paramter1 * parameter2

so it becomes:

1 Like

Did somebody solved this? I’m trying to do the same thing as @uaftab.cem19 :smiling_face_with_tear: