{"id":74225,"date":"2025-12-06T10:01:04","date_gmt":"2025-12-06T10:01:04","guid":{"rendered":"https:\/\/www.harsle.com\/?page_id=74225"},"modified":"2025-12-08T01:59:42","modified_gmt":"2025-12-08T01:59:42","slug":"length-unit-converter","status":"publish","type":"page","link":"https:\/\/www.harsle.com\/pt\/length-unit-converter\/","title":{"rendered":"Conversor de Unidades de Comprimento"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Precision Length Unit Converter for Engineering<\/title>\n    <style>\n        \/* Scoped styles to prevent conflicts with WordPress themes *\/\n        #luc-wrapper {\n            font-family: inherit; \/* Inherit from WP Theme *\/\n            max-width: 1000px; \n            margin: 0 auto;\n            padding: 20px 0; \n            color: #333;\n            background-color: transparent; \n            line-height: 1.6;\n        }\n\n        #luc-wrapper * {\n            box-sizing: border-box;\n        }\n\n        \/* Intro Text *\/\n        .luc-intro-text {\n            text-align: center;\n            margin-bottom: 30px;\n            padding: 0 10px;\n            color: #555;\n            font-size: 18px;\n            max-width: 800px;\n            margin-left: auto;\n            margin-right: auto;\n            line-height: 1.6;\n        }\n\n        \/* Calculator Card *\/\n        .luc-calculator-card {\n            background: #ffffff;\n            border-radius: 16px;\n            padding: 40px;\n            box-shadow: 0 10px 30px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);\n            border: 1px solid #edf2f7;\n            margin-bottom: 60px;\n        }\n\n        \/* Top Converter Section *\/\n        .luc-converter-top {\n            display: flex;\n            align-items: flex-start;\n            justify-content: space-between;\n            gap: 15px;\n            margin-bottom: 30px;\n            padding-bottom: 30px;\n            border-bottom: 1px solid #f0f0f0;\n            position: relative;\n        }\n\n        .luc-input-group {\n            flex: 1;\n            display: flex;\n            flex-direction: column;\n            gap: 8px;\n            min-width: 0; \n        }\n\n        .luc-input-group label {\n            font-size: 13px;\n            font-weight: 700;\n            color: #64748b;\n            text-transform: uppercase;\n            letter-spacing: 0.8px;\n            margin: 0; \n        }\n\n        .luc-input-wrapper {\n            display: flex;\n            background: #fff;\n            border: 2px solid #e2e8f0;\n            border-radius: 12px;\n            overflow: hidden;\n            transition: all 0.2s ease;\n            position: relative;\n            align-items: center;\n            height: 64px !important; \n            min-height: 64px !important;\n        }\n\n        .luc-input-wrapper:focus-within {\n            border-color: #3b82f6;\n            box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);\n        }\n\n        \/* Input Area - Inherit Font *\/\n        .luc-input-wrapper input {\n            flex: 1; \n            border: none;\n            padding: 0 15px !important; \n            height: 100% !important; \n            font-size: 24px !important; \n            line-height: normal !important; \n            font-weight: 700;\n            color: #1e293b;\n            background: #fff !important; \n            outline: none;\n            width: 100%;\n            min-width: 0; \n            font-family: inherit !important; \n            margin: 0; \n            box-shadow: none; \n            border-radius: 0 !important; \n            -webkit-appearance: none; \n        }\n\n        \/* Result Input Area *\/\n        #luc-input-b {\n            background-color: #f8fafc !important; \n            color: #0284c7;\n        }\n\n        \/* Enhanced Select Area *\/\n        .luc-input-wrapper select {\n            border: none;\n            background-color: #f1f5f9 !important; \n            border-left: 1px solid #e2e8f0; \n            padding: 0 30px 0 15px; \n            font-size: 16px; \n            font-weight: 700; \n            color: #3b82f6; \n            outline: none;\n            cursor: pointer;\n            width: auto;\n            min-width: 95px; \n            height: 100% !important; \n            flex-shrink: 0; \n            appearance: none;\n            background-image: url(\"data:image\/svg+xml,%3Csvg xmlns='http:\/\/www.w3.org\/2000\/svg' fill='none' viewBox='0 0 24 24' stroke='%233b82f6' stroke-width='3'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C\/path%3E%3C\/svg%3E\");\n            background-repeat: no-repeat;\n            background-position: right 10px center;\n            background-size: 14px;\n            margin: 0; \n            transition: background-color 0.2s;\n            border-radius: 0 !important; \n            -webkit-appearance: none; \n            font-family: inherit !important; \n        }\n        \n        .luc-input-wrapper select:hover {\n            background-color: #e2e8f0 !important; \n            color: #2563eb; \n        }\n\n        \/* Swap Button *\/\n        .luc-swap-container {\n            display: flex;\n            flex-direction: column;\n            align-items: center;\n            justify-content: center;\n            padding-top: 32px;\n            flex-shrink: 0;\n            z-index: 5;\n            height: 100%; \n        }\n\n        .luc-swap-btn {\n            background-color: #ffffff !important;\n            color: #64748b !important;\n            border: 2px solid #e2e8f0 !important;\n            width: 44px !important;\n            height: 44px !important;\n            border-radius: 50% !important;\n            cursor: pointer;\n            display: flex !important;\n            align-items: center !important;\n            justify-content: center !important;\n            transition: all 0.2s;\n            padding: 0 !important;\n            margin: 0 !important;\n            box-shadow: 0 2px 5px rgba(0,0,0,0.05);\n            font-size: 24px !important;\n            line-height: 1 !important;\n            font-family: Arial, sans-serif !important; \n            text-decoration: none !important;\n        }\n\n        .luc-swap-btn:hover {\n            border-color: #3b82f6 !important;\n            color: #3b82f6 !important;\n            background-color: #eff6ff !important;\n            transform: translateY(-2px); \n        }\n\n        \/* Dynamic Result Highlight *\/\n        .luc-result-highlight {\n            grid-column: 1 \/ -1;\n            text-align: center;\n            margin: 0 0 40px 0; \n            padding: 25px 30px;\n            background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%); \n            border-radius: 16px;\n            border: 2px solid #bfdbfe; \n            color: #1e3a8a; \n            font-size: 32px; \n            font-weight: 800;\n            display: none;\n            box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.1), 0 4px 6px -2px rgba(59, 130, 246, 0.05); \n            transition: transform 0.2s ease, box-shadow 0.2s ease;\n            font-family: inherit !important; \n        }\n\n        .luc-pulse-animation {\n            animation: luc-pulse 0.3s cubic-bezier(0.4, 0, 0.6, 1);\n        }\n\n        @keyframes luc-pulse {\n            0% { transform: scale(1); }\n            50% { transform: scale(1.02); }\n            100% { transform: scale(1); }\n        }\n\n        \/* Results Grid Section *\/\n        .luc-results-section h3 {\n            font-size: 18px;\n            color: #1e293b;\n            margin-bottom: 20px;\n            border-left: 5px solid #3b82f6;\n            padding-left: 15px;\n            font-weight: 800;\n        }\n\n        .luc-unit-category {\n            margin-bottom: 40px;\n        }\n\n        .luc-grid {\n            display: grid;\n            grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));\n            gap: 20px;\n        }\n\n        \/* Enhanced Result Item Cards *\/\n        .luc-result-item {\n            background: #ffffff;\n            padding: 24px; \n            border-radius: 16px; \n            border: 1px solid #f1f5f9; \n            display: flex;\n            flex-direction: column;\n            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n            position: relative;\n            overflow: hidden;\n            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02); \n        }\n\n        .luc-result-item:hover {\n            border-color: #3b82f6;\n            background: #fff;\n            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04); \n            transform: translateY(-4px);\n            z-index: 10;\n        }\n        \n        .luc-result-item::after {\n            content: '';\n            position: absolute;\n            top: 0;\n            left: 0;\n            width: 100%;\n            height: 4px; \n            background: transparent;\n            transition: background 0.2s;\n        }\n        \n        .luc-result-item:hover::after {\n            background: #3b82f6;\n        }\n\n        .luc-result-label {\n            font-size: 12px;\n            color: #94a3b8;\n            margin-bottom: 8px;\n            font-weight: 700;\n            text-transform: uppercase;\n            letter-spacing: 0.5px;\n        }\n\n        .luc-result-value {\n            font-size: 24px;\n            font-weight: 800;\n            color: #0f172a;\n            word-break: break-all;\n            font-family: inherit !important; \n            line-height: 1.2;\n        }\n\n        .luc-result-symbol {\n            font-size: 14px;\n            color: #3b82f6; \n            margin-left: 5px;\n            font-weight: 600;\n        }\n\n        \/* SEO Content Section *\/\n        .luc-seo-container {\n            margin-top: 60px;\n            padding-top: 40px;\n            border-top: 1px solid #e5e5e5;\n            color: #334155;\n        }\n\n        .luc-content-grid {\n            display: grid;\n            grid-template-columns: 1fr 1fr;\n            gap: 40px;\n            margin-bottom: 40px;\n        }\n        \n        .luc-seo-block {\n            margin-bottom: 40px;\n        }\n\n        .luc-seo-block h3 {\n            font-size: 24px;\n            color: #0f172a;\n            margin-bottom: 15px;\n            font-weight: 800;\n            letter-spacing: -0.5px;\n        }\n\n        .luc-seo-block h4 {\n            font-size: 18px;\n            color: #334155;\n            margin-top: 20px;\n            margin-bottom: 10px;\n            font-weight: 700;\n        }\n\n        .luc-seo-block p {\n            font-size: 16px;\n            line-height: 1.7;\n            margin-bottom: 15px;\n            color: #475569;\n        }\n\n        .luc-seo-block ul {\n            padding-left: 20px;\n            margin-bottom: 20px;\n        }\n\n        .luc-seo-block li {\n            margin-bottom: 10px;\n            color: #475569;\n        }\n\n        \/* Styled Table *\/\n        .luc-table-wrapper {\n            overflow-x: auto;\n            margin: 25px 0;\n            border-radius: 12px;\n            border: 1px solid #e2e8f0;\n            box-shadow: 0 4px 6px -2px rgba(0, 0, 0, 0.05);\n        }\n\n        .luc-conversion-table {\n            width: 100%;\n            border-collapse: collapse;\n            font-size: 15px;\n            text-align: left;\n            background: #fff;\n        }\n\n        .luc-conversion-table th {\n            background: #f1f5f9;\n            padding: 14px 20px;\n            font-weight: 700;\n            color: #334155;\n            border-bottom: 2px solid #e2e8f0;\n            text-transform: uppercase;\n            font-size: 12px;\n            letter-spacing: 0.5px;\n        }\n\n        .luc-conversion-table td {\n            padding: 14px 20px;\n            border-bottom: 1px solid #f1f5f9;\n            color: #475569;\n            font-variant-numeric: tabular-nums;\n        }\n\n        .luc-conversion-table tr:hover td {\n            background: #f8fafc;\n        }\n\n        \/* FAQ Styling *\/\n        .luc-faq-item {\n            margin-bottom: 20px;\n            background: #fff;\n            padding: 24px;\n            border-radius: 12px;\n            border: 1px solid #e2e8f0;\n            transition: box-shadow 0.2s;\n        }\n\n        .luc-faq-item:hover {\n            box-shadow: 0 4px 12px rgba(0,0,0,0.05);\n        }\n\n        .luc-faq-question {\n            font-weight: 700;\n            color: #0f172a;\n            font-size: 18px;\n            margin-bottom: 10px;\n            display: block;\n        }\n\n        \/* Popular Searches Styling *\/\n        .luc-tags-container {\n            display: flex;\n            flex-wrap: wrap;\n            gap: 10px;\n        }\n\n        .luc-tag {\n            background: #f1f5f9;\n            color: #475569;\n            padding: 8px 16px;\n            border-radius: 50px;\n            font-size: 14px;\n            font-weight: 500;\n            border: 1px solid #e2e8f0;\n            transition: all 0.2s;\n            cursor: default; \n        }\n\n        .luc-tag:hover {\n            background: #e2e8f0;\n            color: #1e293b;\n        }\n\n        @media (max-width: 768px) {\n            .luc-converter-top {\n                flex-direction: column;\n                gap: 15px;\n            }\n            .luc-swap-container {\n                align-self: center;\n                padding-top: 0;\n                transform: rotate(90deg);\n            }\n            .luc-swap-btn:hover {\n                transform: translateY(-2px);\n            }\n            .luc-content-grid {\n                grid-template-columns: 1fr;\n                gap: 20px;\n            }\n            .luc-input-wrapper select {\n                min-width: 80px; \n            }\n            .luc-result-highlight {\n                font-size: 24px;\n                padding: 20px;\n            }\n        }\n    <\/style>\n<\/head>\n<body>\n\n<div id=\"luc-wrapper\">\n    <!-- Intro Text Only -->\n    <div class=\"luc-intro-text\">\n        <p>A professional tool for mechanical engineers, CNC machinists, and designers. Instantly convert between Metric (SI) and Imperial units with micron-level precision.<\/p>\n    <\/div>\n\n    <!-- Main Calculator Area -->\n    <div class=\"luc-calculator-card\">\n        <!-- Input Section -->\n        <div class=\"luc-converter-top\">\n            <div class=\"luc-input-group\">\n                <label for=\"luc-input-a\">Value<\/label>\n                <div class=\"luc-input-wrapper\">\n                    <input type=\"number\" id=\"luc-input-a\" placeholder=\"0\" value=\"1\">\n                    <select id=\"luc-select-a\" aria-label=\"Select Source Unit\"><\/select>\n                <\/div>\n            <\/div>\n\n            <!-- Swap Button Container - No Rotate -->\n            <div class=\"luc-swap-container\">\n                <button type=\"button\" class=\"luc-swap-btn\" id=\"luc-swap\" title=\"Swap Units\" aria-label=\"Swap units\">\n                    &#8644; \n                <\/button>\n            <\/div>\n\n            <div class=\"luc-input-group\">\n                <label for=\"luc-input-b\">Result<\/label>\n                <div class=\"luc-input-wrapper\" style=\"border-color: #bae6fd;\">\n                    <input type=\"number\" id=\"luc-input-b\" placeholder=\"0\">\n                    <select id=\"luc-select-b\" aria-label=\"Select Target Unit\"><\/select>\n                <\/div>\n            <\/div>\n        <\/div>\n\n        <!-- Dynamic Equation Display (Super Highlighted) -->\n        <div id=\"luc-equation-display\" class=\"luc-result-highlight\"><\/div>\n\n        <!-- All Results Display -->\n        <div id=\"luc-all-results\">\n            <div class=\"luc-unit-category\">\n                <h3>Metric Units (SI)<\/h3>\n                <div class=\"luc-grid\" id=\"luc-metric-grid\"><\/div>\n            <\/div>\n            \n            <div class=\"luc-unit-category\">\n                <h3>Imperial Units<\/h3>\n                <div class=\"luc-grid\" id=\"luc-imperial-grid\"><\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n\n    <!-- Enhanced SEO Content Section -->\n    <div class=\"luc-seo-container\">\n        \n        <!-- Two-column layout for definitions -->\n        <div class=\"luc-content-grid\">\n            <div class=\"luc-seo-block\">\n                <h3>Why Conversion Precision Matters?<\/h3>\n                <p>In the world of <strong>mechanical engineering<\/strong> and manufacturing, accurate length conversion is not just a convenience\u2014it&#8217;s a requirement. The globalization of supply chains means blueprints often arrive in mixed units.<\/p>\n                <p>A rounding error of just 0.01 mm can lead to part failure in high-tolerance applications like aerospace components or hydraulic fittings. Our calculator ensures that whether you are converting <strong>inches to millimeters<\/strong> or <strong>thou to microns<\/strong>, the results maintain scientific integrity.<\/p>\n            <\/div>\n            <div class=\"luc-seo-block\">\n                <h3>Metric vs. Imperial Systems<\/h3>\n                <p><strong>The Metric System (SI):<\/strong> Based on the meter, it uses a decimal system (powers of 10). It is the standard for science and international trade. Common units include mm, cm, m, and km.<\/p>\n                <p><strong>The Imperial System:<\/strong> Primarily used in the United States, Liberia, and Myanmar. It relies on non-decimal progression (12 inches = 1 foot). It is deeply entrenched in the US machining, construction, and oil &#038; gas industries.<\/p>\n            <\/div>\n        <\/div>\n\n        <!-- Comprehensive Table -->\n        <div class=\"luc-seo-block\">\n            <h3>Standard Engineering Conversion Factors<\/h3>\n            <p>Below is a quick reference table for the most critical conversions used in CNC machining and design (CAD).<\/p>\n            <div class=\"luc-table-wrapper\">\n                <table class=\"luc-conversion-table\">\n                    <thead>\n                        <tr>\n                            <th>From Unit<\/th>\n                            <th>To Unit<\/th>\n                            <th>Formula<\/th>\n                            <th>Exact Value<\/th>\n                        <\/tr>\n                    <\/thead>\n                    <tbody>\n                        <tr><td>1 Inch (in)<\/td><td>Millimeter (mm)<\/td><td>x 25.4<\/td><td>25.4 mm<\/td><\/tr>\n                        <tr><td>1 Foot (ft)<\/td><td>Meter (m)<\/td><td>x 0.3048<\/td><td>0.3048 m<\/td><\/tr>\n                        <tr><td>1 Mile (mi)<\/td><td>Kilometer (km)<\/td><td>x 1.60934<\/td><td>1.609344 km<\/td><\/tr>\n                        <tr><td>1 Thou (mil)<\/td><td>Micron (\u03bcm)<\/td><td>x 25.4<\/td><td>25.4 \u03bcm<\/td><\/tr>\n                        <tr><td>1 Yard (yd)<\/td><td>Meter (m)<\/td><td>x 0.9144<\/td><td>0.9144 m<\/td><\/tr>\n                        <tr><td>1 Micron (\u03bcm)<\/td><td>Inch (in)<\/td><td>\/ 25400<\/td><td>0.00003937 in<\/td><\/tr>\n                    <\/tbody>\n                <\/table>\n            <\/div>\n        <\/div>\n\n        <!-- Detailed Unit Definitions -->\n        <div class=\"luc-seo-block\">\n            <h3>Understanding Common Machining Units<\/h3>\n            \n            <h4>What is a &#8220;Thou&#8221; or &#8220;Mil&#8221;?<\/h4>\n            <p>In the US machining industry, the term <strong>&#8220;Thou&#8221;<\/strong> (short for thousandth) refers to 0.001 inches. It is also known as a <strong>&#8220;Mil&#8221;<\/strong>. It is the standard unit of tolerance in Imperial blueprints. For example, a typical bearing fit might have a tolerance of \u00b10.5 thou.<\/p>\n            \n            <h4>What is a Micron (\u03bcm)?<\/h4>\n            <p>The <strong>Micron<\/strong> (or micrometer) is the metric equivalent of high-precision measurement. 1 micron is equal to 0.001 millimeters. To visualize, a human hair is typically between 50 and 70 microns thick. High-end CNC machines often boast accuracy within a few microns.<\/p>\n        <\/div>\n\n        <!-- FAQ Section -->\n        <div class=\"luc-seo-block\">\n            <h3>Frequently Asked Questions (FAQ)<\/h3>\n            \n            <div class=\"luc-faq-item\">\n                <span class=\"luc-faq-question\">How do I convert inches to mm manually?<\/span>\n                <p>To convert inches to millimeters, simply multiply the inch value by <strong>25.4<\/strong>. This is an exact conversion factor defined by international agreement in 1959. <br><em>Example: 2 inches = 2 * 25.4 = 50.8 mm.<\/em><\/p>\n            <\/div>\n\n            <div class=\"luc-faq-item\">\n                <span class=\"luc-faq-question\">Is a nautical mile the same as a regular mile?<\/span>\n                <p>No. A regular &#8220;statute&#8221; mile is 1,609.344 meters. A <strong>Nautical Mile (nmi)<\/strong> is based on the circumference of the earth and is equal to exactly 1,852 meters (approx 1.15 statute miles). It is used exclusively in aviation and maritime navigation.<\/p>\n            <\/div>\n\n            <div class=\"luc-faq-item\">\n                <span class=\"luc-faq-question\">Why does this calculator use scientific notation?<\/span>\n                <p>When dealing with atomic scales (Nanometers) or astronomical distances (Light Years), standard decimal numbers become too long to read (e.g., 0.000000001). Scientific notation (e.g., 1&#215;10\u207b\u2079) allows engineers to read these values quickly and accurately without counting zeros.<\/p>\n            <\/div>\n        <\/div>\n\n        <!-- Popular Searches Block - Reused luc-seo-block for consistent title style -->\n        <div class=\"luc-seo-block\">\n            <h3>Popular Searches<\/h3>\n            <div class=\"luc-tags-container\">\n                <span class=\"luc-tag\">inch to mm converter<\/span>\n                <span class=\"luc-tag\">micron to thou<\/span>\n                <span class=\"luc-tag\">metric to imperial<\/span>\n                <span class=\"luc-tag\">length converter<\/span>\n                <span class=\"luc-tag\">engineering unit converter<\/span>\n                <span class=\"luc-tag\">mm to inches fraction<\/span>\n                <span class=\"luc-tag\">CNC unit conversion<\/span>\n                <span class=\"luc-tag\">1 mil to micron<\/span>\n                <span class=\"luc-tag\">feet to meters<\/span>\n                <span class=\"luc-tag\">thou to mm<\/span>\n            <\/div>\n        <\/div>\n    <\/div>\n<\/div>\n\n<script>\n(function() {\n    \/\/ 1. Definition of Units (Base unit: Meter)\n    const units = [\n        \/\/ Metric\n        { id: 'km', name: 'Kilometer', symbol: 'km', factor: 1000, type: 'metric' },\n        { id: 'm', name: 'Meter', symbol: 'm', factor: 1, type: 'metric' },\n        { id: 'dm', name: 'Decimeter', symbol: 'dm', factor: 0.1, type: 'metric' },\n        { id: 'cm', name: 'Centimeter', symbol: 'cm', factor: 0.01, type: 'metric' },\n        { id: 'mm', name: 'Millimeter', symbol: 'mm', factor: 0.001, type: 'metric' },\n        { id: 'um', name: 'Micrometer', symbol: 'um', factor: 0.000001, type: 'metric' },\n        { id: 'nm', name: 'Nanometer', symbol: 'nm', factor: 1e-9, type: 'metric' },\n        { id: 'pm', name: 'Picometer', symbol: 'pm', factor: 1e-12, type: 'metric' },\n        { id: 'ly', name: 'Light Year', symbol: 'ly', factor: 9.461e15, type: 'metric' },\n        { id: 'au', name: 'Astronomical Unit', symbol: 'AU', factor: 1.496e11, type: 'metric' },\n        \n        \/\/ Imperial\n        { id: 'in', name: 'Inch', symbol: 'in', factor: 0.0254, type: 'imperial' },\n        { id: 'ft', name: 'Foot', symbol: 'ft', factor: 0.3048, type: 'imperial' },\n        { id: 'yd', name: 'Yard', symbol: 'yd', factor: 0.9144, type: 'imperial' },\n        { id: 'mi', name: 'Mile', symbol: 'mi', factor: 1609.344, type: 'imperial' },\n        { id: 'nmi', name: 'Nautical Mile', symbol: 'nmi', factor: 1852, type: 'imperial' },\n        { id: 'fm', name: 'Fathom', symbol: 'fm', factor: 1.8288, type: 'imperial' },\n        { id: 'fur', name: 'Furlong', symbol: 'fur', factor: 201.168, type: 'imperial' },\n        { id: 'mil', name: 'Mil', symbol: 'mil', factor: 0.0000254, type: 'imperial' },\n    ];\n\n    \/\/ 2. DOM Elements\n    const inputA = document.getElementById('luc-input-a');\n    const inputB = document.getElementById('luc-input-b');\n    const selectA = document.getElementById('luc-select-a');\n    const selectB = document.getElementById('luc-select-b');\n    const swapBtn = document.getElementById('luc-swap');\n    const equationDisplay = document.getElementById('luc-equation-display');\n    \n    const grids = {\n        metric: document.getElementById('luc-metric-grid'),\n        imperial: document.getElementById('luc-imperial-grid')\n    };\n\n    \/\/ 3. Initialize UI\n    function init() {\n        \/\/ Populate Selects\n        units.forEach(unit => {\n            const optionA = document.createElement('option');\n            const optionB = document.createElement('option');\n            optionA.value = unit.id;\n            optionB.value = unit.id;\n            \/\/ Shortened text for select to fit new narrow design\n            optionA.textContent = `${unit.symbol}`; \n            optionB.textContent = `${unit.symbol}`;\n            \/\/ Add full name as title for hover\n            optionA.setAttribute('title', unit.name);\n            optionB.setAttribute('title', unit.name);\n            \n            selectA.appendChild(optionA);\n            selectB.appendChild(optionB);\n        });\n\n        \/\/ Set defaults (Inch to MM)\n        selectA.value = 'in'; \n        selectB.value = 'mm'; \n\n        \/\/ Create Result Cards\n        units.forEach(unit => {\n            const card = document.createElement('div');\n            card.className = 'luc-result-item';\n            card.innerHTML = `\n                <span class=\"luc-result-label\">${unit.name}<\/span>\n                <div>\n                    <span class=\"luc-result-value\" id=\"luc-res-${unit.id}\">-<\/span>\n                    <span class=\"luc-result-symbol\">${unit.symbol}<\/span>\n                <\/div>\n            `;\n            if (grids[unit.type]) {\n                grids[unit.type].appendChild(card);\n            }\n        });\n\n        calculate('A');\n    }\n\n    \/\/ 4. Calculation Logic\n    function formatDisplayResult(val) {\n        if (Math.abs(val) < 1e-15) return \"0\";\n        \n        if (Math.abs(val - Math.round(val)) < 1e-9) {\n            return Math.round(val).toLocaleString('en-US'); \/\/ Integers with commas\n        }\n        \n        if (Math.abs(val) < 0.01) {\n             return val.toExponential(2).replace('e+', 'x10^').replace('e-', 'x10^-');\n        }\n\n        \/\/ Standard decimal with commas\n        return val.toLocaleString('en-US', { minimumFractionDigits: 0, maximumFractionDigits: 2 });\n    }\n\n    function formatInputValue(val) {\n        if (Math.abs(val) < 1e-15) return \"0\";\n        if (Math.abs(val - Math.round(val)) < 1e-9) {\n            return Math.round(val).toString();\n        }\n        if (Math.abs(val) < 0.01) {\n             return val.toExponential(2).replace('e+', 'e').replace('e-', 'e-'); \n        }\n        return parseFloat(val.toFixed(2)).toString();\n    }\n\n    function updateEquation(valA, unitAId, valB, unitBId) {\n        const uA = units.find(u => u.id === unitAId);\n        const uB = units.find(u => u.id === unitBId);\n        \n        if (!valA && valA !== 0) {\n            equationDisplay.style.display = 'none';\n            return;\n        }\n\n        equationDisplay.style.display = 'block';\n        \n        equationDisplay.classList.remove('luc-pulse-animation');\n        void equationDisplay.offsetWidth; \/\/ Trigger reflow\n        equationDisplay.classList.add('luc-pulse-animation');\n\n        equationDisplay.innerHTML = `\n            ${formatDisplayResult(valA)} <span style=\"font-size:0.7em; color:#60a5fa; font-weight:600;\">${uA.symbol}<\/span> = \n            <span>${formatDisplayResult(valB)}<\/span> <span style=\"font-size:0.7em; color:#60a5fa; font-weight:600;\">${uB.symbol}<\/span>\n        `;\n    }\n\n    function calculate(source) {\n        let valA, valB;\n        \n        const unitA = units.find(u => u.id === selectA.value);\n        const unitB = units.find(u => u.id === selectB.value);\n\n        if (source === 'A') {\n            valA = parseFloat(inputA.value);\n            if (isNaN(valA)) {\n                inputB.value = '';\n                updateAll(0);\n                equationDisplay.style.display = 'none';\n                return;\n            }\n            const baseMeters = valA * unitA.factor;\n            valB = baseMeters \/ unitB.factor;\n            \n            inputB.value = formatInputValue(valB);\n            updateAll(baseMeters);\n            updateEquation(valA, unitA.id, valB, unitB.id);\n        } else {\n            valB = parseFloat(inputB.value);\n            if (isNaN(valB)) {\n                inputA.value = '';\n                updateAll(0);\n                equationDisplay.style.display = 'none';\n                return;\n            }\n            const baseMeters = valB * unitB.factor;\n            valA = baseMeters \/ unitA.factor;\n            \n            inputA.value = formatInputValue(valA);\n            updateAll(baseMeters);\n            updateEquation(valA, unitA.id, valB, unitB.id);\n        }\n    }\n\n    function updateAll(meters) {\n        units.forEach(unit => {\n            const el = document.getElementById(`luc-res-${unit.id}`);\n            if (el) {\n                const val = meters \/ unit.factor;\n                el.textContent = formatDisplayResult(val);\n            }\n        });\n    }\n\n    \/\/ 5. Event Listeners\n    inputA.addEventListener('input', () => calculate('A'));\n    selectA.addEventListener('change', () => calculate('A'));\n    \n    inputB.addEventListener('input', () => calculate('B'));\n    selectB.addEventListener('change', () => calculate('A')); \n\n    swapBtn.addEventListener('click', () => {\n        const tempUnit = selectA.value;\n        selectA.value = selectB.value;\n        selectB.value = tempUnit;\n        \n        calculate('A');\n    });\n\n    init();\n\n})();\n<\/script>\n\n<\/body>\n<\/html>\n\n","protected":false},"excerpt":{"rendered":"<p>Precision Length Unit Converter for Engineering A professional tool for mechanical engineers, CNC machinists, and designers. Instantly convert between Metric<\/p>","protected":false},"author":1,"featured_media":74286,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-74225","page","type-page","status-publish","has-post-thumbnail","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.harsle.com\/pt\/wp-json\/wp\/v2\/pages\/74225","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.harsle.com\/pt\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.harsle.com\/pt\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.harsle.com\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.harsle.com\/pt\/wp-json\/wp\/v2\/comments?post=74225"}],"version-history":[{"count":0,"href":"https:\/\/www.harsle.com\/pt\/wp-json\/wp\/v2\/pages\/74225\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.harsle.com\/pt\/wp-json\/wp\/v2\/media\/74286"}],"wp:attachment":[{"href":"https:\/\/www.harsle.com\/pt\/wp-json\/wp\/v2\/media?parent=74225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}