0

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

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

1 回答 1

0

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

在 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
于 2012-04-14T12:23:24.033 回答