In the SketchUp UI, the Model Info settings allow for fading the rest of the model when editing a group or component.
Only the entities at the current group hierarchy level are the active_entities…
I don’t see any way to simulate this in a custom tool: A user already must be inside a single group and at a particular level of its group hierarchy, before activating a tool. And so I can’t use onLButtonDoubleClick allow the user to to traverse the group hierarchy within a tool and trigger fading behavior…
Am I correct?
You can close instances but not open them from the API
.
it’s frowned upon, but you can send key codes or clicks from ruby…
for mac’s i have one compiled utility called cliclick
def edit_comp
cliclick = File.join(File.dirname(__dir__), 'bin', 'cliclick')
%x["#{cliclick}" kd:shift t:C ku:shift]
end
def edit_grp
cliclick = File.join(File.dirname(__dir__), 'bin', 'cliclick')
%x["#{cliclick}" kd:shift t:G ku:shift]
end
on Windoze you can use system or Win32 calls I believe…
you also need to check shortcuts match…
john
On Windows, from Ruby, it is easiest to use WIN32OLE class and the Windows Scripting Host object and it’s SendKeys method.
To enter a selected object’s editing context use the ENTER key. So clear the selection, then put one group or component object into the set, then send an ENTER.
But if the main modeling viewport does not have focus, the ENTER might get lost (processed by one of the app’s child windows,) so we test at the end of the method …
if (Sketchup.platform == :platform_win rescue RUBY_PLATFORM !~ /darwin/)
require 'win32ole' # load from standard library (SketchUp 2014+)
UTIL = WIN32OLE::new(WScript.Shell)
def edit_comp(comp)
return false unless comp.respond_to?(:definition)
return false if comp.definition.image? # bailout
return unless step_back_to(comp)
sel = Sketchup.active_model.selection
sel.clear
sel.add(comp)
# perhaps a pause here? sleep(0.3)
UTIL.SendKeys('{ENTER}')
# Test the active entities and return boolean result for method:
Sketchup.active_model.active_entities == comp.definition.entities
end
else # Mac
UTIL = File.join(File.dirname(__dir__), 'bin', 'cliclick')
def edit_comp(comp)
return false unless comp.respond_to?(:definition)
return false if comp.definition.image? # bailout
return unless step_back_to(comp)
return nil unless File.exist?(UTIL)
sel = Sketchup.active_model.selection
sel.clear
sel.add(comp)
# perhaps a pause here? sleep(0.3)
if comp.definition.group?
%x["#{UTIL}" kd:shift t:G ku:shift]
else # it's a component
%x["#{UTIL}" kd:shift t:C ku:shift]
end
# Test the active entities and return boolean result for method:
Sketchup.active_model.active_entities == comp.definition.entities
end
end
end
…
def step_back_to(comp)
# ensure the active context contains comp
model = Sketchup.active_model
active = active_entities
if active.grep(comp.class).include?(comp)
return true
elsif model.entities == active
return false
else
until model.entities == active ||
active.grep(comp.class).include?(comp)
model.close_active
active = model.active_entities
end
active.grep(comp.class).include?(comp)
end
end
The related problem is that I don’t see a way to change the fade/hide settings from the API(?)

In some circumstances, where groups abut or overlap, I want to switch from fade to hide so user can see what he is doing.
Sketchup.active_model.rendering_options["InactiveFade"] = 0.35
Sketchup.active_model.rendering_options["InactiveHidden"] = true
Sketchup.active_model.rendering_options["InstanceFade"] = 0.25
Sketchup.active_model.rendering_options["InstanceHidden"] = true
these?
john