Dear Johny,
Cool, glad you like it. Please let us know how you can make use of it.
Thank you for the sample code and model to run it in.
For the sake of completeness and legibility, here is your Python Code:
# IronPython Pad. Write code snippets here and F5 to run.
doc = __revit__.ActiveUIDocument.Document
uidoc = __revit__.ActiveUIDocument
schedule = doc.ActiveView
tableData = schedule.GetTableData()
tableName = schedule.GetCellText(SectionType.Header,0,0)
qty = schedule.GetCalculatedValueText(SectionType.Body,2,2)
calcValName = schedule.GetCalculatedValueName(SectionType.Body,2,2)
print(tableName)
print("Calculated Qty is: " + qty)
print("Calculated Value Name is: " + calcValName)
I created a C# add-in to test it in that environment.
My code looks like this after some debugging and one little addition:
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Document doc = uidoc.Document;
ViewSchedule schedule = doc.ActiveView as ViewSchedule;
Result rc = Result.Failed;
if(null == schedule)
{
message = "Please launch this command in a schedule view.";
}
else
{
TableData tableData = schedule.GetTableData();
//TableView tableView = null;
int row = 2;
int col = 2;
string tableName = schedule.GetCellText( SectionType.Header, 0, 0 );
string qty = schedule.GetCalculatedValueText( SectionType.Body, row, col );
string calcValName = schedule.GetCalculatedValueName( SectionType.Body, row, col );
Debug.Print( tableName );
Debug.Print( "Calculated Qty is: " + qty );
Debug.Print( "Calculated Value Name is: " + calcValName );
Debug.Print( "Cell text " + schedule.GetCellText( SectionType.Body, row, col ) );
rc = Result.Succeeded;
}
return rc;
I have no idea what the purpose of GetCalculatedValueText and GetCalculatedValueName is.
However, if what you want is what you see in the schedule, the last call in my code to GetCellText returns exactly that:
MS-06362-01
Calculated Qty is:
Calculated Value Name is:
Cell text 19.177083
I am attaching my C# sample to this message in GetScheduleCalculatedValue.zip.
I hope this helps.
Ooops... I just noticed that you say GetCellText works, and you want the name... name of the value?! What is that? What is the name of a value?
Cheers,
Jeremy