Closed u-anurag closed 4 years ago
I suppose there would be two approaches. One possibility is to use key word arguments to turn on or off reading from a file. I use keywords in my functions, but something I don't like is you can end up with passing a lot of arguments to the functions, which looks messy.
i.e. plot_model(Read_From_File = True)
The other possibility would be to use different functions, i.e. plot_model_file()
That sounds like a good approach. I was thinking about first trying to read the ODB and use try & except function. for example,
try: nodeList = np.loadtxt(ODB_folder/nodeList.out) except: nodeList = getNodeTags()
This way, we don't have to introduce another argument. plot_model() command currently has two optional arguments, 'nodes' and 'elements' to enable users to print the node and element tags only if they want. Although introducing the ODB argument in the command can be useful. Let's go with the plot_model(Read_From_File = True) or plot_model(ODB).
Add new tasks in the Project (https://github.com/u-anurag/OpenSeesPy/projects/1) and convert them into an issue by clicking on the three dots on the upper right corner.
So I'll have a version of this up shortly.
@u-anurag I'd like to get input on one thing. Before we would get our node coordinants using OpenSeesPy's function "nodeCoord", e.g.
iNode = ops.nodeCoord(Nodes[0])
jNode = ops.nodeCoord(Nodes[1])
However, if we read from the database, we might not have an active model. I propose using a dictionary to map the node label to the input xyz coordinats. This dictionary would function like a " nodeCoord " command, notably
ops.nodeCoord(nodeID) = [x, y, z]
node_xyz_labels[nodeID] = [x, y, z]
We could define it using the input node command:
node_xyz_labels = {}
for jj in range(Nnode):
node_xyz_labels[int(nodeList[jj])] = [*nodes[jj, :] ]
Let me know if that sounds okay. Also let me know if you have a preference for the node dictionary, above it's called "node_xyz_labels"
If you haven't gone far this route, I would say that leave this function to me. I was working on some plotting things for my research and implemented this thing 1 hour ago in my local repo. You can keep your focus on animations. Sorry, I should have given you heads up.
Sure I'm happy to leave things to you for now.
A procedure to use plot_model() and plot_modeshape() commands without and with an ODB. The commands should be able to function within the script as well as by reading output from the output database.