I have an idea to quick and easily change a lot of layer names, I have layers where the names are correct, and some layers where the names are wrong, All names of the _3D Layers are correct, _2D are wrong, but only in Number, Amount and having the text “[BLOCK]” behind it. The center of all strings of text are correct.
I want my script to look for the names of child layers from 2D, look the counterpart with the correct Number and amount, and then just change the 2D child layer name, to the same as the 3D name.
I hope this is clear enough, otherwise there is also an example in the script portion.
Glance your eyes over my “proposed” script and tell me if this has any chance of working (if written correctly)
////////////////////////////////////// // // In below example you see there are 3 things that change, Number, Amount and the [BLOCK] portion is removed. // // Number;ObjectNumber;Name;Dimensions;Amount; // // This script should take the name of child layer from the _2D layer, find the relating name from the _3D layer, and then copy the _3D Layers child name over the _2D layers child name. // //Example //22.003.501_2D // 1;TB-20 16 5;Washer;Ø20xØ16x2.5;1;[BLOCK] // 1;BBE-2259393;Body;30x20x60;1;[BLOCK] // //22.003.501_3D // 01;TB-20 16 5;Washer;Ø20xØ16x2.5;4; // 02;BBE-2259393;Body;30x20x60;2; // //Should become: // //22.003.501_2D // 01;TB-20 16 5;Washer;Ø20xØ16x2.5;4; // 02;BBE-2259393;Body;30x20x60;2; // //22.003.501_3D // 01;TB-20 16 5;Washer;Ø20xØ16x2.5;4; // 02;BBE-2259393;Body;30x20x60;2; // /////////////////////////////////////////////////// $INPUT_P_Layer "Please insert name of parent layer with default child-layer amounts" ";22.003.501_2D;" $INPUT_S_Layer "Please insert name of parent layer with correct child-layer amounts" ";22.003.501_3D;" $INPUT_P_Layer //This script should check all child layers of $INPUT_P_Layer once $TargetToReplace = Search child layer for first hit of: 1;*;[BLOCK] -> $TargetSource = * of $TargetToReplace result $TargetToReplaceWith = Search $INPUT_S_Layer child layers for $TargetSource (CHECK IF ONLY 1 result, otherwise print/report the given results) $CorrectName = Take full layer name of $TargetToReplaceWith Replace Initial found child layer with $TargetToReplace option and replace it with $CorrectName PRINT: process is completed and how many results it found / replaced (if possible)