Skip to main content
You must create a lasso selection before calling this API; otherwise the call fails.
static getLassoElements(): Promise<APIResponse<Element[]>>;
Returns

Example

import { PluginCommAPI, ElementType, type Element } from 'sn-plugin-lib';

/**
 * Example: get lasso elements and filter by type.
 */
export async function exampleGetLassoElements() {
 const res = await PluginCommAPI.getLassoElements();
 if (!res.success) {
 throw new Error(res.error?.message ?? 'getLassoElements call failed');
 }

 const elements = (res.result ?? []) as Element[];
 const strokes = elements.filter((e) => e.type === ElementType.TYPE_STROKE);
 return { elements, strokes };
}