GithubHelp home page GithubHelp logo

gdsii_js's Introduction

gdstk_js

Intro

Javascript wasm wrapper for gdstk. We use emscritpen sdk wrapper gdstk as a Javascript pacakage, so that we can use gdstk functions in web.

How to Build

Both Linux and windows is ok, emsdk and cmake is required

mkdir build
cd build
emcmake cmake ..
cmake --build .

You will get wasm with it's binding js in packages dir

Valid cmake configuration are:

CMAKE_BUILD_TYPE // default is "Release", use -DCMAKE_BUILD_TYPE=Debug when you want to get Debug packages
EXPORT_MODULE // default is "ON", you will get pacakges named "Gdstk" in directory `packages`, if "OFF", pacakges will be named "Module"

How to use

API is very similar like gdstk python interface but in Js flavor, see gdstk documentation for details

If you work in pure JS enviroment, you must cmake this gdstk_js project with option "-DEXPORT_MODULE=OFF", then use <script>xxx/gdstk.js</script> label import gdstk as Module object. See examples

If you work in node.js enviroment, you must cmake this gdstk_js project with option "-DEXPORT_MODULE=ON"(it's default value), then use require to import gdstk as Gdstk object.

Pitfalls

  • If you want set one of default value of interface, you must give all value for default parameter
  • In web broswer, it's hard to operate local file directly. You can use FS object offered by emscripten to achieve that. Or just use upload_file and download_file js function of gdstk_js package. Notic: if use FS, should wrapper with Module.FS or Gdstk.FS base on you build type.
  • Polygon.points is a js array like proxy object. Support modify points value in place as js array ways, but not support iter yet.
  • When access properties like Curve.points(in form of native js array) in iteration, it's better save proerties as a variable, then iter it. Otherwise may cause huge useage of memory and CPU performance.
  • FlexPath.commands accept array of commands instead of variable length of parameters. same of Curve.commands
  • Some method like Plygon.get_properties not implemented yet.
  • Some Class like RawCell, GdsWriter not implemented yet.

gdsii_js's People

Contributors

michaelcache avatar

Watchers

 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.