generative modeling for Rhino
Hi Guys,
I am trying to incrementally rotate a line using the codes below in c# and Vb.net. The components show no error but they only overlap lines...Any idea what is going wrong? The python attempt just gave the strange message "i" unexpected token "i".
Many thanks,
on C#:
Arthur
private void RunScript(Curve ln, int x, double angle, ref object A)
{List<Curve> lines = new List<Curve>();
Int16 i = default(Int16);for(i = 0; i <= x; i++){
ln.Rotate(angle * i, Vector3d.ZAxis, ln.PointAtEnd);
lines.Insert(i, ln);
}A = lines;
on VB.net:
Private Sub RunScript(ByVal ln As Curve, ByVal x As Integer, ByVal angle As Double, ByRef A As Object)
Dim lns As New List(Of Curve)()
Dim i As Int16For i = 0 To x
ln.Transform(transform.Rotation(angle * i, vector3d.ZAxis, ln.PointAtEnd))
lns.Insert(i, ln)
NextA = lns
in python I get the strange error : unexpected token "i"
For i in xrange(0,x):
rs.RotateObject(angle * i, vector3d.ZAxis, ln.PointAtEnd)
rs.AddLine(lns)
A = lns
Permalink Reply by Giulio Piacentino on April 4, 2012 at 2:10am Hi Arthur,
could you upload what you have so far?
Thanks,
- Giulio
_______________
giulio@mcneel.com
Permalink Reply by Arthur Mamou-Mani on April 4, 2012 at 4:52am Hi Giulio,
Thanks for your reply!
Please see attached files.
arthur
Permalink Reply by Giulio Piacentino on April 4, 2012 at 6:04am Hi Arthur,
there were some minor syntax mistakes but one big issue: you should remember to copy objects if you do not want your changes to be not propagated from one tranformation to the next one.
(I've added a rhinoscriptsyntax and a RhinoCommon version of the Python script. Rhinoscriptsyntax works in degrees).
Thanks,
- Giulio
________________
giulio@mcneel.com
Permalink Reply by Arthur Mamou-Mani on April 4, 2012 at 7:01pm
Permalink Reply by Ángel Linares on April 5, 2012 at 7:33am Thanks for sharing! I'm studying C# and Python these days and is a really usefull thing.
© 2013 Created by Scott Davidson.
Powered by