Skip to content

Instantly share code, notes, and snippets.

@wallabyway
wallabyway / 3dwood-uvw.js
Created August 6, 2021 01:26
apply 3D wood prism...
function ensureMeshUvws(geometry) {
// If mesh has no uvws, generate them by copying the vertex position vectors
// (x,y,z) => (u,v,w). We apply no transform. All geometry loaded by lmvtk uses
// this interleaved vertex buffer approach. We have to get the vertex position
// vectors out of the interleaved vertex buffer.
if (!geometry.getAttribute('uvw')) {
let vbb = ggeom.vb; // should always be 3

Forge Properties API swizzle endpoint

A Proxy Server that provides an alternative Forge Properties API endpoints for your BIM360 content. It does this by replacing any reference of svf2 dbids with svf1 dbids.

Just point your application to this proxy server, and it will swizzle the dbIDs for you, and provide you the matching properties meta-data (prior to the July 1st changes).

Screen Shot 2021-07-26 at 8 01 35 PM

TO INSTALL

// Add GridExtension as a forge-viewer extension, like this:
// viewer = new Autodesk.Viewing.GuiViewer3D(viewerDiv, {extensions: ['GridExtension']});
class GridExtension extends Autodesk.Viewing.Extension {
constructor(viewer, options) {
super(viewer, options);
this.grid = null;
}
load() {
// Load the extension on startup, like this:
// viewer = new Autodesk.Viewing.GuiViewer3D(viewerDiv, {extensions: ['GoogleMapsExtension']});
// Result: https://youtu.be/9kVHlTV8wHw
class GoogleMapsExtension extends Autodesk.Viewing.Extension {
constructor(viewer, options) {
super(viewer, options);
}
quad(x,y) {
const mesh = new THREE.Mesh(
@wallabyway
wallabyway / tagEquipmentToRoom.js
Last active March 17, 2022 04:26
Run "Tag Equipment To Room". Take a fragmentlist.pack file and list of room dbids, and output a list of object dbids, tagged with room dbids
/*
// INSTALL:
// run the following commands:
// > npm install node-fetch fs-extra aabb-3d
// download a rme-advanced/FragmentList.pack file using https://gist.github.com/wallabyway/51a7bf50f5fe2ec19657278494fcd076
// RUNNING:
// Run this command, and add a comma list of roomIDs, like this:
// > node tagEquipmentToRoom.js [{dbid:9011},{dbid:9261},{dbid:9132}]
// RESULT:
@wallabyway
wallabyway / getRoomsReport.js
Last active May 26, 2021 01:07
Nodejs app: Pull list of Rooms from 3DModel, add room properties, and save to report.json file
// to install, run this command in a terminal:
// > npm install node-fetch
// now, add your URN, GUID, KEY, SECRET
// To run, type this:
// > node getRoomsReport.js
// see `report.json` as an example output
const fetch = require('node-fetch');
@wallabyway
wallabyway / propertiesdownload.js
Last active February 25, 2022 00:02
download JSON Properties files
// download properties database JSON files
// add your KEY, SECRET and URN
// npm install node-fetch@2 fs-extra
// node propertiesdownload.js
const fetch = require('node-fetch');
const fs = require('fs-extra');
const atob = a => Buffer.from(a, 'base64').toString('binary');
const opts = token => ({ compress: true, headers: { 'Authorization': 'Bearer ' + token }});
@wallabyway
wallabyway / claudia.json
Last active April 28, 2023 01:58
minimal access-token generator (with AWS-lambda & Claudia.js)
{
"lambda": {
"role": "web-api-test-executor",
"name": "web-api-test",
"region": "us-east-1"
},
"api": {
"id": "rtvnonbl58",
"module": "web"
}
@wallabyway
wallabyway / import_mssql.js
Last active September 13, 2023 21:07
properties db - convert json to postgreSQL or sqliteDB
/* Pull Properties db files (objects_vals.json.gz _id, _val, _eav, _attr) into MS-SQL-Server database
Example usage:
1. copy your 5 files ( objects_vals.json.gz _id, _val, _eav, _attr) into 'svf' folder
2. > npm install @frangiskos/mssql readline
3. > node import_mssql.js pathTo/svf/output/0 myNewDatabase
*/
const fs = require('fs');
const path = require('path');
@wallabyway
wallabyway / hypermodeling-index.html
Last active June 8, 2021 14:59
hyper modeling extension sample
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="icon" href="data:,">
<link rel="stylesheet" href="https://wallabyway.github.io/floor-animation/skeleton.min.css">
<title>SkeletonCSS</title>