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: 

Dijkstra algorithm plug for wall

1 REPLY 1
Reply
Message 1 of 2
alex_gegedyush
127 Views, 1 Reply

Dijkstra algorithm plug for wall

hello guys, I'm having trouble with a plugin I have a problem: The plugin finds all walls as a list of start and end points to build a pipe along them. And to build it along them, you need to define a path along which the plugin will generate pipes. What I got: Collect all the walls in the list What I didn't get: Find the path/paths along which the pipes will be generated, there is an array of walls for example: (23, 65, 0)(38, -52, 0) (67, -11, 0)(83, 2, 0) (38, -52, 0)(28, 32, 0) (-30, 20, 0)(28, 32, 0) Etc. And you need the plugin to detect that to build a route between points (23, 65, 0) and (-30, 20, 0), you need to include walls in the new list: (23, 65, 0)(38, -52, 0) (38, -52, 0)(28, 32, 0) (-30, 20, 0)(28, 32, 0) I looked in the Internet that something similar is with the help of Dijkstra's algorithm, but all that I found is too difficult to implement in favour of code optimisation.

1 REPLY 1
Message 2 of 2

Well, the first step to take would be to construct a suitable graph from the walls. Dijkstra's algorithm finds the shortest path between nodes in a weighted graph.If you can reduce your graph to a 2D one, which would fit the example coordinates that you list, you are in luck. I am not aware of any ready-made samples for this, though. The Revit path of travel functionality is somewhat related, cf. the FindShortestPaths method:

  

  

The AvoidObstruction SDK sample might also be interesting to look at. 

    

Jeremy Tammik, Developer Advocacy and Support, The Building Coder, Autodesk Developer Network, ADN Open

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

Post to forums  

Forma Design Contest


Rail Community