QQ登录

只需一步,快速开始

扫一扫,访问微社区

犀牛建筑网

查看: 22442|回复: 4

GH计算器的脚本计算器讲解(四)

[复制链接]
发表于 2014-10-25 14:45:24 | 显示全部楼层 |阅读模式
犀牛网校

今天我们介绍一点简单的代码。

四种方法是用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



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

发表于 2014-10-25 15:09:53 | 显示全部楼层
这么好的帖子,必须顶,希望再发一些
回复 支持 反对

使用道具 举报

发表于 2014-10-25 15:56:56 | 显示全部楼层
楼主,帮下,能私聊一下么
回复 支持 反对

使用道具 举报

发表于 2014-10-28 00:45:35 | 显示全部楼层
感谢分享,教程附言倍加分
回复 支持 反对

使用道具 举报

发表于 2016-4-22 08:14:38 | 显示全部楼层
感谢楼主,希望能多给些例题。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关于我们|网站地图|BIM|rhino3d ( 沪ICP备19001822号-2 )

GMT+8, 2024-4-29 17:51 , Processed in 0.050012 second(s), 22 queries .