Hello,
The question i'm trying to answer is a tad complex so bear with me. Essentially, I create a lot of designs for 3D printing where each customer may give me different text for the design. As it stands I have a saved file before exploding the text. I open that file, type in the new text, explode it, and extrude it.
However, now I wish to get much more complex. I want to make designs that reference text and build a back plate around it, for example. Is it possible to do this with fusion 360? Can I "go back" in a design and edit exploded text for new designs?
For comparison I've seen this done in openscad where you can type text to generate a design since it is script based.
Does anyone have any input? Thanks
You can change the text, but not if you explode it. Once extruded, you can project the bodies to another sketch and the projected geometry will update as long as you don't change the number of characters.
ETFrench
Hello,
I’ve came accross the same idea as yours that I wanted to achieve. After few days of reading, tinkering and “learning” how python works I’ve found really cool solution that I want to share with you guys. It lets me to change the text in the design in just two clicks and save that as an stl automatically – ready for 3D printing.
First, let’s start from the credits which goes to:
So to get started, first you need to create anew script (code below):
import adsk.core, adsk.fusion, adsk.cam, traceback def run(context): ui = None try: app = adsk.core.Application.get() ui = app.userInterface design = app.activeProduct rootComp = design.rootComponent # Get the sketch named "ChangeText" sk = rootComp.sketches.itemByName('ChangeText') # Get the first sketch text. skText = sk.sketchTexts.item(0) #Prompts the user for the new Text (returnValue, cancelled) = ui.inputBox('What text?', 'New text:', ) # Grab the sketch and first text entity sk = rootComp.sketches.itemByName('ChangeText') skText = sk.sketchTexts.item(0) # Change the text. skText.text = returnValue # Write in the path to the folder where you want to save STL‘s folder = 'C:/Users/Desktop/etc...' # Construct the output filename. Name will be the same as you‘ve changed the text into. filename = folder + skText.text + '.stl' # Save the file as STL. exportMgr = adsk.fusion.ExportManager.cast(design.exportManager) stlOptions = exportMgr.createSTLExportOptions(rootComp) stlOptions.meshRefinement = adsk.fusion.MeshRefinementSettings.MeshRefinementMedium stlOptions.filename = filename exportMgr.execute(stlOptions) except: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
You need to create design and add new sketch where the text that you want to change will be.
IMPORTANT: name that sketch „ChangeText“ so that script could grab it and work on.
Next thing that was very important for me was to find a solution to align text so that when you change it it still stays aligned. It is done by a little trick as Fusion doesn‘t have much text options. It is really simple when you find it.
I‘ve made a screencast how everything works and how to align text so it stays „parametric“. Attached below.
Note that when you choose coincident constraint for the text you should hold SHIFT+find center of the line and click it.
Hope that will help as it helped me a lot 🙂
Happy 3D printing!
P.S. Maybe someone could help me to add some code so that if you change the text into the same one that is already in the STL export folder, it automatically makes file name "filename+2"?
Good day to you!
I came across this and found it to be an amazing little script for my purpose.
I got it to work by following your instructions, however after I input the text on the dialogue box, the newly written text comes out with a lot of space in between letters. Any idea how to fix this? thank you
Hi,
check out the new text function on the path.
Use a simple line as the path and play with the options (lenght of path included). It is also possible to change the spacing afterwards.
günther
Thank you for your reply!
It's a real nice script! Thank you
I've tried different types of constraints and the issue seems to be the same. Will attach photos
I wrote "Test" manually, then booted up the script and wrote "HI" It came out the way it did on the second photo
Cheers!
Hello,
I was able to reproduce your described problem but couldn't figure out how to solve it though.
As I'm not that great at programming maybe someone could help us?:)
Maybe the script command which changes the text interferes with some kind of values of different lengths of texts. Are there any other commands to change text (different than: skText = sk.sketchTexts.item(0) )?
Thank you
Hi All,
I was having the spacing issue and was able to solve the problem by choosing the "Text on Path" option to create the text, then selecting the "Fit to path" checkbox.
I've been trying to incorporate the file name in the export stl
Does anyone have any ideas how to do that?
Can't find what you're looking for? Ask the community or share your knowledge.