Message 1 of 6
Edit text value in API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a simple model - basically a square with 9 holes in it and text at the bottom. I need to change the hole diameter and text based on a table of values. The hole diameter is easy to change base on a parametric value, but I can't seem to edit the text value with the API.
This returns the current text value, but errors when setting the text value to a new string (textinputitem.text = "booyah")
def run(context😞
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
ui.messageBox("Running")
design = app.activeProduct
rootComp = design.rootComponent
features = rootComp.features
sketches = app.activeProduct.rootComponent.sketches
bRepBodies = app.activeProduct.rootComponent.bRepBodies
textsketch = sketches.itemByName("Sketch1")
textsketchtexts = textsketch.sketchTexts
textinputitem = textsketchtexts.item(0)
actualwords = textinputitem.text
ui.messageBox(str(actualwords))
textinputitem.text = "booyah"