Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

  • Exporting to DXF with the Generate command

    Hello,

    I am trying to export this iteration of the notch snowflake into Rhino, but when I do all I get is a Single line. I can t figure it out. The code is here

                import processing.dxf.*; 
                RawDXF dxf;
                ArrayList<KochLine> lines;
                boolean record;
                void setup () {
                  size (800, 800,P3D);
                  background(255);
                  lines = new ArrayList<KochLine>();
                  PVector a = new PVector(50, 400);
                  PVector b = new PVector(700, 400);
                  PVector c = new PVector(width/2, 400+width*cos(radians(90)));
    
                  lines.add(new KochLine(a, b));
                  lines.add(new KochLine(b, c));
                  lines.add(new KochLine(c, a));
    
                  for (int i = 0; i < 3; i++) {
                    generate();
                  }
                }
    
                void draw() {
                  background(255);
                  if (record) {
                   dxf = (RawDXF) createGraphics(width, height, DXF, "output.dxf");
                   beginRaw(dxf);
                  }
                  for (KochLine l : lines) {
                    l.display();
                     if (record) {
                    endRaw();
                    record = false;
                  }
                  }
                }
    
    
                void generate() {
    
    
                  ArrayList next = new ArrayList<KochLine>();
                  for (KochLine l : lines) {
                    PVector a = l.kochA();
                    PVector b = l.kochB();
                    PVector c = l.kochC();
                    PVector d = l.kochD();
    
                    next.add(new KochLine(a, b));
                    next.add(new KochLine(b, c));
                    next.add(new KochLine(c, d));
                    next.add(new KochLine(d, a));
                  }
                  lines = next;
    
                }
    
                void keyReleased()
                {
                  if (key == 's' || key == 'S') {
                    saveFrame("KochRooms.png");
                    println ("image saved");
                  }
                    if (key == 'r' || key == 'R') {
                      record = true;
                      println ("dxf Exported");
                    }
                  }
    

    any help would be much appreciated, it saves the file and i can open it but it isn't what I need it to be to work with in Rhino.

  • How to export to dxf file?

    I am trying to export to dxf file for using in Rhino.

    This is my script. even though I use dxf file format, it does not work. let me know what is the problem thanks.

    import processing.dxf.*; int ecart=int(random(4,10)); float angle1=PI*0.2; float sat=random(200,240); int hauteur=int(random(30,50)); boolean record;

    void setup() {

    size(640, 640, P3D);

    if(random(2)<1){ background(255); } else { background(0); } stroke(255); colorMode(HSB); strokeWeight(2); }

    void draw() { if (record) { beginRaw(DXF, "output.dxf"); } for (int a=50; a<1000;a+=int(random(200,220))){ dessineCloture(a); } noLoop(); }

    void dessineCloture(int h) {

    float x=0; float y=h; int cas=0; float t=100; while (x<640) { float angle=0; switch(cas) { case 0 : angle=angle1; cas=1; t=random(60, 120); break; case 1 : angle=-angle1; cas=2; t=random(60, 120); break; case 2 : angle=PI+angle1; t=random(80, 150); cas=3; break; case 3 : angle=-angle1; cas=0; t=random(60, 120); break; }

    float  newx=x+cos(angle)*t; 
    float  newy=y+sin(angle)*t;  
    for (int a=0; a<hauteur; a++) {
      stroke(map(a,0,hauteur,0,255),sat,255,200);
      line(x, y+a*ecart, newx, newy+a*ecart);
    }
    y=newy; 
    x=newx;
    

    } if (record) { endRaw(); record = false; if (record) {

    } } void keyPressed() { if (key == 'r') { record = true; } }

  • Processing to Grasshopper

    Anybody has any ideas if it is possible to import a processing code to rhino grasshopper?

  • Not clear on how export dxf result from canvas surface working?

    Hello. I am new here and processing... Would like to ask something about the result of exported dxf. For what I draw in processing: And there is something above about setting exporting dxf or something.

    void draw(){
    if (record) {
    beginRaw(DXF, day()+"-"+month()+".dxf");
    }
      ellipse(y,200,20,20);  
      y+=15;
    if (y >=500){
     y = 0;
     fill(random(250),random(250),random(250));
    }
    

    So the plain result from processing window is : keep rooping and go back and rooping due to draw function. keep rooping

    But after I export it as dxf and open in Rhino/CAD, it looks like this: Screenshot

    Isn't it a little bit too diffrent? Could anybody please help me explain how it form such shape with just drawing continuous circles????

  • Connect 3d points (exported from P5 and get from Kinect II) to create a curved line/path

    Hi everyone,

    I am working on a project focusing on hand tracking. I got the 3d position of my right hand from the Kinect and exported the as .obj file. (one .obj file per frame) and here is the video you can see these points:

    Now I am trying to connect these points and created 4 curved trace (I am tracking 4 points of hand) based on them, and 3d print them as a shape test. But I couldn't find any way to connect these points since only GeoMagic can read these point. After I tried to import these .obj files in Maya or Rhino, nothing show up.

    I am wondering is there anyone has any good suggestion on these?

    Many thanks!

  • How to automate Rhino/grasshoper workflow with processing?

    Here is the workflow that is required

    Drop an excel file in a specific folder-rhino is loaded-grasshopper executed- reads the excel data - processes data - outputs 3dmodel in the same folder.

    I just require to code the initial part to automate the process instead of manually locating the excel file in grasshopper.

  • Deconstruct Captain America (video editing)

    Hi I'm trying to create a script that allows me to import a video and this is split into a video track and an audio track that will ripped randomly and re-assembled together. I conceptually thought of different ways.

    My questions:

    1. Can I separate video track and audio track from a file directly in processing?

    2. Is there any way to cut/split the tracks (a command inside or in some “library”)?

    3. If not, is it possible, by randomly skipping (myMovie.jump(random(myMovie.duration())), to eliminate the possibility of re-jumping in the already seen parts?

    4. the same questions about the audio track

    5. If you think, as I now think, that with processing is not possible, you can indicate a possible software with which I would be able to do it (I tried to look for some editing software that would work with block programming (like grasshopper for rhino for example) but for now I'm far away From the solution)

    I'm a beginner in programming, but I understand in a hurry. sorry for my english

  • Image Texture Mode strange Mapping 360

    @nabr no seam on imported meshsphere created in rhino 3d: noSeam

  • Is there a way to use javax.script.* in Android mode?

    @mschillo=== no, there is no way for importing javax.script in android. But, depending of your needs there are a lot of solutions: either using a webView (if javaScript is a kind of "detail" in your app) or using rhino lib if it is essential for you:

    https://developer.mozilla.org/fr/docs/Mozilla/Projects/Rhino

  • Appending x,y values to an indexed array

    @gotoloop: I appreciate the elegance of your code. :)>- Also, the way you are solving some problems of randomly choosing palette indices and how to set up a grid are quite helpful. Nevertheless, the method you have employed to create the x,y tuples is rather complex for me at this point in my learning. Is there a simpler way?

    Here is how I can achieve it in python (just a snippet b/c code is for Rhino:

        #loop to create list of short values
        for i in range(iMax):
            for j in range(jMax):
    
                x = i
                y = j
                z = k
                ptList.append([x,y,z])
    

    As you can see, it is so simple, I wonder if I use IntList or another functionality in processing/java. I am mostly confused with this code.

        final int i = x*GAP, j = y*GAP;
        dots[x*ROWS + y] = new ShortTuple(i, j);
    

    Why do you multiply by x*Rows and then add why? Also, this array seems to be either a class or embedded within a class. It is elegant, but a bit advanced for me :(

    final ShortTuple[] dots = new ShortTuple[GRID];

    Thank you again. My end goal is to measure the list of x,y values against the attractor point.

  • What say - visual programming for Processing?

    Hi, i love processing its a great platform for creative coding, very powerful and with a soft learning curve.

    In the last years i have been organizing workshops on agent-based systems for non-programmers such as historians, sociologists etc, but somehow people still have trouble diving into the language, especially because these are just 3-4 days long.

    Coming from the architecture world i have seen how young architects have easily made it into parametric design using grasshopper for Rhino, and i was wondering whether it would be interesting or not to implement visual programming for processing too. NodeBox is also a nice example, although building state-dependant code is kind of obscure.

    Actually i dont even think it would be that hard to develop at all... what are your thoughts?

  • Problem with DXF Exported sketch from Processing to Rhino

    hi everyone, i just exported my sketch to Rhino for making 3d model but i realized that each of my lines exported as 2 parallel and make them useless for lofting!! is it possible to fix them in processing and make only one Cv line for each of them or is just a way processing generate them?!

    (image from exported lines in rhino) paraLines

    Thanks

  • iGeo not working

    Got it. Model has to be Rhino version 3, and processing 2.2.1

  • iGeo not working

    Hi, I'm an amateur processing user. Does anyone know what version of processing it works with? I have tried it on both 3.0.2 and 2.2.1 and I can't get it to load any geometry from Rhino. It will work if I load a file that has no geometry.

  • collage generator / display

    you wrote

    created a script in Grasshopper (Graphical Programming Interface for Rhino 3D) that groups pictures based on some database. All data of the items are written into a .csv (things like position, size and index of the file).

    so the .csv gets deleted / recreated or appended?

    appended would mean getting bigger.

    Is this in Win? I don't know what happens when 2 programs access the same file at the time. Can Grasshopper lock the csv for writing and the open it again?

    and can processing detect that?

    I can't help.

    ;-)

  • collage generator / display

    Hey Guys, I got one little problem that really blocks me from working on. To explain this: I created a script in Grasshopper (Graphical Programming Interface for Rhino 3D) that groups pictures based on some database. All data of the items are written into a .csv (things like position, size and index of the file). I then wrote some code in Processing to display pictures with the options provided in the csv-file (gh_data.csv). The filenames with the corresponding indices are written into a seperate csv-file.

    All this works great until a certain time when the processing program seems to hang (colour-wheel of death) and I don't really know why.

    Could this happen because I reload the table all the time? My thought was that I overwrite the data all the time and so there should not be any problem considering RAM, but maybe there is?

     String filepath = "/Users/max/Desktop/collage_maker/png_small/";
    
     Table filenames;
     Table table_gh;
    
     PImage[] images;
     float factor = 1;
     float factor_size = 1.2;
    
     void setup()
     {
       imageMode(CENTER);
       filenames = loadTable("gh_filenames.csv");
       images =  new PImage[filenames.getRowCount()];
       load_images();
    
       size(int(1000*factor),int(1000*factor));
     }
    
    
     void draw()
     {
         load_data();
         background(255);
    
         for(int i = 0; i<table_gh.getRowCount(); i++){
             int _pos_x = int(factor*table_gh.getFloat(i,0));
             int _pos_y = int(factor*table_gh.getFloat(i,1));
             int _size = int(factor_size*table_gh.getFloat(i,2));
             int _index = int(table_gh.getString(i,3));
    
             image(images[_index],_pos_x,_pos_y,_size,_size);
         }
     }
    
    
     void load_data(){
       table_gh = loadTable("gh_data.csv");
     }
    
    
    void load_images(){
    
       int image_counter = 0;
    
       for(int i = 0; i<images.length; i++){
    
         String filename = filenames.getString(i,0)+".png";
         File f = new File(dataPath(filepath+filename));
    
         // FILE EXISTS?
         if (f.exists()){
           println(filename);
           image_counter ++;
           images[i] = loadImage(filepath+filename);
         } else {
           println(filename+" nicht vorhanden");
           images[i] = loadImage(filepath+"placeholder.png");
         }
       }
       println(image_counter+" Bilder gefunden");
    } 
    
  • Saving Modified Geometry using iGeo Library

    Hi all,

    I've successfully imported geometry from Rhino into Processing using the iGeo Library. I was then able to create new IBoid instances that flock for the specified duration. I've been able to modify the flock's behavior over time via iGeo's attractor and field classes ... very cool.

    Here's the issue: I'm having trouble saving the modified geometry via the suggested method, IG.save("file_name.3dm"). The method does create a Rhino file, but the geometry is the original geometry that I opened, not the geometry modified by the swarm behavior.

    Any suggestions?

    Thank you! Josh

    === CODE ===

    import processing.opengl.*; import igeo.*;

    size(480, 360, IG.GL);

    IG.darkBG(); IG.duration(3000); //I've shortend the duration to 3000, which halts the process, but not program, in about 1 min on my desktop IG.open("curve_field_init5.3dm"); new IGravity(0,0,0.1); //instantiate gravity force

    //IG.save("test_output_file.3dm"); // Saves initial geometry state, NOT desired modified 'flock'

    IG.p(IG.duration());

    ISurface[] fieldSurfaces = IG.layer("field").surfaces(); for(int i=0; i < fieldSurfaces.length; i++) { new I2DSurfaceSlopeField(fieldSurfaces[i]).gaussian(50).intensity(20); //switched to gaussian field decay, which seems to have moved things along a bit. }

    new IFieldVisualizer(-100,-100,1, 100,100,1, 40,40,1);

    IGeometry[] geometries = IG.layer("particle").geometries(); for(int i=0; i < geometries.length; i++){ println(i); IBoid b = new IBoid(geometries[i]).fric(0.05); // reduced .fric(0.2) to .1, which seems to have reduced the birds inertia

      b.cohesionDist(30);
      b.cohesionRatio(1.5);
      b.separationRatio(4.0);
      b.separationDist(30.0);
      b.alignmentRatio(7.0);
      b.alignmentDist(30.0);
    

    }

    IG.p("ping");

  • Importing geometry with Saito´s OBJLoader

    Hi, I´m playing with Saito´s OBJLoader_Sample to get as imported geometry just a few lines from an OBJ object. The thing is that these lines do not show up when I try to run the sketch. The file was baked in Rhino. Am I missing somehing here? Thanx!

  • Export 3D geometry to PDF

    I'm using the library IGeo, and realised it might be more of a Rhino problem.. does anyone have experience with that?