Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Script to edit font across multiple sketches

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
mtroutt.cpp
748 Views, 4 Replies

Script to edit font across multiple sketches

Hi there!

I'm a total noob when it comes to scripting and python, so I wanted to run an idea past y'all as a sanity test and perhaps get some advice. 🙂

I'm modeling a set of dice for Dungeons and Dragons, and between all of the different components I've got 72 sketches just for the text components (the specific sketches have text numbers as well as some construction geometry). Is there a way to make a script/add-in/macro that would go through those sketches, and if there's a text object change the font to one I'd define on a drop-down list? That way I don't have to go through each sketch individually and choose the font from the drop-down list.

If it is possible, any advice pointing me in the right direction would be greatly appreciated! Thank you for your time and making the fusion 360 community great!

Labels (6)
4 REPLIES 4
Message 2 of 5
kandennti
in reply to: mtroutt.cpp

Hi @mtroutt.cpp .

 

I am Japanese, but I have played Dungeons and Dragons when I was a kid. I miss it.

 

"I want to change the font of all sketch text in one operation." Is that your question?

Message 3 of 5
mtroutt.cpp
in reply to: kandennti

That's awesome to hear that you also played D&D! I think you've got my question summed up nicely. 🙂

If there was a way where I could define the design font as a parameter, and then change it in the future and have all the sketches automatically update to the new selected font, that would be awesome!
Message 4 of 5
kandennti
in reply to: mtroutt.cpp

In Fusion360, I don't think it is possible to create user parameters whose values are characters such as font names.

 

So I created a script to change the font for all sketch text in the active document. I've attached the file.

(In case you're wondering, it's python.)

 

You can select the font to be changed in the drop-down menu.

1.png

This list has been created manually as a CSV file using this method.

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/use-textcommands2/m-p/9937199#M12120 

Since I am using it in Japanese, it must contain several undesirable font names.

 

I thought it would be desirable to use the method described by @JeromeBriot , but I didn't use it because I needed to install an external library.

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/api-access-to-list-of-available-supported-... 

 

Message 5 of 5
mtroutt.cpp
in reply to: kandennti

Oh wow! This looks to be just what I'm looking for, thank you so much! I tested it out with Arial since it was already included on your list and after a bit of computing time the D20 updated with the new font. I'll have to do some work to resize but that was to be expected since the fonts differ so much anyways.

I will look into making a new CSV document updated with my computer's font list. I admit that python programming is beyond my current scope of knowledge (I only do small arduino projects at the moment), but I'll do my best to figure it out on my own and let you know if I'm still struggling.

Again, thank you very much!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report