Supported CAD Formats
Relevant source files
The following files were used as context for generating this wiki page:
The Nextcloud CAD Viewer is a native application designed to provide browser-based viewing capabilities for Computer-Aided Design (CAD) files. Its primary purpose is to allow users to interact with professional drawing formats directly within the Nextcloud web interface without requiring local software installations.
The scope of support currently focuses on the two most industry-standard formats: DWG and DXF. By utilizing WebGL technology and the @mlightcad/cad-viewer library, the app renders these files using high-performance client-side resources.
Sources: README.md:9-12, appinfo/info.xml:7-13
Core Supported Formats
The application provides full support for AutoCAD DWG and DXF files. Support is determined by both file extensions and a specific set of MIME types defined in the backend controller and frontend utilities.
AutoCAD DWG (Drawing)
DWG is the native format for several CAD packages. The viewer supports various versions of the DWG specification ranging from legacy releases to modern standards.
| Feature | Details |
|---|---|
| Versions Supported | R14, 2000, 2004, 2007, 2010, 2013, 2018 |
| Extensions | .dwg |
| Support Level | Full rendering with layer management |
Sources: wiki/Requirements.md:154-159, README.md:54-58
AutoCAD DXF (Drawing Exchange Format)
DXF is an open-source CAD data file format developed by Autodesk for enabling data interoperability between AutoCAD and other programs.
| Feature | Details |
|---|---|
| Versions Supported | R12, R13, R14, 2000+ |
| Extensions | .dxf |
| Support Level | Full rendering with layer management |
Sources: wiki/Requirements.md:161-166, README.md:54-58
Technical Identification and Validation
The system uses a strict validation logic to ensure only compatible files are processed. This validation occurs both on the server (PHP) and the client (TypeScript).
MIME Type Specification
The following MIME types are recognized as valid CAD formats across the entire application:
private const SUPPORTED_MIME_TYPES = [
'application/acad',
'application/autocad_dwg',
'application/dwg',
'application/x-autocad',
'application/x-dwg',
'image/vnd.dwg',
'image/vnd.dxf',
'application/dxf',
'application/x-dxf',
'image/x-dxf',
];
Sources: lib/Controller/FileController.php:33-44, src/utils/cadLoader.ts:104-115
Validation Workflow
The application follows a multi-stage validation process before rendering a file.
The diagram shows the validation flow from the initial user click to final frontend mounting.
Sources: lib/Controller/FileController.php:78-83, src/utils/cadLoader.ts:103-116, tests/unit/cadLoader.spec.ts:7-22
File Size and Performance Constraints
While the viewer is capable of handling large files, performance is categorized by file size due to the browser-based nature of the rendering engine.
| Category | Size Range | Performance Note |
|---|---|---|
| Small | < 10 MB | Optimal performance |
| Medium | 10-50 MB | Good performance |
| Large | 50-200 MB | May require more system resources |
| Very Large | 200-500 MB | Performance depends on client GPU/RAM |
| Maximum | 500 MB+ | Server upload limits must be adjusted |
Sources: wiki/Requirements.md:168-176
Format Loading Logic
The frontend utility cadLoader.ts provides the logic for determining format compatibility via file extensions and MIME types.
export function isSupportedCADFormat(mimeType: string): boolean {
return [
'application/acad',
// ... other types
'image/x-dxf',
].includes(mimeType)
}
export function getFileExtension(filename: string): string {
const parts = filename.split('.')
return parts.length > 1 ? (parts.pop() as string).toLowerCase() : ''
}
Sources: src/utils/cadLoader.ts:103-121
Conclusion
Nextcloud CAD Viewer provides robust support for DWG and DXF formats by implementing rigorous MIME type validation in both the PHP FileController and TypeScript cadLoader utility. This ensures that only compatible AutoCAD versions are streamed to the browser for high-performance WebGL rendering.
Sources: README.md:103-107, appinfo/info.xml:23-26