- Messages
- 6,525
- Country

In sketchup, objects are not ordinarily centered. There are some tools to align the object to the Origin point ( 0,0,0 )... but those tools align to vertical center of the object instead of the center of the base of the object.
Here's a simple ruby plugin that will move an object, component or group to the Origin, but keeps the base flat to the ground.
Dick
Here's a simple ruby plugin that will move an object, component or group to the Origin, but keeps the base flat to the ground.
Code:
require 'sketchup.rb'
def center_group_bottom
my_model = Sketchup.active_model
my_selection = my_model.selection
my_component = my_selection[0]
if my_selection.length == 1
if my_component.typename == "Group" || my_component.typename == "ComponentInstance"
bb = my_component.bounds
cpoint = bb.center
lowpoint = bb.corner(0)
cpoint.z = lowpoint.z
vector = cpoint.vector_to [0,0,0]
t = Geom::Transformation.translation vector
my_component.transform! t
else
UI.messagebox "Select a single group or component"
end
else
UI.messagebox "Select a single group or component"
end
end
if( !$MyAddonLoaded )
UI.menu("Plugins").add_item("Center Group Bottom") { center_group_bottom }
MyAddonLoaded = true
end
Dick









