Kadangi tekstas sukurtas su TEXT turi problemų su lietuvybėmis geriausia jį konvertuoti į MTEXT objektą kuris lietuvybę atvaizduoja gerai
Taigi čia be lisp kodo neapsieisime.
Kodas konvertuoja daugybinius TEXT objektus į MTEXT objektus:
(princ"\nKodas konvertuoja daugybinius TEXT objektus į MTEXT objektus")
(DEFUN c:txt2mtxt (/ LST SS SSL EN ED COUNT cmdecho menuecho atd2txt_olderr atd2txt_err)
(defun txt2mtxt_err (s) ; If an error (such as CTRL-C) occurs
(if cmdecho(setvar"cmdecho"cmdecho))
(if menuecho(setvar"menuecho"menuecho))
(if (/= s "Function cancelled")
(princ (strcat "\nError: " s))
)
(if atd2txt_olderr (setq *error* atd2txt_olderr)) ; Restore old *error* handler
(princ)
)
(setq atd2txt_olderr *error* ; Save error routine
*error* atd2txt_err ; Substitute ours
)
(setq cmdecho(getvar"cmdecho"))
(setq menuecho(getvar"menuecho"))
(setvar"cmdecho"0)(setvar"menuecho"1)
(PRINC"\nInspecting Drawing for Attribute Definitions...")
(SETQ SS (SSGET"X"'((0 . "ATTDEF"))))
(IF SS
(PROGN
(princ"\nConverting...Please Wait... [+++]")
(SETQ COUNT 0)
(setq ssl(sslength ss))
(princ(strcat"\nFound [" (itoa ssl) "] Attribute Definitions."))
(REPEAT ssl
(if (= 0 (rem count 2))
(princ"\rConverting...Please Wait... [---]")
(princ"\rConverting...Please Wait... [|||]")
)
(SETQ EN (SSNAME SS COUNT))
(redraw en 3)
(SETQ ED (ENTGET EN))
(SETQ LST
(LIST
(CONS 0 (CDR(ASSoc 0 ED)))(CONS 2 (CDR(ASSoc 2 ed)))
(CONS 8 (CDR(ASSoc 8 ed)))(CONS 10 (CDR(ASSoc 10 ed)))
(CONS 40 (CDR(ASSoc 40 ed)))(CONS 50 (CDR(ASSoc 50 ED)))
(CONS 41 (CDR(ASSoc 41 ed)))(CONS 51 (CDR(ASSoc 51 ed)))
(CONS 7 (CDR(ASSoc 7 ed)))(CONS 71 (CDR(ASSoc 71 ed)))
(CONS 72 (CDR(ASSoc 72 ED)))(CONS 11 (CDR(ASSoc 11 ed)))
(CONS 210 (CDR(ASSoc 210 ed)))(CONS 73 (CDR(ASSoc 73 ED)))
)
)
(SETQ LST(SUBST(CONS 0 "TEXT")(ASSOC 0 LST) LST))
(SETQ LST(SUBST(CONS 1 (CDR(ASSOC 2 ED)))(ASSOC 2 LST) LST))
(ENTDEL EN)
(ENTMAKE LST)
(SETQ COUNT (1+ COUNT))
)
(PRINC"\nAll Attribute Definitions Converted to Texts.")
)
(PRINC"\nNo Attribute Definitions Found.")
)
(setvar"cmdecho"cmdecho)(setvar"menuecho"menuecho)(princ)
(if atd2txt_olderr (setq *error* atd2txt_olderr))(PRINC) ;REStore old *error* handler
)(princ)
Taigi čia be lisp kodo neapsieisime.
Kodas konvertuoja daugybinius TEXT objektus į MTEXT objektus:
(princ"\nKodas konvertuoja daugybinius TEXT objektus į MTEXT objektus")
(DEFUN c:txt2mtxt (/ LST SS SSL EN ED COUNT cmdecho menuecho atd2txt_olderr atd2txt_err)
(defun txt2mtxt_err (s) ; If an error (such as CTRL-C) occurs
(if cmdecho(setvar"cmdecho"cmdecho))
(if menuecho(setvar"menuecho"menuecho))
(if (/= s "Function cancelled")
(princ (strcat "\nError: " s))
)
(if atd2txt_olderr (setq *error* atd2txt_olderr)) ; Restore old *error* handler
(princ)
)
(setq atd2txt_olderr *error* ; Save error routine
*error* atd2txt_err ; Substitute ours
)
(setq cmdecho(getvar"cmdecho"))
(setq menuecho(getvar"menuecho"))
(setvar"cmdecho"0)(setvar"menuecho"1)
(PRINC"\nInspecting Drawing for Attribute Definitions...")
(SETQ SS (SSGET"X"'((0 . "ATTDEF"))))
(IF SS
(PROGN
(princ"\nConverting...Please Wait... [+++]")
(SETQ COUNT 0)
(setq ssl(sslength ss))
(princ(strcat"\nFound [" (itoa ssl) "] Attribute Definitions."))
(REPEAT ssl
(if (= 0 (rem count 2))
(princ"\rConverting...Please Wait... [---]")
(princ"\rConverting...Please Wait... [|||]")
)
(SETQ EN (SSNAME SS COUNT))
(redraw en 3)
(SETQ ED (ENTGET EN))
(SETQ LST
(LIST
(CONS 0 (CDR(ASSoc 0 ED)))(CONS 2 (CDR(ASSoc 2 ed)))
(CONS 8 (CDR(ASSoc 8 ed)))(CONS 10 (CDR(ASSoc 10 ed)))
(CONS 40 (CDR(ASSoc 40 ed)))(CONS 50 (CDR(ASSoc 50 ED)))
(CONS 41 (CDR(ASSoc 41 ed)))(CONS 51 (CDR(ASSoc 51 ed)))
(CONS 7 (CDR(ASSoc 7 ed)))(CONS 71 (CDR(ASSoc 71 ed)))
(CONS 72 (CDR(ASSoc 72 ED)))(CONS 11 (CDR(ASSoc 11 ed)))
(CONS 210 (CDR(ASSoc 210 ed)))(CONS 73 (CDR(ASSoc 73 ED)))
)
)
(SETQ LST(SUBST(CONS 0 "TEXT")(ASSOC 0 LST) LST))
(SETQ LST(SUBST(CONS 1 (CDR(ASSOC 2 ED)))(ASSOC 2 LST) LST))
(ENTDEL EN)
(ENTMAKE LST)
(SETQ COUNT (1+ COUNT))
)
(PRINC"\nAll Attribute Definitions Converted to Texts.")
)
(PRINC"\nNo Attribute Definitions Found.")
)
(setvar"cmdecho"cmdecho)(setvar"menuecho"menuecho)(princ)
(if atd2txt_olderr (setq *error* atd2txt_olderr))(PRINC) ;REStore old *error* handler
)(princ)
Komentarų nėra:
Rašyti komentarą