ToolModel.to_json

ToolModel.to_json(filepath)[source]

Serialise the data dictionary representing the tool to JSON and store in a file.

Parameters

filepath (str) – Path to the file.

Returns

None

Examples

>>> import os
>>> import compas
>>> from compas.datastructures import Mesh
>>> from compas.geometry import Frame
>>> mesh = Mesh.from_stl(compas.get('cone.stl'))
>>> frame = Frame([0.14, 0, 0], [0, 1, 0], [0, 0, 1])
>>> tool = ToolModel(mesh, frame)
>>> filepath = os.path.join(compas.DATA, "cone_tool.json")
>>> tool.to_json(filepath)