ExplodeBlockInstance () can't handle text - Bug

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

Can you post a simple script and a model, that contains a block, that replicates the problem?

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

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

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

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

This is a bug, which is now fixed.

http://mcneel.myjetbrains.com/youtrack/issue/RH-29769

Wow, Dale! All bugs should be fixable that easily! New features implemented, too. :smiley:

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?

Probably too late for SR11. SR12, if there is one, a the WIP for sure.