루비 왕초보 질문[도와주세요]
조회수 369회
This one-liner pasted into the Ruby Console +[enter] might work.
t=inputbox(['Find Text: '],[''],'');if(t);m=Sketchup.active_model;s=m.selection;s.clear;m.active_entities.grep(Sketchup::Text).select{|e|e.text=~/#{t[0]}/}.each{|e|s.add(e)};Sketchup.send_action('viewZoomToSelection:');end
In the dialog type the search string.
It uses regex matching so a few tips… It’s case-sensitive so use [Cc]at to find both matches [Cat, catalog]. Use [CcMm]at to find word matches [Cat, cat, Mat, mat, material]. Or M[ae]t etc fro [Material, Metal]… Note that you’ll need to escape ‘slashes’ as \ and \/ - and also place some characters inside [] - like , $ . and so on… otherwise a sting like 1.2 will match several possibilities, like 1.2, 122, 1a2 etc, but 1[.]2 will match only 1.2 To find all text starting with a lower-case letter use a-z [cat, mat, hat], to find all text ending with say ‘cm’ use cm$ [min. 12cm, 34cm, max. 39cm] etc…
All Text in the current active context is searched for a match. Any matching Text entities are highlighted. The Zoom is set to that Selection…
루비 코드질문해서 받은 답변인데
샘이 저기 코드 안에 #은 왜 넣은 걸까요?
이해가 안됩니다
-
(•́ ✖ •̀)
알 수 없는 사용자
댓글 입력