今天我们介绍一点简单的代码。 四种方法是用vb脚本创建一条直线。 1, Public Sub New(x0 As Double, y0 As Double, z0 As Double, x1 As Double, y1 As Double, z1 As Double)
rhino.Geometry.Line 的成员
摘要:
Constructs a new line segment between two points. 参数:
x0: The X coordinate of the first point.
y0: The Y coordinate of the first point.
z0: The Z coordinate of the first point.
x1: The X coordinate of the second point.
y1: The Y coordinate of the second point.
z1: The Z coordinate of the second point.
2, Public Sub New(from As Rhino.Geometry.Point3d, to As Rhino.Geometry.Point3d)
Rhino.Geometry.Line 的成员
摘要:
Constructs a new line segment between two points. 参数:
from: Start point of line.
to: End point of line. 3, Public Sub New(start As Rhino.Geometry.Point3d, span As Rhino.Geometry.Vector3d)
Rhino.Geometry.Line 的成员
摘要:
Constructs a new line segment from start point and span vector. 参数:
start: Start point of line segment.
span: Direction and length of line segment. 4, Public Sub New(start As Rhino.Geometry.Point3d, direction As Rhino.Geometry.Vector3d, length As Double)
Rhino.Geometry.Line 的成员
摘要:
Constructs a new line segment from start point, direction and length. 参数:
start: Start point of line segment.
direction: Direction of line segment.
length: Length of line segment.
我们编写如下代码: Private Sub RunScript(ByVal x As Object, ByVal y As Object, ByRef A As Object)
a = New line(New point3d(0, 0, 0), New point3d(1, 1, 1))
a = New line(New point3d(0, 0, 0), New vector3d(1, 1, 1))
a = New line(New point3d(0, 0, 0), New vector3d(1, 1, 1), 2)
a = New line(0, 0, 0, 1, 1, 1)
End Sub 上面我们对a进行了四次赋值,肯定是最后一次的值为a的值。如果我们想输出四条直线,要么增加三个输出端参数,要么使用一个列表存储四条直线,再将列表赋值给a。 我们的点也可以是由输入端输入,注意将x,y设置成item,Point3d Private Sub RunScript(ByVal x As Point3d, ByVal y As Point3d, ByRef A As Object)
Dim Myline1 As New Line(x, y)
a = Myline1
End Sub
|