Jump to content

Recommended Posts

Posted

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!!:)

Posted

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)
)

Posted
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. :)

Posted
That did it! Thank you so much. I tried every combination but that one. :)

You are welcome :).

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...