Fork of HakanSeven12/OpenCADStudio (GPL-3.0), patched for embedded job-scoped load/save integration with the CMMS.
  • Rust 71.9%
  • Fluent 26.7%
  • WGSL 0.7%
  • Max 0.3%
  • HTML 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
sLuCHa 1a45f6bd97 fix(plot): correct hatch rendering in PDF / plot export
Hatched content — especially fills nested inside a block INSERT, such as a
title-block logo — plotted incorrectly: missing, mis-spaced, or with phantom
bars. Five related fixes make the PDF/plot output match AutoCAD.

1. Export block-internal hatch fills.
   The export collected only hatches owned directly by the layout block, so a
   hatch nested in a block INSERT was dropped and printed as bare monochrome
   outlines. The insert-explosion the viewport already does is extracted into a
   shared `exploded_insert_hatch_models()` and called from both the viewport
   (`synced_hatch_models`) and the export (`paper_canvas_hatches`), so a plot
   draws block-internal hatches identically to the screen.

2. Honour the hatch's own stored pattern-line spacing.
   `hatch_model_from_dxf` re-derived pattern spacing from the name-matched
   catalog entry x pattern_scale, ignoring the resolved line geometry the DWG
   stores on the hatch. When a drawing was authored against a different base
   spacing (imperial 0.125 vs the catalog's metric 3.175 for ANSI31), lines
   came out up to ~25x too coarse and a dense fill collapsed to a few stray
   lines. When the hatch carries its own line geometry it is now used directly
   (identity scale/angle); the catalog path remains the fallback.

3. Fill far-from-origin pattern hatches.
   `pattern_segments` clamped the ABSOLUTE scan-line index to
   +/-MAX_LINES_PER_FAMILY. A fine-spaced hatch far from the pattern origin has
   large-magnitude indices at both ends but a small span, so the clamp inverted
   the range and emitted nothing — silently dropping the fill. Cap the line
   count (span) instead of the absolute index.

4. Skip TEXTBOX boundary paths.
   TEXTBOX boundary paths (flag bit 3) are text bounding-boxes AutoCAD derives
   for island detection; they are never drawn or filled. Treating one as a fill
   boundary painted its rectangle solid — a phantom bar. It is now skipped when
   building the fill boundary.

5. Print white/ACI-7 hatch fills black on paper.
   Hatch fills arrive adapted to the dark screen background, so a white/ACI-7
   fill would vanish white-on-white on the sheet. Mirror the wire pass:
   near-white/near-yellow -> black, near-cyan -> dark blue, matching AutoCAD's
   colour-7-on-white plotting. Wipeouts keep their paper-white mask.

Adds `tests/block_hatch_export.rs` covering: block-internal hatch reaches the
export set, stored-line spacing is honoured, far-from-origin fills are not
dropped, and TEXTBOX paths are not filled.
2026-07-06 12:24:10 +02:00
.cargo fix(text): address PR #180 review 2026-06-26 00:27:40 +03:00
.claude feat: add local settings for Bash permissions 2026-04-30 10:01:17 +03:00
.github feat(web): show Patreon supporters on the web build too 2026-07-02 01:25:24 +03:00
assets feat(ui): ribbon collapse-mode selector + start-page recent controls 2026-07-06 01:06:01 +03:00
crates feat(plugin): surface loaded plugin commands in command-line autocomplete 2026-07-04 23:01:53 +03:00
docs perf(core): cache ribbon_groups() with OnceLock, avoid per-frame tree allocations 2026-07-02 21:00:57 +01:00
packaging feat(packaging): desktop shortcut, icon-cache refresh, checksums, AppStream 2026-06-16 04:27:46 +03:00
plugins Update registry.json 2026-06-23 00:22:08 +03:00
src fix(plot): correct hatch rendering in PDF / plot export 2026-07-06 12:24:10 +02:00
tests fix(plot): correct hatch rendering in PDF / plot export 2026-07-06 12:24:10 +02:00
web/fonts feat(web): lazy per-script font loading for international CAD text 2026-06-20 16:13:26 +03:00
.gitignore chore: ignore .claude/launch.json (local preview config) 2026-06-18 13:36:35 +03:00
build.rs feat(start): show paying Patreon supporters on the Start page 2026-07-02 01:00:22 +03:00
Cargo.lock chore(release): v0.7.6 2026-07-05 21:05:51 +03:00
Cargo.toml chore(release): v0.7.6 2026-07-05 21:05:51 +03:00
COMMANDS.md fix(render): repaint on layer/property edits (#231) 2026-06-30 23:41:13 +03:00
HEADER_AUDIT.md feat: add HeaderVariables audit documentation 2026-05-20 05:57:16 +03:00
index.html feat(web): lazy per-script font loading for international CAD text 2026-06-20 16:13:26 +03:00
LICENSE Initial commit 2026-03-22 14:53:51 +03:00
README.md Update README.md 2026-06-17 02:14:56 +03:00
STATUSBAR.md docs: add status bar items roadmap 2026-06-05 00:14:41 +03:00
Trunk.toml fix(wasm): make the web build actually run in the browser 2026-06-16 17:53:56 +03:00

Open CAD Studio

OCS is a CAD application for 2D drafting and 3D modeling, built with Rust. Reads and writes DWG and DXF files natively. Also has a web version now!

OCS Web try it in the browser: https://hakanseven12.github.io/OpenCADStudio/

resim resim2

Features

File Formats

  • DWG read/write (R13 through R2018)
  • DXF read/write (R13 through R2018)
  • STL export (STLOUT / EXPORTSTL)
  • STEP AP203 export (STEPOUT)
  • OBJ import (IMPORTOBJ)
  • PDF export (plot layouts to PDF)
  • WBLOCK — write selected entities or a block to an external file
  • XREF — attach, reload, and auto-resolve external references

2D Drafting

Command Description
LINE, PLINE, RECTANG, POLYGON Basic geometry
CIRCLE, ARC, ELLIPSE, SPLINE Curves
HATCH, HATCHEDIT Hatch fills with pattern, scale, angle editing
OFFSET, TRIM, EXTEND, FILLET Modify geometry (supports lines, arcs, ellipses, polylines, splines)
BREAK, STRETCH, LENGTHEN Shape editing
ARRAY, MIRROR, MOVE, COPY, ROTATE, SCALE Transformations
EXPLODE Explode blocks, dimensions, polylines, mlines
DDEDIT Double-click text editing
MASSPROP Area, perimeter, centroid of selected entities

3D Modeling

Command Description
BOX, SPHERE, CYLINDER Solid primitives
EXTRUDE, REVOLVE Profile-based solids
LOFT Ruled-surface loft through cross-sections
SWEEP Sweep a profile along a path
ARRAY3D 3D array
ACIS tessellation Renders 3DSOLID, REGION, and BODY entities

Annotations & Dimensions

  • Dimensions: Linear, Aligned, Angular, Radial, Diameter, Ordinate — with full DIMSTYLE support (DIMASZ, DIMSCALE, DIMEXO, DIMEXE, and more)
  • Text: MTEXT, TEXT, DTEXT with font browser (STYLE DIALOG)
  • Leaders: MLEADER with straight and spline path types; MLEADERSTYLE manager
  • Tolerances: GD&T feature control frames
  • Tables: TABLE entity render; TABLESTYLE manager
  • MLine: MLINE entity with MLSTYLE manager and EXPLODE support

Paper Space & Layouts

  • Multi-tab layout system with model space and unlimited paper space tabs
  • Viewport projection: Model content correctly projected into paper-space viewport rectangles
  • Camera persistence: View position and zoom saved per layout; restored on file open and tab switch
  • Correct paper size: Physical paper dimensions read from embedded PlotSettings (not drawing limits)
  • Inline MSPACE overlay — enter a viewport with double-click; edit model entities in place
  • VPORTS — preset viewport configurations (single, 2H, 2V, 4-way)
  • LAYOUTMANAGER / LAYOUTPANEL — GUI layout manager
  • PLOTSTYLEPANEL / STYLESMANAGER — plot style table editor (CTB/STB)
  • PRINT — send layout to system printer

Blocks & References

  • INSERT with attribute prompting (ATTREQ)
  • ATTEDIT — edit block attribute values interactively
  • REFEDIT / REFCLOSE — in-place block reference editing
  • XREF — attach, reload, and resolve external DWG/DXF references
  • DATAEXTRACTION — export entity property data to CSV

Snapping & Precision

  • Object snaps: Endpoint, Midpoint, Center, Node, Quadrant, Intersection, Perpendicular, Tangent, Nearest, Insertion, and more
  • Ellipse arc endpoints, LWPolyline arc midpoints, Hatch boundary points
  • Object Snap Tracking (OTRACK / F11)
  • Polar Tracking with configurable angle increment
  • Dynamic Input overlay (DYNMODE / F12)
  • Grid snap with adaptive spacing
  • Command history navigation (↑ / ↓)

Rendering

  • GPU-accelerated via WebGPU (wgpu)
  • 4× MSAA anti-aliasing
  • Orthographic and perspective camera
  • ViewCube with face/edge/corner snapping
  • Wide polylines: LWPolyline and Polyline2D filled strokes
  • Raster images: GPU-textured quad pipeline (IMAGE command)
  • Wipeout: Solid fill masking
  • Complex linetypes: Text and shape elements rendered in linetype patterns
  • White/black entity colors adapt to background luminance
  • Per-viewport background color (BACKGROUND)
  • Visual style selector (Wireframe, Shaded, etc.)
  • X-ray ghost pass for selected wires occluded by geometry

UI

  • Modular ribbon interface — Home, Insert, Annotate, View, Manage, Layout
  • Command line with autocomplete and history
  • Layer Manager with per-viewport freeze columns
  • Properties panel
  • COLORSCHEME — runtime theme switching
  • SHORTCUTS — keyboard shortcuts panel
  • SPLINEDIT — close, open, reverse spline control points
  • UCS icon with 3D foreshortening and axis labels

Installation

Linux (AppImage)

Download OpenCADStudio-*-linux-x86_64.AppImage from the latest release, then:

chmod +x OpenCADStudio-*-linux-x86_64.AppImage
./OpenCADStudio-*-linux-x86_64.AppImage

No installation required — runs directly on any modern Linux distribution.

Windows

Download OpenCADStudio-*-windows-x86_64.exe from the latest release and run it directly. Windows SmartScreen may show "Windows protected your PC" because the binary is not yet code-signed — click More info → Run anyway.

macOS (Apple Silicon)

Apple Silicon (M-series) only; Intel macOS isn't built. The app is ad-hoc signed but not Apple-notarised (notarisation requires a paid Apple Developer ID), so macOS Gatekeeper guards the first launch. Pick whichever path is easiest:

Option A — Homebrew (recommended):

brew install --cask --no-quarantine \
  https://raw.githubusercontent.com/HakanSeven12/OpenCADStudio/main/packaging/homebrew/open-cad-studio.rb

--no-quarantine lets Gatekeeper skip the unsigned-app prompt. See packaging/homebrew/ for publishing this as a brew tap.

Option B — manual .dmg:

Download OpenCADStudio-*-macos-arm64.dmg from the latest release, open it, and drag OpenCADStudio.app to /Applications. If the first launch is blocked, clear the quarantine flag once:

xattr -dr com.apple.quarantine /Applications/OpenCADStudio.app

On older macOS you can instead right-click OpenCADStudio.app → Open and confirm; on macOS Ventura and later, approve it via System Settings → Privacy & Security → Open Anyway.

Build from Source

Requirements: Rust 1.75+

git clone https://github.com/HakanSeven12/OpenCADStudio.git
cd OpenCADStudio
cargo build --release --bin OpenCADStudio
./target/release/OpenCADStudio

License

GPL-3.0-only — see LICENSE