I wanted to Orient a box to a plane or on a direction, but the box is scaling down in every situation. Please see the attached image. I do not want the box become smaller after translate or orient. Please some one help me. I want to copy the box then translate and orient in certain direction . I want to make 100s of copies.
I am new for Python. I usually work in C# dot net. This is why I am stuck. Please help.
import rhinoscriptsyntax as rs import Rhino.Geometry import math depth = 10 reflist= targetlist= pt1 = Rhino.Geometry.Point3d(0, 0, 0) pt2 = Rhino.Geometry.Point3d(depth, 0, 0) pt3 = Rhino.Geometry.Point3d(depth, depth, 0) pt4 = Rhino.Geometry.Point3d(0, depth, 0) pt5 = Rhino.Geometry.Point3d(0, 0, depth) pt6 = Rhino.Geometry.Point3d(depth, 0, depth) pt7 = Rhino.Geometry.Point3d(depth, depth, depth) pt8 = Rhino.Geometry.Point3d(0, depth, depth) corners = [pt1, pt2, pt3, pt4, pt5, pt6, pt7, pt8] box = rs.AddBox(corners) #---------------------------------------------- reflist.append(Rhino.Geometry.Point3d(100,0,0)) reflist.append(Rhino.Geometry.Point3d(0,0,0)) reflist.append(Rhino.Geometry.Point3d(0,100,0)) p1=Rhino.Geometry.Point3d(200,200,200) p2=Rhino.Geometry.Point3d(100,10,0) p3=Rhino.Geometry.Point3d(100,10,100) targetlist.append(p1) targetlist.append(p2) targetlist.append(p3) reference=reflist target=targetlist bx=rs.CopyObject(box) by=rs.MoveObject(bx,p1) bxx=rs.OrientObject( box, reference, target, flags=1 ) a=bxx # Here box is scaling down. But it should not . The box should be of same size after orientation. #for TranslateObject we can use as below, but still it scale down the box , as you can see in the image. #How to get read of this scale down and I also want to move the box not inside the original box. from_plane = Rhino.Geometry.Plane(pt1,pt2,pt3) to_plane = Rhino.Geometry.Plane(p1, p2, p3) xform_final = Rhino.Geometry.Transform.PlaneToPlane(from_plane, to_plane) bxx=rs.TransformObject(by,xform_final,True)