3.3. Convert SVG graphic into LMD excision instructions

[1]:
from lmd.lib import Collection, Shape
import numpy as np
/Users/sophia/mambaforge/envs/pylmd_docs/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
  from .autonotebook import tqdm as notebook_tqdm

With a couple of lines of code we can easily convert a SVG file into cutting instructions for the LMD microscope.

[2]:
#define file path to simple SVG we want to excise
file_path = "../../_static/pyLMD_text.svg"

#define 3 times the same calibration point
calibration_points = [(0, 0), (40000, 0 ), (40000, - 20000)]

#initalize collection and add points for SVG
my_collection = Collection(calibration_points = calibration_points)
my_collection.svg_to_lmd(file_path)

3.3.1. Visualize Results

[3]:
my_collection.plot()
../../_images/pages_notebooks_generate_cutting_mask_svg_5_0.png

3.3.2. Export to XML

[4]:
#save results to XML
my_collection.save("pyLMD_xml_excision.xml")
[0. 0.]
[4000000.       0.]
[ 4000000. -2000000.]