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 Session from 'awv3/session'; | |
// Create session | |
const session = window.session = new Session({ | |
debug: true, | |
connection: 'http://localhost:8181/' | |
}); | |
// Wait until we're connected | |
session.onConnected().then(server => { |
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 Plugin from 'awv3/session/plugin'; | |
import { Group, Button, Input, Label, Selection, Checkbox, Dropdown } from 'awv3/session/elements'; | |
export default class extends Plugin { | |
constructor(session, { name }) { | |
super(session, { type: "Measure", name }); | |
// 1. Elements SHOULD be created in the constructor. They can be stored in any way or form, | |
// in this case we use 'this' so that they are accessibable throuout the plugin |
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 | |
canvas | |
scene | |
class VersatileObject(obj1) -> eventhandler | |
obj2 -> eventhandler | |
obj3 -> eventhandler | |
plugins | |
UI elements [selection] -> notify | |
pluginsystem->events->override |
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 Plugin from 'awv3/plugin/base'; | |
import Integration from 'awv3/plugin/integration'; | |
class MyPlugin extends Plugin { | |
constructor() { | |
super(); | |
// ... functionality | |
} | |
} |
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 |
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
[ | |
{ "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
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
// 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 '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 |