-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InfoWorks - addition of nodes into existing links #14
Comments
Hi Andy, Maybe you are already aware of this but in Synergi Water you can do exactly what you describe from the user interface but this feature is missing in InfoWorks, I can see how building a Ruby script to achieve this could be very useful. The good news is this can definitely be done in Ruby however you would need to do all the spatial calculations on figuring out where a node lays on a line at a set distance yourself. If you want to see how the spatial algorithm for what you're asking is done you can look at the The code is pretty short but in summary:
Now, this is good for creating nodes but you wanted to split the lines at these points so potentially you could use the function 'lineSliceAlong' which does a similar method to the above but collects the vertexes along the way and returns a line object. So bring this all together, you would do the following
The above examples are in Javascript so they would need to be converted to the equivalent in Ruby, however, some more good news is I've already done all of the above though I haven't uploaded it all at the moment, you can see some examples of my use of the library here: For my use case, I was converting nodes to links and then expanding to a short length, but the same principles could be used for your needs. Feel free to start looking into the above but I can upload what I have and I'm sure you could adapt it or maybe I could create a separate library to do what you need. |
Hi Luke Many thanks for getting back to me so soon on this - that's very much appreciated. I have other means of achieving this fairly quickly but I was wanting to make the procedure 'instant' and without having to leave the InfoWorks environment. From what you describe it won't be the easiest script to write - but I quite like a challenge so I'll attempt to give it a go - but I strongly suspect I will be begging for help before long! I'm not a programmer and I'm relatively new to Ruby but I do have a reasonable background in coding for other software so I'll see if I can translate my skills. In the meantime, any uploads would be welcomed! |
Hi Luke
I'm wondering if you can help out with functionality and syntax with regard to inserting nodal items in links.
I'm essentially wanting to automatically create and snap nodes into a selected link.
For example, create a node at a distance of 100m from the selected link's start node, then another in another 100m, etc etc until there is no further room.
Then snap the newly created nodes into the selected link (i.e. by splitting the link).
I know how to create nodal items at given co-ords but I can't figure out how to return the co-ords of points which are a specified distance along a link.
Plus I don't know how to snap the unconnected nodes into a link.
Can this actually be achieved using InfoWorks PRO WS interface (rather than Exchange) - if so have you got any pointers as to how I can go about it? I'm struggling to find anything in the available documentation that comes close to this functionality.
Cheers
Andy
The text was updated successfully, but these errors were encountered: