I want to know how to create “Text” feature with Python Script?
Here is snippet on how to make Text feature and define its Text property.
from vcScript import * app = getApplication() comp = getComponent() node = comp text_feat = node.getFeature("Example") if not text_feat: text_feat = node.RootFeature.createFeature(VC_TEXT, "Example") text_feat.Text = "\"Howdy, partner! 2+2=4\"" text_feat.Size = 100.0 node.rebuild() app.render()
Notice that I had to use a string quote with escape characters to pass a string since Text is expecting an expression given in the form of a string.
Text feature is of type vcFeature, and it has these properties:
- Name
- Visible
- Material
- Text
- Size
- IsFloating
- IsReadOnly
OK,thank you very much!
The reason I asked this question was because that the “VC_TEXT” constant was not found in the Python API.