Exemplo n.º 1
0
  public BooleanGridList offset(LayerRules lc, boolean outline) {
    boolean foundation = lc.getLayingSupport();
    if (outline && foundation) Debug.e("Offsetting a foundation outline!");

    BooleanGridList result = new BooleanGridList();
    for (int i = 0; i < size(); i++) {
      Attributes att = attribute(i);
      if (att == null) Debug.e("BooleanGridList.offset(): null attribute!");
      else {
        Extruder[] es = lc.getPrinter().getExtruders();
        Extruder e;
        int shells;
        if (foundation) {
          e = es[0]; // By convention extruder 0 builds the foundation
          shells = 1;
        } else {
          e = att.getExtruder();
          shells = e.getShells();
        }
        if (outline) {
          for (int shell = 0; shell < shells; shell++)
            result.add(get(i).offset(-((double) shell + 0.5) * e.getExtrusionSize()), att);
        } else {
          // Must be a hatch.  Only do it if the gap is +ve or we're building the foundation
          double offSize;
          if (foundation) offSize = 3;
          else offSize = -((double) shells + 0.5) * e.getExtrusionSize() + e.getInfillOverlap();
          if (e.getExtrusionInfillWidth() > 0 || foundation) // Z valuesn't mattere here
          result.add(get(i).offset(offSize), att);
        }
      }
    }
    return result;
  }
Exemplo n.º 2
0
  /**
   * Make a list with a single entry: the union of all the entries. Set its attributes to that of
   * extruder 0 in the extruder list.
   *
   * @param a
   * @return
   */
  public BooleanGridList union(Extruder[] es) {
    BooleanGridList result = new BooleanGridList();
    if (size() <= 0) return result;

    BooleanGrid contents = get(0);

    Attributes att = attribute(0);
    Boolean foundAttribute0 = false;
    if (att.getExtruder() == es[0]) foundAttribute0 = true;
    for (int i = 1; i < size(); i++) {
      if (!foundAttribute0) {
        if (attribute(i).getExtruder() == es[0]) {
          att = attribute(i);
          foundAttribute0 = true;
        }
      }
      contents = BooleanGrid.union(contents, get(i));
    }
    if (!foundAttribute0) Debug.e("RrCSGPolygonList.union(): Attribute of extruder 0 not found.");
    result.add(contents, att);
    return result;
  }
Exemplo n.º 3
0
 /**
  * Add another list of shapes on the end
  *
  * @param a
  */
 public void add(BooleanGridList aa) {
   for (int i = 0; i < a.size(); i++) add(aa.get(i), aa.attribute(i));
 }