TableSectionData GetRowHeight not returning accurate height for rows in the body

TableSectionData GetRowHeight not returning accurate height for rows in the body

Anonymous
Not applicable
1,333 Views
8 Replies
Message 1 of 9

TableSectionData GetRowHeight not returning accurate height for rows in the body

Anonymous
Not applicable

Hello,

When I use the GetRowHeight() method of TableSectionData it does not seem to return the correct height.

 

As you can see I have a python method printing out the height of each row in each section.  If you look at "Section 1" the code shows that the row height is 1/72 (or 1/6") for each row in the section, but it is obvious that the header for Section 1, which starts with "Sheet Number", is much taller.  Also, a line 1/72 high is drawn in the row, and it does not match the height of the row on the sheet.

 

Is this method giving me some other row height?  If so, what other height could be relevant for a schedule than the height on a sheet?

 

I'd really appreciate someone else telling my I'm not crazy... or that I am, and there's an easy solution.


Thanks!

Image 5.png

0 Likes
Accepted solutions (1)
1,334 Views
8 Replies
Replies (8)
Message 2 of 9

sobon.konrad
Advocate
Advocate

You are not crazy. As far as I am aware that value only represents individual Row heights and doesn't account for additional formatting, header heights etc when schedule is placed on a sheet. Here's a reference: 

http://thebuildingcoder.typepad.com/blog/2014/06/refresh-element-graphics-display.html#3

 

However, to piggy back on this question I would hope for Jeremy to perhaps help me solve this: 

// place schedule on sheet
var ssi = ScheduleSheetInstance.Create(doc, sheet.Id, schedule.Id, placementPoint);

// adjust placement point for next schedule
var bbox = ssi.get_BoundingBox(sheet);
var scheduleHeight = bbox.Max.Y - bbox.Min.Y;
var newPoint = new XYZ(placementPoint.X, placementPoint.Y - scheduleHeight - margin, 0);
placementPoint = newPoint;

Now, for reasons not obvious to me, I keep getting wrong heights when I do that. I am almost certain this has to do with the fact that schedule needs to be refreshed. I tried inserting doc.Regenerate() after ScheduleSheetInstance.Create() call, but that doesn't change a thing. Is there a sure fire way to get the size of the BoundingBox after it was placed on a sheet? 

Thanks! 

0 Likes
Message 3 of 9

matthew_taylor
Advisor
Advisor
Accepted solution

@sobon.konrad,

Just enclose the placement in a transaction, commit it, then query the bounding box.


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
0 Likes
Message 4 of 9

Anonymous
Not applicable

Nevermind

0 Likes
Message 5 of 9

Anonymous
Not applicable

That idea of placing the table in a sheet and querying its height did end up being the answer. To find out the height of each individual row we programmatically changed the schedule to add one row at a time, “measuring” the height after each row was added.  

 

By recording the difference in the height after each row was added we could know the  real height of the row.

 

Great tip!

0 Likes
Message 6 of 9

sobon.konrad
Advocate
Advocate

Matt,

 

I should try that. I already tried doc.Regenerate() and putting it inside a SubTransaction / committing, but that did nothing to make it report the actual height. I will split that out maybe into another transaction and see if it works. 

Cheers! Thanks for the tip. 

Message 7 of 9

FrankHolidaytoiling
Advocate
Advocate

Hi is there an improvement on getting the real hight in pixels for the schedule rows yet? I am using Revit 2021 to 2023 and 2025 currently I am using the View Schedule, do i need to use the SchedulesheetInstance? I do not want to alter anything about the Schedule just gets its close to accurate as in within a pixel or two of the row height.


// Process Body returns the same height in pixels 

TableData tableData = viewSchedule.GetTableData();
TableSectionData sectionDataHeader = tableData.GetSectionData(SectionType.Header);
TableSectionData sectionDataBody = tableData.GetSectionData(SectionType.Body);


for (int row = 0; row < sectionDataBody.NumberOfRows; row++)
{
double bodyHeight = sectionDataBody.GetRowHeightInPixels(row);

}

0 Likes
Message 8 of 9

FrankHolidaytoiling
Advocate
Advocate

So If I use the ScheduleSheetInstance boundary, i need the start height or y axis points of the corners of the schedule on the sheets headers, not the header that is the Title confusingly. The text appearance overrides the body top rows. how can i differentiate these?

 

0 Likes
Message 9 of 9

FrankHolidaytoiling
Advocate
Advocate

If i can maybe get their text appearance ovverides then i can make some awful but necessary approximation to the row heights for some changes the users makes before placing the viewScheduile on a sheet?

 

0 Likes