Incrementally rotate a curve using VB.net or C#

Go To StackoverFlow.com

0

I am trying to incrementally rotate a curve using the codes below in c# and Vb.net (the editor already imports the necessary libraries). In my 3D modelling program i get overlapping lines instead of lines with different angles. What am I doing wrong?

on C#:

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 Int16
For i = 0 To x
ln.Transform(transform.Rotation(angle * i, vector3d.ZAxis, ln.PointAtEnd))
lns.Insert(i, ln)
Next
A = lns
2012-04-04 07:01
by Arthur Mamou-Mani


0

I need to duplicate the line before rotating the next one in the loop otherwise there is no trace of it.

In C#:

private void RunScript(Curve ln, int x, double angle, ref object A)
{
 List<Curve> lns = new List<Curve>;
 for (int = 0; i<= x; i++)
  {
   Curve copy = ln.DuplicateCurve();
   copy.Rotate(angle * i, Vector3d.ZAxis, ln.PointAtEnd);
   lns.Add(copy);
  }
}
A = lns;

in VB.net:

Private Sub RunScript(By Val ln As Curve, ByVal x As Integer, ByVal angle As Double, By Ref A as Object)
  Dim lns As New List(Of Curve) ()
  For i As Integer = 0 To x
     Dim nl As Curve = ln.DuplicateCurve()
     nl.Transform(transform.Rotation(angle*i, vector3D.ZAxis, ln.PointAtEnd))
     lns.Add(nl)
  Next
  A = lns
End Sub
2012-04-14 12:23
by Arthur Mamou-Mani
Ads