forked from 1b-agent/opencadstudio-upstream
Drawings arrive from elsewhere carrying someone else's layer names, and folding them into a set of house layers meant renaming and merging by hand, one layer at a time. LAYTRANS reads a layer set out of another drawing and moves this one onto it. Given a file it maps every name the two already share and translates at once, which is all most incoming drawings need. Bare, it opens a translator: the drawing's layers on one side, the loaded set on the other, mappings built up between them and applied only on Translate, so a mapping can be reconsidered and the whole translation is a single undo step. Mappings can be saved and read back, objects can be forced to ByLayer so the target layer's properties are what actually shows, and the result can be written out as a log. The move itself is the one LAYMRG already made for a single pair, so LAYMRG now goes through it too rather than keeping its own copy. Three things fell out for free or nearly so. A standards file is a drawing, so .dws and .dwt need nothing but a place in the file filter. The entity list is flat and holds block definitions, so objects inside blocks travel with everything else instead of being stranded on a layer that no longer exists. And a target layer that this drawing already has is left alone: the drawing has an opinion about it, and restyling it would reach past what was asked for -- only newly created targets take the standard's properties. Mappings are saved beside the drawing rather than inside a DWS. That is where AutoCAD keeps them, but putting them there would mean inventing a place in the drawing that nothing else reads back. Closes #624 Co-Authored-By: Claude Opus 5 <[email protected]>