diff --git a/plugins/draw/draw.png b/plugins/draw/draw.png new file mode 100644 index 0000000..8cc39dc Binary files /dev/null and b/plugins/draw/draw.png differ diff --git a/plugins/draw/index.html b/plugins/draw/index.html new file mode 100644 index 0000000..546133f --- /dev/null +++ b/plugins/draw/index.html @@ -0,0 +1,2418 @@ + + + + + + Draw - FigUI Plugin + + + + +
+
+ + + +

+
+
+ +
+ +
+
+

How to use Draw

+ +
+ +
+

Job Settings

+ +
+
+ Not configured + +
+ +
+

Design elements

+ +
+
+
+ + + + + +
+ +
+

Machine Settings

+ +
+
+ Default + +
+ +
+

Tools

+ +
+
+
+
+ + + +
+
+
+ + +
+
+

Preview Drawing:New Drawing

+ +
+ +
+ +
+ +
+
+ + +
+
+

Shape

+ +
+ + + + + + + + + + + + + + +
+
+ + +
+

Job Settings

+ + + + + + + + +
+
+ + +
+

Machine Settings

+ + + + + + + + + + + + + + +
+
+ + +
+

Tool

+ + + + + + + + + + + +
+
+ + +
+

Save Drawing

+ + + + + + + +
+
+ + +
+

Load Drawing

+ + +
+ +
+ +

+ + + + +
+
+ + + + + diff --git a/plugins/draw/plugin.json b/plugins/draw/plugin.json new file mode 100644 index 0000000..9718469 --- /dev/null +++ b/plugins/draw/plugin.json @@ -0,0 +1,9 @@ +{ + "name": "Draw", + "description": "Create simple shapes and generate G-code in FigUI.", + "version": "1.0.0", + "entry": "index.html", + "layout": "full", + "icon": "draw.png", + "files": ["index.html", "plugin.json", "draw.png"] +} diff --git a/src/components/PluginFrame.tsx b/src/components/PluginFrame.tsx index d1db005..e31df77 100644 --- a/src/components/PluginFrame.tsx +++ b/src/components/PluginFrame.tsx @@ -166,8 +166,26 @@ export function PluginFrame({ plugin, onClose, inline }: { plugin: Plugin; onClo reply(useMachineStore.getState().controllerSettings); break case 'getSettings': { const fs = plugin.fs - fetchFileContent(`/plugins/${plugin.id}/settings.json`, fs) - .then(text => reply(JSON.parse(text))) + const paths = fs === 'sd' + ? [`/sd/plugins/${plugin.id}/settings.json`, `/plugins/${plugin.id}/settings.json`] + : [`/plugins/${plugin.id}/settings.json`] + + const tryRead = async () => { + for (const path of paths) { + try { + const text = await fetchFileContent(path, fs) + const trimmed = text.replace(/^\uFEFF/, '').trim() + if (!trimmed) return {} + return JSON.parse(trimmed) + } catch { + // Try next path variant. + } + } + return {} + } + + tryRead() + .then(data => reply(data)) .catch(() => reply({})) break }