MoI discussion forum
MoI discussion forum

Full Version: 3-Point-Align Script

From: RayCAD1962 (RAYCAD003)
21 May 2018   [#1]
There is a script that allows you to precisely align an object by aligning three points on the object to any another three points in space.

I have create the 3D ball with 3D Moi v4 May beta and I took a lot of time to Align it with the Transform / Orient command.

Thank you for your help and time. If there is, I can make my work more easy.

Ray

Image Attachments:
3-Point-Align.jpg 


From: amur (STEFAN)
21 May 2018   [#2]
Hi Ray,

i don't know how long it took you to create the football and i can not
help with a script, but thought of the following procedure:

1. Import a truncated icosahedron with the .obj import script,
shell the solid.

2. Select all the edges, copy/paste and then loft those copied
edges individually, so that you get a "cutter" object for a
sphere.

3. Place a shelled sphere inside the cutter objects and cut
the shelled sphere with the cutter objects.

4. The result should be individual solids, forming the football.

Bildschirmfoto_2018-05-21_um_16.46.32

Regards
Stefan
From: RayCAD1962 (RAYCAD003)
21 May 2018   [#3] In reply to [#2]
Hi Stefan,
Thanks for your useful help that you gave me. The ball took me around half an hour and I learn a lot from it. Your idea is good but I prefer to use 3D Moi commands for this exercise and I've done it. I found a good video that make me eager to do it. The only I ask for a script because I believe that someone who programming Moi knows how to do this script and I hope to have more functions incorporate to the new 3D Moi v4 to improve the abilities of it. These commands are important to be there for the artist and designers and users like me.

Thanks anyway.

regards

Ray
From: Michael Gibson
21 May 2018   [#4] In reply to [#1]
Hi Ray, you can do a 3 point align with the Transform > Orient command, the first point is done by the origin placement and the 2nd and 3rd points are done by clicking and dragging on the x or y axis lines and releasing them on your target points.

If you can post the 3DM model file that you show in your screenshot I can make a demo for you of how that works.

- Michael
From: RayCAD1962 (RAYCAD003)
21 May 2018   [#5] In reply to [#4]
Hi Michael,

Thanks for your help that you always gave us. I am sending you the file of 3D ball and I like to show me how please.

I am so pleased with the 3D Moi Beta v4 of May. I feel the changes and the environment of it and more easy to manipulate the commands but sometimes still need help to understand.

Thanks again for your help

Ray

Attachments:
3D Ball.3dm


From: Michael Gibson
21 May 2018   [#6] In reply to [#5]
Hi Ray, it looks like the black piece is of a slightly different size than the spot you're trying to put it so it's not going to be an exact fit there.

I used this script to get the length of a selected edge:
script:moi.ui.alert( moi.geometryDatabase.getSelectedObjects().getCurves()[0].getLength() );





I thinking building a more complete wire framework like Stefan was showing above is probably better.

But anyway the way you can do a 3 point align currently works like this - you select the object that you're moving then run Transform > Orient. Place the origin point of the orientation picker onto your first known point.

Now comes the part that's a bit tricky - the way the orientation picker works is that one of the 3 axes has a dot over it, that one is the "primary axis" and if you drag it, it can be freely moved to point in any direction. The other 2 axes are restricted when you drag them to only pivot around the primary axis. You can set the primary axis by clicking on one of the axis lines without dragging it.

So the next step is to place the x axis pointing at your second point. Click on it once to set it as the primary axis and then drag on it and release over your 2nd point.

Then drag the y axis and release it over your 3rd point.

I'll try to make a video of this for you in a bit.

Since it's a little complicated I've been meaning to make a "3 points" option in the orientation picker as well.

- Michael

Image Attachments:
ray_align1.jpg  ray_align2.jpg 


From: Michael Gibson
21 May 2018   [#7] In reply to [#5]
Hi Ray - so here's the way to do a 3 point align.

1 - Place origin point at your first reference point.

2 - Click (click and release the mouse, not drag) on the orientation picker's x axis line. It is now the primary axis which can be oriented in any direction.

3 - Drag on the x axis line and release it on your second reference point.

4 - Drag on the y axis line and release it on your third reference point.



- Michael
From: RayCAD1962 (RAYCAD003)
21 May 2018   [#8] In reply to [#7]
Hi Michael,

I follow your instructions video and I made the 3D Ball with your help. I am so happy that I made it. I just take 5 minutes to do it.

Yes, the first file that I sent you was mislead measures but I correct them. The one that I send you is correct and good measures.

Thank you for your help and support.

regards,

Ray

Attachments:
3D Done Ball.3dm


From: Michael Gibson
21 May 2018   [#9] In reply to [#8]
You're welcome Ray, I'm glad that worked for you!

- Michael