Add Topography Points Relative to Surface

Add Topography Points Relative to Surface

Anonymous
Not applicable
1,712 Views
3 Replies
Message 1 of 4

Add Topography Points Relative to Surface

Anonymous
Not applicable

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?

0 Likes
Accepted solutions (2)
1,713 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk
Accepted 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



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 4

Anonymous
Not applicable
Accepted solution

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

0 Likes
Message 4 of 4

Alxd
Contributor
Contributor

Can I use ReferenceIntersector to find intersection of Pipe with TopographySurface? TopographySurface can be in Revit LinkInstance is this case?

0 Likes