Skip to content
Snippets Groups Projects
Commit b21da26f authored by Sam Calisch's avatar Sam Calisch
Browse files

added visualize example

parent 5cce00fe
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,18 @@ from pyframe3dd.frame3dd import write_frame3dd_file, read_lowest_mode, read_fram
from pyframe3dd.util import magnitudes, close
import subprocess
def plot_connections(nodes,connect):
#for debug only, this is slow!
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.gca(projection='3d')
for seg in connect:
ax.plot(nodes[seg,0], nodes[seg,1], nodes[seg,2], c='g')
plt.show()
def run_frame3dd(args,nodes,global_args,beam_sets,constraints,loads):
write_frame3dd_file(nodes,global_args,beam_sets,constraints,loads)
cmd = ["frame3dd", "-i",global_args['frame3dd_filename']+'.csv']
......@@ -85,7 +97,7 @@ def find_stability_threshold(args):
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-M','--mode',choices=('simulate','search'), required=True)
parser.add_argument('-M','--mode',choices=('simulate','search', 'visualize'), required=True)
parser.add_argument('-Q','--quiet',action='store_true',help='Whether to suppress frame3dd output')
parser.add_argument("-f","--force", type=double, default=1, help="force to apply")
parser.add_argument("-fr","--force_res", type=double, default=.01, help="Final resolution of force for search mode")
......@@ -112,6 +124,9 @@ if __name__ == '__main__':
res = run_simulation(args)
print "Fundamental frequency: %.3f Hz"%res['fundamental_frequency']
print "Stress: %.3f MPa"%(res['stress']/1e6)
elif args.mode=='visualize':
nodes,rods = build(args)
plot_connections(nodes,rods)
else:
assert(0) #should not be here
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment