flatcamshell.rst 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. Shell Command Line Interface
  2. ============================
  3. .. warning::
  4. The FlatCAM Shell is under development and its behavior might change in the future.
  5. This includes available commands and their syntax.
  6. The FlatCAM Shell provides a command line interface to FlatCAM's functionalies
  7. and to the TCL language. It serves the following purposes:
  8. * An alternative to the GUI for issuing commands and visualizing data output.
  9. * Scripting interface for automating large sequences of commands.
  10. * A mechanism for the user to implement new functionality.
  11. * A mechanism to provide detailed information to the user.
  12. * Keep a record of commands and responses.
  13. Calling a Shell script on startup
  14. ---------------------------------
  15. A file containing Shell commands (:ref:`cmdreference`) can be executed
  16. when starting FlatCAM from the command line::
  17. python FlatCAM.py --shellfile=/path/to/file
  18. The Shell Window
  19. ----------------
  20. .. image:: shell.png
  21. :align: center
  22. The FlatCAM Shell window is shown at startup when FlatCAM loads. It can be
  23. closed and re-opened at any time without loss of data by clicking on the
  24. close button on the top right edge of the window and selecting
  25. **Tool→Command Line** from the main menu respectively.
  26. It is divided into 2 sections, an output section on the top and an input
  27. section on the bottom. A record of previously issued commands is shown in
  28. the output section along with their results and other information that
  29. FlatCAM might provide. Distinction between types of data in the output
  30. section is done by color coding.
  31. To issue a command, type it in the input section and hit ``Enter``. If the
  32. command consists of multiple lines, use ``Shift-Enter`` to insert a new
  33. line without issuing the command.
  34. Shell Language
  35. --------------
  36. The Shell uses the TCL_ language. TCL provides the simples posible syntax
  37. and requires no learning at all for isuing the basic FlatCAM commands.
  38. Nonetheless, TCL is a powerfull language that enables the users to create
  39. their own complex functionality if desired.
  40. .. _TCL: https://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html
  41. Issuing a command is as simple as typing its name and hitting the
  42. ``Enter`` key. For example::
  43. new
  44. This the same as clicking on **File→New** in the main window menu.
  45. If a command requires additional information, it is given immediately
  46. after the command name and a space. For example, to open the gerber
  47. file ``mygerber.gbr``::
  48. open_gerber mygerber.gbr
  49. Sometimes a command will have optional parameters, this is, if you
  50. provide it it will use it, otherwise it will use some default value.
  51. For example::
  52. isolate mygerber.gbr -tooldia 0.04
  53. This would create isolation routing geometry for the ``mygerber.gbr``
  54. gerber object with a tool diameter of 0.04 inches (or mm, depending on
  55. the project settings). Otherwise, if you run::
  56. isolate mygerber.gbr
  57. The same action will be performed but the tool diameter will be taken
  58. from the default value set for that object (If it is a new object, its
  59. default values will be set from the project options.)
  60. For complete reference of FlatCAM Shell commands, see :ref:`cmdreference`.