Cylis0509 Posted February 20, 2015 Posted February 20, 2015 I found a LISP that will merge textstyles into one. But as it is written now I must repeat the code for each text style. Is it possible to take this code and include additional text styles? Basically give a list and merge all to one style. (defun C:SM ( / CurEnt CurObj CurSet1 CurSet2) (vl-load-com) (command "-style" "Existing" "simplex" "" "" "" "no" "no" "no") (command "-style" "Proposed" "Gill Sans MT" "" "" "" "no" "no") (setq CurSet1 (ssget "_x" '((0 . "TEXT")(7 . "E100")))) (if CurSet1 (while (setq CurEnt (ssname CurSet1 0)) (setq CurObj (vlax-ename->vla-object CurEnt)) (ssdel CurEnt CurSet1) (vla-put-StyleName CurObj "Existing") (vla-Update CurObj) ) ) (princ) ) I know this doesn't work but something like: (defun C:SM ( / CurEnt CurObj CurSet1 CurSet2) (vl-load-com) (command "-style" "Existing" "simplex" "" "" "" "no" "no" "no") (command "-style" "Proposed" "Gill Sans MT" "" "" "" "no" "no") (setq CurSet1 (ssget "_x" '((0 . "TEXT")(7 . "E100, E120, E50, E60, ETC.")))) (if CurSet1 (while (setq CurEnt (ssname CurSet1 0)) (setq CurObj (vlax-ename->vla-object CurEnt)) (ssdel CurEnt CurSet1) (vla-put-StyleName CurObj "Existing") (vla-Update CurObj) ) ) (princ) ) Thank you in advance!! Quote
Ahankhah Posted February 21, 2015 Posted February 21, 2015 I didn't checked the process, just know that when defining a wcmatch list, space also is a character, so you must eliminate spaces in your filter-list, as follows: (defun C:SM ( / CurEnt CurObj CurSet1 CurSet2) (vl-load-com) (command "-style" "Existing" "simplex" "" "" "" "no" "no" "no") (command "-style" "Proposed" "Gill Sans MT" "" "" "" "no" "no") (setq CurSet1 (ssget "_x" '((0 . "TEXT")(7 . [b][color=magenta]"E100,E120,E50,E60"[/color][/b])))) (if CurSet1 (while (setq CurEnt (ssname CurSet1 0)) (setq CurObj (vlax-ename->vla-object CurEnt)) (ssdel CurEnt CurSet1) (vla-put-StyleName CurObj "Existing") (vla-Update CurObj) ) ) (princ) ) Quote
Cylis0509 Posted February 22, 2015 Author Posted February 22, 2015 I didn't checked the process, just know that when defining a wcmatch list, space also is a character, so you must eliminate spaces in your filter-list, as follows: (defun C:SM ( / CurEnt CurObj CurSet1 CurSet2) (vl-load-com) (command "-style" "Existing" "simplex" "" "" "" "no" "no" "no") (command "-style" "Proposed" "Gill Sans MT" "" "" "" "no" "no") (setq CurSet1 (ssget "_x" '((0 . "TEXT")(7 . [b][color=magenta]"E100,E120,E50,E60"[/color][/b])))) (if CurSet1 (while (setq CurEnt (ssname CurSet1 0)) (setq CurObj (vlax-ename->vla-object CurEnt)) (ssdel CurEnt CurSet1) (vla-put-StyleName CurObj "Existing") (vla-Update CurObj) ) ) (princ) ) That did it! Thank you so much. I tried every combination but that one. Quote
Ahankhah Posted February 24, 2015 Posted February 24, 2015 That did it! Thank you so much. I tried every combination but that one. You are welcome . 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.