I tried to use the OrientObject example script in the RhinoIronPython help file and I can’t get it to work. It also seems that OrientObjects (multiple) isn’t implemented yet. Is there an updated version of this Help?
What I need to do is orient a group just created by a pass in the script. I would script the two reference points then place the group with 2 user selected target points.
Any ideas here?
Thanks in advance
Robb
Normally, when methods do not take multiple objects, the procedure is to create a loop and then pass each object individually inside the loop
reference=[list of two or three 3d points]
target=[list of two or three 3d points]
for obj in objs:
rs.OrientObject (obj, reference, target)
HTH, --Mitch
Many thanks - that worked. I am beginning to get a handle on this Python stuff but still have a VERY long way to go. Hopefully there are other newbies that will find this beneficial.
After playing with this some I have found a weird issue - when I attempt to orient the objects along the same axis and direction as the original they are inverted below the construction plane… the Z gets translated to a negative value. Any other axis or direction works perfectly.
What I am working with is
bpr = (0,0,0)
bpl = (CWx,0,0)
reference = [bpl, bpr]
tp1 = rs.GetPoint ()
tp2 = rs.GetPoint()
target = [tp1, tp2]
for obj in objs:
rs.OrientObject (obj, reference, target)
CWx is a previously declared variable and I ultimately want to be able to reverse the order of bpl - bpr by function in the script. I tried adding a vector -> up = rs.VectorCreate((0, 0, 10), (0, 0, 0)) but this introduced a different set of orientation issues. I am perfectly happy for all the script actions to operate in world coordinates but don’t see how to enforce that.