Link to trial the tool.
Above is the finished beta release R2R tool. It seems to work for large projects and should be a huge time saver and QA/QC tool as compared to manually checking RAM beams to Revit beams.
If you want to be a beta tester for this tool, please either leave a comment/reach out to me. I would be happy to share with you. Please be aware, the tool is still unstable in many conditions, be sure to save a local RAM model and Revit that you do not care about.
How It Works - Screen 1
Screen 1 is where you mostly focus on selection, coordinate system transformation and selection of RAM beams and Revit beams to be mapped.
The Inputs
Select RAM File
This one is self explanatory, select the .rss file you want to inspect. Be sure that ALL RAM products are closed before doing this, the program will crash if you have RAM open. I need to add some code to catch this error and ask the user to close RAM.
Gather RAM Levels
This button gathers the RAM levels in the project from the selected RAM model. NOTE: the grids will only be imported if you set a max and min in the RAM grid definition.
Select Level
This button will load in the RAM grids into the canvas below and will select the RAM beams at that level to be compared to Revit.
Gather Revit Grids
Button will plot all Revit grids in the Revit canvas.
Select Revit Beams
Button prompts the user to select revit beams to map, ensure your mapping window for selection is already in your current view. The revit project becomes "locked" when starting up the addin and you are not able to interact with the revit model once you have started up the app. I will work on fixing this in the future. From here, window over any objects you want to map, the selection is filtered down to only select the beams.
With the grids in the mapping window, you can select (2) corresponding grids from the revit model and the ram model and click "Calc X Y and Rotation". This function is rough and not perfect but it attempts to calculate the X Y and Rotation parameter between the RAM and Revit model. Lots of times our RAM models do not align with our Revit models and this function attempts to automate this once manual step.
With the X Y and rotation parameters set, you can save the file path of your .rss file and mapping parameters to .json file.
Once you are happy with your mapping properties, be sure to hit save so you do not have to do this again. Clicking import brings in these settings and you can mostly skip the import screen save a few buttons:
- RAM level, select your ram level and beams
- Selecting your Revit beams.
Sample of the R2R_Json file created:
How it Works - Screen 2
Screen two is pretty simple, you will be greeted with your ram and revit beams being plotted on the canvas in front of you. You can check the RAM or Revit beams on or off as well as control their transparency. Then, click on map the beams and the mapping algorithm will go to town checking all beams in the models.
A datagrid is populated on the left and discrepancies are highlighted in yellow in the datagrid. You can select the data grid row and it will highlight the selected beam in the mapping panel. The colors are a bit gross right now, but I will work to make the UI a bit more manageable moving forward.
I plan on making a youtube channel to record a video going over all the inputs, typing this all out is tedious and a video would likely be much easier for me and the end user.
The Code
I am pleasantly surprised by how quickly the mapping algorithm works. On the screen at the beginning of the post the algorithm was able to make it through ~1000 revit and ram beams in under 1 second!!! Crazy fast. The algorithm works by taking one RAM beam and then comparing its end point to every Revit beam in the project until the beam is either mapped into the Revit space or is does not find a mate. Let's try to do some quick mental math on the number of calculations performed in this process.
- 1000 RAM beams, call a distance function on each end point of each Revit beam, assume that a match is found at about the half distance of the Revit Beam list.
- The first beam in this list would run the distance function 500*2 times = 1000 times, next beam would then 499*2 times = 998 times
- I thought this was 500!*2, but this seems likely impossible for even a computer to crunch in ~1 second. Google can't even give me an awesome for something over 100! Can someone smarter at math point out where I am wrong? (Edit 2024-01-08, I found my problem, it is the summation of 500*2, not 500!, 125250*2 = 250,500 calculations in ~1 second.)
Developing in C Sharp is starting to become more and more natural, I am really liking the experience now that I am more knowledgeable. At one point, I really liked Python due to it's dynamically typed nature, but type hints in the Revit API are so valuable to know what a function expects to act on. Another fun one, while you are in the visual studio debugger, you can actually make changes to your code while you are debugging and see how your changes affect the code. I had to do this a bunch in my mapping algorithm implementation, ever so slightly tweaking the code as I go. In the code below, tweaking startPoint.Y +/- was really cool while debugging.
As always, ChatGPT is truly a game changer for coding. This project was developed sooooo much quicker becuase of ChatGPT. One small example, in order to make my rows highlight in yellow if the beams between revit and ram did not match seemed like quite a difficult task. XAML does not have a does not equal expression, !=, similiar to that of python/C#, so you have a to write a "Converter" class for XAML and C #.
I asked chatGPT to do this for me and the code worked perfectly.
Feedback
I have heard a few comments asking how this tool is different from the RAM ISM connection tool. Given that I have not used the RAM ISM connection tool, I cannot answer this. If you have used the connection tool, can you let me know if R2R is the same, does a different task, worse or better the ISM Digital twin product that Bentley seems to offer.
The Future
Distribution
I am exploring a few different ways to get this tool distributed to a wider mass of structural engineers. If you have experience in dealing with Autodesk, please reach out to me, I would love to pick your brain on this topic.
Work on all levels in the RAM model at once? Expand to check camber, studs, etc.
This would be super cool, maybe there would be a way to check all levels at once with this tool. The tool could be pretty easily expanded to check camber studs, beam end reactions etc. The possibilities are endless, if you have any requests, please let me know. Hopefully this tool allows structural engineers to focus on the more important items in design and less on back checks!.
Fix pan, zoom, other graphics issues, clean up code, focus on DRY coding
Dry coding, do not repeat yourself, was not implemented in this code. I have (3) differing pan zoom and mouse over functions for the RAM and Revit canvas on screen 1, and another pan zoom and mouse over function for screen 2. This leads to lots of repetition and chances for mistakes. I would like to come back to this and make the code more DRY. In addition, the pan function only works if you select an element in the canvas, like a line or text. If you select the big empty white space, the pan function does not work? I need to dig into why. The zoom function in the canvas's are also super whack, with zooming only partially work and zoom into weird spots, not centered on the current mouse position.
Next steps, I look forward to supporting this product and incorporating any feedback you may have. Again, leave a comment/message me if you want to test the tool out or want additional features.
For the next part of the site, I want to focus on getting back to structural engineering and less coding. Some examples on non-linear concrete shearwalls, dynamic analysis, rubber isolators and all of that fun stuff. I am excited to get away from coding for a bit.
I also have an itch to dig into machine learning/AI, what is it besides these fun buzz words we hear all the time? I want to explore pytorch/tensorflow and really learn what it means to train a model. How do I create the input nodes for a neural network? I still have no idea how this could relate to structural engineering, but it would be fun to dig and explore the space.