drafttests.draft_test_objects Namespace Reference

Function Documentation

◆ create_test_file()

def drafttests.draft_test_objects.create_test_file (   file_name = "draft_test_objects",
  file_path = os.environ["HOME"],
  save = False,
  font_file = "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf" 
)
Create a complete test file of Draft objects.

It draws a frame with information on the software used to create
the test document, and fills it with every object that can be created.

Parameters
----------
file_name: str, optional
    It defaults to `'draft_test_objects'`.
    It is the name of the document that is created.

    The `file_name` will be appended to `file_path`
    to determine the actual path to save. The extension `.FCStd`
    will be added automatically.

file_path: str, optional
    It defaults to the value of `os.environ['HOME']`
    which in Linux is usually `'/home/user'`.

    If it is the empty string `''` it will use the value
    returned by `App.getUserAppDataDir()`,
    for example, `'/home/user/.FreeCAD/'`.

save: bool, optional
    It defaults to `False`. If it is `True` the new document
    will be saved to disk after creating all objects.

font_file: str, optional
    It defaults to `'/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf'`.
    It is the full path of a font in the system to be used
    to create a `Draft ShapeString`.
    If the font is not found, this object is not created.

Returns
-------
App::Document
    A reference to the test document that was created.

To Do
-----
Find a reliable way of getting a default font to be able to create
the `Draft ShapeString`.