Jump to content

ssget and change text properties


leonucadomi

Recommended Posts

hello :

 

I have an mtext group

 

I want to make a selection (with ssget "x") of the texts color blue and 150

 

and change their height , color and layer

 

the text height i need is 6 and layer name is DOLWIN6_EL_TEXT, new color bylayer.

 

can anybody help me?

 

thanks

Link to comment
Share on other sites

Sure.

 

Command SCTP (your title abbreviated.  Feel free to change this)

 


(defun c:sctp ( / ss i ent)
	;; I want to make a selection (with ssget "x") of the texts color blue and 150
	;; (cons 62) is the color.  5 is blue; 150 is light blue
	;; let's do sctp twice, once for blue, once for light blue
	(sctp 5)
	(sctp 150)
)

(defun sctp ( color / ss i ent)
	(setq ss (ssget "_X" (list (cons 0 "TEXT,MTEXT") (cons 62 color))))  
	;; change their height = (cons 40), color = (cons 62) and layer = (cons 8)
	;; loop over all the selected Text/MText objects
	(setq i 0)
	(if ss
		(repeat (sslength ss)
			(setq ent (ssname ss i))
			;; modifying objects with entmod.
			;; substitute groups with (subst new_group old_group entget_list)
			(entmod (subst 
					(cons 62 256)  			;; 256 sets the color to ByLayer
					(assoc 62 (entget ent))	;; the current color
					(entget ent)
			))
			(entmod (subst
					(cons 40 6.0)  			;; text height
					(assoc 40 (entget ent))
					(entget ent)
			))
			(entmod (subst
					(cons 8 "DOLWIN6_EL_TEXT")  			;; layer
					(assoc 8 (entget ent))
					(entget ent)
			))
			(setq i (+ i 1))
		)
	)
)

 

Link to comment
Share on other sites

1 hour ago, leonucadomi said:

the function entsel  can be used as a selection window?

No it single item selection only.

Link to comment
Share on other sites

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