- #1
person123
- 325
- 51
- TL;DR Summary
- I found the SAP2000 API useful for modeling a complex structure, but without static analysis there's a lot of friction. Is there a way it could be added?
For background, SAP2000 is a structural analysis software used in industry a lot and it has an API in several languages that seems to talk to a SAP2000 executable. It be used to create structural models as an alternative (though I think infrequently used) to the GUI.I started using the SAP2000 API for modeling a complex structure and I found it very helpful. I could have a record of everything that made the model, loop through repetitions in the structure, quickly update it with different parameters, and have calculations for the structure's geometry in the code directly. However, while there is good documentation, I found a big source of friction was that python (the language I'm using) couldn't do a static analysis with that documentation. (I can't see the component classes and methods of a component class, nor the arguments of a method in the IDE itself like most libraries). This means I have to search the documentation separately, copy over the method I want (often there's 3 or 4 layers of component classes), and count the arguments to check what they each refer to (there's often many arguments, some irrelevant). Then to review the arguments I passed I have to either wrap the call in a function I wrote, add a comment or just remember it. If this friction was removed, I think using the API would be faster and more robust than using the GUI in general.
Could there be a way to get static analysis of the classes and methods?
One approach I thought of is parsing through the documentation (a chm file) to get name, description and arguments of each method. Then I would generate python classes with an identical composition hierarchy who have methods that just call an API method with an identical name. It would then appear identical to calling the API method directly but static analysis would come with it. It sounds like a crazy idea to me (writing code to write code and wrapping an API in essentially another API), but I think it should work.
Would there be a better and simpler way of doing it? Are there issues with the way I'm proposing? Might there already be a way of getting static analysis?
Thanks!
Could there be a way to get static analysis of the classes and methods?
One approach I thought of is parsing through the documentation (a chm file) to get name, description and arguments of each method. Then I would generate python classes with an identical composition hierarchy who have methods that just call an API method with an identical name. It would then appear identical to calling the API method directly but static analysis would come with it. It sounds like a crazy idea to me (writing code to write code and wrapping an API in essentially another API), but I think it should work.
Would there be a better and simpler way of doing it? Are there issues with the way I'm proposing? Might there already be a way of getting static analysis?
Thanks!