how to use MultiLineTextDefinition.rectangleLines ?

how to use MultiLineTextDefinition.rectangleLines ?

lionel.courgnaud
Enthusiast Enthusiast
353 Views
2 Replies
Message 1 of 3

how to use MultiLineTextDefinition.rectangleLines ?

lionel.courgnaud
Enthusiast
Enthusiast

Hello

 

I've got a multiline text set like this. variables are not important.

 

        textInput.setAsMultiLine(cornerPoint,
                                 diagonalPoint,
                                 horizontalAlignment,
                                 verticalAlignment,
                                 characterSpacing)
        textInput.isHorizontalFlip = False
        textInput.isVerticalFlip = False
        textInput.fontName = 'Arial'
        myTextc1 = texts.add(textInput)

 

 

I need to constraint the bottom of the bounding box of this text to a sketchline (skLine1). It Seems I can access bounding box through MultiLineTextDefinition.rectangleLines, but I don't know how.

If it's easier, I could constraint one of the point (from bounding box) to a sketch point (skPt1).

 

Any example ? thank for your precious help.

 

 

 

0 Likes
Accepted solutions (1)
354 Views
2 Replies
Replies (2)
Message 2 of 3

kandennti
Mentor
Mentor
Accepted solution

Hi @lionel.courgnaud -San.

 

Check the type of the rectangleLines property.

    print(type(myTextc1.definition.rectangleLines))

 

The output will look like this.

<class 'adsk.fusion.SketchLineVector'>

 

In the case of the Fusion360 API, anything that is a ~Vector can be cast as a List.

    rectangleLines = list(myTextc1.definition.rectangleLines)

After that, you should be able to handle it as a normal SketchLine.

 

It is also possible to handle it directly without casting it to a list.

    line = myTextc1.definition.rectangleLines[0]
Message 3 of 3

lionel.courgnaud
Enthusiast
Enthusiast

thanks.

this helped me 🙂

0 Likes