Making only the text visible on the screen into mext

Making only the text visible on the screen into mext

k005
Advisor Advisor
362 Views
3 Replies
Message 1 of 4

Making only the text visible on the screen into mext

k005
Advisor
Advisor

Hello friends;


Can we convert text objects visible on an object approached with Zoom Window to mtext without selecting them?

 

*That is, to make mtext only the texts that appear in the zoomed (or zoomed) part... without selecting them...


Thanks.

0 Likes
Accepted solutions (1)
363 Views
3 Replies
Replies (3)
Message 2 of 4

Kent1Cooper
Consultant
Consultant

A routine could work with the VIEWCTR and VIEWSIZE System Variables to determine the top- and bottom-edge Y coordinates of the current view.  I'm not aware of a way to determine its left- and right-edge X coordinates, to be able to define a selection window, but maybe someone knows....

Kent Cooper, AIA
Message 3 of 4

komondormrex
Mentor
Mentor
Accepted solution

hello there,

check this out

(defun c:visible_text_mtext (/ screen_height screen_size_list view_center aspect_ratio actual_screen_size_list actual_screen_llc_urc_list text_sset)
	(setq screen_height (getvar 'viewsize)
	      screen_size_list (getvar 'screensize)
	      view_center (getvar 'viewctr)
	      aspect_ratio (apply '/ screen_size_list)
	      actual_screen_size_list (list (* aspect_ratio screen_height) screen_height)
	      actual_screen_llc_urc_list (list (mapcar '- view_center (mapcar '* '(0.5 0.5) actual_screen_size_list))
					       (mapcar '+ view_center (mapcar '* '(0.5 0.5) actual_screen_size_list))
					 )
	)
	(if (setq text_sset (ssget "_w" (car actual_screen_llc_urc_list) (cadr actual_screen_llc_urc_list) '((0 . "text"))))
		(progn
		  	(setvar 'cmdecho 0)
		  	(foreach text (vl-remove-if 'listp (mapcar 'cadr (ssnamex text_sset)))
			  	(command "_txt2mtxt" text "")
			)
		  	(setvar 'cmdecho 1)
		  	(princ (strcat "\nTexts converted to mtexts: " (itoa (sslength text_sset)))) 
	  	)
	  	(princ "\nNo visible texts found")
	)
	(princ)
)
Message 4 of 4

k005
Advisor
Advisor

@komondormrex 

 

Yes. It worked. Thank you very much. In one word Super! 🤗

0 Likes