J11
1
I am a total newbie. So please ignore my ignorance.
Is there a way to bypass user input of force entry into the command line.
For example, I have a Block Instance in a file. I named the block instance.
I now import the file and run the selblockinstancenamed. But the script stops for the user to select the block.
If I select the item manually the script runs fine.
However if I try to select the item another way for example - Rhino.ObjectsByLayer I get a mismatch error saying a str is required.
Any ideas?
clement
2
@J11,
try if this does select your block in an extra script first.
Option Explicit
Call Main()
Sub Main()
Dim strBlockName, cmd, blnResult, arrObjects
Rhino.UnselectAllObjects()
strBlockName = "MyBox"
cmd = "_-SelBlockInstanceNamed " & CHR(34) & strBlockName & CHR(34)
blnResult = Rhino.Command(cmd, True)
arrObjects = Rhino.SelectedObjects()
If IsNull(arrObjects) Then
Rhino.Print "Nothing has been selected"
Else
Rhino.Print UBound(arrObjects) + 1 & " Blocks selected"
End If
End Sub
Note that you have to change the name of the block in the script, mine is named “MyBox”.
c.