Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

PascalCad

View on Codeberg

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

PascalCad

PascalCad is a Lazarus LCL component for creating, reading, writing and visualizing CAD entities in Free Pascal. It supports solid modeling (boolean operations on triangle meshes), surface modeling (NURBS, Bezier, mesh surfaces), and curve/point primitives.

Inspired by OpenCascade, Rhinoceros, xEagle, and OpenSCad.

Features

  • 3D Primitives — Point, Vector, Line, PolyLine, Polygon, Triangle, Circle, Ellipse
  • Curve Primitives — B-Spline curves with de Boor basis functions
  • Surface Primitives — Bezier surfaces, NURBS surfaces (rational B-spline with weights and knot vectors)
  • Solid Primitives — Box, Sphere, Cylinder (each generates a TriangleMesh)
  • Triangle Meshes — TTriangleMesh with volume, area, centroid, clone, and solid/non-solid flag
  • Solid Modeling — Union, Subtraction, Section (on solid meshes)
  • Feature Operations — Extrude, Sweep, Pocket
  • Surface Modeling — Trim, PunchHole, ExtendSurface
  • Transformations — Scale, Rotate, Translate
  • LCL Components — TPascalCadComponent (entity manager), TPascalCadViewport (with mouse orbit/pan/zoom), TPascalCadScripter (scripting support)
  • Package — Delivered as a Lazarus package (PascalCad.lpk)

Installation

  1. Open Lazarus
  2. Package → Open Package File (.lpk)
  3. Select PascalCad.lpk
  4. Click Compile, then Install (or Use → Add to Project)
  5. The PascalCad, PascalCadViewport, and PascalCadScripter components appear on the component palette

Quick Start

Drop a TPascalCadComponent and a TPascalCadViewport on a form, link the viewport's CadComponent property, then create entities:

pascal
CadComponent1.AddBox('Box1',
  TPoint3D.Create(0, 0, 0),
  TPoint3D.Create(10, 10, 10));

Project Structure

pascal
Src/
????????? Common/                  # Shared constants (PConstants.inc)
????????? CadPrimitives/           # Point, Vector, Line, Triangle, Circle, Ellipse,
???                            # PolyLine, Polygon, BSpline, BezierSurface,
???                            # NurbsSurface, TriangleMesh, Box, Sphere, Cylinder
????????? SolidModelingOperations/ # Union, Subtraction, Section
????????? FeatureOperations/       # Extrude, Sweep, Pocket
????????? SurfaceModelingOperations/ # SurfaceTrim, PunchHole, ExtendSurface
????????? Transformations/         # Scale, Rotate, Translate
????????? LCLComponents/           # PascalCadComponent, PascalCadViewport, PascalCadScripter

Dependencies

  • Lazarus LCL
  • Free Pascal 3.2+ / Lazarus 2.2+ (recommended)

License

MIT