Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Keep object highlighted during command?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
kenneth.smithV6QLC
316 Views, 3 Replies

Keep object highlighted during command?

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
Tags (2)
3 REPLIES 3
Message 2 of 4

Explore these methods.

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

Message 3 of 4

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
in reply to: kenneth.smithV6QLC

 

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report