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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using User Parameter values in in Sketch Text...

Message 1 of 7
3206 Views, 6 Replies

Using User Parameter values in in Sketch Text...

Hi Folks,

First of all apologies if I'm in the wrong forum or this has been asked before, I've only been playing with F360 for a couple of months and am still learning, and I searched without finding anything relevant...

I'm currently using F360 to design and occasionally 3D print jigs to help me with my woodworking. I try and make the designs scaleable using the maths and functions available for use with parameters but can't figure out how to use the content of a parameter in sketch text.

For example I have a user parameter "30", named "radius" which is used as the radius of an arc. It would be really useful if the content of parameter could also be used as the content of text in a sketch. This could be extruded into the model and included in a print.

This way one user parameter change for "radius" would also be reflected in any text using "radius" with some sort of delimiter to indicate the content is from the user parameters.

Is something like this even possible?

Thanks for any help/advice, and apologies again if I've missed something relevant.



Andy B.
Message 2 of 7
in reply to: andyAWMXG

 Hi @andyAWMXG .


I tried it because I never tried it.


1) Open the f3d file included in the attached file.
2) Execute Addin of attached file.
3) Correct the "radius" value of the user parameter.

4) When you press the OK button, the text of the "jigs_mark" sketch is changed and the shape is also corrected.

Message 3 of 7
in reply to: kandennti

Attachment file Addin works as it is, but there was a part that I forgot.

Adding it may make things a bit lighter.

class CommandHandler(adsk.core.ApplicationCommandEventHandler):
    def update_jigs_mark(self):
            # skt
            skt :adsk.fusion.Sketch = root.sketches.itemByName('jigs_mark')
            txt :adsk.fusion.SketchText = skt.sketchTexts.item(0)
            txt.text = '{:.1f}'.format(um.convert(prm.value, um.internalUnits, prm.unit))

            _last_radius = prm.value

            if _ui:
Message 4 of 7
in reply to: kandennti

Wow! many thanks for the quick reply, the code does pretty much exactly what I needed...

All I need to do now is figure out how it works under the hood!

Guess its time to go brush up on my Python, its been a few years...



Andy B.
Message 5 of 7
in reply to: andyAWMXG

I wrote the code but didn't come up with such an idea.
It was a good experience for me too.


In addition, this one only adds a little function to this one. 

 Thanks also to @william-c-anderson .


Message 6 of 7
in reply to: kandennti

Dam! - this is so close...


The add in doing exactly what i asked for but I have one tiny problem (my fault - sorry!)


The text being changed is actually cut into the underside of the model and when the new text is rendered (is that the right word?) it needs to be horizontally flipped, can this be done in the code as well?


Apologies for being a pain!


Andy B.
Message 7 of 7
in reply to: andyAWMXG

Probably the same problem here. 

I haven't looked into it, but I think the orientation of the sketchtext will be affected by the vector of the sketch's support surface.
As far as you can see the help, I think that the sketchtext can only change the angle. 


For me, I think that only the text model is created on XYPlane and moved.

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