Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add Topography Points Relative to Surface

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
1439 Views, 3 Replies

Add Topography Points Relative to Surface

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?

3 REPLIES 3
Message 2 of 4
jeremytammik
in reply to: Anonymous

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
in reply to: jeremytammik

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

Message 4 of 4
Alxd
in reply to: jeremytammik

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community