Looking to create ( or pay to get created ) a Fusion API python script that can :
1. display a dialog with text input area, so I can Paste 7 lines of text ( or populate the text input from the Win system clipboard ? ).
2. Use the text in line 1 and Save the open design with that name.
3. Place the text from line 2 in to an existing text area in a sketch.
4. change the height of the text in that text area of the sketch, so that the width of the lettering does not exceed a specific dimension.
5. repeat steps 3 & 4 for another 5 lines, to 5 other text areas ( the 6 text areas can be in one sketch, or on separate sketches, whichever is easier ).
If step 4 is not possible, can the text be extruded, and then the bodies of the extruded text, scaled to a specific width ?
I don't really have any answers for you, but I'm interested in the same thing (specifically step 4) since the base program doesn't give users any control over the actual width of text. You can control the height of text but then you're at the whim of the font to determine the width.
I do know that you'll probably have to access the SketchTexts object using the sketchTexts() method (notice the lowercase letter at the start of the method to differentiate it from the actual object). You can do this with the below line
textbox = <sketch object variable name>.sketchTexts.item(0)
To change the actual content of the text you would use
textbox.text = 'new text content'
It should definitely be possible to create the text, then measure the textbox via script, then adjust the text box by scaling it accordingly. The problem is that often the width of the textbox is only very loosely correlated with the actual width of the letter(s). So you might have to explode the text, then somehow find the smallest and highest X value points (the left and right extremes) and calculate the difference. That I assume is going to be the tricky part.
Hi @info83PHN .
The easiest way to create a text sketch of arbitrary width was to draw a line as a guide and use the SketchTextInput.setAsFitOnPath method.
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-E5C05A62-0282-4FBE-A13D-5A8BF099C2C2
I've created a few and attached the files.
ć»I have not done any saving.
ć»It is possible to paste text from the clipboard.
ć»The second line of text rewrites the specified sketch text.
ć»The specified sketch text must be drawn horizontally on the sketch parallel to the XY plane to create the correct position.
When the number of characters in the sketch text increases, it is incomplete because we did not know how to get the direction in which the characters increase.