All_Color2Layers

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.

Pixel

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>

Share this page:

Leave a Reply

Page Tag: 🏷️ Linetype Cleanup

  • All_Color2Layers

    β€”

    by

    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…