CADXChange

Tutti i comandi LISP

CXFONTCHKPuliziaVersione 1.0.0Provato in AutoCAD

Elencare gli stili di testo con il file del carattere mancante

Controlla ogni stile di testo ed elenca quelli che puntano a un file di carattere SHX introvabile, la causa più comune dei punti interrogativi nel testo.

Come si usa

  1. Digita CXFONTCHK.
  2. Leggi l'elenco di stili e file mancanti.
  3. Usa CXFONTSUB per indirizzarli a un carattere che hai.

Da sapere

  • I caratteri TrueType qui non vengono controllati.

Caricarlo in AutoCAD

  1. Salva il file dove preferisci.
  2. Digita APPLOAD, scegli il file e premi Carica.
  3. Digita il nome del comando: CXFONTCHK.

Per averlo a ogni avvio, aggiungilo alla Raccolta di avvio nella stessa finestra, oppure carica un'intera cartella in una volta con il caricatore facoltativo. Il caricatore facoltativo

Provato in AutoCAD (versione completa). Altri programmi che eseguono AutoLISP potrebbero funzionare, ma non sono stati provati.

Il codice

Testo semplice, niente di nascosto. Copialo in un file chiamato cxfontchk.lsp oppure scaricalo.

;;; ============================================================================
;;; CXFONTCHK - List text styles whose font file is missing
;;; Version 1.0.0
;;; CADXChange LISP tools - https://cadxchange.net/resources/lisp/cxfontchk
;;; Tested in: AutoCAD (full version). Other programs that run AutoLISP may work but are not tested.
;;; Copyright (c) CADXChange. Free for personal and commercial use; do not resell or
;;; republish it as a collection. Terms: https://cadxchange.net/legal/lisp-terms
;;; ============================================================================

;; The text styles whose font file cannot be found by the program: ((style . file) ...).
;; Only .shx fonts are checked; TrueType fonts and shape files are skipped.
(defun cx:fontchk-run ( / r out file)
  (setq r (tblnext "STYLE" T))
  (while r
    (setq file (cx:dxf 3 r))
    (if (and (= (logand 1 (cx:dxf 70 r)) 0)
             file
             (wcmatch (strcase file) "*.SHX")
             (not (findfile file)))
      (setq out (cons (cons (cx:dxf 2 r) file) out)))
    (setq r (tblnext "STYLE")))
  (reverse out))

(defun c:CXFONTCHK ( / *error* cx:sv rows)
  (setq *error* cx:err)
  (setq rows (cx:fontchk-run))
  (if rows
    (progn
      (princ "\nText styles with a missing font file:")
      (foreach r rows (princ (strcat "\n  " (car r) "   " (cdr r))))
      (princ "\nCXFONTSUB can replace a missing font by another one."))
    (princ "\nEvery shx font file used by a text style was found."))
  (princ))


;;; ---- Shared helpers (used by the command above; identical in every CADXChange tool) ----

(defun cx:dxf (code ed)
  (cdr (assoc code ed)))

;; Close the undo step and put the system variables back.
(defun cx:end ()
  (foreach v cx:sv (setvar (car v) (cdr v)))
  (command "_.UNDO" "_End")
  (setq cx:sv nil)
  (princ))

;; Error handler: restores everything, stays quiet on Esc.
(defun cx:err (msg)
  (if (> (getvar "CMDACTIVE") 0) (command))
  (cx:end)
  (if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")))
    (princ (strcat "\nError: " msg)))
  (princ))

(princ "\nCXFONTCHK loaded. Type CXFONTCHK to start.")
(princ)

Cronologia delle versioni

Versione 1.0.0 · 27 ottobre 2026

Prima versione.

Ti serve su molti disegni?

TextSync svolge questo tipo di lavoro su un'intera cartella di disegni in un solo passaggio.

TextSync

Altri comandi: Pulizia