This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Canvas from 'canvas'; | |
import * as parser from 'parser'; | |
let canvas = new Canvas({ | |
dom: document.querySelector('#main') | |
}); | |
let blob = {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}; | |
// Add views, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'requestidlecallback'; | |
import Canvas from 'canvas'; | |
import View from 'view'; | |
import Object3 from 'three/object3'; | |
import { Performance } from 'helpers/misc'; | |
// Create new canvas | |
const canvas = new Canvas({ dom: '#main' }); | |
// Create a view, defaults into the same dom as the canvas | |
const view = new View(canvas, { ambient: 0x909090 }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'requestidlecallback'; | |
import Canvas from 'canvas'; | |
import View from 'view'; | |
import Object3 from 'three/object3'; | |
import { Performance } from 'helpers/misc'; | |
// Create new canvas | |
const canvas = new Canvas({ dom: '#main' }); | |
// Create a view, defaults into the same dom as the canvas | |
const view = new View(canvas, { ambient: 0x909090 }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let { firstModel } = await canvas.parser.stream('/assembly.txt')); | |
firstModel.interaction.recursive = true; | |
firstModel.interaction.listen("hover", object => console.log(`%{object.name}: hover`); | |
let secondListener = firstModel.interaction.listen("hover", object => console.log(`2nd callback %{object.name}: hover`); | |
firstModel.interaction.listen("unhover", object => console.log(`%{object.name}: unhover`); | |
firstModel.interaction.listen("drag", (object, type) => { | |
switch (type) { | |
case 'start': console.log(`%{object.name}: drag started`; break; | |
case 'drag': console.log(`%{object.name}: dragging`; break; | |
case 'end': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'requestidlecallback'; | |
import Canvas from 'canvas'; | |
import View from 'view'; | |
import Object3 from 'three/object3'; | |
import Animation from 'animation'; | |
import { Performance } from 'helpers/misc'; | |
// Create new canvas | |
const canvas = new Canvas({ dom: '#main' }); | |
// Create a view, defaults into the same dom as the canvas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Application ------------------------------------------------------------------------ | |
import AssemblyFactory from 'factory/assembly' | |
// Create factory, link it to the scene, or whereever models are stored in the application | |
let factory = new AssemblyFactory(scene); | |
// Request a table | |
server.request('_O.CreateTable()', factory); | |
// Request a clone | |
server.request('_O.Clone(0)', factory); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Parser from 'parser'; | |
export default class { | |
constructor(pool) { | |
this.pool = pool; | |
return attribs => { | |
switch (attribs.type) { | |
case Parser.Factory.Link: | |
let { ref, matrix } = attribs.data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ "type": "Geometry", "name": "Tischplatte", "id": 6, "data": [base128], "meta": {} }, | |
{ "type": "Geometry", "name": "Tischbein", "id": 7, "data": [base128], "meta": {} }, | |
{ "type": "Model", "name": "Tisch", "id": 8, | |
"data":[ | |
{ "type": "Link", "ref": "Tischplatte", "matrix": [0,0,0], "meta": {} }, | |
{ "type": "Link", "ref": "Tischbein", "matrix": [0,0,0], "meta": {} }, | |
{ "type": "Link", "ref": "Tischbein", "matrix": [0,10,0], "meta": {} }, | |
{ "type": "Link", "ref": "Tischbein", "matrix": [10,0,0], "meta": {} }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 'url', default URL, depends on the analyzer running online or local | |
// 'Canvas', 'View', 'SocketIO' & 'Object3' from AWV3-next | |
// 'log' (.start(), .stop(message) & .printResults(string || object)) | |
log.start(); | |
let tasks = []; | |
let task = new SocketIO().connect(url).then(connection => { | |
// Clear scene |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import and create canvs | |
import Canvas from 'awv3'; | |
const canvas = new Canvas({ dom: '#view' }); | |
// import plugins, they should be separate from the awv3-repo | |
import Sketcher from 'awv3-sketcher'; | |
import Extrusion from 'awv3-extrusion'; | |
import Measuring from 'awv3-measuring'; | |
// create measure layer, "use" it Node style |
OlderNewer