MirrorObjects() bugs/requests

I don’t know in which youtrack category to post bugs related to scripting (vb pr python) - there doesn’t seem to be a specific scripting category there - so I’ll continue to post them here for the time being…

Issue #1:
MirrorObject() and MirrorObjects() take 2 points as input to determine the mirror plane. However, 3 points are actually needed to determine a plane. The Help (both vb and Python rhinoscriptsyntax) does not specify how the third point is found to fully define the mirror plane. It is the current view’s CPlane vertical, of course, but that needs to be stated in the help. It also means the function is dependent on the current active view, which leads to issue #2

Issue #2:
It would be good if a plane and its origin could be passed to this method as an alternative to passing two points. That would allow people to use planes other than ones related to the active CPlane, resulting in more flexibility and reliability of scripts.

Thanks, --Mitch

You can define a plane with two points, where the first point is the origin and the second point is in the direction of the plane’s normal. But I do agree the methods should just accept a plane argument, like other methods do. The function were originally designed to mimic the Mirror command…

http://mcneel.myjetbrains.com/youtrack/issues#

Thanks Dale!

I would agree with this statement only partially. With two points, origin and normal, you define an infinite number of coplanar planes which rotate around the normal. Rhino picks one arbitrary one from those - I don’t really know how it does that - but it’s certainly not guaranteed to have its x,y axes oriented the way you want…

Yes, thanks for looking into this!
Merry Christmas ! --Mitch

Hi,

Has there been any progress on this? I have been running into this in a script I have where the behaviour of MirrorObjects depends on the active viewport. The obvious workaround is to set the view before calling the command however it would be nice not to be forced to do this every time.

Thanks!

In the meantime, you can use the function below as a substitute… --Mitch

import rhinoscriptsyntax as rs

def MirrorObjectsPlane(objIDs,plane,copy=False):
    xForm=rs.XformMirror(plane.Origin,plane.Normal)
    return rs.TransformObjects(objIDs,xForm,copy)

def TestFunction():
    objs=rs.GetObjects()
    origin=rs.coerce3dpoint([0,0,0])
    ptX=rs.coerce3dpoint([1,1,0])
    ptY=rs.coerce3dpoint([0,0,1])
    mplane=rs.PlaneFromPoints(origin, ptX, ptY)
    #try with different variations for the 3rd argument (copy or not)
    MirrorObjectsPlane(objs,mplane,True)
TestFunction()
2 Likes

Cheers! :beer: