Short description
π¨ All_Color2Layers is an AutoCAD AutoLISP ByLayer cleanup utility for resetting entity color and/or linetype overrides to BYLAYER.
π§° It adds a DCL interface with operation options, scope controls, layout filtering, layer selection, settings memory, and undo support.
Command:
π Main dialog command: BYLAYERDLG – opens the ByLayer Tool DCL interface
π Alias command: BYLAYER – runs the same DCL interface
π Command-line mode: BYLAYERCMD – runs Color/Linetype/Both from the command line
π Diagnostic command: BLDEBUG – writes a debug report for DCL/environment troubleshooting
Description:
π¨ All_Color2Layers is an SEO-friendly AutoCAD entity cleanup utility for resetting object color and linetype overrides to BYLAYER.
π§° The BYLAYERDLG command writes a temporary DCL dialog with Color only, Linetype only, and Both operation modes.
ποΈ The dialog includes scope toggles for Model Space, Paper Spaces, and Block Definitions, plus a layout filter and multi-select list.
β©οΈ Apply creates an undo mark and the custom Undo button reopens the dialog after running AutoCAD UNDO 1.
π The code unlocks locked layers temporarily, processes non-xref blocks/entities, restores layer locks, and stores dialog settings with getcfg/setcfg.
Helper function: (if any)β
π§© BL:Get and BL:Set read and write persistent dialog settings through the AutoCAD configuration store.
π§© BL:WriteDcl creates a fresh temporary DCL file to avoid stale or locked dialog files.
π§© BL:Process applies the original ByLayer logic across selected scope areas and restores locked layers.
π§© BL:Filter, BL:FillList, and BL:UpdSel manage the layer/layout list and selection count.
π§© BL:OnApply wraps processing in a document undo mark and updates the status text.
π§© BLDEBUG writes an environment and DCL diagnostic log for troubleshooting.
Functionalities:
β
Reset entity Color to BYLAYER.
β
Reset entity Linetype to BYLAYER.
β
Reset both Color and Linetype in one operation.
β
Choose processing scope: Model Space, Paper Spaces, and Block Definitions.
β
Filter layouts/layers with wildcard-style filtering.
β
Select all or select none in the DCL list.
β
Temporarily unlock locked layers and restore their lock state after processing.
β
Save operation mode, scope, filter, and dialog position between sessions.
β
Provide an undo button for the last ByLayer operation step.
Result:
π― The result is a cleaner AutoCAD drawing where object-level color and linetype overrides are returned to layer-driven CAD standards.
π§± This improves layer management, plotting consistency, CAD auditing, and Civil 3D production file cleanup.
Images, animations etc.
XAML code:
ο»Ώ<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:src="clr-namespace:Autodesk.Windows;assembly=AdWindows"> <src:RibbonToolTip x:Key="All_Color2Layers"> <src:RibbonToolTip.ExpandedContent> <StackPanel> <TextBlock Background="AntiqueWhite" TextAlignment="Left"> <Bold>Function Syntax: BYLAYERDLG / BYLAYER / BYLAYERCMD / BLDEBUG</Bold> <LineBreak/> <Bold>Version: 1.1 Date: 20.06.2026 6:38:52PM</Bold> <LineBreak/> <Hyperlink>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/change-all-to-color-bylayer-linetype-replacement/td-p/1523288</Hyperlink> <TextBlock TextWrapping="Wrap" Foreground="Black"> <Run FontWeight="Bold">Function:</Run> bylayer β Force entity color and/or linetype to Bylayer. </TextBlock> <TextBlock TextWrapping="Wrap" Foreground="Black"> <Run FontWeight="Bold">Overview:</Run> <LineBreak/> This command allows the user to convert all entities in the drawing so their color and/or linetype properties are set to <Run Foreground="DarkOrange" FontWeight="Bold">Bylayer</Run>.<LineBreak/> Routine to change all drawing entities color or linetype, or both to the assigned color and/or linetype. </TextBlock> <TextBlock TextWrapping="Wrap" Foreground="Black"> <Run FontWeight="Bold">User Prompt:</Run> <LineBreak/> Upon execution, the user selects from three options: <LineBreak/> β’ <Run Foreground="Blue" FontWeight="Bold">Color</Run> β Change only colors to Bylayer. <LineBreak/> β’ <Run Foreground="Green" FontWeight="Bold">Linetype</Run> β Change only linetypes to Bylayer. <LineBreak/> β’ <Run Foreground="Purple" FontWeight="Bold">Both</Run> β Change both properties to Bylayer. </TextBlock> <TextBlock TextWrapping="Wrap" Foreground="Black"> <Run FontWeight="Bold">Key Operations:</Run> <LineBreak/> β’ Unlocks all layers temporarily to allow modification. <LineBreak/> β’ Iterates over all blocks and entities (excluding XRefs). <LineBreak/> β’ Applies Bylayer color and/or linetype based on user selection. <LineBreak/> β’ Handles block attribute definitions β ensures nested attribute colors are also changed. <LineBreak/> β’ Restores original layer lock states after processing. </TextBlock> <TextBlock TextWrapping="Wrap" Foreground="Black"> <Run FontWeight="Bold">Additional Notes:</Run> <LineBreak/> β’ Attributes inside INSERT entities with attribute definitions (`66=1`) are also modified. <LineBreak/> β’ Uses `vlax-property-available-p` to safely access color and linetype properties. <LineBreak/> β’ Fully supports nested block-level entity edits. </TextBlock> <TextBlock TextWrapping="Wrap" Foreground="Black"> <Run FontWeight="Bold">Ideal For:</Run> <LineBreak/> β’ Cleaning up drawings. <LineBreak/> β’ Enforcing CAD standards. <LineBreak/> β’ Preparing files for plotting or standardization. </TextBlock> <Bold><Run Foreground="DodgerBlue">Description</Run></Bold><LineBreak/><Run Foreground="White">π¨ All_Color2Layers is an AutoCAD AutoLISP ByLayer cleanup tool for restoring entity color and linetype behavior to layer-controlled standards.</Run><LineBreak/><Run Foreground="LimeGreen">π§° It is useful for CAD standards enforcement, plotting consistency, xref-independent cleanup, and production drawings where object overrides must be removed.</Run><LineBreak/><LineBreak/> <Bold><Run Foreground="DodgerBlue">Function Syntax</Run></Bold><LineBreak/><Run Foreground="White">Main dialog command: </Run><Bold><Run Foreground="Orange">BYLAYERDLG</Run></Bold><Run Foreground="White">opens the ByLayer Tool DCL interface</Run><LineBreak/><Run Foreground="White">Alias command: </Run><Bold><Run Foreground="Orange">BYLAYER</Run></Bold><Run Foreground="White">runs the same DCL interface</Run><LineBreak/><Run Foreground="White">Command-line mode: </Run><Bold><Run Foreground="Orange">BYLAYERCMD</Run></Bold><Run Foreground="White">runs Color/Linetype/Both from the command line</Run><LineBreak/><Run Foreground="White">Diagnostic command: </Run><Bold><Run Foreground="Orange">BLDEBUG</Run></Bold><Run Foreground="White">writes a debug report for DCL/environment troubleshooting</Run><LineBreak/><LineBreak/> <Bold><Run Foreground="DodgerBlue">SEO Optimized Overview</Run></Bold><LineBreak/><Run Foreground="White">π¨ All_Color2Layers is an SEO-friendly AutoCAD entity cleanup utility for resetting object color and linetype overrides to BYLAYER.</Run><LineBreak/><Run Foreground="White">π§° The BYLAYERDLG command writes a temporary DCL dialog with Color only, Linetype only, and Both operation modes.</Run><LineBreak/><Run Foreground="White">ποΈ The dialog includes scope toggles for Model Space, Paper Spaces, and Block Definitions, plus a layout filter and multi-select list.</Run><LineBreak/><Run Foreground="White">β©οΈ Apply creates an undo mark and the custom Undo button reopens the dialog after running AutoCAD UNDO 1.</Run><LineBreak/><Run Foreground="White">π The code unlocks locked layers temporarily, processes non-xref blocks/entities, restores layer locks, and stores dialog settings with getcfg/setcfg.</Run><LineBreak/><LineBreak/> <Bold><Run Foreground="LimeGreen">Primary Workflow</Run></Bold><LineBreak/><Run Foreground="White">1οΈβ£ Run </Run><Bold><Run Foreground="Orange">BYLAYERDLG</Run></Bold><Run Foreground="White"> or BYLAYER to open the ByLayer Tool dialog.</Run><LineBreak/><Run Foreground="White">2οΈβ£ Choose Color only, Linetype only, or Both.</Run><LineBreak/><Run Foreground="White">3οΈβ£ Set the scope toggles for Model Space, Paper Spaces, and Block Definitions.</Run><LineBreak/><Run Foreground="White">4οΈβ£ Filter and select the relevant list entries, then click Apply.</Run><LineBreak/><Run Foreground="White">5οΈβ£ Use Undo in the dialog when the last cleanup step must be rolled back.</Run><LineBreak/><LineBreak/> <Bold><Run Foreground="LimeGreen">Functionalities</Run></Bold><LineBreak/><Run Foreground="White">β Reset entity Color to BYLAYER.</Run><LineBreak/><Run Foreground="White">β Reset entity Linetype to BYLAYER.</Run><LineBreak/><Run Foreground="White">β Reset both Color and Linetype in one operation.</Run><LineBreak/><Run Foreground="White">β Choose processing scope: Model Space, Paper Spaces, and Block Definitions.</Run><LineBreak/><Run Foreground="White">β Filter layouts/layers with wildcard-style filtering.</Run><LineBreak/><Run Foreground="White">β Select all or select none in the DCL list.</Run><LineBreak/><Run Foreground="White">β Temporarily unlock locked layers and restore their lock state after processing.</Run><LineBreak/><Run Foreground="White">β Save operation mode, scope, filter, and dialog position between sessions.</Run><LineBreak/><Run Foreground="White">β Provide an undo button for the last ByLayer operation step.</Run><LineBreak/><LineBreak/> <Bold><Run Foreground="DodgerBlue">Important Commands and Functions</Run></Bold><LineBreak/><Run Foreground="White">π§© </Run><Bold><Run Foreground="Orange">BYLAYERDLG</Run></Bold><Run Foreground="White"> - main DCL command for the ByLayer cleanup interface.</Run><LineBreak/><Run Foreground="White">π§© </Run><Bold><Run Foreground="Orange">BYLAYER</Run></Bold><Run Foreground="White"> - alias that opens the same interface.</Run><LineBreak/><Run Foreground="White">π§© </Run><Bold><Run Foreground="Orange">BYLAYERCMD</Run></Bold><Run Foreground="White"> - command-line mode for Color, Linetype, or Both.</Run><LineBreak/><Run Foreground="White">π§© </Run><Bold><Run Foreground="Orange">BL:Process</Run></Bold><Run Foreground="White"> - core object traversal and property reset function.</Run><LineBreak/><Run Foreground="White">π§© </Run><Bold><Run Foreground="Orange">acbylayer</Run></Bold><Run Foreground="White"> - ActiveX color constant used to reset entity color.</Run><LineBreak/><Run Foreground="White">π§© </Run><Bold><Run Foreground="Orange">vla-put-lock</Run></Bold><Run Foreground="White"> - temporarily unlocks and restores locked layers during cleanup.</Run><LineBreak/><LineBreak/> <Bold><Run Foreground="LimeGreen">Result</Run></Bold><LineBreak/><Run Foreground="White">π― The result is a cleaner AutoCAD drawing where object-level color and linetype overrides are returned to layer-driven CAD standards.</Run><LineBreak/><Run Foreground="White">π§± This improves layer management, plotting consistency, CAD auditing, and Civil 3D production file cleanup.</Run><LineBreak/><LineBreak/> <Bold><Run Foreground="DarkRed">Important Notes</Run></Bold><LineBreak/><Run Foreground="White">β οΈ The routine can process many entities across model space, layouts, and block definitions; test scope settings before running on large project drawings.</Run><LineBreak/><Run Foreground="White">β οΈ It intentionally changes entity properties, so use undo or a backup when cleaning production files.</Run><LineBreak/><Run Foreground="White">β οΈ The code skips xref block definitions and avoids xref-style block names when traversing blocks.</Run><LineBreak/><LineBreak/> <Bold><Run Foreground="Yellow">Tags</Run></Bold><LineBreak/><Run Foreground="Yellow">π·οΈ AutoCAD, π·οΈ AutoLISP, π·οΈ Civil 3D, π·οΈ BYLAYER, π·οΈ Color Cleanup, π·οΈ Linetype Cleanup, π·οΈ Layer Standards, π·οΈ DCL Dialog, π·οΈ CAD Cleanup, π·οΈ All_Color2Layers</Run><LineBreak/> </TextBlock> <!-- Use MediaElement for GIF (static first frame) and Image as fallback --> </StackPanel> </src:RibbonToolTip.ExpandedContent> </src:RibbonToolTip> </ResourceDictionary>

Leave a Reply
You must be logged in to post a comment.