NCF参数化建筑论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 12337|回复: 1
打印 上一主题 下一主题

[话题讨论] 调用RHINO.COMMAND如果在执行中选择物体如何操作

[复制链接]
跳转到指定楼层
1m
发表于 2010-11-7 22:43:16 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
例如call rhino.command("_split")其后要选择一个物体使用什么代码?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享
2m
 楼主| 发表于 2010-11-8 12:06:18 | 只看该作者
本帖最后由 attention412 于 2010-11-9 08:53 编辑

Function DoBrepSplit(brep, cutter)

   ' Declare local variables
   Dim saved, cmd

   ' Set default return value  
   DoBrepSplit = Null

   ' For speed, turn of screen redrawing
   Rhino.EnableRedraw False

   ' Save any selected objects
   saved = Rhino.SelectedObjects

   ' Unselect all objects
   Rhino.UnSelectAllObjects

   ' Select the brep
   Rhino.SelectObject brep

   ' Script the split command
   cmd = "_Split _SelID " & cutter & " _Enter"
   Rhino.Command cmd, 0

   ' By preselecting the brep, the results of
   ' Split will be selected. So, get the selected
   ' objects and return them to the caller.
   DoBrepSplit = Rhino.SelectedObjects

   ' Unselect all objects
   Rhino.UnSelectAllObjects

   ' If any objects were selected before calling
   ' this function, re-select them
   If IsArray(saved) Then Rhino.SelectObjects(saved)

   ' Don't forget to turn redrawing back on
   Rhino.EnableRedraw True

End Function
The function above can be test using the following simple subroutine:

Sub TestSplitBrep

  ' Declare local variables
   Dim brep, cutter, pieces, i

   ' Pick the brep to split
   brep = Rhino.GetObject("Select surface or polysurface to split", 8 + 16)
   If IsNull(brep) Then Exit Sub

   ' Pick the cutting brep
   cutter = Rhino.GetObject("Select cutting or polysurface to split", 8 + 16)
   If IsNull(cutter) Then Exit Sub

   ' Call our special splitter   
   pieces = DoBrepSplit(brep, cutter)
   If IsArray(pieces) Then
     For i = 0 To UBound(pieces)
       Rhino.Print pieces(i)
     Next
   End If

End Sub
看到一个实例,居然正是我要找的,_SelID 选择物体 ID

小黑屋|手机版|NCF参数化建筑论坛 ( 浙ICP备2020044100号-2 )    辽公网安备21021102000973号

GMT+8, 2024-11-11 03:44 , Processed in 0.057314 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表