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.
Jérôme Briot, Freelance engineer - Mechanical design and prototyping
3D Print Plus / Pro | IDF Import | GitHub To Fusion 360 | Tube Bending Data Exchanger | Slice Data Export
Memory Used | Basic Calculator | Check Computer Specifications | Import spline from any CSV file
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.
Jérôme Briot, Freelance engineer - Mechanical design and prototyping
3D Print Plus / Pro | IDF Import | GitHub To Fusion 360 | Tube Bending Data Exchanger | Slice Data Export
Memory Used | Basic Calculator | Check Computer Specifications | Import spline from any CSV file
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.
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.
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
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
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.
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.
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.
Regards
MichaelT
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.
Regards
MichaelT
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.
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.
Can't find what you're looking for? Ask the community or share your knowledge.