GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - cadlens-co/cadlens-sdk-js: Official JavaScript/TypeScript SDK for the Cadlens CAD parsing API — DWG, DXF, DWF to JSON

BranchesTags
Open more actions menu

Latest commit

 

History

14 Commits
14 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

cadlens

npm version

Official JavaScript/TypeScript SDK for Cadlens — the DWG to JSON API that converts CAD files into preview images, structured JSON, layer metadata, and vector entities.

  • Website: cadlens.co
  • API Docs: cadlens.co/docs
  • Dashboard: cadlens.co/dashboard

Install

npm install cadlens

Requires Node.js 18+ (uses native fetch and FormData).


Quick Start

import { CadlensClient } from 'cadlens';
import { readFileSync } from 'fs';

const client = new CadlensClient({ apiKey: process.env.CADLENS_API_KEY! });

// One-shot: upload + poll + return result
const result = await client.parseAndWait(
  new Blob([readFileSync('drawing.dwg')]),
  'drawing.dwg',
);

console.log('Sheets:', result.sheets.length);
console.log('Entities:', result.summary?.totalEntities);
console.log('Layers:', result.summary?.totalLayers);
console.log('Preview:', result.imageUrl ?? result.imageUrls?.[0]);

Step-by-step Usage

import { CadlensClient } from 'cadlens';
import { readFileSync } from 'fs';

const client = new CadlensClient({ apiKey: 'cadl_your_key_here' });
const file = new Blob([readFileSync('drawing.dwg')]);

// 1. Upload
const { job_id } = await client.parse(file, 'drawing.dwg');

// 2. Poll
let job;
do {
  await new Promise((r) => setTimeout(r, 3000));
  job = await client.getJob(job_id);
} while (job.status === 'PENDING' || job.status === 'PROCESSING');

// 3. Result
const result = await client.getResult(job_id);
console.log(result.file);     // { name, format, version, units }
console.log(result.summary);  // { totalSheets, totalEntities, totalLayers, truncated }
for (const sheet of result.sheets) {
  console.log(`${sheet.name}: ${sheet.entityCount} entities, ${sheet.layerCount} layers`);
}

API Reference

new CadlensClient(options)

Option Type Description
apiKey string Your cadl_xxx API key (required)
baseUrl string Override API base URL (default: https://api.cadlens.co)

Methods

Method Returns Description
parse(file, fileName, options?) ParseResponse Upload a CAD file; get a job_id
parseAndWait(file, fileName, options?) JobResult Upload, poll, and return result
getJob(jobId) Job Get job status and metadata
listJobs() { jobs: Job[] } List recent jobs (up to 100)
getResult(jobId) JobResult Get file, summary, sheets[] (entities + layers per sheet)
getImage(jobId) { imageUrl: string } Get presigned PNG preview URL (1h TTL)
deleteJob(jobId) void Delete job and S3 artifacts

ParseOptions

Option Type Description
webhookUrl string Receive a POST callback on completion
mode 'async' | 'sync' sync waits up to 60s server-side

Supported Formats

DWG · DXF · DWF · DWFx · DGN · PDF


Get an API Key

Sign up at cadlens.co, go to the dashboard, and create an API key. Keys start with cadl_.


Links

  • Cadlens official website
  • Cadlens API documentation
  • Cadlens pricing

GitHub Topics

Add these topics to this repo for discovery: cad dwg dxf sdk typescript nodejs npm cad-api engineering-api dwg-parser


License

MIT

About

Official JavaScript/TypeScript SDK for the Cadlens CAD parsing API — DWG, DXF, DWF to JSON

cadlens.co/docs

Topics

cadcad-apidwgdwg-parserdxfengineering-apinodejsnpmsdktypescript

Resources

Readme
MIT license
Activity
Custom properties

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.