Discovery Import

Discovery Import


    • Guillaume ANFOSSI


      I am looking for the command in scripting to find the distance between two origins (local in a component compared to the origin of the assembly). Is it possible ?


    • Naresh Patre
      Ansys Employee

      Hello GUICAD

      Below is a simple script to get the distance of local coordinate system w.r.t global origin:

      import math

      part = GetRootPart()

      #access local coordinate system
      temp = part.CoordinateSystems[0]

      #access origin of coordinate system
      a = temp.Frame.Origin
      print a

      #note - the values of origin are returned in Meter units

      #calculate distance from global origin
      dist = math.sqrt((a[0]*a[0])+(a[1]*a[1])+(a[2]*a[2]))
      print dist

    • Guillaume ANFOSSI

      Thanks Naresh !

Viewing 2 reply threads
  • You must be logged in to reply to this topic.