Private Sub RunScript(ByVal position As On3dPoint, ByVal target As On3dPoint, ByVal picture_number As Object, ByVal render_open As Object, ByVal dir As Object)
'code by 王大川 (http://alwayswdc.com)
'署名-非商业性使用-相同方式共享 3.0 http://creativecommons.org/licenses/by-nc-sa/3.0/deed.zh
'point as single graft, don't flatten or in a list.
'点作为单个graft数据传入,不能作为数个点组同时传入
If render_open = True Then
Dim filename As String = dir & picture_number & ".bmp" ’(定义图片名称和格式,建议把.bmp改为.jpg)
Dim x As String = CStr(position.x)
Dim y As String = CStr(position.y)
Dim z As String = CStr(position.z)
Dim a As String = CStr(target.x)
Dim b As String = CStr(target.y)
Dim c As String = CStr(target.z) ‘(这几步都是抽取点坐标数据)
app.RunScript("-_ViewportProperties" & chr(32) & "c" & chr(32) & x & "," & y & "," & z & chr(32) & a & "," & b & "," & c & chr(32) & "CANCEL") ‘(相当于在犀牛中运行 _ViewportProperties 命令,并输入相应的坐标数据)
app.RunScript("-_Render") ‘(相当于在犀牛中运行 _Render 命令,并输入相应的坐标数据)
app.RunScript("-_SaveRenderWindowAs " & Chr(34) & filename & Chr(34)) ‘(保存图片)
app.RunScript("-_CloseRenderWindow") ‘(关闭 Render 窗口 )
Else
End If
End Sub