1 """ Module for Porting Tensegrity Data in JSON format (Proof of Concept) """
2 " As an example, this module functions by incrementing the arbitrary field "
3 " 'x' in the provided JSON file "
6 from pprint
import pprint
8 """ change the state of tensegrity tg """
14 def import_tg_data(filename):
15 tgJSON = open(filename,
'r')
16 tg = json.load(tgJSON)
17 tg_tweaked = tweak(tg)
21 def export_tg_data(filename, json_data):
22 tgJSON = open(
'tgData.json',
'w')
23 json.dump(json_data, tgJSON, indent=4)
28 tweaked_json_data = import_tg_data(f)
29 export_tg_data(f, tweaked_json_data)
31 if __name__ ==
'__main__':
32 if (len(sys.argv) > 1):
35 print "Error: no JSON file passed to tgPort.py"