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: 

[Bug] Unable to modify text of a sketchText created manually with negative angle

6 REPLIES 6
Reply
Message 1 of 7
JeromeBriot
1137 Views, 6 Replies

[Bug] Unable to modify text of a sketchText created manually with negative angle

JeromeBriot
Mentor
Mentor

Hello,

 

1) Open a new document

2) Add a text with negative angle in a sketch 

3) Run the script below

 

 

import adsk.core, traceback # pylint: disable=import-error

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface

        design = app.activeProduct

        rootComp = design.rootComponent

        sketches = rootComp.sketches
        sketch = sketches.item(0)
        sketchText = sketch.sketchTexts.item(0)

        sketchText.text = 'new text'

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

 

 

 

It returns the error: "Invalid input angle".

 

Thank you.

 

1 Like

[Bug] Unable to modify text of a sketchText created manually with negative angle

Hello,

 

1) Open a new document

2) Add a text with negative angle in a sketch 

3) Run the script below

 

 

import adsk.core, traceback # pylint: disable=import-error

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface

        design = app.activeProduct

        rootComp = design.rootComponent

        sketches = rootComp.sketches
        sketch = sketches.item(0)
        sketchText = sketch.sketchTexts.item(0)

        sketchText.text = 'new text'

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

 

 

 

It returns the error: "Invalid input angle".

 

Thank you.

 

6 REPLIES 6
Message 2 of 7
thomasa88
in reply to: JeromeBriot

thomasa88
Advocate
Advocate

I hit the exact same problem today.

What's worse, is that I cannot make the angle positive in the script (e.g. going from -pi/2 to +3/2*pi), as all attempts to assign to an angle fails if the initial value is negative.

 

sketch_text.angle
-3.141592653589793
sketch_text.angle = 2*math.pi - sketch_text.angle
RuntimeError: 3 : invalid input angle
sketch_text.angle=0
RuntimeError: 3 : invalid input angle
sketch_text.angle=1
RuntimeError: 3 : invalid input angle
sketch_text.angle=math.pi/2
RuntimeError: 3 : invalid input angle
sketch_text.angle=-math.pi/2

 

 

Also, 2nd bug, I have also had text flip when I assigned text to it. Unfortunately, I doubted myself and I don't have an reproducable example at the moment. edit: Likely this: https://forums.autodesk.com/t5/fusion-360-api-and-scripts/sketchtext-object/m-p/8562981

 

And an annoyance: If the sketch text has an angle of -180*, setting it to 180* in the GUI just reverts to -180*. I had to set another (positive) angle in-between.

0 Likes

I hit the exact same problem today.

What's worse, is that I cannot make the angle positive in the script (e.g. going from -pi/2 to +3/2*pi), as all attempts to assign to an angle fails if the initial value is negative.

 

sketch_text.angle
-3.141592653589793
sketch_text.angle = 2*math.pi - sketch_text.angle
RuntimeError: 3 : invalid input angle
sketch_text.angle=0
RuntimeError: 3 : invalid input angle
sketch_text.angle=1
RuntimeError: 3 : invalid input angle
sketch_text.angle=math.pi/2
RuntimeError: 3 : invalid input angle
sketch_text.angle=-math.pi/2

 

 

Also, 2nd bug, I have also had text flip when I assigned text to it. Unfortunately, I doubted myself and I don't have an reproducable example at the moment. edit: Likely this: https://forums.autodesk.com/t5/fusion-360-api-and-scripts/sketchtext-object/m-p/8562981

 

And an annoyance: If the sketch text has an angle of -180*, setting it to 180* in the GUI just reverts to -180*. I had to set another (positive) angle in-between.

Message 3 of 7
MichaelT_123
in reply to: JeromeBriot

MichaelT_123
Advisor
Advisor

Hi Mr.JeromeBriot,

 

Negativity is not allowed!!!

Be always positive, there are snares in F360 to check a sentiment of the User.

In order to avoid consequences, use:

 

Positivity = 360 - Negativity

 

Best Regards 😎

MichaelT

 

 

 

MichaelT
0 Likes

Hi Mr.JeromeBriot,

 

Negativity is not allowed!!!

Be always positive, there are snares in F360 to check a sentiment of the User.

In order to avoid consequences, use:

 

Positivity = 360 - Negativity

 

Best Regards 😎

MichaelT

 

 

 

MichaelT
Message 4 of 7
thomasa88
in reply to: MichaelT_123

thomasa88
Advocate
Advocate

Hi @MichaelT_123 , the problem is that it is very easy for a user to create a text with a negative angle. Just drag to rotate the text correctly and Fusion can input a negative value.

0 Likes

Hi @MichaelT_123 , the problem is that it is very easy for a user to create a text with a negative angle. Just drag to rotate the text correctly and Fusion can input a negative value.

Message 5 of 7
MichaelT_123
in reply to: thomasa88

MichaelT_123
Advisor
Advisor

Hi Mr ThomasA88

 

I agree, ....

This is one of some other instances where TF360 frivolously breaks basic mathematical/algebraic/topological rules.

Disallowing minus sign (ASCII 45 or Alt+45 or hyphen or just dash) ... can't be called other than the abhorrent dictatorship, ... as the result we CADeople suffer and resort to writing unnecessary silly replays 🙄.

For you attention here is the another case.

 

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/identity-matrix-causing-problems/m-p/91253...

 

Regards

MichaelT

 

MichaelT
0 Likes

Hi Mr ThomasA88

 

I agree, ....

This is one of some other instances where TF360 frivolously breaks basic mathematical/algebraic/topological rules.

Disallowing minus sign (ASCII 45 or Alt+45 or hyphen or just dash) ... can't be called other than the abhorrent dictatorship, ... as the result we CADeople suffer and resort to writing unnecessary silly replays 🙄.

For you attention here is the another case.

 

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/identity-matrix-causing-problems/m-p/91253...

 

Regards

MichaelT

 

MichaelT
Message 6 of 7
thomasa88
in reply to: MichaelT_123

thomasa88
Advocate
Advocate

A small update on this. It seems the user can only set a negative angle the first time the text dialog is opened. If they set a positive angle when they first create the text, it seems that they can never set a negative angle.

 

Unfortunately, I have not found any way to force Fusion to do this recalculation/fix, but twiddling with other SketchText attributes. The "Compute All" command does not affect this either.

 

I don't know if this is a recent change. I'm using Fusion 360 v2.0.9006.

0 Likes

A small update on this. It seems the user can only set a negative angle the first time the text dialog is opened. If they set a positive angle when they first create the text, it seems that they can never set a negative angle.

 

Unfortunately, I have not found any way to force Fusion to do this recalculation/fix, but twiddling with other SketchText attributes. The "Compute All" command does not affect this either.

 

I don't know if this is a recent change. I'm using Fusion 360 v2.0.9006.

Message 7 of 7
thomasa88
in reply to: thomasa88

thomasa88
Advocate
Advocate

This seems to have been fixed in v 2.0.9142.

 

@anandjoshi 

0 Likes

This seems to have been fixed in v 2.0.9142.

 

@anandjoshi 

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

Post to forums  

Autodesk Design & Make Report