Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
3D Design

3D Design

Topics related to Ansys Discovery and Ansys SpaceClaim.

insert a txt file with circle coordinates

    • Guillaume ANFOSSI
      Subscriber

      Hello,

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

      Thanks,

    • Brian Bueno
      Ansys Employee

      GUICAD

      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
  • The topic ‘insert a txt file with circle coordinates’ is closed to new replies.
[bingo_chatbox]