wiki:PythonScripting
Last modified 8 months ago Last modified on 09/15/11 19:42:23

==Possible solutions==

  • Jython

Syntax Examples

geo.a = 1 -> kernel.getAlgebraProcessor().processAlgebraCommand("a=1", false); geo.b = 1 geo.p = Point(1, geo.a.x) would make a GeoPoint p which depends on GeoNumeric a geo.p = Point(1, geo.a.x.value) would make a GeoPoint p which doesn't depend on GeoNumeric a kernel.getAlgebraProcessor().evaluateToPoint("(1,CopyFreeValue[x(p)]"); geo.p = Point(1, geo.p.x + geo.q.x) would call kernel.getAlgebraProcessor().evaluateToPoint("p=(1,x(p)+x(q))"); geo.p.x = 3 -> kernel.getAlgebraProcessor().processAlgebraCommand("SetCoords[p,3,y(p)]", false);

p = Point(3,4) -> makes point and gives it the next free label p.name -> gets its name

Other things we could do

  • Add script to Custom Tool

eg Select 2 points, select Tool, script replaces %0, %1 by the points. Script does (for midpoint) this: Point((%0.x+%1.x)/2,(%0.y+%1.y)/2)