Hi all,

I am studying mechanical engineering and now I am doing my diploma thesis.

I have to programm a new command in Rhino and I have read the Rhino Script, yet. And programmed some easy commands. So I have to create a command to transform a coordinate system. I try to explain my problem now.

I have two objects with the same number of control points. The control points are moved with a coordinate transformation (see figure).

So I have all the coordinates before and after the transformation. And  I would like to have the Transformation matrix/matrices for these control point. I thought about it. If I now take only one control point of each object and want to set a transformation matrix for this, I only have 3 equations and up to 9 unknowns. When I select two control points of each object and I get a transformation matrix for the edge. Then I have 6 equations but still up to 9 unknowns.

Now I have discovered a third possibility. I have nearly the same system like above, but only painted.The control points before the transformation are described by a (x,y)-coordinate system and the afterwards by (b,a)-coordinate system. First I consider only one quad. The requirement which must be given, since only the points are looked at, it must be either straight connections between points.

The formula for the example in the figure before is:

When I set all the equations, I have 8 equations with 8 unknowns and solve the system of equations. In the end I get the 4x2 Matrix (figure 3) as Transformationmatrix for the quad is shown in the second figure.

Now I need a programming code in Rhino that I always select the four to a quad adjacent points with which I can calculate a transformation matrix. If I take the first picture I need a command, which, if the user select the hole object, takes first the points 1,2,3,5, second 3,4,6,8 and third the points 4,5,6,7 in a loop.
Can anyone help me?

Tanks a lot in advance


Views: 2011

Replies to This Discussion

Hi Bettina,

In the future, you might want to post your questions on the RhinoScript forum so more users will see your post.


If you have two known points, a & b, and want to know how to transform a to b, then create a translation transformation using the vector created by the points. For example:


a = Array(0.10, 0.03, 0.00)
b = Array(24.70, 0.03, 0.00)
dir = Rhino.VectorCreate(b, a)
xf = Rhino.XformTranslation(dir)
c = Rhino.PointTransform(a, xf)
Rhino.Print Rhino.Pt2Str(c)


Is this all you are looking for?

 -- Dale



thank you for your fast response. I thought I am in the rhinoscript forum

I have thought about the problem this weekend. And now I hope I can present it  more clearly now. I think the most difficult part of the problem is to find an algorithm, which automatically put 4 points of the 4 corners of a quad. Then a loop calculate for every quad the transformation matrix.


So when I look at the first picture of the previous post, then the algorithm would select  3 times the 4 points of the four quads.

Do you understand my problem now?

Thanks in advance,



I am still working with this problem. Now I found a command which selects the quads, but only with a mesh: "rhino.meshfacevertices(number of faces)(number of points of the facecorners (4 Points)" and "rhino.meshvertices(number of points)(coordinates)". So if I have a polygon mesh I can take these commands. Now I am looking for a similar command, which works with the control polygon and the coordinates of the control points. 

Can anyone help me with this?

Thanks a lot in advance


Hi Bettina,

If you want the locations of a surface's control points, then use the SurfacePoints function:


Keep in mind that a surface and a mesh face are quite different. Unlike a mesh face, which is always going to have either 3 or 4 vertices, a surface might have many control points. Thus, if you are trying to divide a surface's control points into a quad grid, you will have to write your own function to do this.

Also, it is possible to turn on the control points (or grips) from RhinoScript:


Having these might make transformations easier.

 -- Dale

Thank you for your fast response!

Now I have only 1 month to write my Diploma thesis. And I think the time is to close to write a new algorithmus. I've especially started to program only two months ago. 



© 2021   Created by McNeel Admin.   Powered by

Badges  |  Report an Issue  |  Terms of Service