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: 

Using User Parameter values in in Sketch Text...

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
andyAWMXG
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.

 

TTFN

Andy B.
6 REPLIES 6
Message 2 of 7
kandennti
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.

1.png
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
kandennti
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

        except:
            if _ui:
                _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Message 4 of 7
andyAWMXG
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...

 

TTFN

Andy B.
Message 5 of 7
kandennti
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.

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/events-handlers-for-sketch-selections-and-... 

 Thanks also to @william-c-anderson .

 

Message 6 of 7
andyAWMXG
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!

TTFN

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

Probably the same problem here.

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/why-the-text-is-mirrored-and-upside-down/t... 


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.
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-265d4bb3-2e68-4edf-bd57-bb4d4204beb0 

 

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