r/ScanNCut • • Oct 25 '26

Files/SVGs FCM Export from VectorCraft (Adobe Illustrator Alternative)

Post image

I regret paying for the official Brother Adobe Illustrator exporter. I've created this FCM exporter for VectorCraft. It's a plug-in that enables FCM exports from VectorCraft.

Plugin is here:
https://github.com/plasticbugs/vectorcraft-scanncut/

VectorCraft is here:
https://getartcraft.com/apps/vectorcraft

5 Upvotes

7 comments sorted by

2

u/justjanne Oct 26 '26

You (or rather, your AI) could've just used my fcmlib library instead of reimplementing that library, it's open source for a good reason :)

(and MPL has very little restrictions, so it shouldn't be an issue for you either)

1

u/AlarmingSurprise8019 Oct 26 '26

Yes, I actually did end up using it. I was happy to have found it! But the plugin had to be written in web assembly for VectorCraft, so it wound up as a port of sorts.

1

u/justjanne 29d ago

Well, your docs say your AI just rebuilt it.

Can you tell me what worked/didn't work for the WebAssembly version? I'd love to update the library so it can be used in Wasm as well.

2

u/AlarmingSurprise8019 27d ago

Hi! Sorry for the delayed reply. Without your work, I don't think "my" FCM plugin would be nearly as accurate (and possibly not even usable!)

My clanker (Opus 5.5) has these recommendations. I don't write Rust or Wasm (I can read/write Python, JS and Z80 Assembly), so take this with a grain of salt.

fcmlib should already compile to WebAssembly (as you're well aware): its three dependencies (nom, log and bitflags) are pure Rust, and it bans unsafe code. Only from_file and to_file would fail when run in a browser. Where the VectorCraft plugin work could help:

1. Crashes on bad input. In a few places fcmlib indexes into the data directly, bypassing nom's error handling, so a bad file crashes the program instead of returning an error. In WebAssembly that kills the whole module with no message.

- Reading a bad piece-table offset or length: read_from_offsets in util.rs.

- Reading a piece label shorter than 4 bytes: piece.rs.

- Writing a version string shorter than 4 characters.

- Writing a 1–2 character label.

- Writing a long non-ASCII name, because truncate(255) can cut a character in half.

2. A text-encoding bug. write_utf16_str writes the length in UTF-8 bytes, but the format counts UTF-16 units. Any non-ASCII name, author or copyright will throw off every field after it in the header. For example, "Café" is 5 UTF-8 bytes but only 4 UTF-16 units. Brother's files only use " ", so the sample tests can't catch this.

3. Writing new files. Our fcm.rs, thumbnail.rs and geom.rs handle that part: exact curve bounds, the centring transform, combining segments into runs, closing segments and drawing the thumbnail at mat scale. They're MIT-licensed, so they can go into an MPL-2.0 library. FCM-FORMAT.md lists the rules from the sample survey.

4. The WebAssembly boundary. The plug-in takes JSON in and gives bytes and warnings out. It's 135 KB with no imports and runs in VectorCraft's strict sandbox. An optional serde/wasm-bindgen feature in fcmlib could work the same way.

5. Small model fixes:

- Add a Plugin variant for 1PLG files. These currently show up as Device(0x474C5031, 0).

- Fix the empty-diameter default on open paths. A new open path would get 0x3F000000, but every open path in the samples has 0.

- Check PieceRestrictions, where two flags are both 0x0020.

My clanker is confirming the bugs it discovered now and I'll create an issue you can use (or not!)

2

u/AlarmingSurprise8019 27d ago edited 27d ago

And if you're okay with vibecoded stuff (led by a moderately intelligent full stack web dev), I can have my clanker open a PR with these modifications. If not no worries!

I love your stickers btw! ❤️

1

u/justjanne 27d ago

Not a fan of vibecoded stuff, but I'll try to fix what I can.

Some of these complaints are quite interesting, because they're actually how the brother library and devices do it as well.

e.g., two flags having the same value is actually a bug in brother's code, but I have to keep it compatible.

I actually built a small cli tool that links against brother's library, so I could then fuzz all possible in and outputs of that library, which is why I know that some of these bugs are required for compatibility 😅

2

u/AlarmingSurprise8019 27d ago

I love that! How very Brother Sewing Machine Company. Replicating bugs for compatibility sake. 😬

Your library was incredibly helpful in making sure I wasn't creating some kind of terrible mess.

I am an Adobe Illustrator user since forever, but I'm feeling like the $40/month is no longer something I need - VectorCraft does practically everything I need it to do. So glad I can use for my scan n cut now.