generative modeling for Rhino
Private Sub RunScript(ByVal x As Curve, ByVal y As Vector3d, ByRef A As Object)
Dim movex As New OnXform
movex.rotation(0.5, y, Point3d.Origin)
A = x
the results is red....it doesnot work...output is Error: Type 'OnXform' is not defined. (line 86)
i think may be it is replaced by another class....who knows it?
thank you very much!~
OnXform is a class in the old Rhino SDK. Since you're using RhinoCommon now, the class you're looking for is called Transform. It's in the Rhino.Geometry namespace.
thank you David
but how can i make a instance of this structure?i try many times,but failed....
To translate the code you have above, you'd need something like this:
Dim movex = Transform.Rotation(0.5,y,Point3d.Origin)
A = x
Thank you Andrew,and i add C# edition:
private void RunScript(Curve x, ref object A)
Transform movex = Transform.Rotation(0.5, Vector3d.ZAxis, Point3d.Origin);
A = x;
Private Sub RunScript(ByVal x As Curve, ByRef A As Object)
Dim movex As Transform = Transform.Rotation(20 * Math.PI / 180, Vector3d.ZAxis, Point3d.Origin)
A = x
//add As transform can avoid warning
Or, shorter still
x.Transform(Transform.Rotation(0.5, y, Point3d.Origin))
Creating a specific variable for a transform matrix is only really useful if you need it more than once.
yes,it is shorter!
David,can you explain the matrix of transform?because it is difficult to understand.....what is the meaning of m00,m01,m02...........
A transform matrix is a 4x4 grid of numbers where each number has a specific meaning assigned to it. Some of them are to do with translation, others with rotation, others still with scaling and tapering. The beauty of using matrices to encode transformations is that you can combine them before you apply them. It is quite a lot of work to transform a Brep, so you really only want to do it once. With transforms you can take 3 translations, 2 rotations and a scaling step, put them all in a single matrix and then only modify the Brep once.
You should not have to concern yourself with the actual meaning of the elements in the matrix, just use the provided functions to create standard transformations.
thankyou David,for long and clear explaination!i know what i should do is to ignore matrix:),because we can use the translate and rotation,scale method instead.