Create multi-line comment in Mechanical tree ?

Options
Landon Mitchell Kanner
Landon Mitchell Kanner Member, Employee Posts: 256
First Answer First Comment 5 Likes First Anniversary
edited July 2023 in Structures

Looking for a way to write comments on multiple lines in a single comment object in Mechanical. I have tried:

commentObj = ExtAPI.DataModel.Project.Model.Geometry.AddComment()
commentObj.Name = 'NewName'
commentObj.Text = " comment1 \n comment2 \n comment3"
print commentObj.Text

When executing the above script, the comments are printed on new lines in the console, but in the comment object they remain on a single line:


Is there a way to print on multiple lines using AddComment()?

Tagged:

Best Answer

  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee Posts: 256
    First Answer First Comment 5 Likes First Anniversary
    edited July 2023 Answer ✓
    Options

    The comment object displays text in HTML format. You could create multi-line comment, e.g., by using html <br> element:

    commentObj = ExtAPI.DataModel.Project.Model.Geometry.AddComment()
    commentObj.Name = 'NewName'
    commentObj.Text = 'comment1 <br> comment2 <br> comment3'