使用VB.net或C#增量旋转曲线



我正在尝试使用c#和Vb.net中的以下代码增量旋转曲线(编辑器已经导入了必要的库)。在我的三维建模程序中,我得到了重叠的线,而不是不同角度的线。我做错了什么?

在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;

在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

在循环中旋转下一行之前,我需要复制该行,否则就没有它的踪迹。

在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;

在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

最新更新