ScriptSpot home

Forum topic · Scripts Wanted

Mirror object/group on X or Y axis

By Remy · 2018-08-13

Downloads
Description

Hi :)

Hopefully somebody can help me out here.

I'm looking for a script that easily mirror and object/group on the X or Y axis. I know that there are scripts that already do this, but they are part of another pop-up. I just like to attach it as a simple button i can press.

I've tried some stuff in the script below but my scripting skills are not well.

Thank you :)

Comments (8)
Ulrich Thümmler

Thank you so much!

obaida

Actually, Mirror in 3dsMax is a negative scale on the Mirror Axis
but it should be written as (scale $ [-1,1,1]) not ($.scale = [-1,1,1])

obaida

duplicated...

Reply to miauu
llp103ping

Link is broken

Hello, this link can no longer be opened. Could you please tell me how the script is written? Thanks!

Reply to llp103ping
miauu

.

Code by denisT



global MirrorDialogPos = unsupplied
 try
 (
      MirrorDialogPos = getdialogpos MirrorDialog
      destroydialog MirrorDialog
 ) 
 catch()
 rollout MirrorDialog "Simple Mirror" width:200
 (
      radiobuttons axis_rb labels:#("X","Y","Z   ") 
      button mirror_bt "Mirror Selection" width:192 align:#right offset:[8,0]
      
      local axis_types = #(#x, #y, #z)
      
      fn oppositeTM tm axis:#x nodes: = 
      (
            local rot_tm, ntm
            if ini == unsupplied do ini = tm
 
            local xm = case axis of
            (
                         #x: (matrix3 [-1,0,0] [0,1,0] [0,0,1] [0,0,0])
                         #y: (matrix3 [1,0,0] [0,-1,0] [0,0,1] [0,0,0])
                         #z: (matrix3 [1,0,0] [0,1,0] [0,0,-1] [0,0,0])
                  default: (matrix3 1)
            )
            tm * xm
      )
      on mirror_bt pressed do undo "Mirror" on 
      (
            for node in selection as array do node.transform = oppositeTM node.transform axis:axis_types[axis_rb.state]
      )
      
 )
 createdialog MirrorDialog pos:MirrorDialogPos