View Full Version : How To Automated Snap Together Tool Script

08 August 2007, 07:55 PM
as shown in image;I need to select nearest face of polygon and snap to other object
snap together tool works as how I want.

but how can I automate via mel that operation
I know nearest face have to be selected and snaptogether tool will be exeuted.

I want just select two objects and they will snap same as gif picture shows .

maybe multiple objects and a surface to be snap together operation via mel
because its hard to focus-find bottom face-select other nearest object face point manually.
I want to automate that via mel...I think I will do.
but any help will be appricated and shorten develop time lost.

any clue ?

thanks before, for helps.

08 August 2007, 08:49 PM
In mel - can we attempt this ? ( i m not sure if its possible or not )

Lets assume that you have written a mel script which does the job of moving the object based on the source position & target position, now you need maya to automatically check if there is a particular 'event' and do something so that we can see snap happenning. Example of one such even related to our need is : snapModeChanged event - If you setup a script job which sources your script and immediately shows both geometries in component mode & computes the source and destination points based on the selection - then moves the transform node and also puts the component mode to off after the snap is done, it will do.

So if the someone wants to move an object(trs) to another position - he will press c or x so that the event calls the function and we see things immediately in component mode and the minute i release the key, the object gets snapped based on your function's calculation.

By this we avoid hitting a button or a menu item or a shortcut hotkey press, otherwise its the same. If this is set to a permanent scriptJob then we need to consider the performance of maya too, as u know scriptJob's constantly check and fire stuff based on event and we can't do anyother process intensive stuff properly until its killed ;) ( not a correct statement in most cases ) .

If you were to write using maya api, u can create a manipulator (examples in devkit) and see if we can get the same thing done without having to switch to component mode.

reg, sriram

CGTalk Moderation
08 August 2007, 08:49 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.