Skip to content
Back to search

autocad-dwg-redraw-skill

This repository contains two Codex skills:

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/pengxiaoan--autocad-dwg-redraw-skill/badge.svg)](/listings/pengxiaoan--autocad-dwg-redraw-skill)

HTML

<a href="/listings/pengxiaoan--autocad-dwg-redraw-skill"><img src="/api/listings/pengxiaoan--autocad-dwg-redraw-skill/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Install the skill from this repository:

python %USERPROFILE%\.codex\skills\.system\skill-installer\scripts\install-skill-from-github.py --repo <owner>/<repo> --path skills/autocad-dwg-redraw

Or with a GitHub URL:

python %USERPROFILE%\.codex\skills\.system\skill-installer\scripts\install-skill-from-github.py --url https://github.com/<owner>/<repo>/tree/main/skills/autocad-dwg-redraw

Restart Codex after installation.

Install the image-to-DWG skill:

python %USERPROFILE%\.codex\skills\.system\skill-installer\scripts\install-skill-from-github.py --repo pengxiaoan/autocad-dwg-redraw-skill --path skills/autocad-image-redraw

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 119 lines
  1. # AutoCAD Redraw Skills
  2. This repository contains two Codex skills:
  3. - `autocad-dwg-redraw`: exact, evidence-backed reconstruction when a source or intermediate DWG exists.
  4. - `autocad-image-redraw`: generalized raster image to DWG/DXF reconstruction with input preflight, evidence-aware specs, CAD output inspection, visual comparison, and iterative validation.
  5. Chinese tutorial: [图片自动绘制 DWG 使用教程](docs/图片自动绘制DWG使用教程.md)
  6. ## Install
  7. Install the skill from this repository:
  8. ```powershell
  9. python %USERPROFILE%\.codex\skills\.system\skill-installer\scripts\install-skill-from-github.py --repo <owner>/<repo> --path skills/autocad-dwg-redraw
  10. ```
  11. Or with a GitHub URL:
  12. ```powershell
  13. python %USERPROFILE%\.codex\skills\.system\skill-installer\scripts\install-skill-from-github.py --url https://github.com/<owner>/<repo>/tree/main/skills/autocad-dwg-redraw
  14. ```
  15. Restart Codex after installation.
  16. Install the image-to-DWG skill:
  17. ```powershell
  18. python %USERPROFILE%\.codex\skills\.system\skill-installer\scripts\install-skill-from-github.py --repo pengxiaoan/autocad-dwg-redraw-skill --path skills/autocad-image-redraw
  19. ```
  20. ## Use
  21. Ask Codex:
  22. ```text
  23. Use $autocad-dwg-redraw. I will provide a DWG; generate a custom redraw prompt, then rebuild and validate it.
  24. ```
  25. For a photographed drawing, scan, sketch, screenshot, PNG, or JPG:
  26. ```text
  27. Use $autocad-image-redraw. Preflight this image, create and validate an evidence-aware CAD spec, draw an editable DWG/DXF, inspect it, compare it with the source image, and report unresolved assumptions.
  28. ```
  29. The skill includes:
  30. - A standard workflow for turning any source DWG into a custom redraw prompt.
  31. - A PDF-derived DWG workflow for cases where a PDF is available but the original DWG is not.
  32. - A workflow for exact DWG reconstruction through AutoCAD COM.
  33. - Validation for entity counts, object type distribution, dimensions, leaders, annotations, layers, blocks, and PaperSpace.
  34. - A reusable prompt builder at `skills/autocad-dwg-redraw/scripts/dwg_prompt_builder.py`.
  35. - A reusable redraw script at `skills/autocad-dwg-redraw/scripts/dwg_redraw.py`.
  36. - A prompt template for generated AutoLISP/Python redraw programs when exact extracted entity data is available.
  37. - Raster input quality checks and explicit `known` / `scaled` / `inferred` / `unreadable` evidence levels.
  38. - Dimension-driven, hybrid, visual-trace, and geometry-only image redraw profiles.
  39. - Spec validation, AutoCAD DWG inspection, fixed-page DXF preview, registered overlay, and edge-distance comparison.
  40. - A validation contract that separates visual similarity from physical dimensional accuracy.
  41. ## Script Examples
  42. Generate a drawing-specific custom redraw prompt:
  43. ```powershell
  44. python skills\autocad-dwg-redraw\scripts\dwg_prompt_builder.py --source input.dwg --output input-redraw-prompt.md
  45. ```
  46. If AutoCAD is stuck on the Start page or COM document access fails, restart AutoCAD cleanly:
  47. ```powershell
  48. python skills\autocad-dwg-redraw\scripts\dwg_prompt_builder.py --source input.dwg --output input-redraw-prompt.md --restart-autocad --acad-exe "C:\Path\To\acad.exe"
  49. ```
  50. Create the validated redraw:
  51. ```powershell
  52. python skills\autocad-dwg-redraw\scripts\dwg_redraw.py --source input.dwg --output outputs\redraw_exact.dwg
  53. ```
  54. Clean AutoCAD restart plus redraw:
  55. ```powershell
  56. python skills\autocad-dwg-redraw\scripts\dwg_redraw.py --source input.dwg --output outputs\redraw_exact.dwg --restart-autocad --acad-exe "C:\Path\To\acad.exe"
  57. ```
  58. ModelSpace-only redraw:
  59. ```powershell
  60. python skills\autocad-dwg-redraw\scripts\dwg_redraw.py --source input.dwg --output outputs\redraw_modelspace_only.dwg --modelspace-only
  61. ```
  62. No personal DWG files or local machine paths are included in this repository.
  63. Image-redraw preflight and validation:
  64. ```powershell
  65. python skills\autocad-image-redraw\scripts\preflight_image_redraw.py --image input.jpg --mode general --output reports\input-preflight.json
  66. python skills\autocad-image-redraw\scripts\validate_image_redraw_spec.py --spec redraw-spec.json --profile general --report reports\spec-validation.json
  67. python skills\autocad-image-redraw\scripts\draw_image_spec.py --spec redraw-spec.json --output outputs\redraw.dwg
  68. python skills\autocad-image-redraw\scripts\inspect_dwg_output.py --dwg outputs\redraw.dwg --report reports\dwg-inspection.json
  69. python skills\autocad-image-redraw\scripts\render_dxf_preview.py --dxf outputs\redraw.dxf --png reports\preview.png --pdf reports\preview.pdf
  70. python skills\autocad-image-redraw\scripts\compare_redraw.py --source input.jpg --cad-preview reports\preview.png --anchors anchors.json --output-dir reports\comparison
  71. ```
  72. ## Standard Process
  73. 1. Provide a source `.dwg`, or convert a PDF into an auditable intermediate `.dwg`.
  74. 2. Generate `*-redraw-prompt.md` with `dwg_prompt_builder.py`.
  75. 3. Review the prompt's drawing fingerprint: entity count, layers, blocks, text styles, dimension styles, annotation counts, and object distribution.
  76. 4. Run `dwg_redraw.py` for the final deliverable.
  77. 5. Validate that the target has the same ModelSpace/PaperSpace entity counts, dimensions/leaders, annotations, and object type distribution as the source or intermediate DWG.
  78. ## Notes
  79. - AutoCAD must be installed on Windows.
  80. - Python requires `pywin32`.
  81. - PDF-derived DWGs should be reported as PDF-derived, not as exact copies of an unavailable original DWG.
  82. - For legacy DWGs, custom objects, proxy objects, xrefs, or annotative dimensions, run a visual review in AutoCAD after automated validation.
  83. - Image-derived drawings must not be described as dimensionally exact unless units and sufficient authoritative constraints are present and validated.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.