Closed u-anurag closed 4 years ago
Looking at this, there actually would need to be a few significant updates to the plotting functions. One notable change would be if the internal functions return the objects they create. I didn't want to make any change because I'm not assigned.
e.g.
def _plotCubeVol(nodesCords, xyz_labels, ax, show_element_tags, element, eleStyle, fillSurface):
## procedure to render a cubic element, use eleStyle = "wire" for a wire frame, and "solid" for solid element lines.
## USe fillSurface = "yes" for color fill in the elements. fillSurface="no" for wireframe.
tempLines = 6*[None]
tempSurfaces = 6*[None]
tempTag = [None]
# 2D Planer four-node shell elements
[iNode, jNode, kNode, lNode,iiNode, jjNode, kkNode, llNode ] = [*nodesCords]
tempSurfaces[0] = _plotCubeSurf([iNode, jNode, kNode, lNode], ax, fillSurface, eleStyle)
tempSurfaces[1] = _plotCubeSurf([iNode, jNode, jjNode, iiNode], ax, fillSurface, eleStyle)
tempSurfaces[2] = _plotCubeSurf([iiNode, jjNode, kkNode, llNode], ax, fillSurface, eleStyle)
tempSurfaces[3] = _plotCubeSurf([lNode, kNode, kkNode, llNode], ax, fillSurface, eleStyle)
tempSurfaces[4] = _plotCubeSurf([jNode, kNode, kkNode, jjNode], ax, fillSurface, eleStyle)
tempSurfaces[5] = _plotCubeSurf([iNode, lNode, llNode, iiNode], ax, fillSurface, eleStyle)
if show_element_tags == 'yes':
tempTag = ax.text((iNode[0]+jNode[0]+kNode[0]+lNode[0]+iiNode[0]+jjNode[0]+kkNode[0]+llNode[0])/8,
(iNode[1]+jNode[1]+kNode[1]+lNode[1]+iiNode[1]+jjNode[1]+kkNode[1]+llNode[1])/8,
(iNode[2]+jNode[2]+kNode[2]+lNode[2]+iiNode[2]+jjNode[2]+kkNode[2]+llNode[2])/8,
str(element), **ele_text_style) #label elements
return tempLines, tempSurfaces, tempTag
Go ahead and try it on your local machine. I am aware that we need to return objects for animation. You should do all the necessary changes to make it work. Just check the functions are still working for other commands. We can always discuss on the pull request.
Okay, sounds good. The pull request will likely be fairly big, I should be able to integrate some of the other issues that have been assigned as well.
Try to keep them not so big since they might take longer to review.
Sure, I'll do my best to keep the change size small.
There are some limitations, particularly around the tags in the model. Right now I have left it so that the tag locations stay fixed throughout the animation. It felt like a big performance cost to update the tag location in addition to the nodes and elements.
We don't need node and element tags to show in the animation. If the users want to see the location of a particular node or element, they can use the plot_model()
command. There are no node and element tags shown in the plot_modeshape()
command.
That makes sense to me, I support that decision. In a future patch, I'll edit out any reference to tags in the animation model.
@cslotboom Once you update the animation library based on my changes to Get_Rendering, let's check all the functions locally. After that, I'll push these changes to OpenSeesPy official repo for a release.
Is it possible to call animate_deformedshape()
from Get_Rendering
itself instead of a separate library? Just so users don't have to import multiple libraries. If you think it is not a good way to do it, then we'll leave it as it is.
Yeah, that should be possible regarding 'animate_deformedshape()'. We should probably do a bit of shuffling with the internal functions to try and consolidate things a bit. I'll make a list of potential changes in #27.
Add animation function. Also, if you add slider, test it on Jupyter notebooks too. Once you start to work on it, move it to "In Progress" column in the project. https://github.com/u-anurag/OpenSeesPy/projects/1