So I've been making some stuff with the Revit API for a little bit now and mostly understand what I'm doing based on examples I've seen or just trying stuff out. this has mostly worked out for me and I'm actually getting stuff done quite well but I've run into an issue with a plugin I'm making where i can't figure out how to do it. Hopefully, someone here can help me.
My plugin gets the structural concrete walls in a project and generates views
for them for formwork or rebar detailing, For this i need 3 plans, an elevation a section, and a floorplan. The elevation and section part works like a charm but im having issues with the floorplan.
I would like not to use a callout from a reference plan but rather a section to make the floor plan. Manually I can create this by placing a section vertically in my elevation and then rotating it 90 degrees so it looks up or down. how would I do this exact same step via the Revit API?
My current attempt looks like this where i get the rotation axis (Line) perpendicular to the wall with the GetrotationVector function which i then use to rotate the floorplanview.Location, this however throws a Nullrefrence exception "object is not set to an instance of an object"
BoundingBoxXYZ Perpendicular_sectionBox = GetSectionPerpendiculartToWall(wall);
BoundingBoxXYZ Parallel_sectionBox = GetSectionParallelToWall(wall);
Line rotation_Vector = GetrotationVector(wall);
// Create sections
Autodesk.Revit.DB.View parallelview = ViewSection.CreateSection(doc, vft.Id, Parallel_sectionBox);
Autodesk.Revit.DB.View perpendicularview = ViewSection.CreateSection(doc, vft.Id, Perpendicular_sectionBox);
Autodesk.Revit.DB.View floorplanview = ViewSection.CreateSection(doc, vft.Id, Perpendicular_sectionBox);
floorplanview.Location.Rotate(rotation_Vector, (Math.PI /180)*90 );
If anyone could show me how to achieve this that would be much appreciated!
Solved! Go to Solution.