Repository navigation
ATTOUT and ATTIN: export and import block attribute values - #14
Merged
Merged
Conversation
…and back The Express Tools' Export / Import Attribute Information. ATTOUT writes one row per block reference (handle with a leading apostrophe, block name, one column per tag over the union of tags) to a UTF-8 .txt; ATTIN reads it back and updates the references it names by handle in one undo step, skipping unknown handles, leaving missing tags, `<>` cells and locked layers alone. File input is capped (size, rows, columns, cell length) and decoded from UTF-8, UTF-16 or Windows-1252. JSON forms take `path`/`text` and `handles`; the ribbon (Extra Tools > Blocks, Home's Edit Attributes drop-down) asks for the file first. New icons, Italian and Chinese strings, tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds ATTOUT and ATTIN, the Express Tools' Export / Import Attribute Information, asked for on Discord.
What they do
.txtfile: a headerHANDLE,BLOCKNAME, then one column per tag (the union of tags over the references, in the order first met); one row per reference, its handle written as'1A2so a spreadsheet keeps it as text. A cell is empty when a block has no such tag; a repeated tag in one block becomesTAG(2). Values with tabs, quotes or line breaks are quoted. UTF-8 with a BOM, CRLF. The default file is the drawing's name with.txt.<>cells) are left alone; an empty cell clears a value; references on locked layers (or attributes on a locked layer of their own) are left alone. It reports references and values updated, rows skipped, locked references and unknown tag columns.Where
crates/engine/src/cmd/blocks/attio.rs(attout,attin), menu Tools ▸ Express Tools ▸ Export/Import Attribute Information....attout {path?, handles?}(nopath: the file's text comes back astext; nohandles: the selection, else every attributed reference in the current space);attin {path | text, handles?}(handleslimits which references may change).icons.rs(block + sheet, arrow out / in). The Save dialog gains a Text, tab-delimited (TXT) filter.it.tsv, menu entries (and the prompts) inzh.tsv.Hostile input
ATTIN reads through
capped_read(32 MB cap, regular files only), caps rows (200 000), columns (2 000) and cell size (64 KB), refuses an unclosed quote, and changes nothing if any of that fails. It decodes UTF-8 (BOM or not), UTF-16 LE/BE with a BOM (a spreadsheet's "Unicode text") and otherwise Windows-1252; CRLF, LF and CR line ends; control characters are dropped and line breaks become spaces in single-line attributes. On the web, ATTOUT downloads the file through the delivery hook; ATTIN takestext(no file system there). Behaviour observed black-box only.Tests
crates/engine/tests/it/attout_attin.rs: file format and union of tags, round trip ATTOUT → edit → ATTIN → undo/redo as one step, unknown handles and other objects skipped,handleslimit, missing tags /<>/ short rows / case-insensitive tags, locked layers, hostile files (unclosed quote, oversized cell, too many columns, file over the cap, folder, missing file, junk, control characters, Windows-1252, UTF-16), the command-line forms and a script.attio.rs; a UI test that the ribbon form asks for the file and JSON calls open no dialog.--sample --control): the ribbon buttons start the commands, a file edited outside was imported (2 references, 3 values, 1 unknown-handle row skipped) andUtook it back in one step.cargo xtask ci: fmt, clippy, i18n, assets, layers and wasm pass; every test passes except the 3 known macOS-only ones (usage::non_unicode_output_names,read_file_refuses_a_name_that_is_not_unicode,thai_marks_stack_in_an_installed_font).🤖 Generated with Claude Code