Moving text within a sketch breaks the world

Moving text within a sketch breaks the world

Anonymous
Not applicable
382 Views
1 Reply
Message 1 of 2

Moving text within a sketch breaks the world

Anonymous
Not applicable
import adsk.core, adsk.fusion, traceback

def Point3D(x, y):
  return adsk.core.Point3D.create(x, y, 0)

def run(context):
  ui = None
  try:
    app = adsk.core.Application.get()
    ui  = app.userInterface
    des = adsk.fusion.Design.cast(app.activeProduct)
    root = des.rootComponent
    sketch = root.sketches.add(root.xYConstructionPlane)

    msg = (
        'this is my string it might be long\n'
        'and multi lined.\n\n'
        'I would like to be able to center it\n'
        'in the sketch space.')
    text_input = sketch.sketchTexts.createInput(msg, 0.25, Point3D(1, 1))
    text_input.fontName = 'Consolas'
    txt = sketch.sketchTexts.add(text_input)
    text_p = txt.boundingBox.maxPoint.copy()
    text_p.x = -(text_p.x - 1) / 2
    text_p.y = -(text_p.y - 1) / 2
    text_p.z = 0
    txt.position = text_p

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

This code breaks the drawing it is run in. Documentation states that text position can be SET but when you do set it the UCS icon vanishes and it's impossible to zoom/pan  to anything.

0 Likes
383 Views
1 Reply
Reply (1)
Message 2 of 2

marshaltu
Autodesk
Autodesk

Hello,

 

Thank you for reporting the issue to us. UP-36437 has been logged in our internal system to track it.

 

Thanks,

Marshal



Marshal Tu
Fusion Developer
>
0 Likes