Пример #1
0
  static Drawing drawFN() {
    Drawing d = new Drawing();

    d.setLineWidth(0.1f);

    d.circle(0.6);

    d.circle(0.4);

    d.moveTo(0, -0.2, 0);
    d.setFaceColor(Color.CYAN);
    Shape b1 = d.box(0.8, 0.3, 0.3);

    d.setFaceColor(Color.GREEN);
    Shape b2 = d.box(0.8, 0.15, 0.6);

    d.setFaceColor(Color.MAGENTA);
    Shape box = d.box(-0.25, 0.25, 0.25);

    d.setFaceColor(Color.ORANGE);
    d.box(-0.1, 0.1, 0.35);

    //		d.setTexture("brick1.gif");

    d.setFaceColor(Color.YELLOW);
    Shape cyl = d.cylinder(0.5, 0.7, Math.PI * 3 / 2);

    //		d.noTexture();
    d.moveTo(0, 0, 0);
    d.setFaceColor(Color.BLUE);
    d.cylinder(0.2, 0.3, Math.PI * 2);
    d.save("FN.brep");
    return d;
  }
Пример #2
0
  static Drawing drawBuilding3D() {
    Drawing d = new Drawing();
    d.setLineWidth(2);
    d.moveTo(0, 0, 0);
    d.setCheckIntersection(true);
    d.setFaceColor(Color.GRAY);
    Shape wall = d.rectangleXZ(30, 15);
    d.moveTo(0.3, 0, 0.3);
    Shape plate = d.rectangleXZ(30 - 0.4, 15 - 0.4);
    d.setFaceColor(Color.YELLOW);
    wall = d.extrude(wall, 3);
    d.setFaceColor(Color.CYAN);
    for (int i = 0; i < 10; i++) {
      d.moveTo(0.5 + i * 3, 0.8, 0);
      Shape window = d.box(1, 1.5, 0.2);
      d.delete(window);
      d.moveTo(0.5 + i * 3, 0.8, 15);
      window = d.box(1, 1.5, 0.2);
      d.delete(window);
    }
    d.array(wall, 10, 0, 3, 0);
    d.array(plate, 11, 0, 3, 0);
    d.moveTo(-20, 0, -20);
    d.setFaceColor(Color.GREEN);
    d.box(70, -30, 60);

    d.save("building.brep");
    return d;
  }
Пример #3
0
  static Drawing drawBox() {
    Drawing d = new Drawing();
    d.setLineWidth(2);

    d.setCheckIntersection(false);
    Shape box = d.box(1, 1, 1);
    int n = 15;
    double dist = 1.1;
    Shape line = d.array(box, n, dist, 0, 0);
    Shape area = d.array(line, n, 0, dist, 0);
    Shape cube = d.array(area, n, 0, 0, dist);

    d.setCheckIntersection(true);

    return d;
  }
Пример #4
0
  static Drawing drawBuilding() {
    Drawing d = new Drawing();
    d.setLineWidth(2);
    d.moveTo(0, 0, 0);
    d.setCheckIntersection(true);
    d.setFaceColor(Color.GRAY);
    Shape plate = d.rectangleXZ(30, 15);
    Shape wall = d.getEdges(plate);
    d.setFaceColor(Color.DARK_GRAY);
    Shape base = d.extrude(wall, -1.5);
    d.copy(plate, 0, -1.5, 0);
    d.setFaceColor(Color.YELLOW);
    wall = d.getEdges(plate);
    wall = d.extrude(wall, 3);
    d.setFaceColor(Color.CYAN);
    for (int i = 0; i < 10; i++) {
      d.moveTo(0.5 + i * 3, 0.8, 0);
      Shape window = d.rectangleXY(1, 1.7);
      d.delete(window);
      d.moveTo(0.5 + i * 3, 0.8, 15);
      window = d.rectangleXY(1, 1.7);
      d.delete(window);
    }
    d.setCheckIntersection(false);
    d.array(wall, 10, 0, 3, 0);
    d.array(plate, 11, 0, 3, 0);
    d.setCheckIntersection(true);

    d.moveTo(-20, 0, -20);
    d.setFaceColor(Color.GREEN);
    d.box(70, -30, 60);
    Shape excavation = d.extrude(plate, -1.5);
    d.delete(excavation);

    //	    d.delete(plate);

    d.save("building.brep");
    return d;
  }
Пример #5
0
  static Drawing drawFigure() {
    Drawing d = new Drawing();

    d.setCheckIntersection(true);
    d.setLineWidth(2);
    d.setFaceColor(Color.CYAN);
    d.moveTo(0, 0, 0);
    d.line(1, 0, 0);
    d.line(0, 0, 1);
    d.line(-1, 0, 0);
    Shape rect = d.close();

    d.setFaceColor(Color.YELLOW);
    d.move(0.2, 0, 0.2);
    d.line(0.6, 0, 0);
    d.line(0, 0, 0.6);
    d.line(-0.6, 0, 0);
    Shape rect1 = d.close();

    d.moveTo(0, 0, 2);
    d.setDirection(0, 1, 0);
    Shape s = d.extrude(rect, 0.5);

    //		d.fillet(s);

    //		d.setDirection(1, 0, 0);
    //		Shape shape = d.revolve(rect, Math.PI/4);

    ////		d.setCheckIntersection(false);
    //		d.setVirtualDrawingMode(true);
    //		d.moveTo(0, 1, 0.6);
    //		Shape circle = d.circle(0.15);
    //		Shape cylinder = d.extrude(circle, 1);
    //		d.setVirtualDrawingMode(false);
    //
    //
    ////		d.add(cylinder);
    //		shape = d.cut(shape, cylinder);
    //
    //		d.moveTo(0,0,0);
    //		d.setDirection(-1, 0, 0);
    //		Shape rev = d.revolve(rect1, Math.PI);
    //		d.delete(rev);
    //		d.delete(d.getCommon());
    //
    //
    ////		d.setCheckIntersection(false);
    ////		int n = 10;
    ////		double dist = 2;
    ////		Shape line = d.array(shape, n, dist, 0, 0);
    ////		Shape area = d.array(line, n, 0, dist, 0);
    ////		Shape cube = d.array(area, n, 0, 0, dist);
    ////
    ////		d.setCheckIntersection(true);
    //
    ////		d.copy(shape, 2,0,0);
    //
    ////		Shape shape1 = d.copy(shape, 2, 0, 0);
    ////
    ////		shape1 = d.scale(shape1, 0.5);
    ////
    ////		d.moveTo(2, 0, 0);
    ////		d.setDirection(0, 0, 1);
    ////		shape1 = d.rotate(shape1, Math.PI/4);
    ////
    //
    ////		rect1.setSelected(true);
    //////		d.save("figure.brep");
    //////		d.explode(shape);

    return d;
  }