Discovery Import

Discovery Import

insert a txt file with circle coordinates

    • Guillaume ANFOSSI


      Is there a possibility to import a file (txt or csv) containing circle coordinates (x, y and diameter) ?


    • Brian Bueno
      Ansys Employee


      It's probably easiest to do this with a script.  The syntax in items 1 & 2 is standard for Python.  I think it will work in the script editor, but you might need to make some minor changes.

      1. Read the file into the script

        # Open function to open the file "MyFile1.txt" 

        # (same directory) in append mode and

        file1 = open("MyFile.txt","a")

      2. Iterate to pick up 1 set of (X, Y, r) values: File_object.readline([n])
      3. Create the circle:

        # Set Sketch Plane
        selection = DatumPlane1
        result = ViewHelper.SetSketchPlane(selection, Info3)
        # EndBlocks

        # Sketch Circle
        origin = Point2D.Create(MM(X), MM(Y))
        result = SketchCircle.Create(origin, MM(r))
        # EndBlock

      4. Repeat the process for the next set of (X, Y, r) values

Viewing 1 reply thread
  • You must be logged in to reply to this topic.