[Bug] Create a SketchText with negative angle returns "invalid input angle"

[Bug] Create a SketchText with negative angle returns "invalid input angle"

JeromeBriot
Mentor Mentor
419 Views
0 Replies
Message 1 of 1

[Bug] Create a SketchText with negative angle returns "invalid input angle"

JeromeBriot
Mentor
Mentor

Hello,

 

Here is an example that should create a text rotated by -90° in a sketch:

 

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

import math

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

        design = app.activeProduct

        rootComp = design.rootComponent

        sketches = rootComp.sketches
        xyPlane = rootComp.xYConstructionPlane
        sketch = sketches.add(xyPlane)

        sketchTexts = sketch.sketchTexts

        sketchTextInput = sketchTexts.createInput('example', 1.0, adsk.core.Point3D.create(1.0, 1.0, 1.0))

        sketchTextInput.angle = -math.pi / 2
        
        sketchText = sketchTexts.add(sketchTextInput)       

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

 

The code fails by returning the error "invalid input angle".

 

The documentation of the angle property should also mention that the value must be in radian and not in degree.
This is not obvious because it's the opposite in the dialog in Fusion 360.

 

Thank you.

0 Likes
420 Views
0 Replies
Replies (0)