reference.md 11 KB

Line

Yaml

A: point(-5,-5)
B: point(5,5)
line: Line(A,B)

Python

A = point(-5,-5)
B = point(5,5)
line = Line(A,B)

Code to get the result

Using the following framework in a jupyter notebook

[1]: %matplotlib widget
[2]: from pysketcher import *
[3]: drawing_tool.set_coordinate_system(xmin=-10, xmax=10,ymin=-10, ymax=10,axis=True)
[4]: drawing_tool.mpl.gcf().canvas

for Yaml, you need the added steps

head = """\
libraries: ["from math import tan, radians, sin, cos","from pysketcher import *"]
"""
myfig={}
sketchParse(head,myfig)

Yaml

myfig={}
sketch="""
# put here the yaml 'object' definition
"""
drawing_tool.erase()
sketchParse(sketch,myfig)
# replace 'object' by the actual one
d = myfig['object'].draw() 
drawing_tool.display()

Python

drawing_tool.erase()
# put the code of the object case here
# replace object by the actual name line, rectangle, circle...
object.draw()
drawing_tool.display()