We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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; } }
Answers
Please format your code. Edit your post (gear on top right side of any of your posts), select your code and hit ctrl+o. Leave an empty line above and below your block of code. Details here: https://forum.processing.org/two/discussion/15473/readme-how-to-format-code-and-text
Kf
It looks like this is a libraries question (
import processing.dxf.*
) and the post should be moved.Have you already looked at past discussions of dxf on the forum?