CAD2005 Posted February 21 Posted February 21 Hi everybody ! I found it on the forum. But when I use it, I get this error: bad argument type "iselsetp nil Please review and help me fix this error. thank you very much defun C:CHANGESTYLE (/ entities len count ent ent_data ent_name new_style_name) (command "STYLE" "iso" "isocp.shx" "" "" "" "" "") (setq entities (ssget "X" '((0 . "TEXT"))) len (sslength entities) count 0 );setq (while (< count len) (setq ent (ssname entities count) ent_data (entget ent) ent_name (cdr (assoc 7 ent_data)) );setq (setq new_style_name (cons 7 "iso")) (setq ent_data (subst new_style_name (assoc 7 ent_data) ent_data)) (entmod ent_data) (setq count (+ count 1)) );while ;;;runs same routine again, picking up Mtext this time. (setq entities (ssget "X" '((0 . "MTEXT"))) len (sslength entities) count 0 );setq (while (< count len) (setq ent (ssname entities count) ent_data (entget ent) ent_name (cdr (assoc 7 ent_data)) );setq (setq new_style_name (cons 7 "iso")) (setq ent_data (subst new_style_name (assoc 7 ent_data) ent_data)) (entmod ent_data) (setq count (+ count 1)) );while (princ) );defun Quote
GLAVCVS Posted February 21 Posted February 21 (edited) Hi I think there is either no TEXT or no MTEXT in your drawing That's why the code below can't work. I've edited your code with my smartphone to try to fix this. So I can't test it, but it should work (defun C:CHANGESTYLE (/ entities len count ent ent_data ent_name new_style_name) (command "STYLE" "iso" "isocp.shx" "" "" "" "" "") (if (setq entities (ssget "X" '((0 . "TEXT")))) (progn (setq len (sslength entities) count 0 );setq (while (< count len) (setq ent (ssname entities count) ent_data (entget ent) ent_name (cdr (assoc 7 ent_data)) );setq (setq new_style_name (cons 7 "iso")) (setq ent_data (subst new_style_name (assoc 7 ent_data) ent_data)) (entmod ent_data) (setq count (+ count 1)) );while ) ;progn );if ;;;runs same routine again, picking up Mtext this time. (if (setq entities (ssget "X" '((0 . "MTEXT")))) (progn (setq len (sslength entities) count 0 );setq (while (< count len) (setq ent (ssname entities count) ent_data (entget ent) ent_name (cdr (assoc 7 ent_data)) );setq (setq new_style_name (cons 7 "iso")) (setq ent_data (subst new_style_name (assoc 7 ent_data) ent_data)) (entmod ent_data) (setq count (+ count 1)) );while );progn );if (princ) );defun Edited February 21 by GLAVCVS Quote
Steven P Posted February 21 Posted February 21 So the error lselsetp is saying it is looking for a selection set (ssget) and didn't find one, often when you have asked it to say, select text but no text was selected - the selection set wasn't created. As above, it is good practice to check that a selection set has been found before you do anything with it Quote
Tharwat Posted February 21 Posted February 21 Here you go. (defun c:Test (/ int sel ent get) ;;--------------------------------------------;; ;; Author : Tharwat Al Choufi ;; ;; ;; ;; www.AutolispPrograms.WordPress.com ;; ;;--------------------------------------------;; (and (or (tblsearch "STYLE" "iso") (entmake '((0 . "STYLE") (100 . "AcDbSymbolTableRecord") (100 . "AcDbTextStyleTableRecord") (2 . "iso") (70 . 0) (40 . 0.0) (41 . 1.0) (50 . 0.0) (71 . 0) (42 . 100.) (3 . "isocp.shx") (4 . "") ) ) ) (or (setq int -1 sel (ssget "_X" '((0 . "TEXT,MTEXT")))) (alert "No texts found in this drawing.!") ) (while (setq int (1+ int) ent (ssname sel int)) (and (setq get (entget ent)) (entmod (subst '(7 . "iso") (assoc 7 get) get)) ) ) ) (princ) ) 1 Quote
CAD2005 Posted February 22 Author Posted February 22 Thank you @Tharwat! I Just want to change the selected font! Please help me ! Quote
Tharwat Posted Saturday at 08:54 AM Posted Saturday at 08:54 AM 5 hours ago, CAD2005 said: Thank you @Tharwat! I Just want to change the selected font! Please help me ! Now you are asking for another go. Quote
CAD2005 Posted Saturday at 04:03 PM Author Posted Saturday at 04:03 PM (edited) yes! please help@tharwat Edited Saturday at 04:06 PM by CAD2005 Quote
Steven P Posted Saturday at 09:07 PM Posted Saturday at 09:07 PM Change this line: (3 . "isocp.shx") To your preferred text. Should create the dimension style to suit. 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.