Create Object Instance of Text

Hey guys,
I kind of new to python and especially to Rhino.
Iam working on a file read function and I want to add a few Texts to a certain block.
How do I get the Text Id if the text is not drawn yet.
I just want to create a text object, add it to the block and insert the block.

The only way Iam doing it right now is:

text = rs.AddText( "some text" ,ZPoint)
    objects = [text]

    block = rs.AddBlock(objects,iDPoint)


this will add the text twice to the workspace. As a single text and a block with a text.
Im kinda freakin out already because I can’t find anything about creating a single text object.
In java this would be something like this:

 Text textInstance = new Text("Hallo");

I would be really happy if anyone could help me with this =)

Cheers in advance!

Hi Schummel,

rs.AddBlock function has an argument delete_input. Set it to True to delete you initial text:

text = rs.AddText("some text", ZPoint)
objects = [text]
block = rs.AddBlock(objects, iDPoint, delete_input=True)
rs.InsertBlock(block, iDPoint)
1 Like