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: 

Get coordinates from category and check if is on line

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
998 Views, 2 Replies

Get coordinates from category and check if is on line

Hi everybody,

 

I'm new to C# and the Revit API so I could use your help.

I'm building a tool that would allow me to fill the Mark parameter of elements along a drawn line.

I already have the category selection in Visual Studio setup.

 

Form my next part I would like to know if there is a way to check if the coordinates (X and Y) of the Elements (piles and columns) are on the line. If so, put the element in a list and fill in the mark parameter.

(I believe Dynamo can compare a set of coordinates to a set of lines if they are on those lines)

 

Please don't provide the answer in a ready-to-use script. I need to learn to code.

So if you could provide pieces of code or links to sites that could provide insight into how to get it done that would be awesome.

 

Thanks for the help.

Kind regards,

Mike

2 REPLIES 2
Message 2 of 3
stever66
in reply to: Anonymous

Every element in revit has a bounding box that encloses the elements geometry.

 

And every line can be represented by an equation, or a vector.

 

You may find a solution by using these two ideas and searching for things like “revit api intersect”.

 

A less elegant way might be to use the elements bounding boxes and just test a lot of points along the line and see if any are inside the box.

Message 3 of 3
Anonymous
in reply to: stever66

Thanks for your reply @stever66 

I'll go and have a look at that "intersect" option.

(I was thinking about that less elegant option: I have a list of coordinates and run them trough a foreach loop to check if they match coordinates along the line (from the startpoint of the line). If so... add them (ascendingly) to an empty list. Then fill in the Mark parameters from elements in that list.)

 

Still have a lot to learn.😁

 

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

Post to forums  

Autodesk Design & Make Report