This is the code to read a CSV file and create points with coordinates given by the values on the file.
If you want to export and import points on the same sketch please just copy/paste the importPointCoordinates from the EExport class, I just broke them on separate files for reference.
Again, the path for the file is hardcode due to technical difficulties, I’ll update both post when this gets fixed, hopefully very soon.
code:
import igeo.*;
import processing.opengl.*;
void setup() {
size(1200, 1200, IG.GL);
//Example to import and create point from CSV file
boolean result = EExport.importPointCoordinates(“/Users/evertamador/Dropbox/Processing/File input outout example/pointCoordinatesOut.txt”);
if (result)
{
println (“Successfully imported and created points form CSV file”);
}
else
{
println (“Sorry I couldn’t create points from CSV file”);
}
}
//IO class
static class EExport
{
public static boolean importPointCoordinates(String path)
{
boolean result = false;
File aFile = new File(path);
Scanner bufferedScanner = null;
try
{
double x;
double y;
double z;
Scanner lineScanner;
String currentLine;
bufferedScanner = new Scanner( new BufferedReader
(new FileReader (aFile)));
while (bufferedScanner.hasNextLine ())
{
currentLine = bufferedScanner.nextLine();
lineScanner = new Scanner(currentLine);
lineScanner.useDelimiter(“,”);
x = lineScanner.nextDouble();
y = lineScanner.nextDouble();
z = lineScanner.nextDouble();
println (“Importing point with coordinates: ” + x + ” ,” + y + ” ,” + z);
new IPoint (x, y, z);
}
}
catch(Exception e)
{
println(“Error reading file ” + ” ” + e);
}
finally
{
try
{
bufferedScanner.close();
result = true;
}
catch (Exception e)
{
println(“Error while closing file ” + ” ” + e);
}
}
return result;
}
}

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales License.