Changeset 6469 for branches/1.7/lang


Ignore:
Timestamp:
Aug 7, 2016, 2:55:28 PM (8 years ago)
Author:
ldelgass
Message:

merge r6435 from trunk (run tools from Python)

Location:
branches/1.7
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/1.7

    • Property svn:mergeinfo changed
      /trunkmerged: 6435
  • branches/1.7/lang/python/Rappture/__init__.py

    r5529 r6469  
    1010import Utils
    1111import encoding
     12from raptool import Tool
    1213
    1314# encoding/decoding flags
  • branches/1.7/lang/python/Rappture/python_api.rst

    r5628 r6469  
    257257
    258258
     259
     260----------
     261
     262RUNNING RAPPTURE TOOLS FROM PYTHON
     263----------------------------------
     264
     265If you want to write a Python program that runs Rappture tools, you can do it with the above API and
     266the Rappture Tool class.  For example, to run a published tool named "complam":
     267
     268.. code-block:: python
     269
     270    import Rappture
     271    io = Rappture.Tool("complam")
     272
     273    # Set input values for the Complam tool
     274    material = io['input.group(tabs).group(Material)']
     275    material['number(E1).current'] = E1 / 1e9
     276    material['number(E2).current'] = E2 / 1e9
     277
     278    # run the tool
     279    io.run()
     280
     281    # read the results
     282    ex = io['output.number(Ex).current'].value
     283    nu = io['output.number(nu).current'].value
     284
    259285REFERENCE
    260286=========
     
    272298-------
    273299
    274 - node.close()
    275     Writes out the XML.
     300- node.close(status=0)
     301    Sets the output status field and writes out the XML.
    276302
    277303Reading
  • branches/1.7/lang/python/Rappture/pyxml.py

    r5624 r6469  
    7979        return elem.xml()
    8080
    81     def close(self):
     81    def close(self, status=0):
     82        self.lib.result(status)
    8283        result(self.lib)
     84
Note: See TracChangeset for help on using the changeset viewer.