Component search, select and zoom. Howto?
-
Hi all,
I started looking for Ruby examples on menu driven searching for components (with filters),
then zooming to the selected component - pretty much like a scene selection.Failed big time...
I don't expect any replies to this message, but thought I'd throw it out there as an idea.
Any thoughts fine SK people?
-
@philbx1 said:
Hi all,
I started looking for Ruby examples on menu driven searching for components (with filters),
then zooming to the selected component - pretty much like a scene selection.Failed big time...
I don't expect any replies to this message, but thought I'd throw it out there as an idea.
Any thoughts fine SK people?
Here's a start
mod = Sketchup.active_model ent = mod.active_entities sel = mod.selection vue = mod.active_view cmp_names = mod.definitions.map{|cd|cd.name} ctf = UI.inputbox(["Find;"],[cmp_names[0]],[cmp_names.join("|")],"Find Component Instances") if ctf mod.definitions[ctf[0]].instances.each{|ci| vue.zoom ci; break if UI.messagebox("Keep Searching?",MB_YESNO) == 7 } end
-
@sdmitch said:
Here's a start
Hi Sam (sdmitch)
I notice you use some sort of dialog or tool bar to execute the selected code from a dropdown. May I know its name and availability?
Thanks
Philip (pcmoor) -
Hey sdmitch,
Thanks much for the reply. much appreciated.
This will give me a good start as after looking at the SU Ruby API
docs left me fairly confused.Similar to what pcmoor has stated, I now also need to find examples of menus etc.
Hey, very nice web page BTW
Cheers,
Phil.@sdmitch said:
Here's a start
mod = Sketchup.active_model > ent = mod.active_entities > sel = mod.selection > vue = mod.active_view > cmp_names = mod.definitions.map{|cd|cd.name} > ctf = UI.inputbox(["Find;"],[cmp_names[0]],[cmp_names.join("|")],"Find Component Instances") > if ctf > mod.definitions[ctf[0]].instances.each{|ci| > vue.zoom ci; > break if UI.messagebox("Keep Searching?",MB_YESNO) == 7 > } > end >
-
Hey Sam,
Just looking through your nice plugins and thought I'd get the main SDM Tools required dependancy plugin to check them out.
Well, I failed again as I can't seem to locate the 'main' plugin as yet.
Maybe I'm not looking hard enough...
Thanks again,
Phil B. -
@pcmoor said:
@sdmitch said:
Here's a start
Hi Sam (sdmitch)
I notice you use some sort of dialog or tool bar to execute the selected code from a dropdown. May I know its name and availability?
Thanks
Philip (pcmoor)The tool bar is Ruby Web Console, the original of several currently available, by Jim Foltz. It allows you to type in code snippets and execute them in the model. The code I posted was created and tested in this manner.
Advertisement