Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.
Hi to all programists!
I import topoSurface into revit :
But it's location is too high. I want to have the average value of the points along the axis Z on the level 1:
How to do this right? Should I use MovePoints method in TopographyEditScope transaction or something else? Thanks for any help.
Solved! Go to Solution.
Solved by aignatovich. Go to Solution.
Hi!
First of all, get average Z from the surface points (surface.GetPoints()), then calculate the distance (this value minus your level project elevation),
then call ElementTransformUtils.MoveElement(doc, surface.Id, -1*distance*XYZ.BasisZ)
Thank you very much for your reply.
Could you please help me with one more problem? With your code i have an exception: "A managed exception was thrown by Revit or by one of its external applications"
My code looks about this:
using (Transaction tr = new Transaction(CurrentRevitDocument, "VIEW_3D")) { tr.Start(); TopographySurface topoSurface = TopographySurface.Create(CurrentRevitDocument, Points); double distance = getCoordinatesOfZAxis(Points, 3).Average(); ElementTransformUtils.MoveElement(CurrentRevitDocument, topoSurface.Id, -1 * distance * Autodesk.Revit.DB.XYZ.BasisZ); tr.Commit();
}
And in line with moveElement method i have my exception.
Thanks.
Hmm. Strange thing.
Try to split creation of topography surface and moving it down in separated transactions. You can join them later in a transaction group.
Can't find what you're looking for? Ask the community or share your knowledge.