Why, why not! It has no real purpose, but created to test performance, and also just nerd out as I remember a QA programmer do something similar for testing years ago and it looked cool.

CW – Basic quality 180k wedges, 3-6 min, basic quality
CWGOOD – Smooth quality 180k wedges, 3-6 min, basic quality
CWPERFECT – Seamless quality 324k wedges, 20-30 min, seamless quality
CWSMART – 23.6M colors in 3D 23.6M points, 45-60 min, all colors in 3D
CHECKWHEEL – Diagnostics
DELETEWHEEL – Cleanup
How the LISP Script Creates the Color Wheel
The color wheel generator uses a cylindrical coordinate system to map the HSV (Hue, Saturation, Value) color space into AutoCAD’s XYZ space.
Color Space Selection – HSV
The script uses HSV color space rather than RGB because:
- Hue naturally maps to angle (0-360°)
- Saturation naturally maps to radius (0-100%)
- Value/Brightness naturally maps to height or layers (0-100%)
This creates intuitive, circular color arrangements that artists and designers understand.
HSV to RGB Conversion
AutoCAD requires RGB values, not HSV. The conversion algorithm:
(defun hsv2rgb (h s v)
;; 1. Normalize hue to 0-6 range
(setq h1 (/ h 60.0)) ; Divides 360° into 6 sectors
;; 2. Calculate chroma (color intensity)
(setq c (* v s))
;; 3. Calculate intermediate value
(setq x (* c (- 1.0 (abs (- (rem h1 2.0) 1.0)))))
;; 4. Calculate offset
(setq m (- v c))
;; 5. Assign RGB based on which 60° sector we're in:
(cond
((< h1 1) (setq r c g x b 0)) ; Red to Yellow
((< h1 2) (setq r x g c b 0)) ; Yellow to Green
((< h1 3) (setq r 0 g c b x)) ; Green to Cyan
((< h1 4) (setq r 0 g x b c)) ; Cyan to Blue
((< h1 5) (setq r x g 0 b c)) ; Blue to Magenta
(t (setq r c g 0 b x))) ; Magenta to Red
;; 6. Add offset and scale to 0-255
(list (fix (* (+ r m) 255))
(fix (* (+ g m) 255))
(fix (* (+ b m) 255))))
Why this works: The HSV color space divides the hue circle into 6 sectors (60° each), and within each sector, two RGB components change linearly while the third is either 0 or at maximum.
Iteration Strategy
The script uses nested loops to iterate through color space:
;; CWPERFECT example (2160 × 150 × 1):
(repeat value-steps ; Outer: Brightness levels
(repeat saturation-steps ; Middle: Saturation rings
(repeat hue-steps ; Inner: Hues around circle
;; Calculate position
;; Convert HSV to RGB
;; Create entity
)))
Performance consideration: The innermost loop (hue) executes most frequently, so calculations here must be efficient. Pre-calculating angle increments (dh) and radius increments (dr) speeds this up significantly.
Complete Flow Diagram
1. User runs command (e.g., CWPERFECT)
↓
2. Set parameters (hue_steps, sat_steps, val_steps)
↓
3. Pre-calculate constants (dh, dr)
↓
4. Create/set COLOR_WHEEL layer
↓
5. Triple nested loop:
FOR each brightness level:
FOR each saturation ring:
FOR each hue step:
a. Calculate angle and radius
b. Calculate XYZ coordinates
c. Convert HSV → RGB
d. Pack RGB into integer
e. Create SOLID or POINT entity
f. Update progress display
↓
6. Restore original layer
↓
7. Display completion message
Understanding The Scale
Color Count Comparison
Human Color Perception: ~10 million distinguishable colors
AutoCAD ACI (pre-2004): 255 colors (0.0000255 million)
AutoCAD True Color (2004): 16,777,216 colors (16.77 million)
AutoCAD True Color (2004): 167× what humans can distinguish
Physical Representation
If you printed one 1mm × 1mm square for each true color:
Total area: 16,777,216 mm² = 16,777 m² = 4.1 acres
Square grid: 4,096 × 4,096 colors
Grid size: 4.096 km × 4.096 km = 16.8 km²
Compare to:
- ACI 255 colors: 16×16 grid = 16mm × 16mm (postage stamp)
- True Color: 4.1 acres (3 football fields)
Modern CPU can:
- Calculate HSV→RGB: ~100 million conversions/sec
- AutoCAD bottleneck is entity database insertion, not calculation
Technical Implementation Deep Dive
Why 24-bit Color?
Human Color Perception
Human eye sensitivity:
- Red cones: Detect ~100 levels of red
- Green cones: Detect ~100 levels of green
- Blue cones: Detect ~100 levels of blue
- Total distinguishable: ~100³ = 1 million colors
Computer displays:
- Red channel: 256 levels (8 bits)
- Green channel: 256 levels (8 bits)
- Blue channel: 256 levels (8 bits)
- Total possible: 256³ = 16,777,216 colors
Result: 24-bit color exceeds human perception by 16×.
Why Not More?
32-bit color exists:
- RGBA (24-bit color + 8-bit alpha/transparency)
- Used in computer graphics
- AutoCAD uses this in rendering, but not for entity colors
Why 24-bit is sufficient for CAD:
- Exceeds human perception
- Matches display technology
- Matches printing capabilities
- Balances file size vs quality



