JONTHEPOPE Posted November 11, 2008 Posted November 11, 2008 NOT SURE HOW TO RUN LISP C/W DCL ?? IT WONT RUN PROPERLY WITH OUT DCL ANY ONE KNOW WHY AND HOW TO FIX ?? WHERE SHOULD I PUT DCL AND LISP FILES ?? ;Tip1758a: DD_CHS.LSP Change Text Style (C)2001, Colin Mitchell (defun C:CHS (/ OLD_ERROR OLD_CMDECHO TEXTENTITIES DCL_ID TEXTSTYLE_LIST TS_LIST TABLE_CHECKER DO_IT_UP ENTITY_INDEX NEW_STYLE ) ;;;;;;; (defun ERERROR () (command ^C^C) (setq *ERROR* OLD_ERROR) (princ)) (setq OLD_ERROR *ERROR*) (setq *ERROR* ERERROR) ;;;;;;; (setq OLD_CMDECHO (getvar "cmdecho")) (setvar "cmdecho" 0) (princ "\nSelect text objects: ") (setq TEXTENTITIES (ssget (list (cons 0 "TEXT")))) (while (null TEXTENTITIES) (princ "\nPlease select some text.") (setq TEXTENTITIES (ssget (list (cons 0 "TEXT")))) ) ;end while (progn (if TEXTENTITIES (progn ;;;;;;; (if (not AI_UTILS) (load "ai_utils") ) ;_ end of if (setq DCL_ID (load_dialog "DD_chs.dcl")) (if (not (new_dialog "ChangeStyle" DCL_ID)) (alert "\nCannot load. Dialog file DD_CHS.DCL was not found." ) ;_ end of alert ) ;_ end of if (defun TEXTSTYLE_TABLE () (setq TEXTSTYLE_LIST (AI_TABLE "STYLE" 4)) (setq TS_LIST (itoa (length (AI_TABLE "STYLE" 4)))) ) ;_ end of defun (TEXTSTYLE_TABLE) (cond ((/= TS_LIST "0") (setq TEXTSTYLE_LIST (acad_strlsort TEXTSTYLE_LIST)) (start_list "textstyle_list") (mapcar 'add_list TEXTSTYLE_LIST) (end_list) ) ) ;_ end of cond (setq TABLE_CHECKER 0) (defun CHECK_IT () (if (= TABLE_CHECKER 0) (progn (setq DO_IT_UP 1) (set_tile "message" "Please select a text style.") ) ;_ end of progn ) ;_ end of if (if (= DO_IT_UP 0) (done_dialog 1) ) ;_ end of if ) ;_ end of defun (action_tile "accept" "(setq do_it_up 0)(check_it)") (action_tile "cancel" "(setq do_it_up 1)(done_dialog)") (action_tile "info" "(info)") (action_tile "how" "(how_to)") (action_tile "about" "(about)") (action_tile "textstyle_list" "(setq entity_index $value)(setq table_checker 1)" ) ;_ end of action_tile (setq EXECUTE_IT (start_dialog)) (unload_dialog DCL_ID) (if (= EXECUTE_IT 1) (progn (setq ENTITY_INDEX (read (strcat "(" ENTITY_INDEX ")"))) (foreach I ENTITY_INDEX (setq NEW_STYLE (nth I TEXTSTYLE_LIST)) ) ;_ end of foreach (progn (setq TELOOP 0) (setq TELENGTH (sslength TEXTENTITIES)) (repeat TELENGTH (setq TEENTITY (ssname TEXTENTITIES TELOOP)) (setq TEEVAL (entget TEENTITY)) (setq TEEVAL (subst (cons 7 NEW_STYLE) (assoc 7 TEEVAL) TEEVAL ) ;_ end of subst ) ;_ end of setq (entmod TEEVAL) (setq TELOOP (+ 1 TELOOP)) ) ;repeat (princ) (prompt (strcat "\nText style set to: " NEW_STYLE)) ) ; ) ; (princ "\nNo changes were made.") ) ;end execute_it ;;;;;;; ) ; ) ; ) ; (setq *ERROR* OLD_ERROR) (setvar "cmdecho" OLD_CMDECHO) (princ) ) ;_ end of defun ;;end of file Quote
CmdrDuh Posted November 11, 2008 Posted November 11, 2008 put both in a support file search path for autocad Quote
CmdrDuh Posted November 11, 2008 Posted November 11, 2008 put both in a support file for autocad Quote
JONTHEPOPE Posted November 13, 2008 Author Posted November 13, 2008 Im in support folder now how do i link button to dcl to lisp ??? the button is created already in a toolbar but when i use it it says _chs Unknown command "CHS". please explain more how to connect Quote
lpseifert Posted November 13, 2008 Posted November 13, 2008 Did you load the .lsp first? type this at the command line, then try CHS (load "DD_CHS") Quote
JONTHEPOPE Posted November 13, 2008 Author Posted November 13, 2008 //Tip1758b: DD_CHS.DCL Change Text Style (C)2001, Colin Mitchell dcl_settings : default_dcl_settings {audit_level=0;} ChangeStyle : dialog {label="Change Text Style"; spacer; :row { :column { :boxed_column {label="Available Text Styles:"; :list_box {key="textstyle_list"; width=35; fixed_width=true; height=10; fixed_height=true; allow_accept=true; multiple_select=false;} spacer; }//end boxed_column :text {key="message";edit_width=10;alignment=centered;} }//end column : column { :spacer {height = 0.125;} :button {label = "OK"; key = "accept"; is_default = true; fixed_width=true; width=11;} :button {label = "Cancel"; key = "cancel"; is_cancel = true; fixed_width=true; width=11;} :spacer {height = 10;} }//end column }//end row }//end of file Quote
JONTHEPOPE Posted November 13, 2008 Author Posted November 13, 2008 nicely done friends. yes yes yes . Quote
lpseifert Posted November 13, 2008 Posted November 13, 2008 The lisp 'calls' the DCL, you don't need to 'link' them. As stated before "put both in a support path for Autocad" Quote
JONTHEPOPE Posted November 14, 2008 Author Posted November 14, 2008 swell . the lisp calls it which part could i remove /add if i didnt want call to dcl ?? ;Tip1758a: DD_CHS.LSP Change Text Style (C)2001, Colin Mitchell (defun C:CHS (/[code] OLD_ERROR OLD_CMDECHO[/code] TEXTENTITIES DCL_ID TEXTSTYLE_LIST TS_LIST TABLE_CHECKER DO_IT_UP ENTITY_INDEX NEW_STYLE ) [code];;;;;;; (defun ERERROR () (command ^C^C) (setq *ERROR* OLD_ERROR) (princ)) (setq OLD_ERROR *ERROR*) (setq *ERROR* ERERROR) ;;;;;;;[/code] (setq OLD_CMDECHO (getvar "cmdecho")) (setvar "cmdecho" 0) (princ "\nSelect text objects: ") (setq TEXTENTITIES (ssget (list (cons 0 "TEXT")))) (while (null TEXTENTITIES) (princ "\nPlease select some text.") (setq TEXTENTITIES (ssget (list (cons 0 "TEXT")))) ) ;end while (progn (if TEXTENTITIES (progn ;;;;;;; (if (not AI_UTILS) (load "ai_utils") ) ;_ end of if (setq DCL_ID (load_dialog "DD_chs.dcl")) (if (not (new_dialog "ChangeStyle" DCL_ID)) (alert "\nCannot load. Dialog file DD_CHS.DCL was not found." ) ;_ end of alert ) ;_ end of if (defun TEXTSTYLE_TABLE () (setq TEXTSTYLE_LIST (AI_TABLE "STYLE" 4)) (setq TS_LIST (itoa (length (AI_TABLE "STYLE" 4)))) ) ;_ end of defun (TEXTSTYLE_TABLE) (cond ((/= TS_LIST "0") (setq TEXTSTYLE_LIST (acad_strlsort TEXTSTYLE_LIST)) (start_list "textstyle_list") (mapcar 'add_list TEXTSTYLE_LIST) (end_list) ) ) ;_ end of cond (setq TABLE_CHECKER 0) (defun CHECK_IT () (if (= TABLE_CHECKER 0) (progn (setq DO_IT_UP 1) (set_tile "message" "Please select a text style.") ) ;_ end of progn ) ;_ end of if (if (= DO_IT_UP 0) (done_dialog 1) ) ;_ end of if ) ;_ end of defun (action_tile "accept" "(setq do_it_up 0)(check_it)") (action_tile "cancel" "(setq do_it_up 1)(done_dialog)") (action_tile "info" "(info)") (action_tile "how" "(how_to)") (action_tile "about" "(about)") (action_tile "textstyle_list" "(setq entity_index $value)(setq table_checker 1)" ) ;_ end of action_tile (setq EXECUTE_IT (start_dialog)) (unload_dialog DCL_ID) (if (= EXECUTE_IT 1) (progn (setq ENTITY_INDEX (read (strcat "(" ENTITY_INDEX ")"))) (foreach I ENTITY_INDEX (setq NEW_STYLE (nth I TEXTSTYLE_LIST)) ) ;_ end of foreach (progn (setq TELOOP 0) (setq TELENGTH (sslength TEXTENTITIES)) (repeat TELENGTH (setq TEENTITY (ssname TEXTENTITIES TELOOP)) (setq TEEVAL (entget TEENTITY)) (setq TEEVAL (subst (cons 7 NEW_STYLE) (assoc 7 TEEVAL) TEEVAL ) ;_ end of subst ) ;_ end of setq (entmod TEEVAL) (setq TELOOP (+ 1 TELOOP)) ) ;repeat (princ) (prompt (strcat "\nText style set to: " NEW_STYLE)) ) ; ) ; (princ "\nNo changes were made.") ) ;end execute_it ;;;;;;; [code] ) ; ) ; ) ; (setq *ERROR* OLD_ERROR) (setvar "cmdecho" OLD_CMDECHO) (princ)[/code] ) ;_ end of defun ;;end of file Quote
JONTHEPOPE Posted November 14, 2008 Author Posted November 14, 2008 I found one similar at Jeffery P Sanders .com (CTS) but both dont allways work like i want i wanted to change text to standard ... it's out of date code i think ?? see attached Drawing1.dwg Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.