I see AddText but there is no AddTextObject.
Is this possible in Rhino 6 WIP? Where can I download V6?
Thanks
I see AddText but there is no AddTextObject.
Is this possible in Rhino 6 WIP? Where can I download V6?
Thanks
there is no AddTextObject function but you can always roll your own with a bit of RhinoCommon by creating a text enitity, exploding it to curves, creating surfaces from each letter and extruding the results like below:
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
def DoSomething():
'''creates a 3d text object'''
te = Rhino.Geometry.TextEntity()
te.Plane = Rhino.Geometry.Plane.WorldXY
te.Text = "Rhino rocks !"
te.TextHeight = 10.0
te.Justification = Rhino.Geometry.TextJustification.BottomLeft
te.FontIndex = scriptcontext.doc.Fonts.FindOrCreate("Arial", False, False)
curves = te.Explode()
arr_breps = Rhino.Geometry.Brep.CreatePlanarBreps(curves)
if arr_breps.Count == 0: return
start_pt = te.Plane.Origin
end_pt = te.Plane.ZAxis
height = 1.5
xform = Rhino.Geometry.Transform.Scale(te.Plane, height, height, height)
end_pt.Transform(xform)
line = Rhino.Geometry.Line(start_pt, end_pt)
path = line.ToNurbsCurve()
for brep in arr_breps:
new_brep = brep.Faces[0].CreateExtrusion(path, True)
scriptcontext.doc.Objects.AddBrep(new_brep)
scriptcontext.doc.Views.Redraw()
DoSomething()
c.