我正在尝试使用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
答案 0 :(得分: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