sketchgraphs.data.sketch.Sketch

class sketchgraphs.data.sketch.Sketch(entities=None, constraints=None)

This class encapsulates a sketch instance.

A sketch is defined by a list of entities, and a list of constraints between these entities. The Sketch class is designed to represent the sketches as obtained from Onshape in a structured and faithful manner. In particular, it can round-trip the relevant parts of the JSON representation of Onshape’s feature-script.

__init__(entities=None, constraints=None)

Initialize self. See help(type(self)) for accurate signature.

static from_fs_json(sketch_dict, include_external_constraints=True)

Parse primitives and constraints.

Parameters

include_external_constraints (bool, optional) – If True, indicates that constraints referencing the first external node (representing) the origin should be included, otherwise, exclude those from the graph.

static from_info(sketch_info)

Parse entities given result of sketch information call.

to_dict()dict

Create a dictionary representing this sketch.

The created dictionary should be compatible with the json represention of the sketch.