Joshua Newman.

in 3D.

maxscript align tools.

While I was in Utrecht, Ken Pimental was asked what features we think should be added to Max. Someone asked for the ability to align an object to three points.

This script has been in my toolbox for a long time, so I’ve taken it out, polished it up, and partnered it with a friend. There are probably other scripts out there that will do this for you but I hope you will find mine intuitive and easy to use.

Ladies and gentlemen I give to you Align Tools

Download here

image icon for the algin to three points tool. 1. Align to three points

Pick your source objects, activate the tool and then click the three points. Max refuses to show the snap icon after the first click but it will snap correctly.

image icon for the algin to edge tool. 2. Align to an edge

Pick your target object, select and edge in the sub-object and the click the tool. Now either click your source object or right click to have a dummy created along that edge.


Download the mzp package and drop it into your max viewport.

customize | customize user interface

choose the JNScripts category and the two tools should be listed. Drag them onto a toolbar. You may need to re-start Max in order to get the icons to show correctly.

If I can think of any more then I will expand the toolbox. Requests welcomed.


  1. mohinder
    Posted July 23, 2009 at 9:32 pm | Permalink

    Could you explain how to install the script onc eI have downloaded the zip file? Thanks.

  2. Posted July 23, 2009 at 9:44 pm | Permalink

    Hi Mohinder,

    The zip file is a special mzp file design especially for 3ds Max. you can either:

    1 – drag the file and drop it onto your viewport
    2 – chose ‘run’from the Maxscript dropdown list

    Once this done, you then choose ‘customize | customize user interface’ from the drop down menus.

    Then you will find a field called ‘catergoy’, change this to ‘JN Scripts’.

    You will then see two tools listed called ‘Align to edge’ and ‘Align to three points’.

    With your mouse, drag these onto your toolbar one by one to create buttons for the tools.

    You may need to re-start Max in order to get the icons to show correctly.

    I hope this helps!

  3. Cristian
    Posted August 5, 2009 at 5:18 pm | Permalink

    First of all, thanks for sharing :)
    What I would like to see in max (max 9 and up) is a simple toolbar à la Illustrator or Photoshop, with a more simple behaviour (there’s an obvious difference between 2D and 3D tools, but I think it can be useful with a little tweaking to the options/behaviours):

    - If you have 2 or more objects selected, the tools became active.

    - Options (buttons):
    – Align Objects
    – Align Min / Horizontal Align center / Horizontal Max
    – Distribute objects
    – Distribute Min / Distribute center / Distribute Max
    – Distribute Spacing:
    – distribute space
    – Axis (X/Y/Z) used for align/distribute (one of them must be selected, so it can default to X).

    - Pressing the buttons align or distribute the objects accordingly. No more clicks needed.

    The logic is: instead of vertical/horizontal (2D), X/Y/Z axis (3D); instead of left/center/right (2D), min/center/max (3D). Min and Max options follows the same logic as some other tools in 3dsmax (minimum and maximum values in a given axis instead of left/right or top/bottom).

    If you can come up with something like that (well, and if you’re willing to), that would be supercool!

    Hope it would ignite some good scripting ideas ;)

  4. Posted August 5, 2009 at 5:33 pm | Permalink

    Hi Cristian,

    A good thought! I think Neil Blevins has a quick align tool as part of his soulburn scripts that may do some of what you’re asking. Check out his web page or on scriptspot.
    I do have a spacing tool somewhere around here that needs a little dusting but I will get it out and see if I can make it something useful


  5. Cristian
    Posted August 5, 2009 at 5:49 pm | Permalink

    Hey! that was quick! ;)
    Thanks for your kind response :)
    About Neil’s tools (an awesome lot) I think that there’s still too much “thinking” and clicking. Adobe’s tools are simple and economic: the buttons perform the task at the moment of being pressed. The only pre-requisite is having 2 or more objects selected. No extra clicking (ok, in illustrator actually there’s a different behaviour than photoshop’s: you can do an extra click to specify to wich object the others will be aligned… but that’s a special case; the general and more simple use is just a click away).


  6. Posted August 5, 2009 at 5:55 pm | Permalink

    ok, it’s a good idea so I’ll look into it!

  7. belly
    Posted October 16, 2009 at 6:33 pm | Permalink

    Hi Josh,

    I think I have a very good idea who this “someone” in Utrecht was who requested the three point align tool :-)

    Many thanks!

    see you again at the EUE in 2011?

    cheers mate


  8. Posted October 17, 2009 at 2:07 pm | Permalink

    Hi Belly!

    It is fast becoming popular. I’ll be in Utrecht again next year so hopefully I will see you there!


  9. belly
    Posted November 28, 2009 at 1:19 pm | Permalink

    Hi Josh,

    Last week, I tried to install your align tools with max design 2010 and win 7 pro 64 bit. It seems it is not installing them. Could it be that this is due to win 7?



  10. Posted November 28, 2009 at 1:45 pm | Permalink

    Hi belly,

    I use w7 on my laptop and it installs fine. What happens when you drop the mzp? does it open a report window?

    It’s no secret what is happening under the hood with installation. In the mazp (basically a zip file) there are bmp files and mcr files. The files are copied to these directories

    *.bmp to $uiIcons
    *.mcr to $macroscripts

    These locations should be the current ui folder and the current macroscript folders. You can look in there yourself and see if they’re copied. This location by default is under your user directory, for example:

    C:Users$MY USERNAMEAppDataLocalAutodesk3dsMaxDesign2010 – 32bitenuUIusermacros

    Let me know how it goes


  11. belly
    Posted December 9, 2009 at 3:41 pm | Permalink

    Hi Josh,

    after dropping the mpz file in MAX window, nothing happened and I didn’t receive any error message.
    I looked into the specific usermacroscript folder and it was empty.

    So I unpacked the MPZ and copied everything to the correct folders.
    Now it is working.



  12. Posted December 9, 2009 at 3:54 pm | Permalink

    Good job!

    Still, strange it should work. Did you try running it from the scirpt drop-down menu?


  13. belly
    Posted December 13, 2009 at 8:29 pm | Permalink

    Didn’t tried it.

    anyway, thanks


  14. wj
    Posted February 1, 2010 at 1:34 am | Permalink

    very good

  15. lunerjelly
    Posted December 4, 2010 at 6:02 am | Permalink

    Hi Joshua,

    I think if the script is modified as following the snap problem will be solved:

    tool alignto3points
    local startpos=#(), p1, p2, p3, obj,

    fn getnormal3pts p1 p2 p3=
    v3=normalize (p3-p1)
    v2=normalize (p2-p1)
    return normalize (cross v2 v3)

    fn planefrom3points aIn bIn cIn =
    Pre = matrixfromnormal (getnormal3pts aIn bIn cIn)
    Pre.pos = aIn

    a = aIn * (inverse Pre)
    b = bIn * (inverse Pre)
    c = cIn * (inverse Pre)

    va = b.x – a.x
    vb = b.y – a.y
    vc = c.x – a.x
    d = c.y – a.y

    ve = va*(a.x + b.x) + vb*(a.y + b.y)
    f = vc*(a.x + c.x) + d*(a.y + c.y)

    g = 2.0*(va*(c.y – b.y)-vb*(c.x – b.x))
    p.x = (d*ve – vb*f) / g
    p.y = (va*f – vc*ve) / g

    return ( [p.x, p.y, 0.0] * Pre )

    on start do
    if selection.count>0 do

    obj=(selection as array)
    for s in selection do append startpos s.transform
    p1=pickpoint snap:#3d
    if classof p1==point3 do p2=pickpoint snap:#3d rubberband:p1
    if classof p2==point3 do p3=pickpoint snap:#3d rubberband:p2
    if classof p3==point3 do if p1!=p2 and p1!=p3 and p2!=p3 do
    obj.transform=(matrixfromnormal(getnormal3pts p1 p2 p3))
    obj.pos=(planefrom3points p1 p2 p3)

  16. Posted December 22, 2010 at 5:51 pm | Permalink

    Hi Lumberjelly,

    Sorry it has taken me so long to approve your post I have been a little pre-occupied. Thanks for your comment. I tried your script and it does snap, but it doesn’t provide the real-time feedback that mine does on the third click, which I think is useful. I seem to remember when I was developing the script that my version snapped properly when not contained as a macro. I will hopefully update these scripts with some new align tools soon, and I will try to adapt the three point script to see if we can have the best of both worlds


  17. Aroo
    Posted February 3, 2011 at 6:11 am | Permalink

    When i tried to run the script I got this message:

    – Runtime error: Copy error on file: C: Program FilesAutodesk3ds Max 2010UIIconsJNAlign_3points_16abmp

    Thank you

  18. Aroo
    Posted February 3, 2011 at 6:15 am | Permalink

    Mhhh… may be it is because I am running 3ds max in a 64bit…?

  19. Posted February 3, 2011 at 8:15 am | Permalink

    Hello Aroo,

    The script works with both 32 and 64 bit versions of max, and should also work with any 20xx version (maybe even max9).

    I have seen this error on user profiles that do not have the rights to change the install directory of max, maybe your windows UAC is stopping installation or you don’t have enough user rights?


  20. Aroo
    Posted February 4, 2011 at 8:06 pm | Permalink


    Thank you for your quick response, I finally fixed this error, what I did was to right click on the 3ds Max folder, go to ‘Properties’ and then in the ‘security’ tab created a new Group (or User name) called ‘Everyone’ !!! of course selecting all the permissions for this new group… this time had to restart Max and run the script then… voilà!

    thank you again!

  21. Posted November 3, 2011 at 4:21 am | Permalink

    Hi Josh,
    I have installed your align tools thanks to Aroo’s discovery.
    I had the same Runtime error problem on Windows 7 32 bit and the solution was the same as in his case – Max folder permissions.

    Next, I have tried to align the polygonal cylinder and the edge of the polygonal box. Dummy was created and was aligned to the box edge but the cylinder stayed where it was.

    Is this the end result? What can be done next to get the cylinder aligned.

    I was looking for the script allowing to align two objects – edge to edge, face to face eliminate rotations present in one of these objects.

    Alternatively, I was looking for the script allowing to align objects with the WCS axes.

    I will be grateful for comments,
    Thank you,

  22. Posted November 3, 2011 at 8:36 am | Permalink

    Hi Matt,

    First of all thanks for trying the script, and thanks for posting some feedback. I will investigate a way around the older permissions issue to see if there is a way to stop this happening.

    Now, onto your question. There are two modes of operation for the “Align to edge” tool, here is how:

    Select a sub-object edge, execute the script, then either pick an object to align to the edge OR right click to finish the tool and create a dummy on the edge.

    Of course, once you have the dummy you could use the 3DsMax align tool to align whatever you like to it. I often use a dummy as a pick object for the user co-ordinate sytem when things are not aligned to the world.

    Did you know that 3DsMax already has a normal align tool? This will allow you to align one objects face to anothers. Look on the align rollout (Hold the mouse button down on the align tool icon).


  23. Posted November 3, 2011 at 3:00 pm | Permalink

    Hi Josh,
    I cannot get the end result I was looking for. The cylinder moves to different edges of the box but maintains its rotations. I am trying to get rid of these rotations by forcing the cylinder axis of symmetry to follow the direction of one of the box edges. Box sits on the grid and its edges follow the direction of the WCS axes exactly.

    I feel that the problem can be better described as: how to force the cylinder axis of rotation that is currently located somewhere in 3D space to follow one of the WCS axis.


  24. Posted November 3, 2011 at 3:49 pm | Permalink

    The Align to edge tool works but only if cylinder does not have any rotations w/r to the WCS. When these rotations are present and your tool is used, the cylinder center moves close to the selected box edge but nothing is aligned.

    I have rotated the cylinder 45 degrees about X and Z using typed in rotations, used your tool and tried to rotate the cylinder back ( rot.X -45 degrees and rot.Z – 45 degrees. The effect: cylinder did not go back to 0/0/0 rotations, its center is not on the box edge and some, unknown rotations are still present.


  25. Posted November 3, 2011 at 3:56 pm | Permalink

    Hi Matt,

    OK if I understand you correctly, the pivot of the cylinder in not alinged correctly. All the script is doing is aligning the object pivot Z axis to the edge. So if your objects pivot is mis-aligned then you need to fix it first. This is how I do it (and my reason for writing this script in the first place!).

    1 – Select an edge that you want to be the Z-axis in the sub-object of the cylinder (copy it and collapse it if neccessary)
    2 – Run the script and right click to make a dummy.
    3 – Open “Affect Pivot Only” on the Heirarchy command panel.
    4 – Use the align tool (Alt+A) and align the orientation of the pivots axis to match the dummy.

    Your cylinders pivot will now match what you want, or you can continue to snap rotate it to suit. Now you will be able to align the cylinder to whatever edge you like.


Post a Comment

You must be logged in to post a comment.