Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;600" />
<article>
  <header>
    <h1>Streetworks project savings calculator</h1>
  </header>
  <section>
    <label>
      Project length
      <input type="number" step="0.25" value="1.7" / id="length" min="0">
      <select id="units">
        <option value="uscs">miles</option>
        <option value="metric">km</option>
      </select>
    </label>
    <label>
      How many phases?
      <input id="phaseCount" type="number" min="1" max="unbounded" value="3" />
    </label>
    <label>
      Project context
      <select id="context">
        <option value="fwy">Freeway or Expressway</option>
        <option value="rural">Rural conventional</option>
        <option value="urban" selected>Urban conventional</option>
      </select>
    </label>
    <label>
      Intersections requiring magnification
      <input id="intersectionCount" type="number" min="0" max="unbounded" value="5" />
    </label>
    <button onClick="onSubmit()">Calculate Savings</button>
  </section>
  <section id='savings-div' style="display:none;">
    <p id='answer'></p>
    <button onClick="showAssumptions()">Show calculation assumptions</button>
  </section>
  <footer id="assumptions" style="display:none;">
    <p>
      To determine expected savings, we first approximate the savings per sheet:
    </p>
    <table>
      <thead>
        <tr>
          <th>design role</th>
          <th class="cad">hours per sheet using CAD</th>
          <th class="streetworks">hours per sheet saved using Streetworks</th>
          <th>hourly rate</th>
          <th class="cad">cost per sheet using CAD</th>
          <th class="streetworks">savings per sheet using Streetworks</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th>Project Engineer</th>
          <td class="cad">1.0</td>
          <td class="streetworks">0.5</td>
          <td>$180</td>
          <td class="cad">$180</td>
          <td class="streetworks">$90</td>
        </tr>
        <tr>
          <th>CAD Technician</th>
          <td class="cad">2.5</td>
          <td class="streetworks">1.0</td>
          <td>$100</td>
          <td class="cad">$250</td>
          <td class="streetworks">$100</td>
        </tr>
        <tfoot>
          <tr>
            <td colspan="4">total</td>
            <td class="cad">$430</td>
            <td class="streetworks">$180</td>
          </tr>
        </tfoot>
      </tbody>
    </table>
    <p>
      Next, we determine the number of sheets required per phase. Assuming there is 16" or 40 cm of usable width on the page, we calculate:
    </p>
    <table id="sheetstable">
      <thead>
        <tr>
          <th>project context</th>
          <th>scale</th>
          <th>sheet window length</th>
          <th>result</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th>urban conventional</th>
          <td>πŸ‡ΊπŸ‡Έ&nbsp;1"=50' | 🌍️&nbsp;1:500</td>
          <td>πŸ‡ΊπŸ‡Έ&nbsp;800 ft | 🌍️&nbsp;200 m</td>
          <td>πŸ‡ΊπŸ‡Έ&nbsp;6.6 sheets/mile | 🌍️&nbsp;5.0 sheets/km</td>
        </tr>
        <tr>
          <th>rural conventional, freeways, and expressways</th>
          <td>πŸ‡ΊπŸ‡Έ&nbsp;1"=100' | 🌍️&nbsp;1:1000</td>
          <td>πŸ‡ΊπŸ‡Έ&nbsp;1600 ft | 🌍️&nbsp;400 m</td>
          <td>πŸ‡ΊπŸ‡Έ&nbsp;3.3 sheets/mile | 🌍️&nbsp;2.5 sheets/km</td>
        </tr>
      </tbody>
    </table>
    <p>We multiply the result in the table above by the project length, then round up to the whole sheet, adding the number of intersections that will be magnified on their own sheets, and finally we multiply the number of sheets per phase by the number of phases to get the total number of TTC sheets for the project. To reach the displayed savings number, we multiply by the estimated savings per sheet by the number of sheets in the project. To reach the displayed "days of work" savings, we assume 7 hours per day of work time and 1 hour per day of overhead or administrative time.</p>
  </footer>
</article>
              
            
!

CSS

              
                body, select, input {
  font-family: Fira Sans;
  font-weight: 400;
}
.cad {
  color: mediumblue;
}
td.streetworks {
  color: #ff6600;
}
tfoot {
  font-weight: 600;
}
h1, #answer, th.streetworks {
  font-weight: 600;
  color: #ff6600;
}

label {
  display: block;
  padding: 0.45rem;
}
tbody td:nth-child(even), thead th:nth-child(even) {
  background: #d8d8d8;
}
td:not(:first-child) {
  text-align: center;
}
footer {
  font-size: 0.8rem;
}
#length, #phaseCount, #intersectionCount {
  width: 4rem;
}
              
            
!

JS

              
                /*
 Assumptions: 
 o $430 per plan sheet, $180 savings per plan sheet
   . 0.5 hours of Project Engineer time
   . 1.0 hours of CAD Technician time
   . for days of work savings, 7 work hours per day (1 work hour to "overhead")
 o 16" of usable plan sheet width
 o Scales
   - Rural: 100/1:1000
   - Urban: 50/1:500
   - Freeway: 100/1:1000
   - Intersection details: 20/1:200
   
 Inputs:
 o Project length
 o Phase count
 o Context
 o Count of intersections requiring detailed treatment
 */

let savings = 0;
const contextData = new Map();
contextData.set('fwy', {
  scales: {
    'uscs': 100,
    'metric': 1000,
  },
});
contextData.set('rural', {
  scales: {
    'uscs': 100,
    'metric': 1000,
  },
});
contextData.set('urban', {
  scales: {
    'uscs': 50,
    'metric': 500
  }
});
const usableSheetWidth = {
  'uscs': 16, // inches
  'metric': 0.40, // meters
};
const conversionFromLongUnits = {
  'uscs': 5280,
  'metric': 1000,
};

function showAssumptions() {
  document.getElementById('assumptions').style.display = 'inline';
}

function onSubmit(e) {
  const projectLength = new Number(document.getElementById('length').value);
  const phaseCount = new Number(document.getElementById('phaseCount').value);
  const context = document.getElementById('context').value;
  const intersectionCount = new Number(document.getElementById('intersectionCount').value);
  const units = document.getElementById('units').value;
  
  const intervalPerSheet = usableSheetWidth[units] * contextData.get(context).scales[units];
  const sheetCountPerPhase = Math.ceil(projectLength * conversionFromLongUnits[units] / intervalPerSheet) + intersectionCount;
  const savingsPerSheet = 180;
  const peWorkDaysSaved = Math.round(sheetCountPerPhase * phaseCount * 0.5 / 7);
  const cadWorkDaysSaved = Math.round(sheetCountPerPhase * phaseCount * 1.0 / 7);
  document.getElementById('savings-div').style.display = 'block';
  document.getElementById('answer').innerHTML = `Streetworks would save you about $${sheetCountPerPhase * phaseCount * savingsPerSheet} on plan production costs for this project, which is about ${peWorkDaysSaved} days of work saved for the Project Engineer and ${cadWorkDaysSaved} days of work saved for the CAD Technician!`;
}
              
            
!
999px

Console