feat: harden maps export for CAD and improve satellite/OSM workflow
Cap zoom to real imagery, attach a BricsCAD-safe DXF IMAGE at the selected extent, and consolidate startup plus Overpass/address handling. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
fadfb807ec
commit
7769a4412e
8 files changed
+1186
-330
No files matched your search
+184
-29
@@ -3,6 +3,35 @@
|
||||
* Supports Google Maps and Google Earth (Web) links. Google Earth view/altitude/distance
|
||||
* is used to optimize the requested area (smaller = faster Overpass and imagery).
|
||||
*/
|
||||
function isShortMapsUrl(input) {
|
||||
return /^https?:\/\/(maps\.app\.goo\.gl|goo\.gl\/maps)\//i.test(String(input).trim());
|
||||
}
|
||||
|
||||
function isGoogleMapsLink(input) {
|
||||
const s = String(input).trim();
|
||||
return isShortMapsUrl(s) || /^https?:\/\/(www\.)?(google\.[^/]+\/maps|maps\.google\.)/i.test(s);
|
||||
}
|
||||
|
||||
function extractAddressFromMapsUrl(input) {
|
||||
const s = String(input).trim();
|
||||
const place = s.match(/google\.[^/]+\/maps\/place\/([^/@?#]+)/i);
|
||||
if (place && place[1]) {
|
||||
const decoded = decodeURIComponent(place[1].replace(/\+/g, ' ')).trim();
|
||||
if (decoded && !/^-?\d+\.?\d*\s*,\s*-?\d+\.?\d*$/.test(decoded)) return decoded;
|
||||
}
|
||||
const search = s.match(/google\.[^/]+\/maps\/search\/([^/@?#]+)/i);
|
||||
if (search && search[1]) {
|
||||
const decoded = decodeURIComponent(search[1].replace(/\+/g, ' ')).trim();
|
||||
if (decoded && !/^-?\d+\.?\d*\s*,\s*-?\d+\.?\d*$/.test(decoded)) return decoded;
|
||||
}
|
||||
const q = s.match(/[?&](?:q|query|daddr|saddr)=([^&]+)/i);
|
||||
if (q && q[1]) {
|
||||
const decoded = decodeURIComponent(q[1].replace(/\+/g, ' ')).trim();
|
||||
if (decoded && !/^https?:/i.test(decoded) && !/^-?\d+\.?\d*\s*,\s*-?\d+\.?\d*$/.test(decoded)) return decoded;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function extractCoordinates(url) {
|
||||
const s = String(url).trim();
|
||||
let lat;
|
||||
@@ -13,19 +42,26 @@ function extractCoordinates(url) {
|
||||
while ((pinMatch = placePinRegex.exec(s)) !== null) {
|
||||
placePins.push({ lat: parseFloat(pinMatch[1]), lon: parseFloat(pinMatch[2]) });
|
||||
}
|
||||
const coordRegex = /@(-?\d+\.?\d*),(-?\d+\.?\d*)/;
|
||||
const coordMatch = s.match(coordRegex);
|
||||
const atMatch = s.match(/@(-?\d+\.?\d*),(-?\d+\.?\d*)/);
|
||||
const qCoord = s.match(/[?&](?:q|ll|center|query)=(-?\d+\.?\d*)\s*,\s*(-?\d+\.?\d*)/i);
|
||||
const dirCoord = s.match(/!8m2!3d(-?\d+\.?\d*)!4d(-?\d+\.?\d*)/);
|
||||
if (placePins.length > 0) {
|
||||
const pin = placePins[placePins.length - 1];
|
||||
lat = pin.lat;
|
||||
lon = pin.lon;
|
||||
} else if (coordMatch && coordMatch.length >= 3) {
|
||||
lat = parseFloat(coordMatch[1]);
|
||||
lon = parseFloat(coordMatch[2]);
|
||||
} else if (dirCoord) {
|
||||
lat = parseFloat(dirCoord[1]);
|
||||
lon = parseFloat(dirCoord[2]);
|
||||
} else if (atMatch && atMatch.length >= 3) {
|
||||
lat = parseFloat(atMatch[1]);
|
||||
lon = parseFloat(atMatch[2]);
|
||||
} else if (qCoord && qCoord.length >= 3) {
|
||||
lat = parseFloat(qCoord[1]);
|
||||
lon = parseFloat(qCoord[2]);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
if (isNaN(lat) || isNaN(lon)) return null;
|
||||
if (isNaN(lat) || isNaN(lon) || Math.abs(lat) > 90 || Math.abs(lon) > 180) return null;
|
||||
|
||||
let viewMeters;
|
||||
const mapsZoomM = s.match(/@-?\d+\.?\d*,-?\d+\.?\d*,(\d+(?:\.\d*)?)\s*m\b/i);
|
||||
@@ -99,9 +135,11 @@ function buildPreviewData(osmData, origin, layerOptions) {
|
||||
});
|
||||
|
||||
const s = 8;
|
||||
out.push(['L', -s, 0, s, 0, 4]);
|
||||
out.push(['L', 0, -s, 0, s, 4]);
|
||||
out.push(['C', 0, 0, s / 1.5, 4]);
|
||||
if (on('locationMarker')) {
|
||||
out.push(['L', -s, 0, s, 0, 4]);
|
||||
out.push(['L', 0, -s, 0, s, 4]);
|
||||
out.push(['C', 0, 0, s / 1.5, 4]);
|
||||
}
|
||||
|
||||
const PARKING_SPOT_HW = 1.25;
|
||||
const PARKING_SPOT_HH = 2.5;
|
||||
@@ -201,6 +239,9 @@ function generateHighDetailDXF(osmData, origin, layerOptions, clipBounds) {
|
||||
const metersPerLat = 111132.92;
|
||||
const metersPerLon = 111412.84 * Math.cos((origin.lat * Math.PI) / 180);
|
||||
const clipMargin = 8;
|
||||
if (!osmData || !Array.isArray(osmData.elements)) {
|
||||
osmData = { elements: [] };
|
||||
}
|
||||
|
||||
function inClip(x, y) {
|
||||
if (!clipBounds) return true;
|
||||
@@ -227,14 +268,15 @@ function generateHighDetailDXF(osmData, origin, layerOptions, clipBounds) {
|
||||
}
|
||||
});
|
||||
|
||||
let dxf = '0\nSECTION\n2\nHEADER\n9\n$INSUNITS\n70\n6\n9\n$MEASUREMENT\n70\n1\n0\nENDSEC\n0\nSECTION\n2\nTABLES\n0\nTABLE\n2\nLTYPE\n70\n1\n';
|
||||
dxf += '0\nLTYPE\n2\nDASHED\n70\n0\n3\n_ _ _ _ _ _\n72\n65\n73\n2\n40\n2.0\n49\n1.25\n49\n-0.75\n0\nENDTAB\n0\nENDSEC\n';
|
||||
let dxf = dxfR2000Preamble();
|
||||
dxf += '0\nSECTION\n2\nENTITIES\n';
|
||||
|
||||
const s = 8;
|
||||
dxf += `0\nLINE\n8\nLOCATION_MARKER\n62\n4\n10\n-${s}\n20\n0\n11\n${s}\n21\n0\n`;
|
||||
dxf += `0\nLINE\n8\nLOCATION_MARKER\n62\n4\n10\n0\n20\n-${s}\n11\n0\n21\n${s}\n`;
|
||||
dxf += `0\nCIRCLE\n8\nLOCATION_MARKER\n62\n4\n10\n0\n20\n0\n40\n${s / 1.5}\n`;
|
||||
if (on('locationMarker')) {
|
||||
dxf += `0\nLINE\n8\nLOCATION_MARKER\n62\n4\n10\n-${s}\n20\n0\n11\n${s}\n21\n0\n`;
|
||||
dxf += `0\nLINE\n8\nLOCATION_MARKER\n62\n4\n10\n0\n20\n-${s}\n11\n0\n21\n${s}\n`;
|
||||
dxf += `0\nCIRCLE\n8\nLOCATION_MARKER\n62\n4\n10\n0\n20\n0\n40\n${s / 1.5}\n`;
|
||||
}
|
||||
|
||||
const PARKING_HW = 1.25;
|
||||
const PARKING_HH = 2.5;
|
||||
@@ -402,10 +444,101 @@ function generateHighDetailDXF(osmData, origin, layerOptions, clipBounds) {
|
||||
}
|
||||
});
|
||||
|
||||
dxf += '0\nENDSEC\n0\nEOF';
|
||||
dxf += '0\nENDSEC\n' + dxfBaseObjectsSection() + '0\nEOF';
|
||||
return dxf;
|
||||
}
|
||||
|
||||
/** Model-space BLOCK_RECORD handle; IMAGE entities must own to this, never 0. */
|
||||
const DXF_MODEL_SPACE_HANDLE = '1F';
|
||||
|
||||
/**
|
||||
* R2000 tables/blocks BricsCAD needs. Missing BLOCK_RECORD *MODEL_SPACE causes "Null object Id: (0)".
|
||||
*/
|
||||
function dxfR2000Preamble() {
|
||||
const ms = DXF_MODEL_SPACE_HANDLE;
|
||||
const ps = '1B';
|
||||
return [
|
||||
'0', 'SECTION', '2', 'HEADER',
|
||||
'9', '$ACADVER', '1', 'AC1015',
|
||||
'9', '$HANDSEED', '5', 'FFFF',
|
||||
'9', '$INSUNITS', '70', '6',
|
||||
'9', '$MEASUREMENT', '70', '1',
|
||||
'0', 'ENDSEC',
|
||||
'0', 'SECTION', '2', 'TABLES',
|
||||
'0', 'TABLE', '2', 'VPORT', '5', '8', '100', 'AcDbSymbolTable', '70', '1',
|
||||
'0', 'VPORT', '5', '29', '330', '8', '100', 'AcDbSymbolTableRecord', '100', 'AcDbViewportTableRecord',
|
||||
'2', '*ACTIVE', '70', '0',
|
||||
'10', '0.0', '20', '0.0', '11', '1.0', '21', '1.0',
|
||||
'12', '0.0', '22', '0.0', '13', '0.0', '23', '0.0',
|
||||
'14', '0.5', '24', '0.5', '15', '0.5', '25', '0.5',
|
||||
'16', '0.0', '26', '0.0', '36', '1.0',
|
||||
'17', '0.0', '27', '0.0', '37', '0.0',
|
||||
'40', '297.0', '41', '1.6', '42', '50.0', '43', '0.0', '44', '0.0',
|
||||
'50', '0.0', '51', '0.0', '71', '0', '72', '100', '73', '1', '74', '3',
|
||||
'75', '0', '76', '0', '77', '0', '78', '0',
|
||||
'0', 'ENDTAB',
|
||||
'0', 'TABLE', '2', 'LTYPE', '5', '5', '100', 'AcDbSymbolTable', '70', '4',
|
||||
'0', 'LTYPE', '5', '6', '330', '5', '100', 'AcDbSymbolTableRecord', '100', 'AcDbLinetypeTableRecord',
|
||||
'2', 'BYBLOCK', '70', '0', '3', '', '72', '65', '73', '0', '40', '0.0',
|
||||
'0', 'LTYPE', '5', '7', '330', '5', '100', 'AcDbSymbolTableRecord', '100', 'AcDbLinetypeTableRecord',
|
||||
'2', 'BYLAYER', '70', '0', '3', '', '72', '65', '73', '0', '40', '0.0',
|
||||
'0', 'LTYPE', '5', '9', '330', '5', '100', 'AcDbSymbolTableRecord', '100', 'AcDbLinetypeTableRecord',
|
||||
'2', 'CONTINUOUS', '70', '0', '3', 'Solid line', '72', '65', '73', '0', '40', '0.0',
|
||||
'0', 'LTYPE', '5', 'A', '330', '5', '100', 'AcDbSymbolTableRecord', '100', 'AcDbLinetypeTableRecord',
|
||||
'2', 'DASHED', '70', '0', '3', '_ _ _ _ _ _', '72', '65', '73', '2', '40', '2.0', '49', '1.25', '49', '-0.75',
|
||||
'0', 'ENDTAB',
|
||||
'0', 'TABLE', '2', 'LAYER', '5', '2', '100', 'AcDbSymbolTable', '70', '1',
|
||||
'0', 'LAYER', '5', '10', '330', '2', '100', 'AcDbSymbolTableRecord', '100', 'AcDbLayerTableRecord',
|
||||
'2', '0', '70', '0', '62', '7', '6', 'CONTINUOUS',
|
||||
'0', 'ENDTAB',
|
||||
'0', 'TABLE', '2', 'STYLE', '5', '3', '100', 'AcDbSymbolTable', '70', '1',
|
||||
'0', 'STYLE', '5', '11', '330', '3', '100', 'AcDbSymbolTableRecord', '100', 'AcDbTextStyleTableRecord',
|
||||
'2', 'STANDARD', '70', '0', '40', '0.0', '41', '1.0', '50', '0.0', '71', '0', '42', '2.5', '3', 'txt', '4', '',
|
||||
'0', 'ENDTAB',
|
||||
'0', 'TABLE', '2', 'VIEW', '5', '4', '100', 'AcDbSymbolTable', '70', '0',
|
||||
'0', 'ENDTAB',
|
||||
'0', 'TABLE', '2', 'UCS', '5', '32', '100', 'AcDbSymbolTable', '70', '0',
|
||||
'0', 'ENDTAB',
|
||||
'0', 'TABLE', '2', 'APPID', '5', '12', '100', 'AcDbSymbolTable', '70', '1',
|
||||
'0', 'APPID', '5', '13', '330', '12', '100', 'AcDbSymbolTableRecord', '100', 'AcDbRegAppTableRecord',
|
||||
'2', 'ACAD', '70', '0',
|
||||
'0', 'ENDTAB',
|
||||
'0', 'TABLE', '2', 'DIMSTYLE', '5', '14', '100', 'AcDbSymbolTable', '70', '1',
|
||||
'0', 'DIMSTYLE', '105', '15', '330', '14', '100', 'AcDbSymbolTableRecord', '100', 'AcDbDimStyleTableRecord',
|
||||
'2', 'STANDARD', '70', '0',
|
||||
'0', 'ENDTAB',
|
||||
'0', 'TABLE', '2', 'BLOCK_RECORD', '5', '1', '100', 'AcDbSymbolTable', '70', '2',
|
||||
'0', 'BLOCK_RECORD', '5', ms, '330', '1', '100', 'AcDbSymbolTableRecord', '100', 'AcDbBlockTableRecord',
|
||||
'2', '*MODEL_SPACE',
|
||||
'0', 'BLOCK_RECORD', '5', ps, '330', '1', '100', 'AcDbSymbolTableRecord', '100', 'AcDbBlockTableRecord',
|
||||
'2', '*PAPER_SPACE',
|
||||
'0', 'ENDTAB',
|
||||
'0', 'ENDSEC',
|
||||
'0', 'SECTION', '2', 'BLOCKS',
|
||||
'0', 'BLOCK', '5', '20', '330', ms, '100', 'AcDbEntity', '8', '0', '100', 'AcDbBlockBegin',
|
||||
'2', '*MODEL_SPACE', '70', '0', '10', '0.0', '20', '0.0', '30', '0.0', '3', '*MODEL_SPACE', '1', '',
|
||||
'0', 'ENDBLK', '5', '21', '330', ms, '100', 'AcDbEntity', '8', '0', '100', 'AcDbBlockEnd',
|
||||
'0', 'BLOCK', '5', '22', '330', ps, '100', 'AcDbEntity', '8', '0', '100', 'AcDbBlockBegin',
|
||||
'2', '*PAPER_SPACE', '70', '0', '10', '0.0', '20', '0.0', '30', '0.0', '3', '*PAPER_SPACE', '1', '',
|
||||
'0', 'ENDBLK', '5', '23', '330', ps, '100', 'AcDbEntity', '8', '0', '100', 'AcDbBlockEnd',
|
||||
'0', 'ENDSEC'
|
||||
].join('\n') + '\n';
|
||||
}
|
||||
|
||||
const DXF_ENTITIES_CLOSE = '0\nENDSEC\n0\nSECTION\n2\nOBJECTS\n';
|
||||
|
||||
function dxfBaseObjectsSection() {
|
||||
return '0\nSECTION\n2\nOBJECTS\n' +
|
||||
'0\nDICTIONARY\n5\nC\n330\n0\n100\nAcDbDictionary\n281\n1\n3\nACAD_GROUP\n350\nD\n' +
|
||||
'0\nDICTIONARY\n5\nD\n330\nC\n100\nAcDbDictionary\n281\n1\n' +
|
||||
'0\nENDSEC\n';
|
||||
}
|
||||
|
||||
function insertDxfEntities(dxfContent, block) {
|
||||
if (!block) return dxfContent;
|
||||
return dxfContent.replace(DXF_ENTITIES_CLOSE, block + DXF_ENTITIES_CLOSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convex hull (Graham scan). Returns hull points in CCW order.
|
||||
*/
|
||||
@@ -640,7 +773,7 @@ function appendLotsToDXF(dxfContent, lots) {
|
||||
block += `0\nLINE\n8\nLOTS\n62\n40\n10\n${a.x}\n20\n${a.y}\n11\n${b.x}\n21\n${b.y}\n`;
|
||||
}
|
||||
});
|
||||
return dxfContent.replace('0\nENDSEC\n0\nEOF', block + '0\nENDSEC\n0\nEOF');
|
||||
return insertDxfEntities(dxfContent, block);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -848,7 +981,7 @@ function appendImageryTraceToDXF(dxfContent, polylines, minSegmentMeters, minLen
|
||||
block += `0\nLINE\n8\n${layer}\n62\n7\n10\n${a.x}\n20\n${a.y}\n11\n${b.x}\n21\n${b.y}\n`;
|
||||
}
|
||||
});
|
||||
return dxfContent.replace('0\nENDSEC\n0\nEOF', block + '0\nENDSEC\n0\nEOF');
|
||||
return insertDxfEntities(dxfContent, block);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -889,22 +1022,26 @@ function generateWorldFilePgw(minX, minY, maxX, maxY, widthPx, heightPx, rowZero
|
||||
}
|
||||
|
||||
/**
|
||||
* Append satellite imagery reference to DXF so CAD shows the image as background.
|
||||
* Also adds a visible bounding box (rectangle) on layer IMAGE_BOUNDS so the image extent is visible in CAD.
|
||||
* imageFilename: e.g. "satellite.png" (same folder as DXF).
|
||||
* minX, minY, maxX, maxY: extent in drawing units (meters from origin). Image is placed to fill this rect.
|
||||
* widthPx, heightPx: image size in pixels.
|
||||
* Append a georeferenced IMAGE already attached in the DXF (AutoCAD/BricsCAD IMAGE).
|
||||
* PNG must sit next to the DXF using imageFilename. Insertion is SW corner; size fills the selected extent.
|
||||
* 1 drawing unit = 1 meter ($INSUNITS=6). U/V are meters per pixel so CAD scale matches the selection.
|
||||
*/
|
||||
function appendSatelliteImageToDXF(dxfContent, imageFilename, minX, minY, maxX, maxY, widthPx, heightPx) {
|
||||
const handle = '1F0';
|
||||
const w = maxX - minX;
|
||||
const h = maxY - minY;
|
||||
if (!(widthPx > 0) || !(heightPx > 0) || !(w > 0) || !(h > 0)) return dxfContent;
|
||||
const uPerPx = w / widthPx;
|
||||
const vPerPx = h / heightPx;
|
||||
const clipU = widthPx - 0.5;
|
||||
const clipV = heightPx - 0.5;
|
||||
const imageHandle = 'A4';
|
||||
const defHandle = 'A2';
|
||||
const reactorHandle = 'A3';
|
||||
const imageDictHandle = 'A1';
|
||||
const safeName = String(imageFilename || 'satellite.png').replace(/[\r\n]/g, '');
|
||||
const scaleNote =
|
||||
`0\nTEXT\n8\nIMAGE_SCALE\n62\n3\n10\n${minX}\n20\n${minY - Math.max(3, h * 0.02)}\n40\n${Math.max(2, Math.min(w, h) * 0.03)}\n1\n` +
|
||||
`Satellite ${w.toFixed(1)}m x ${h.toFixed(1)}m | ${uPerPx.toFixed(4)} m/px | INSUNITS=meters\n`;
|
||||
/* Visible bounding box in CAD: four LINE entities (color 4 = cyan) so user sees the image extent */
|
||||
const layer = 'IMAGE_BOUNDS';
|
||||
const color = '4';
|
||||
const boxLines =
|
||||
@@ -913,12 +1050,30 @@ function appendSatelliteImageToDXF(dxfContent, imageFilename, minX, minY, maxX,
|
||||
`0\nLINE\n8\n${layer}\n62\n${color}\n10\n${maxX}\n20\n${maxY}\n30\n0\n11\n${minX}\n21\n${maxY}\n31\n0\n` +
|
||||
`0\nLINE\n8\n${layer}\n62\n${color}\n10\n${minX}\n20\n${maxY}\n30\n0\n11\n${minX}\n21\n${minY}\n31\n0\n`;
|
||||
const imageEntity =
|
||||
`0\nIMAGE\n8\nSATELLITE_IMAGERY\n10\n${minX}\n20\n${minY}\n30\n0\n` +
|
||||
`0\nIMAGE\n5\n${imageHandle}\n330\n${DXF_MODEL_SPACE_HANDLE}\n100\nAcDbEntity\n8\nSATELLITE_IMAGERY\n100\nAcDbRasterImage\n90\n0\n` +
|
||||
`10\n${minX}\n20\n${minY}\n30\n0\n` +
|
||||
`11\n${uPerPx}\n21\n0\n31\n0\n12\n0\n22\n${vPerPx}\n32\n0\n` +
|
||||
`13\n${widthPx}\n23\n${heightPx}\n340\n${handle}\n`;
|
||||
`13\n${widthPx}\n23\n${heightPx}\n340\n${defHandle}\n70\n7\n280\n0\n281\n50\n282\n50\n283\n0\n360\n${reactorHandle}\n` +
|
||||
`71\n1\n91\n2\n14\n-0.5\n24\n-0.5\n14\n${clipU}\n24\n${clipV}\n`;
|
||||
const classes =
|
||||
`0\nSECTION\n2\nCLASSES\n` +
|
||||
`0\nCLASS\n1\nIMAGE\n2\nAcDbRasterImage\n3\nISM\n90\n127\n91\n0\n280\n0\n281\n1\n` +
|
||||
`0\nCLASS\n1\nIMAGEDEF\n2\nAcDbRasterImageDef\n3\nISM\n90\n0\n91\n0\n280\n0\n281\n0\n` +
|
||||
`0\nCLASS\n1\nIMAGEDEF_REACTOR\n2\nAcDbRasterImageDefReactor\n3\nISM\n90\n0\n91\n0\n280\n0\n281\n0\n` +
|
||||
`0\nENDSEC\n`;
|
||||
const objectsSection =
|
||||
`0\nSECTION\n2\nOBJECTS\n` +
|
||||
`0\nIMAGEDEF\n90\n${handle}\n1\n${imageFilename}\n13\n${widthPx}\n23\n${heightPx}\n` +
|
||||
`0\nENDSEC\n0\nEOF`;
|
||||
return dxfContent.replace('0\nENDSEC\n0\nEOF', boxLines + scaleNote + imageEntity + '0\nENDSEC\n' + objectsSection);
|
||||
`0\nDICTIONARY\n5\nC\n330\n0\n100\nAcDbDictionary\n281\n1\n3\nACAD_GROUP\n350\nD\n3\nACAD_IMAGE_DICT\n350\n${imageDictHandle}\n` +
|
||||
`0\nDICTIONARY\n5\nD\n330\nC\n100\nAcDbDictionary\n281\n1\n` +
|
||||
`0\nDICTIONARY\n5\n${imageDictHandle}\n330\nC\n100\nAcDbDictionary\n281\n1\n3\nSATELLITE\n350\n${defHandle}\n` +
|
||||
`0\nIMAGEDEF\n5\n${defHandle}\n330\n${imageDictHandle}\n100\nAcDbRasterImageDef\n90\n0\n1\n${safeName}\n` +
|
||||
`10\n${widthPx}\n20\n${heightPx}\n280\n1\n281\n0\n11\n${uPerPx}\n21\n${vPerPx}\n` +
|
||||
`0\nIMAGEDEF_REACTOR\n5\n${reactorHandle}\n330\n${imageHandle}\n100\nAcDbRasterImageDefReactor\n90\n2\n330\n${imageHandle}\n` +
|
||||
`0\nENDSEC\n`;
|
||||
let out = dxfContent;
|
||||
if (out.indexOf('\n2\nCLASSES\n') === -1) {
|
||||
out = out.replace('0\nENDSEC\n0\nSECTION\n2\nTABLES\n', '0\nENDSEC\n' + classes + '0\nSECTION\n2\nTABLES\n');
|
||||
}
|
||||
out = insertDxfEntities(out, boxLines + scaleNote + imageEntity);
|
||||
return out.replace(dxfBaseObjectsSection(), objectsSection);
|
||||
}
|
||||
Reference in new issue
Block a user