tcl2py¶
- opstool.pre.tcl2py(input_file, output_file, prefix='ops', encoding='utf-8', keep_comments=False)[source]¶
Convert OpenSees
Tclcode to OpenSeesPyPythonformat.Note
This function supports
Tclsyntax and will flatten yourTclcode, includingloops,judgments,assignments,proc, etc.,Do not use assignment statements for OpenSees commands, such as
set ok [analyze 1],set lambdaN [eigen 10], it will trigger an error! This is because this function does not run the OpenSees command at all.If an encoding error is reported, please use software such as vscode to re-save the file encoding as
UTF-8in advance.
Parameters¶
- input_filestr
The name of input
.tclfile.- output_filestr
The name of output
.pyfile.- prefixstr, optional
prefix name of openseespy, by default
ops. I.e.,import openseespy.opensees as ops. If None or void str ‘’, the prefix is not used. I.e.,from openseespy.opensees import *.- encoding: str, optional
file encoding format, by default “utf-8”.
- keep_comments: bool, optional
Comments are preserved, by default False. Note that this parameter will replace all opensees commands in the comment line, if any.