Giter Site home page Giter Site logo

dingcad's Introduction

dingcad is literally just a manifoldcad wrapper with a hot reloading script

easy packaging

credits to manifold cad https://github.com/elalish/manifold

dingcad

wordart (6)

This is dingcad. These are yacine's personal scripts used to design cad shapes.

Dingcad allows you to write cad scripts and have live reloading on a web browser. Design fast! Every time you save, out.glb gets replaced.

Big thanks to elalish and manifold cad. Some projects make me feel very little. Manfioldcad is one of those projects.

output.mp4

DINGCAD! usage

git clone https://github.com/yacineMTB/dingcad/ && cd dingcad
npm run install
npm run cad
open https://localhost:3000
nvim main_assembly.ts
# now, on saving the web view should automatically reload!

Ding software philosophy

I've purposefully made dingcad to be a bunch of scripts that I just use. I've avoided making it an npm module because it's important for me to hack on it This is very much a work in progress. But I think it's better than openscad! If you don't like the renderer, it's a single index.html file. Just change it! If you want to add parts, please do!

Code docs

Thes come from manifold js definitions. I'm not sure what all of these do! I'm not too great at cad

Why typescript?

manifold_lib was ripped from manifoldcad and I was too lazy to detypescript it

// Triangulates polygons
export function triangulate(polygons: Polygons, precision?: number): Vec3[];

// Circular shape quantization defaults
export function setMinCircularAngle(angle: number): void;
export function setMinCircularEdgeLength(length: number): void;
export function setCircularSegments(segments: number): void;
export function getCircularSegments(radius: number): number;
export function resetToCircularDefaults(): void;

export class CrossSection {
  constructor(polygons: Polygons, fillRule?: FillRule);
  static square(size?: Vec2|number, center?: boolean): CrossSection;
  static circle(radius: number, circularSegments?: number): CrossSection;
  extrude(
      height: number, nDivisions?: number, twistDegrees?: number,
      scaleTop?: Vec2|number, center?: boolean): Manifold;
  revolve(circularSegments?: number, revolveDegrees?: number): Manifold;
  transform(m: Mat3): CrossSection;
  translate(v: Vec2): CrossSection;
  translate(x: number, y?: number): CrossSection;
  rotate(v: number): CrossSection;
  scale(v: Vec2|number): CrossSection;
  mirror(v: Vec2): CrossSection;
  warp(warpFunc: (vert: Vec2) => void): CrossSection;
  offset(
      delta: number, joinType?: JoinType, miterLimit?: number,
      circularSegments?: number): CrossSection;
  simplify(epsilon?: number): CrossSection;
  add(other: CrossSection|Polygons): CrossSection;
  subtract(other: CrossSection|Polygons): CrossSection;
  intersect(other: CrossSection|Polygons): CrossSection;
  static union(a: CrossSection|Polygons, b: CrossSection|Polygons): CrossSection;
  static difference(a: CrossSection|Polygons, b: CrossSection|Polygons): CrossSection;
  static intersection(a: CrossSection|Polygons, b: CrossSection|Polygons): CrossSection;
  static union(polygons: (CrossSection|Polygons)[]): CrossSection;
  static difference(polygons: (CrossSection|Polygons)[]): CrossSection;
  static intersection(polygons: (CrossSection|Polygons)[]): CrossSection;
  hull(): CrossSection;
  static hull(polygons: (CrossSection|Polygons)[]): CrossSection;
  static compose(polygons: (CrossSection|Polygons)[]): CrossSection;
  decompose(): CrossSection[];
  static ofPolygons(polygons: Polygons, fillRule?: FillRule): CrossSection;
  toPolygons(): SimplePolygon[];
  area(): number;
  isEmpty(): boolean;
  numVert(): number;
  numContour(): number;
  bounds(): Rect;
  delete(): void;
}

export class Manifold {
  constructor(mesh: Mesh);
  static tetrahedron(): Manifold;
  static cube(size?: Vec3|number, center?: boolean): Manifold;
  static cylinder(
      height: number, radiusLow: number, radiusHigh?: number,
      circularSegments?: number, center?: boolean): Manifold;
  static sphere(radius: number, circularSegments?: number): Manifold;
  static extrude(
      polygons: CrossSection|Polygons, height: number, nDivisions?: number,
      twistDegrees?: number, scaleTop?: Vec2|number,
      center?: boolean): Manifold;
  static revolve(
      polygons: CrossSection|Polygons, circularSegments?: number,
      revolveDegrees?: number): Manifold;
  static ofMesh(mesh: Mesh): Manifold;
  static smooth(mesh: Mesh, sharpenedEdges?: Smoothness[]): Manifold;
  static levelSet(
      sdf: (point: Vec3) => number, bounds: Box, edgeLength: number,
      level?: number): Manifold;
  transform(m: Mat4): Manifold;
  translate(v: Vec3): Manifold;
  translate(x: number, y?: number, z?: number): Manifold;
  rotate(v: Vec3): Manifold;
  rotate(x: number, y?: number, z?: number): Manifold;
  scale(v: Vec3|number): Manifold;
  mirror(v: Vec3): Manifold;
  warp(warpFunc: (vert: Vec3) => void): Manifold;
  static smoothByNormals(normalIdx: number): Manifold;
  static smoothOut(minSharpAngle?: number, minSmoothness?: number): Manifold;
  refine(n: number): Manifold;
  refineToLength(length: number): Manifold;
  setProperties(
      numProp: number,
      propFunc: (newProp: number[], position: Vec3, oldProp: number[]) => void):
      Manifold;
  calculateCurvature(gaussianIdx: number, meanIdx: number): Manifold;
  calculateNormals(normalIdx: number, minSharpAngle: number): Manifold;
  add(other: Manifold): Manifold;
  subtract(other: Manifold): Manifold;
  intersect(other: Manifold): Manifold;
  static union(a: Manifold, b: Manifold): Manifold;
  static difference(a: Manifold, b: Manifold): Manifold;
  static intersection(a: Manifold, b: Manifold): Manifold;
  static union(manifolds: Manifold[]): Manifold;
  static difference(manifolds: Manifold[]): Manifold;
  static intersection(manifolds: Manifold[]): Manifold;
  split(cutter: Manifold): Manifold[];
  splitByPlane(normal: Vec3, originOffset: number): Manifold[];
  trimByPlane(normal: Vec3, originOffset: number): Manifold;
  slice(height: number): CrossSection;
  project(): CrossSection;
  hull(): Manifold;
  static hull(points: (Manifold|Vec3)[]): Manifold;
  static compose(manifolds: Manifold[]): Manifold;
  decompose(): Manifold[];
  isEmpty(): boolean;
  numVert(): number;
  numTri(): number;
  numEdge(): number;
  numProp(): number;
  numPropVert(): number;
  boundingBox(): Box;
  precision(): number;
  genus(): number;
  getProperties(): Properties;
  minGap(other: Manifold, searchLength: number): number;
}

dingcad's People

Contributors

yacinemtb avatar

Stargazers

Lim Yi Sheng Brian avatar Lucky NES avatar  avatar Marco avatar  avatar Ridhi Bandaru avatar  avatar futuroptimist avatar josh avatar char avatar uzair ghori avatar Jack Vial avatar  avatar OussamaBernou avatar  avatar Javed Khan avatar im2rnado avatar Stefan Bokarev avatar Sunny Gonnabathula avatar Ilya Kuhta avatar Draxi avatar Straughter "BatmanOsama" Guthrie avatar Oz Elentok avatar  avatar  avatar Elias Almqvist avatar yuniancong avatar Peter Tran avatar Mark Mwanga avatar Atlas 3DSS avatar D i c h a avatar  avatar Ludo Esmanne avatar samepant avatar Tom Mitchell avatar Tsang Chin Lung avatar Andrei Shvedau avatar  avatar Aashutosh Rathi avatar Mateus Silva Aragao  avatar Alex avatar Paul Wilson avatar Lulzx avatar Louis Masters  avatar Lukas avatar  avatar Sean L. avatar Andriy Pashynnyk avatar Hugo Schmitt avatar  avatar  avatar Neutron avatar Jaysce avatar Bhavit Sharma avatar Indah avatar Siddharth avatar umangkaushik avatar  avatar sarfrazkhan avatar buzzxu avatar Yeet avatar Dominic Peel avatar Rob avatar Kalila avatar raaed avatar Tony Kabilan Okeke avatar Jeffrey avatar tetsuo avatar  avatar Gabe Audick avatar Michael DeMarco avatar  avatar Brian Lu avatar ReadWriteReality avatar siddhant singh (siddhantx0) avatar Corey Lista avatar Roy avatar Jeff Welder avatar Jack Chakany avatar Wentao avatar Cyrus Freshman avatar

Watchers

Hugo Schmitt avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.