<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: chenzefeng09</title>
    <description>The latest articles on DEV Community by chenzefeng09 (@chenzefeng09).</description>
    <link>https://dev.to/chenzefeng09</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4163088%2F57bed239-2c69-4013-8eac-2c9e6bfd2c7f.png</url>
      <title>DEV Community: chenzefeng09</title>
      <link>https://dev.to/chenzefeng09</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chenzefeng09"/>
    <language>en</language>
    <item>
      <title>Tolerance stack-up analysis is still stuck in spreadsheets — so I built a tool that reads the CAD model</title>
      <dc:creator>chenzefeng09</dc:creator>
      <pubDate>Mon, 05 Oct 2026 15:06:30 +0000</pubDate>
      <link>https://dev.to/chenzefeng09/tolerance-stack-up-analysis-is-still-stuck-in-spreadsheets-so-i-built-a-tool-that-reads-the-cad-4pe9</link>
      <guid>https://dev.to/chenzefeng09/tolerance-stack-up-analysis-is-still-stuck-in-spreadsheets-so-i-built-a-tool-that-reads-the-cad-4pe9</guid>
      <description>&lt;p&gt;A few months ago I watched a mechanical engineer spend most of a week on a tolerance stack-up for an assembly with about thirty contributors. Not designing — &lt;em&gt;adding numbers in Excel&lt;/em&gt;. Column per dimension, sign per direction, a comment column explaining why each sign was what it was. At the end, the answer was a single worst-case number that nobody fully trusted, because three of the dimensions were turned with the wrong sign at least once during entry and nobody could prove they'd all been caught.&lt;/p&gt;

&lt;p&gt;This is bizarre when you think about it. The CAD model already &lt;em&gt;contains&lt;/em&gt; every distance, every fit, every mating face. The spreadsheet exists only because nothing reads the model and asks the obvious question: given how these parts can actually vary, will the assembly still work?&lt;/p&gt;

&lt;h2&gt;
  
  
  What stack-up analysis actually is
&lt;/h2&gt;

&lt;p&gt;Take a linear chain — the classic case is three rings stacked in a housing bore. Housing shoulder-to-shoulder is 50.00 ±0.10 mm, each ring is 16.00 ±0.05 mm. The end gap is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;g = 50.00 − (16.00 + 16.00 + 16.00) = 2.00 mm nominal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Worst-case analysis adds the tolerances arithmetically: ±0.25 mm, so g ∈ [1.75, 2.25]. Guaranteed — no conforming set of parts can break it.&lt;/p&gt;

&lt;p&gt;RSS (root-sum-square) treats each ±t as roughly ±3σ and combines in quadrature: √(0.10² + 3×0.05²) ≈ ±0.13 mm. Much tighter, but a small fraction of assemblies will fall outside that band — you've traded a guarantee for a quantified yield.&lt;/p&gt;

&lt;p&gt;Same drawing, same parts. One method says "your 1.80 mm minimum fails," the other says "you're at 4.5σ, ship it." Which answer you're &lt;em&gt;allowed&lt;/em&gt; to believe is an engineering decision — worst-case for safety and unmeasurable processes, RSS where you have controlled production data. I wrote up the &lt;a href="https://nxtolerance.com/learn/tolerance-stack-up-guide/?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=supernx-launch" rel="noopener noreferrer"&gt;full mechanics with worked examples&lt;/a&gt; and a separate piece on &lt;a href="https://nxtolerance.com/learn/worst-case-vs-statistical-tolerance/?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=supernx-launch" rel="noopener noreferrer"&gt;choosing between the methods&lt;/a&gt; if you want the detail.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it actually breaks
&lt;/h2&gt;

&lt;p&gt;The spreadsheet approach fails quietly, not loudly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sign errors.&lt;/strong&gt; Thirty contributors, each entered by hand with a direction. One flipped sign and you get a confident, wrong number.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The chain isn't linear.&lt;/strong&gt; Fastener clearance lets parts float and rotate. A flatness callout tilts a face. Real assemblies are 3D kinematics; a 1D sum is systematically optimistic about tilt-driven variation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contact depends on the answer.&lt;/strong&gt; Whether a pin bottoms on the left or right face changes the chain itself — the worst case has to be &lt;em&gt;searched&lt;/em&gt;, not summed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The inputs live in different vocabularies.&lt;/strong&gt; An &lt;a href="https://nxtolerance.com/learn/iso-286-fits-explained/?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=supernx-launch" rel="noopener noreferrer"&gt;ISO 286 fit code&lt;/a&gt; like H7/g6, a position callout on a bolt circle, and a general-tolerance block all express variation differently. Normalizing them by hand is error-prone.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Teams doing model-based definition hit a subtler version of this: they invest in annotating the model with PMI (Product &amp;amp; Manufacturing Information — dimensions, datums, GD&amp;amp;T living on the 3D model), then assume the problem is solved. But &lt;a href="https://nxtolerance.com/learn/nx-pmi-tolerance-analysis/?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=supernx-launch" rel="noopener noreferrer"&gt;PMI states requirements; it doesn't evaluate their combined effect&lt;/a&gt;. Ten features each inside tolerance can still produce a binding gap. Nothing in the PMI knows about the loop it participates in.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I built
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://nxtolerance.com/?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=supernx-launch" rel="noopener noreferrer"&gt;SuperNX&lt;/a&gt; does the loop end-to-end inside Siemens NX:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Drop in a &lt;code&gt;.prt&lt;/code&gt; file — it extracts the geometry and features directly.&lt;/li&gt;
&lt;li&gt;It infers assembly intent — which joint is a pin-in-hole, which is a slider, which is a press fit — rather than applying a rule table.&lt;/li&gt;
&lt;li&gt;It assigns tolerances the way the mechanism actually works (ISO 286 fits, ISO 2768 defaults, or your custom standards) and runs worst-case + statistical analysis with per-contributor sensitivity.&lt;/li&gt;
&lt;li&gt;It writes back a traceable report and a toleranced model — and a failing key characteristic &lt;em&gt;stops&lt;/em&gt; the PMI write-back, so nothing unverified reaches the drawing.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Two deliberate constraints, stated plainly: it only speaks Siemens NX (&lt;code&gt;.prt&lt;/code&gt;), and every number it reports traces to a real model measurement or a published standard — if it can't be proven, it isn't reported.&lt;/p&gt;

&lt;p&gt;It's free to start: &lt;a href="https://nxtolerance.com/?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=supernx-launch" rel="noopener noreferrer"&gt;nxtolerance.com&lt;/a&gt;. If you've done stack-ups by hand, I'd genuinely like to hear where the spreadsheet version broke for you — sign errors, correlated contributors, or the "thirty contributors and no one trusts the sign column" problem.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>showdev</category>
      <category>cad</category>
    </item>
    <item>
      <title>I dug up the US State Department's rejected passport photo examples — here's what actually gets applications bounced</title>
      <dc:creator>chenzefeng09</dc:creator>
      <pubDate>Mon, 05 Oct 2026 06:49:13 +0000</pubDate>
      <link>https://dev.to/chenzefeng09/i-dug-up-the-us-state-departments-rejected-passport-photo-examples-heres-what-actually-gets-2fn0</link>
      <guid>https://dev.to/chenzefeng09/i-dug-up-the-us-state-departments-rejected-passport-photo-examples-heres-what-actually-gets-2fn0</guid>
      <description>&lt;p&gt;A few weeks ago I started building a free passport-photo tool, and I did the thing you do: I went looking for the &lt;em&gt;official&lt;/em&gt; examples of acceptable and rejected photos. The US State Department publishes them — real sample photos with labels like "too dark," "shadows on face," "head tilted" — the actual failure modes the acceptance agents check for.&lt;/p&gt;

&lt;p&gt;What I didn't expect: the page is a graveyard. Half the example images 404. The ones that remain are 220×220 thumbnails buried in a layout from 2012. If you want to learn what a compliant photo actually looks like, the official source is barely usable.&lt;/p&gt;

&lt;p&gt;So I pulled the full set from the Wayback Machine — 44 real government example photos — and rebuilt the gallery the way it should have been built. Then I read the actual requirements (ICAO 9303 + the State Department's own photo guide) and cross-checked every rejection label against the written rules.&lt;/p&gt;

&lt;p&gt;Here's what I learned that surprised me.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rejection reasons are mostly lighting, not pose
&lt;/h2&gt;

&lt;p&gt;The single biggest bucket of rejected examples isn't smiling or glasses — it's &lt;strong&gt;lighting defects&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Uneven lighting&lt;/em&gt; (one side of the face darker)&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Shadows across the face or behind the head&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Washed out / overexposed&lt;/em&gt; (too much light destroys facial detail)&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Too dark&lt;/em&gt; (detail lost in shadow)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pose problems — tilted head, eyes closed, not facing camera — are obvious and rare. Lighting problems are subtle, and they're the ones that bounce applications weeks later by mail.&lt;/p&gt;

&lt;h2&gt;
  
  
  "White or off-white background" is doing a lot of work
&lt;/h2&gt;

&lt;p&gt;The spec says the background must be plain white or off-white. In practice the examples show rejections for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Background that's technically light but has &lt;em&gt;texture&lt;/em&gt; (a wall with visible paint pattern)&lt;/li&gt;
&lt;li&gt;Background with a &lt;em&gt;gradient&lt;/em&gt; (bright near the head, darker at the edges — common with on-camera flash falloff)&lt;/li&gt;
&lt;li&gt;Slightly gray or cream backgrounds that read fine on screen but fail the "white or off-white" test at inspection&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The fix that actually works: stand further from the wall so your shadow doesn't fall on it, and use two light sources at 45° to kill gradients.&lt;/p&gt;

&lt;h2&gt;
  
  
  Head size tolerances are tighter than they look
&lt;/h2&gt;

&lt;p&gt;US passport photos require the head to be 1 inch to 1⅜ inches (25–35mm) from chin to crown. In the examples, several rejections are just… slightly wrong. The eye-line also has to sit in a band — roughly 1⅛ to 1⅜ inches from the bottom of the photo.&lt;/p&gt;

&lt;p&gt;This is the part that's nearly impossible to eyeball when you're holding a phone at arm's length. It's also, honestly, why I built the tool — cropping to 2×2 inches is easy; getting the head-height ratio and eye-line into spec is the part that needs a ruler overlay.&lt;/p&gt;

&lt;h2&gt;
  
  
  The nerd detail: 300 DPI and pixel dimensions
&lt;/h2&gt;

&lt;p&gt;One more thing that trips people up: a digital passport photo for the US should be &lt;strong&gt;600×600 pixels minimum&lt;/strong&gt; (at 300 DPI for the 2×2 inch print). Screenshot-quality crops often fall below that even when they look fine on a phone screen.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I shipped
&lt;/h2&gt;

&lt;p&gt;I put all 44 recovered examples — the good, the bad, and the "what were they thinking" — into a browsable gallery grouped by rejection reason: &lt;a href="https://photopassport.online/photo-examples" rel="noopener noreferrer"&gt;passport photo examples, official set&lt;/a&gt;. Each example is annotated with the actual rejection label, and every group links to a deeper explainer.&lt;/p&gt;

&lt;p&gt;The tool itself does the crop/scale/background work: &lt;a href="https://photopassport.online" rel="noopener noreferrer"&gt;photopassport.online&lt;/a&gt; — free, runs client-side, no upload (photos never leave your browser).&lt;/p&gt;

&lt;p&gt;If you're building anything in the document-photo space, the State Department's public example set is worth archiving before it rots further. And if you've had a passport application bounced for a photo reason, I'd genuinely like to hear which one — I'm keeping a tally.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>tutorial</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
