How to use the graphics API to draw objects (for example a line)?

Options
Chemsdine CHEMAI
Chemsdine CHEMAI Member, Employee Posts: 201
First Anniversary Ansys Employee Solution Developer Community of Practice Member 5 Likes
edited January 15 in Structures

How to use the graphics API to draw objects (for example a line)?

Tagged:

Answers

  • Chemsdine CHEMAI
    Chemsdine CHEMAI Member, Employee Posts: 201
    First Anniversary Ansys Employee Solution Developer Community of Practice Member 5 Likes
    Answer ✓
    Options

    One can use the following code :

    graphics = ExtAPI.Graphics
    p1 = graphics.CreateWorldPoint(point1.X, point1.Y, point1.Z)  
    p2 = graphics.CreateWorldPoint(point2.X, point2.Y, point2.Z)  
    line = graphics.Scene.Factory3D.CreatePolyline([p1,p2])
    
  • M
    M Member, Employee Posts: 230
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    Answer ✓
    Options

    You can add some info to make the line visible:

    line.LineWeight = 4
    
    line.Color = 0x00FFFF
    
  • Vishnu
    Vishnu Member, Employee Posts: 214
    Name Dropper First Anniversary Solution Developer Community of Practice Member First Comment
    Answer ✓
    Options

    Just to complete :

    draw_cmd = ExtAPI.Graphics
    p1 = draw_cmd.CreateWorldPoint(0,0,0)
    p2 = draw_cmd.CreateWorldPoint(1000,0,0)
    graphics = ExtAPI.Graphics
    line = graphics.Scene.Factory3D.CreatePolyline([p1,p2])
    line.LineWeight = 4
    line.Color = 0x00FFFF