P_Thon
February 25, 2015, 11:06am
1
Hello,
I did a script in Python that check for all block and nested block in the document and then explode them all.
it’s working great but if it encounter a text object it will stop and display this message in the debbuger :
Message: Add currently does not support this annotation type.
does someone know a work around or can confirm that it’s bugged?
in the other hand in Rhinoscript it work perfectly : Rhino.ExplodeBlockInstance
is it’s possible to call that function directly from python?
Btw I’m running Rhino5 SR11 Last candidate
Thanks
dale
(Dale Fugier)
February 25, 2015, 6:10pm
2
Can you post a simple script and a model, that contains a block, that replicates the problem?
P_Thon
March 2, 2015, 10:01am
3
Hello Dale,
Here is an example Rhino file with two blocks, one with only geometry and one with geometry and text Explode text Block example.3dm (48.2 KB)
now if I run this script and select each time one of the block:
import rhinoscriptsyntax as rs
Objs = rs.GetObjects()
explodedObjs = rs.ExplodeBlockInstance(Objs)
print explodedObjs
it will work with the only geometry block however it will not work with the other one and display this message in the debbuger :
Hmm, yeah, that appears to be a bug/limitation of the RhinoCommon method
Rhino.DocObjects.Tables.ObjectTable.AddExplodedInstancePieces
–Mitch
P_Thon
March 2, 2015, 5:21pm
5
I see but please help me understand a thing, maybe I’m wrong but doesn’t RhinoScript also use RhinoCommon? if so why is this script in Rhinoscript work perfectly even with text in blocks :
Option Explicit
Call Main()
Sub Main()
Dim strObject
strObject = Rhino.GetObject("Select block instance to explode")
If Rhino.IsBlockInstance(strObject) Then
Rhino.ExplodeBlockInstance strObject
End If
End Sub
dale
(Dale Fugier)
March 2, 2015, 5:25pm
6
RhinoScript is built on top of the Rhino C++ SDK. RhinoScript does not use RhinoCommon.
No, actually, it doesn’t (for the most part, I think). VB Rhinoscript existed before RhinoCommon and hooks into the system differently.
–Mitch
P_Thon
March 2, 2015, 5:34pm
8
okay thanks Dale and Mitch for the answers, now I understand better.
well if someone is interested the best way I found to bypass this bug is to do :
rs.Command(“-_Explode”)
but I didn’t found a way to return the ID of the newly exploded objects.
Use Rhino.LastCreatedObjects(). --Mitch
dale
(Dale Fugier)
March 2, 2015, 6:12pm
10
AlW
March 2, 2015, 8:35pm
11
Wow, Dale! All bugs should be fixable that easily! New features implemented, too.
P_Thon
March 3, 2015, 9:13am
12
Use Rhino.LastCreatedObjects(). --Mitch
Yeah thanks Mitch that should do the trick.
This is a bug, which is now fixed.
http://mcneel.myjetbrains.com/youtrack/issue/RH-297693
Great Dale that was quick!
I have just a question about this:
does this mean it will only be working on Rhino V6 or it will be implemented in SR11?
dale
(Dale Fugier)
March 3, 2015, 4:35pm
13
Probably too late for SR11. SR12, if there is one, a the WIP for sure.