Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Snapping geometry/components to curves

Snapping geometry/components to curves

gallapoo
Participant Participant
1,611 Views
8 Replies
Message 1 of 9

Snapping geometry/components to curves

gallapoo
Participant
Participant

So snapping to curve with middle mouse allows you to slide objects and components alone the edge of a poly surface but it doesn't let you align things that way.  What I mean is I can get one object to align to another's edge generally but it's inaccurate.  Maybe some pictures can help explain.

 

So I have two objects and I want to align the smaller one to the larger one's surface.

I can just do it by eye but that takes a while.  As I said above I can slide the geometry along the top edge with middle mouse and C and get something like the following (exaggerated to show what I mean).

I was wondering if there was a way I could get the vertex to snap to the edge directly above it to keep the orientation the same?

0 Likes
1,612 Views
8 Replies
Replies (8)
Message 2 of 9

mcw0
Advisor
Advisor

Are you always going to have the edge of one object parallel to the edge you want to snap to?  Or was that just a happy coincidence?  🙂 

 

Maya has nothing out of the box to do this.  You could write your own tool.  You'd have to calculate the orientation of both edges and then snap one to the other.  To do this manually, you could motionpath a locator to each edge with follow checked.  Then delete the motionpaths and parent one object under it's locator.  Then parent constrain that locator to the other locator.  Now you should have the result you want.  Now unparent the mesh from the locator and delete the locators.  If that is indeed a process that you will do multiple times, then you can script that into a button.  Just select the 2 edges and click.

0 Likes
Message 3 of 9

jacktoler1
Contributor
Contributor

Sorry if I am misunderstanding the situation, if I understand correctly then I believe the main way I would try to solve the situation is with Booleans, specifically by using the difference Boolean. It is a bit hard to describe and I'm not entirely sure which method I thought up would be useful for your project (if any) but I made a video where I tried to get that sort of effect by either:

 

A. cutting the smaller object so that it fit on the larger object perfectly (or I believe perfectly)

B. Duplicating both objects, moving them, then after using a difference Boolean on one object (I chose the larger object) I would move the remaining object back to the exact position of the original object, and use the vertices on the Boolean-ified object to perfectly line up the edges on the two original objects.

 

If I misunderstood the question or this does not help for any reason please let me know and I will see if I can think of something better.

0 Likes
Message 4 of 9

jacktoler1
Contributor
Contributor
To clarify just in case, since I didn't really explain it, I held V to snap objects to certain vertices and I used D+V to change the objects pivot point to be over a vertex. And rather than using V and the middle mouse button, at one point I use V and a specific arrow/axis so that it only affects the object in that direction. If you don't want to change the pivot of the object you are moving you can always just put it into a group, change the groups pivot, then remove the object from the group when everything is done.
0 Likes
Message 5 of 9

gallapoo
Participant
Participant

So that's how I;d normally use it yes.  What I'd like it for a similar functionality where the component I've selected snaps to the nearest curve instead of sliding along it.  So similar to the holding V thing, I'd hold C (currently slides along edges etc) and a axis on the gismo and it would snap directly up to the point that plane intersects the curve/edge. So in my pictures it would look more like the top one but perfectly snapped.

0 Likes
Message 6 of 9

jacktoler1
Contributor
Contributor

That definitely would be a whole lot easier than anything I did, but the second idea is the only one I can think of that you can use a normal "snap" movement with and where you can keep complete control of where they will connect. I just did a bit of googling though, and what do you think of the "snap together tool?"

 

modify -> snap together tool

 

The only issue is that the faces need to line up perfectly, I'll show this in one of the videos.

0 Likes
Message 7 of 9

jacktoler1
Contributor
Contributor

It is also still relative easy to change the objects position with the snap together tool though, like I'm doing here.

Message 8 of 9

mcw0
Advisor
Advisor

There are numerous utility nodes that might get you what you want.  Such as nearestPointOnCurve, nearestPointOnMesh or closestPointOnMesh.  Check them out.

 

Now if you want to specify a direction vector, then you'll have to script it.

0 Likes
Message 9 of 9

gallapoo
Participant
Participant

Yeah it sounds like I'm going to have to script this if it's something I want.  I've kinda found a cheat with editing the pivot and setting it to a nearby face or something to 'align' it so snapping works better.  What I'm talking about is going over in this page at the top.

https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2018/ENU/Maya-Bas...

0 Likes