ScriptSpot

Forum topic · Scripts Wanted

Mirror object/group on X or Y axis

By remykonings · 2018-08-13

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 :)

Attachments
Comments (8)

Ulrich Thümmler · 2025-04-30

Thank you so much!

obaida · 2024-06-18

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 · 2024-06-18

duplicated...

Works :)

remykonings · 2018-08-15

Thanks for the link. It works now :)

Link is broken

llp103ping · 2024-04-26

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

.

miauu · 2024-04-26

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

llp103ping · 2024-04-26

Thank you!