Align along an axis

I have a fence line that is at 45degrees to the green axis and I have multiple objects on that plane and I now want to align all of them to the fence by moving them along the red axis until they touch the line. Is there a script or plug in that will do this?

Its a simplified variation on the optimum packing problem.

It would help if you share the .skp file so we can see what you are trying to do. There’s probably a simple way to do it.

What version of SketchUp are you really using? Your profile says 2018 Make but there has never been a SketchUp 2018 Make.

Hello, there are a few align plugins available such as fredo6’s Mam or curic align but I’m not sure they would allow aligning to an edge and I don’t have my computer to try it out. Maybe curic align would do if you first change your axes according to your line

There’s a way that I think would work, although tricky.
You’ll need the dropGC plugin (free)

And now comes the tricky part : turn your 45° line into a vertical plane (tall enough and deep enough to cover up all the items it needs to ‘catch’) select everything and rotate 90 degrees locking the rotate tool onto green. (Anticlockwise if with the same point of view than your screenshot) Then select all groups or components you want to align and use the dropgc plugin.
Rotate everything back 90 degrees.

Perhaps someone will think of another plugin that would do it with more ease - without having to rotate the whole thing - but that’s all I’m thinking of right now


Thanks, I’ve corrected my profile, Pro plan 2023 win 11

here’s the skp file.

Align Objects to line.skp (463.6 KB)

thanks John


dropGC does give the sort of behaviour i’m after but it would be so much better if i didn’t need to change the axis. I would also prefer to use a 2d line as opposed to a plane.

If this can’t be done then your idea migh be my best option.



It’s possible but I don’t think it’s worth it. It is too infrequent to make a script.

For me it would be a key function to automate this as I have to do it manually in every Sketchup project I create.

Would it be a complicated script? I’m failry proficient coder on other platforms but never Ruby. I know it can be hard to quantify but I could try to do it myself or commission someone to do it for me, just trying to get a feel for the effort involved.

Throw To by Tak2hata
GIF 12-09-2023 9-09-50 PM


This guy throws.

This code seems to work. (If there’s nothing between the line and groups or components)

#moves each group or component instance in selection
#to the closest point in red axis direction
module Rtches
module RayTest
  model = Sketchup.active_model
  model.start_operation('Movement', true)
  sel = model.selection
  sel.each do |s|
    if s.respond_to? (:definition) 
      point = s.bounds.corner(0)
      ray = [point,, 0, 0)]
      item = model.raytest(ray, false)
      new_transformation =[0])
      s.transformation = new_transformation


1 Like