add auto dxf units import
This commit is contained in:
parent
c14ea71c8c
commit
d33c6636f7
2 changed files with 4 additions and 3 deletions
|
|
@ -1156,7 +1156,7 @@ function loadDXFDialog(doit) {
|
|||
` Supports POLYLINE, LWPOLYLINE, LINE, CIRCLE, ARC, and SPLINE entities.`,
|
||||
` </p>`,
|
||||
` <div class="f-row t-right image-convert-fields"><table>`,
|
||||
` <tr><th>units</th><td><select id="dxf-units-${rnd}"><option value="mm">millimeters</option><option value="inch">inches</option></select></td></tr>`,
|
||||
` <tr><th>units</th><td><select id="dxf-units-${rnd}"><option value="auto" selected>auto</option><option value="mm">millimeters</option><option value="inch">inches</option></select></td></tr>`,
|
||||
` <tr><th>z height</th><td><input id="dxf-depth-${rnd}" value="5" size="3"></td></tr>`,
|
||||
` <tr><th title="target length of each line segment when converting arcs and circles">arc segment size</th><td><input id="dxf-seg-${rnd}" value="1" size="3"></td></tr>`,
|
||||
` <tr><th title="minimum number of segments for very small arcs to avoid degenerate geometry">minimum arc segments</th><td><input id="dxf-min-${rnd}" value="4" size="3"></td></tr>`,
|
||||
|
|
|
|||
|
|
@ -26,9 +26,10 @@ export function parse(text, opt = { }) {
|
|||
// Parse DXF file - normalize line endings and split
|
||||
const lines = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n').split('\n').map(l => l.trim());
|
||||
|
||||
// Parse header for units (informational, can be overridden by user)
|
||||
// Parse header for units (can be overridden by user)
|
||||
const fileUnits = extractUnits(lines);
|
||||
const inputUnits = opt.units || fileUnits; // user can override file's declared units
|
||||
// Use file units if "auto" or not specified, otherwise use user's choice
|
||||
const inputUnits = (!opt.units || opt.units === 'auto') ? fileUnits : opt.units;
|
||||
const scale = getScaleToMM(inputUnits); // convert to mm (Kiri:Moto's internal unit)
|
||||
|
||||
const entities = extractEntities(lines);
|
||||
|
|
|
|||
Loading…
Reference in a new issue