UI.add_context_menu_handler do |menu|
sel = Sketchup.active_model.selection
if sel.nitems == 1
if sel[0].is_a? Sketchup::Group or sel[0].is_a? Sketchup::ComponentInstance
menu.add_item("Reset Transformation") { sel[0].transformation = IDENTITY }
menu.add_item("Move to Origin") {
tr = sel[0].transformation.to_a
tr[12] = 0
tr[13] = 0
tr[14] = 0
sel[0].transformation = tr
}
end
end
end
Seems to be working fine now.
ReplyDeleteThe highlighter is a nice addition.