/[ascend]/trunk/models/johnpye/fourbarplot.py
ViewVC logotype

Contents of /trunk/models/johnpye/fourbarplot.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 881 - (show annotations) (download) (as text)
Mon Oct 9 10:51:06 2006 UTC (18 years, 3 months ago) by johnpye
File MIME type: text/x-python
File size: 937 byte(s)
Removed some debug output in importhandler.
Fixed aspect ratio on four bar linkage plot.
Fixed up dsg.a4c for consistency with dsg-transient library.
1 import extpy;
2
3 from pylab import *
4 from solverreporter import *
5
6 def fourbarplot(self):
7 """Plot the geometry of the four-bar linkage"""
8 # following is an unfortunate necessity in the current system architecture:
9 self = ascpy.Registry().getInstance('context')
10
11 browser = extpy.getbrowser()
12 browser.do_solve()
13
14 ioff()
15 figure()
16 gca().set_aspect('equal', adjustable='datalim')
17 hold(True)
18
19 for alpha in range(10,74,4):
20 self.alpha.setRealValueWithUnits(alpha,"deg")
21
22 browser.sim.solve(browser.solver,SimpleSolverReporter(browser))
23
24 x = [float(x) for x in [self.x_A, self.x_B, self.x_C, self.x_D]]
25 y = [float(y) for y in [self.y_A, self.y_B, self.y_C, self.y_D]]
26
27 plot(x,y,"y-")
28 plot(x[0:2],y[0:2],"ro")
29 plot(x[2:4],y[2:4],"bo")
30
31 extpy.getbrowser().reporter.reportNote("Plotting completed")
32 ion()
33 show()
34
35 extpy.registermethod(fourbarplot)
36 #the above method can be called using "EXTERNAL fourbarplot(SELF)" in ASCEND.

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22