How to get the root Model in the scene?

btw, to esily detect if a ComponentDefinition is open for editing you can do this test

def inside_component?(definition)
  path = (Sketchup.active_model.active_path || [])# This method should in my view return an empty Array, not nil, when the model root is the active context.
  instance = path.last

  instance && instance.definition == definition
end
3 Likes