Keep object highlighted during command?

Keep object highlighted during command?

kenneth.smithV6QLC
Enthusiast Enthusiast
488 Views
3 Replies
Message 1 of 4

Keep object highlighted during command?

kenneth.smithV6QLC
Enthusiast
Enthusiast

I'm looking for a way to replace in this code the need for "chprop" just to highlight what the user selected. Like when you use the move or erase commands (for example) how the objects stay highlighted until the end of the command. This one I would like to see the same when the single-picked text is selected, it stay highlighted. Thanks in advance for any help.

(defun RTT1 (/ ent enttxt ent2 SourceText DestinText)
	(setq SourceText (entsel "\nSelect text to copy: "))
	(setq sColor (assoc 62 (entget (car	SourceText))))
		(command "chprop" SourceText "" "c" "yellow" "")
	(setq DestinText (entsel "\nSelect text to change: "))
	(setq ent (entget (car SourceText))
		enttxt (cdr (assoc 1 ent))
		ent2 (entget (car DestinText))
		ent2 (subst (cons 1 enttxt)(assoc 1 ent2) ent2)
	);setq ent
	(entmod ent2)
	(command "chprop" SourceText "" "c" "bylayer" "")
 (princ)
)

 

Please be kind, rewind your exploding. Do not explode hatching, dimensions or text. Think of your fellow drafters! 🙂

https://www.youracclaim.com/badges/9aa4a1d5-0d02-4888-be6f-ed8f0653d8ad/public_url
0 Likes
Accepted solutions (1)
489 Views
3 Replies
Replies (3)
Message 2 of 4

ВeekeeCZ
Consultant
Consultant
Accepted solution

Explore these methods.

1) (redraw en 3)
2) (sssetfirst nil ss)
3) (vlax-invoke-method obj 'Highlight :vlax-true)

Message 3 of 4

kenneth.smithV6QLC
Enthusiast
Enthusiast

The first option worked. Thank you tons. 

(defun RTT0 (/ ent enttxt ent2 SourceText DestinText sssetfirst)
	(setq SourceText (entsel "\nSelect text to copy: "))
		(redraw (car SourceText) 3)
	(setq DestinText (entsel "\nSelect text to change: "))
	(setq ent (entget (car SourceText))
		enttxt (cdr (assoc 1 ent))
		ent2 (entget (car DestinText))
		ent2 (subst (cons 1 enttxt)(assoc 1 ent2) ent2)
	);setq ent
	(entmod ent2)
	(redraw (car SourceText) 4)
 (princ)
)
Please be kind, rewind your exploding. Do not explode hatching, dimensions or text. Think of your fellow drafters! 🙂

https://www.youracclaim.com/badges/9aa4a1d5-0d02-4888-be6f-ed8f0653d8ad/public_url
Message 4 of 4

hak_vz
Advisor
Advisor

 

(defun highlite_ss_on (ss / i)
;highlites object stored in selection set ss
	(setq i -1)
	(if (= (type ss) 'PICKSET)
		(while (< (setq i (1+ i))(sslength ss))
			(vla-highlight (vlax-ename->vla-object (ssname ss i)) :vlax-true)
		)
	)
	(princ)
)

(defun highlite_ss_off (ss / i)
;removes highlited objects stores in selection set ss
	(setq i -1)
	(if (= (type ss) 'PICKSET)
		(while (< (setq i (1+ i))(sslength ss))
			(vla-highlight (vlax-ename->vla-object (ssname ss i)) :vlax-false)
		)
	)
	(princ)
)

This will put highlite on objects in selection set variable ss. From this variable concepts can be created.

 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.