Closed kr15h closed 5 months ago
John's GitHub handle: @john-story
We can open mods in a new window now. Next steps are:
Step 2: opening a specific mods program Step 3: modify milling program by adding a new svgToMods module Step 4: figure out how to send svg to the new mods module
Some tips from our friend ChatGPT.
The localStorage and sessionStorage objects store data that can be shared between tabs from the same origin (i.e., same protocol, domain, and port).
Storing Data: In your first tab, you can store the SVG data string in localStorage like this:
localStorage.setItem('svgData', yourSvgDataString);
Retrieving Data: In the second tab, you can retrieve this data with:
let svgData = localStorage.getItem('svgData');
Listening for Changes: Optionally, you can add an event listener in the second tab to react to changes:
window.addEventListener('storage', function(event) {
if (event.key === 'svgData') {
// Handle the new SVG data
let newSvgData = event.newValue;
}
});
Note: localStorage persists data even after closing the tab/browser, whereas sessionStorage is limited to the tab's session.
OK, but how about opening the MODS sketch.
So there is a problem that there are different Mods program for different machines. There is no way to know what machine is targeted and that means that the user has to be involved. In SvgPcb svgToMods modal the user should pick the machine and based on that a Mods program would be opened.
So now, depending on user choice, we can call Mods to open a specific program.
So now we figured out how to open specific Mods program for each machine without the need to modify mods.
Next step: figure out a way how we can load SVG string into the SVG input module in Mods.
At this point sending raw SVG data to a specific Mods sketch works with a customized SVG reader.
The user will need to choose one of the machines where PCB milling sketch exists in Mods and select the layer to be exported. For now one can modify layer colors, but ultimately, whatever color, the objects will be white on black background. I could add a flip X feature for double-sided milling too.
Ready to merge now it is...
Thanks for working on it! And nice job actually writing docs too. Seems to work well.
At the Spain bootcamp this year a need to have a SvgPcb <> Mods connection was identified. We created this pull request with John to work on it.
Essentially we want two things.
Let's do it!