⚡ AWV3 embedded CAD


Keywords
awv3
License
MIT
Install
npm install awv3@10.0.15

Documentation

AWV client CAD framework

Install

npm install awv3 --save

ES6 or CommonJS

HTML

<div id="main" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden;"></div>

JS

import THREE from 'three';
import { Canvas, View, Object3 } from 'awv3';

// Create new canvas
const canvas = new Canvas({ dom: '#main' });

// Create a view, defaults into the same dom-node as the canvas
const view = new View(canvas);

let mesh = {command: "Blob", data: "GQaÉPB3*Ì¥Jj5£D)3.cF¼´NE0©«p|S·D©t¨0;07BpÎÌFC·63.©S¢WkÍÀÄ^gg6ÁP£9Ä$xÃmÊ·¢|cÆ!º%~ÆWa[¼MsLÅmxÊv}oN¡qL.ÆƤZ!Iu¤6Z2UµPxVx,°¤¢«O²¤¹H=¡l´.¼o~Ãh]À3·]q·lc6:{}TÁuC¡¢1^·QP¥AG¸ÎËJ¸R¨Á¨M(®MÌBK1B|t³ËZ@²l§9Âv®M7%Ev¡@vB¨ÂP¸¦ZL¿MSr66[§Ã¯F%=q¨KNCf$N½9_xQ*§goÃb7dµ4¼²W~7h}2duNJW*U¤À4±È=¨XF2Ì¢FfInP¡H¼JºUÈ._¡²L7¼]GD±Ç¿¼;«dVAM[F«]VÎË#g%´¾Ä¸¸a3ËavÄ$¼Fzz®Q¡¸®_Â}¸»k¢Pc¹:@Ì6¢D1G©$cz:1S~O6ËqI³S¥@XM©Olw%f@w·GÃLÆ¥³qzQIGA5¨@r¶FDUL¢¥T¥3¼^aHzoºÍW][OH³gdÇ)!", length: 1093};

// Parse meshes, group objects, collect materials
const model = new Object3((await canvas.parser.parse(mesh)).models).updateMaterials();

// Add to scene
view.scene.add(model);

ES5 global namespace include

HTML

<div id="main" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden;"></div>
<script src="node_modules/three/three.min.js"></script>
<script src="node_modules/awv3/browser.js"></script>

JS

// Create new canvas
var canvas = new AWV.Canvas({ dom: '#main' });

// Create a view, defaults into the same dom-node as the canvas
var view = new AWV.View(canvas);

var mesh = {command: "Blob", data: "GQaÉPB3*Ì¥Jj5£D)3.cF¼´NE0©«p|S·D©t¨0;07BpÎÌFC·63.©S¢WkÍÀÄ^gg6ÁP£9Ä$xÃmÊ·¢|cÆ!º%~ÆWa[¼MsLÅmxÊv}oN¡qL.ÆƤZ!Iu¤6Z2UµPxVx,°¤¢«O²¤¹H=¡l´.¼o~Ãh]À3·]q·lc6:{}TÁuC¡¢1^·QP¥AG¸ÎËJ¸R¨Á¨M(®MÌBK1B|t³ËZ@²l§9Âv®M7%Ev¡@vB¨ÂP¸¦ZL¿MSr66[§Ã¯F%=q¨KNCf$N½9_xQ*§goÃb7dµ4¼²W~7h}2duNJW*U¤À4±È=¨XF2Ì¢FfInP¡H¼JºUÈ._¡²L7¼]GD±Ç¿¼;«dVAM[F«]VÎË#g%´¾Ä¸¸a3ËavÄ$¼Fzz®Q¡¸®_Â}¸»k¢Pc¹:@Ì6¢D1G©$cz:1S~O6ËqI³S¥@XM©Olw%f@w·GÃLÆ¥³qzQIGA5¨@r¶FDUL¢¥T¥3¼^aHzoºÍW][OH³gdÇ)!", length: 1093};

// Parse meshes
canvas.parser.parse(mesh).then(function(context) {

    // Group objects, collect materials
    var model = new AWV.Object3(context.models).updateMaterials();

    // Add to scene
    view.scene.add(model);

Documentation

Documentation

Demos

Live demos, (source)