Hello all,
Is it possible to add topography points Relative to Surface via the API, like you can through the interface?
If not, how would I work out, given a I have and X and Y cordinate, what the Z intersection on a topography surface is? Currently I use a face based family, and place it on the topography, find its Z and then add a point, there has to be a better way?
Solved! Go to Solution.
Solved by jeremytammik. Go to Solution.
Dear Chris,
Yes, I would suspect there is indeed a better way.
Me, loving geometry, I would problably retrieve the topography surface geometry, which I assume consists of triangles, determine which triangle T contains the projection of the given point P, and then calculate the intersection of the vertical ray through P with T.
If you prefer to use the Revit API rather than do it yourself, the ReferenceIntersector class should provide the same functionality with less digging into details.
I hope this helps.
Cheers,
Jeremy
Hi Jeremy,
Thanks for the push in the right direction. ReferenceIntersector works well.
Autodesk.Revit.DB.XYZ startPt = selectedVertex.Position;
Autodesk.Revit.DB.XYZ endPtUp = new XYZ(selectedVertex.Position.X, selectedVertex.Position.Y, selectedVertex.Position.Z + 100);
Autodesk.Revit.DB.XYZ dirUp = (endPtUp - startPt).Normalize();
ReferenceIntersector referenceIntersector = new ReferenceIntersector(ts.Id, FindReferenceTarget.All, m_view3d);
IList<ReferenceWithContext> obstructionsOnUnboundLineUp = referenceIntersector.Find(startPt, dirUp);
XYZ point = null;
ReferenceWithContext gRefWithContext = obstructionsOnUnboundLineUp.FirstOrDefault();
Reference gRef = gRefWithContext.GetReference();
point = gRef.GlobalPoint;
Regards
Chris Mckeown
Can I use ReferenceIntersector to find intersection of Pipe with TopographySurface? TopographySurface can be in Revit LinkInstance is this case?