How are the values in modify sub-elements calculated for elevation as Top Plane

How are the values in modify sub-elements calculated for elevation as Top Plane

atharva_tejale
Observer Observer
94 Views
3 Replies
Message 1 of 4

How are the values in modify sub-elements calculated for elevation as Top Plane

atharva_tejale
Observer
Observer

Hello, i am using the slabShapeEditor.SlabShapeVertices API to get the sub elements value of a floor. This API gives the value from the (0,0) ie, the Project Base Point. But i need the values of the sub elements from elevation base as "Top Plane" as we select in the Revit UI. 
What is the calculation and computation that goes on in the backend so that I can get my desired values

0 Likes
95 Views
3 Replies
Replies (3)
Message 2 of 4

charlesyip913
Observer
Observer

Hi, could you share a bit more detail on the behavior you’re seeing—maybe your expected result and some screenshots? That would help clarify the context. In general, if you use SlabShapeEditor.ResetSlabShape() along with HostObjectUtils.GetTopFaces(floor), you can retrieve the base face’s plane and then calculate the Z value from it. But a specific case example would make it easier to give you a more accurate answer.

0 Likes
Message 3 of 4

ctm_mka
Collaborator
Collaborator

Can you share the code you are using (or at least the part you are using to retrieve the vertices)? coordinates in API are usually reported using the internal coord system, so if unless your slab is truly at elevation 0, or you are translating the coordinates, thats really wierd. Here's a what Revit lookup reports for an elevated slab (level elevation = 21, height offset from level = 0):

ctm_mka_0-1755643635611.png

 

0 Likes
Message 4 of 4

atharva_tejale
Observer
Observer

Hey all, I got the solution for the problem I was facing, I used the below code to get the required value of the sub elements from the elevation base set as Top Plane.

Level level = doc.GetElement(levelId) as Level;

Parameter getlevelelevationpara = level.get_Parameter(BuiltInParameter.LEVEL_ELEV);

Parameter getHeightoffsetnpara = floor.get_Parameter(BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM);

double levelElevation = getlevelelevationpara.AsDouble();
double heightOffset = getHeightoffsetnpara.AsDouble();


SlabShapeEditor slabShapeEditor = floor.SlabShapeEditor;
if (slabShapeEditor == null) continue;

var vertices = slabShapeEditor.SlabShapeVertices
.Cast<SlabShapeVertex>()
.ToList();

if (vertices.Count == 0) continue;

var topZvertices = vertices.Select(v => v.Position.Z - levelElevation - heightOffset).ToList();