Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm using APS with Fusion360, and in my appBundle, i'm trying to change the text of a sketch that i retrieve from a document, however, i get "invalid input font name" when i try to change the text, i do not wish to change the font at all, here's an example code. I also have to say that i'm new at scripting with Autodesk,
const doc = getDocument(app, false, "", scriptParameters.fileURN);
const design = app.activeProduct as adsk.fusion.Design;
const rootComp = design.rootComponent;
const sketches = rootComp.sketches;
const textSketch = sketches.itemByName("Text1");
const sketchTexts = textSketch.sketchTexts;
const sketchText = sketchTexts.item(0);
const newText = scriptParameters.parameters.Text1;
adsk.log(sketchText.text) /* I get the actual text from the sketch here, eg: Test*/
adsk.log(sketchText.fontName) /* i get "Arial" in the log, correct font name of the sketch*/
adsk.log(newText) /* I get correctly what i'm sending on parameter on the workItem*/
sketchText.text = newText; /* This is where the bug occurs, i basically get :
{"message":"3: TASK_ERRORCODE_SCRIPT_EXCEPTION: GENERICEXCEPTION: Exception detected.\nError: GETLASTERROR: invalid input font name */
I also tried to assign it to Arial maybe to overwrite but same issue
I'm i missing something ? is it a known issue ? is there any workaround ?
Thank you in advance for your answers.
Solved! Go to Solution.