Grasshopper

algorithmic modeling for Rhino

Hi,

Does anyone know what's the equivalent code python for this:

var te = RhinoDoc.ActiveDoc.Objects.AddText(content, pl, size, face, bold, italics);

Rhino.DocObjects.TextObject txt = RhinoDoc.ActiveDoc.Objects.Find(te) as Rhino.DocObjects.TextObject;

thanks . . .

Views: 2251

Replies to This Discussion

Thanks Marcus,

Do you know how to deal with this part?

var te = RhinoDoc.ActiveDoc.Objects.AddText(content, pl, size, face, bold, italics);
Rhino.DocObjects.TextObject txt = RhinoDoc.ActiveDoc.Objects.Find(te) as Rhino.DocObjects.TextObject;

if(txt != null)
{
var tt = txt.Geometry as Rhino.Geometry.TextEntity;
A = tt.Explode();

Thx

Yap but this part doesn't work in this format :
var tt = txt.Geometry as Rhino.Geometry.TextEntity

Got it,

Perfect,

Thanks...

Hey Hamia! Is this the function that you are looking for: https://github.com/mostaphaRoudsari/ladybug/blob/master/src/ladybug...

Thanks mostapha,

it's almost the same, here is what i got:

import Rhino as rc
import rhinoscriptsyntax as rs


if(size == 0):
size=1

if( (not(face is None)) and (size>0) and (not (content is None))and type(pl) == rc.Geometry.Plane ):
print "yes"
te=rc.RhinoDoc.ActiveDoc.Objects.AddText(content, pl, size, face, bold, italics)
txt = rc.RhinoDoc.ActiveDoc.Objects.Find(te)
print txt
if not(txt is None):
#txt.decode("utf-8")
tt = txt.Geometry
#tt= rc.Geometry.TextEntity
print tt
a = tt.Explode()
rc.RhinoDoc.ActiveDoc.Objects.Delete(te, True)

issue is that it produce double curve text, which mean too much time for cutting, im looking for a way to make it single curve text.

Best,

H/

Hi Guys, I'll just reply here. I had a quick go at updating the script to work with single stroke fonts (find attached). You'll need to install the fonts and then select which one to use in the GH def. It is not exactly a foolproof update as it assumes that we will always want to remove the last segment of the text polycurve. One could add some if statements to catch more cases (such as a 0 should keep the last segment etc.). But hopefully this at least will help a bit :)

Attachments:

Edit: Had a variable name which was not updated. Just reattached the file.

Attachments:

Many thanks Anders. 

Looks great.

H/

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service