Giter VIP home page Giter VIP logo

jscad2d's Introduction

JScad2d

Javascript Library for CAD 2D drawing from json file. A JSON file includes all data needed to draw paramateric 2D shape as vector image. Export in JSON file or in SVG file.

Test here the live demo

Screenshots

Global view

Description

Draw parts and assemble them in an assembly drawing. Parts and Assy drawing are built from json file. A special editor allows live drawing.

NOTE: assembly functionality not yet coded!

Features

  • Full parametric modeling
  • Draw any shape (print squeleton for debug)
  • Make fillet
  • Fill shape with hatch
  • Draw dimensions
  • Apply transformation
    • Rotate
  • Import from local drive or server
  • Export on local drive with format:
    • JSON (native format)
    • SVG

Usage

API Reference

  • JScad2d.loadFileAsText()
  • JScad2d.readfile(url)
  • JScad2d.zoomandpan(value)
    • value for zoom: zoomIn or zoomOut or reset
    • value for pan: left or right or up or down
  • JScad2d.displayClassToggle('dim' or 'ptsfillet' or 'squeleton')
  • JScad2d.drawOrigin()
  • JScad2d.doDebug()

Code example

Add JS libraries and style sheets links inside HEAD tag:

<head>
    <link rel="stylesheet" type="text/css" href="./jsoneditor/jsoneditor.min.css">
    <link rel="stylesheet" type="text/css" href="./jscad2d/JScad2d.css">
    <script src="./svg-pan-zoom/svg-pan-zoom.js"></script>
    <script src="./jsoneditor/jsoneditor.min.js"></script>
    <script src="./jscad2d/JScad2d.js"></script>
</head>

JSON file description for PART

  • Header {}
    • Type: part
    • Name
    • Title
    • Unit
  • Parameters{}
  • Views[]
    • [] {}
      • Header {}
        • Name
        • Origine {}
          • x
          • y
        • Hatch {}
      • Lines []
        • [] {}
      • Stroke
      • Start {}
      • End {}
      • Shapes []
        • [] {}
          • Fill
      • Points []
        • [] {}
          • x
          • y
          • length
          • angle
          • r
  • Format{}
  • Dimensions[]

JSON file description for ASSY

  • Header {}
  • Type: assy
  • Name
  • Title
  • Page size
  • Unit
  • Parameters[]
  • Parts[]
    • Name
    • View
    • Origine{}
    • Transformation{}
  • Dimensions[]

Dependencies

jscad2d's People

Contributors

benardt avatar

Watchers

 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.