Blog

August 12, 2019

Text to Curve Objects

Changing the Object.Type

Useful for Exporting & Fabrication

Changing an object’s attribute is needed when we want to export elements from one software to another. Digital fabrication mostly presenting this series of actions while we also require to control parametric 3d objects with their attributes. Once your modeling process gets done, the whole procedure for labeling and marking objects will start. The process will be run over and over again and what we need is actually to control every thing from the top. The simple code here using RhinoCommon API to have the path through changing Texts to Curves!

import rhinoscriptsyntax as rs
import Rhino.Geometry as rg
import scriptcontext as sc
import Rhino as r


Texts = []
Texts.append(TxtID)

sc.doc = r.RhinoDoc.ActiveDoc

for i in Texts:
    TxtStr = rs.TextObjectText(TxtID)
    TxtCrv = rg.Curve.CreateTextOutlines(TxtStr, TxtFont, TxtHeight,
    TxtStyle, TxtClose, TxtPlain, TxtCaps, TxtTolerence)

sc.doc = ghdoc

a = TxtStr
b = TxtCrv
print TxtStr
Gh Definition & Rhino File!
You can access the files here! Just load it into Rhino & Gh and test what text you might need to convert to curves!
CAD/CAM, Coding, Digital Fabrication, OpenSource, Technical Design , , , ,
4.5 2 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments