Export / visualize #354
-
Hi,
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
If I understand the question correctly you are trying to achieve the same effect from Python code what can be done through
textX has several built-in generators which you can see with For example, to visualize from textx import metamodel_for_file
from textx import generator_for_language_target
# Get the metamodel which knows how to parse the given file.
mm = metamodel_for_file('hello.tx')
# Parse the given file with the provided metamodel
model = mm.model_from_file('hello.tx')
# Get the generator from tx file (textx language) to dot
# Generator function is defined here: https://github.com/textX/textX/blob/master/textx/generators.py#L54
generator = generator_for_language_target('textx', 'dot')
# Call the generator
generator(mm, model, '.', overwrite=True, debug=False) |
Beta Was this translation helpful? Give feedback.
If I understand the question correctly you are trying to achieve the same effect from Python code what can be done through
textx generate
command?textx visualize
is an old command which has been superseded bytextx generate
as visualization is nothing more but generating output in dot, plantUML or some other graph language.textx generate
is implemented here. You can see that it calls registered generator function here. Generators are registered using registration and discovery API.textX has several built-in generators which you can see with
textx list-generators
. To call them see this part of the doc.For example, to visualize
.tx
files: