Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Issue rs.PlaneTransform() workinf different than expected

$
0
0

Hi,

I’ve encountered an unexpected result when I use rs.PlaneTransform.

I have a model with 2 blockinstances (77.3 KB); a normal one and a mirrored instance of the same definition.

I use the script below to align a copy of the world xy plane to the transformed instances, and construct an axes helper based on that transformed plane.

I expected to see a normal and a mirrored version of the same axes helper. However, checking with the left-hand rule, the axis helpers (and thus the transformed planes) seem to be rotated around the y-axis instead

#! python3
import rhinoscriptsyntax as rs

def main():
    objs = rs.GetObjects(preselect = True, filter= rs.filter.instance)
    if not objs:
        return

    for instance in objs:
        xform = rs.BlockInstanceXform(instance)
        xy = rs.WorldXYPlane()

        plane = rs.PlaneTransform(xy, xform)

        z_helper = rs.AddLine(plane.Origin, plane.Origin + plane.Normal * 100)
        x_helper = rs.AddLine(plane.Origin, plane.Origin + plane.XAxis * 100)
        y_helper = rs.AddLine(plane.Origin, plane.Origin + plane.YAxis * 100)

        rs.ObjectColor(z_helper, (0, 0, 255))
        rs.ObjectColor(y_helper, (0, 255, 0))
        rs.ObjectColor(x_helper, (255, 0, 0))



if __name__ =='__main__':
    main()




5 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles