EXF LISP: Reset Non-Default Extrusion Direction (Free AutoLISP Download)
Some drawing files contain entities that behave "weirdly" because they were created in a non-default User Coordinate System (UCS) and carry a nonzero extrusion direction (DXF group 210). This UCS/extrusion mismatch can cause entities to display or transform unexpectedly. EXF scans the drawing and resets any non-default extrusion vector back to the normal (0, 0, 1) value, which can recover entities affected by this specific issue.
EXTFIX-bgol (Reset Non-Default Extrusion Direction)
Command Type: AutoLISP routine (works in AutoCAD, BricsCAD, ZWCAD and most AutoLISP-compatible CAD platforms)
Developed by: BGol Community, bgol.in
Inspired by the general concept of extrusion-direction recovery utilities used in CAD drawing-repair workflows. This is an original, independently written routine, new file name, new command name, new source code, created so the CAD community has a free, editable, open-source alternative.
Overview
Some drawing files contain entities that behave "weirdly" because they were created in a non-default User Coordinate System (UCS) and carry a nonzero extrusion direction (DXF group 210). This UCS/extrusion mismatch can cause entities to display or transform unexpectedly. EXF scans the drawing and resets any non-default extrusion vector back to the normal (0, 0, 1) value, which can recover entities affected by this specific issue.
How to Use
- Load
EXTFIX-bgol.lspinto your CAD session (drag-and-drop the file onto the drawing window, or use theAPPLOADcommand). - Type
EXFat the command line and press Enter. - The routine automatically scans every entity in the drawing and resets any non-default extrusion direction to normal, no further input is required.
- Running this on a normal, unaffected drawing produces no visible change (and the routine will report that no non-default extrusions were found). Running it on a drawing affected by this issue recovers most affected entities to normal behavior.
Why Use It
- Drawing Recovery, fixes entities that behave incorrectly due to a specific but common corruption pattern (non-default UCS extrusion), restoring normal, predictable behavior.
- Safe on Unaffected Drawings, running it on a normal drawing causes no visible change, so it can be applied broadly as a diagnostic/ preventive step without risk of altering already-correct drawings.
- Diagnoses a Root Cause, directly addresses a known, previously hard-to-diagnose source of "weird" entity behavior in received drawing files.
Where to Use It
- Diagnosing and repairing drawings received from external sources (clients, other firms, different CAD software) that exhibit unexplained entity behavior, entities snapping incorrectly, drawing at unexpected angles, or interacting oddly with other commands.
- A standard "first pass" recovery step when a drawing is suspected to be corrupted, since it's safe to run on unaffected files.
Notes
- Uses a small tolerance (
1e-6) when comparing the extrusion vector to(0, 0, 1)so floating-point rounding doesn't cause false positives. - Entities that cannot be modified (e.g., on a locked layer) are counted separately and reported, rather than silently failing.
- Source code is fully open, feel free to study, modify, and redistribute it under the same open, free-for-all spirit.
Credits
Developed and shared for the CAD community by BGol Community. Website: https://bgol.in/ Free and open-source, use it, modify it, share it, for personal or commercial work alike.
Frequently Asked Questions
EXF is a standard AutoLISP routine, so it runs in AutoCAD, BricsCAD, ZWCAD, and most other AutoLISP-compatible CAD platforms without modification.
Uses a small tolerance (1e-6) when comparing the extrusion vector to (0, 0, 1) so floating-point rounding doesn't cause false positives.
Drawing Recovery, fixes entities that behave incorrectly due to a specific but common corruption pattern (non-default UCS extrusion), restoring normal, predictable behavior.
Yes. EXF is fully open-source and free to use, modify, and redistribute for both personal and commercial work, developed and shared by the BGol Community.
Drag and drop EXTFIX-bgol.lsp onto your open drawing window, or load it through the APPLOAD command, then type EXF at the command line to run it.
๐ค About BGol Community
BGol Community of Advanced Surveying builds and shares free, open-source tools for the survey and CAD drafting community.
๐ Made with โค๏ธ by BGol Community of Advanced Surveying
Free, open-source, and built for the CAD community, for personal or commercial use, always.