Skip to content

Instantly share code, notes, and snippets.

View leefsmp's full-sized avatar

Philippe Leefsma leefsmp

  • Switzerland
  • 04:52 (UTC +02:00)
View GitHub Profile
@leefsmp
leefsmp / ViewingApplication.js
Last active November 2, 2016 03:24
Forge Viewing Application
var options = {
env: 'AutodeskProduction',
getAccessToken: function (onGetAccessToken) {
// Asynchronous request from your app to request
// access token from your server ...
yourAppGetAccessTokenAsync(function (tokenResponse) {
onGetAccessToken (
tokenResponse.access_token,
@leefsmp
leefsmp / basic.js
Last active October 30, 2016 17:54
async function getItem (id) {
var response = await fetch('/api/items/' + id)
var item = await response.json()
return item
}
async function taskOnItems (itemIds) {
@leefsmp
leefsmp / viewer-init.js
Created October 21, 2016 08:21
Illustrates how to load document offline/online with Forge Viewer
async onViewerCreated (data) {
try {
const { viewer, initialize, loadDocument } = data
viewer.addEventListener(
Autodesk.Viewing.FULLSCREEN_MODE_EVENT, (e) => {
this.onFullScreenMode(e)
@leefsmp
leefsmp / react-forge-viewer.js
Created October 14, 2016 13:08
Illustrates how to use the Forge in a React web application
//////////////////////////////////////////////////////////////////////////
// Copyright (c) Autodesk, Inc. All rights reserved
// Written by Philippe Leefsma 2016 - ADN/Developer Technical Services
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
@leefsmp
leefsmp / bindings.js
Created July 29, 2016 23:05
WebIDl bindings definition file for Emscripten SDK
interface Vector {
void Vector(double x, double y, double z);
void set(double x, double y, double z);
double getX();
double getY();
double getZ();
@leefsmp
leefsmp / particle test.cpp
Created July 29, 2016 17:37
Particle System Test C++ version
#include <stdio.h>
#include "ParticleSystem.h"
#include "ParticleEmitter.h"
#include "MagneticField.h"
#include "Particle.h"
int main() {
// Create new particle system with 10 particles max
@leefsmp
leefsmp / Version payload.js
Created July 25, 2016 15:40
Forge DataManagement API payload
[{
type: "versions",
id: "urn:adsk.wipprod:fs.file:vf.m-lA0fEwQJyLND9lLJSYZQ?version=1",
attributes: {
name: "Amine Absorber.dwfx",
displayName: "Amine Absorber.dwfx",
createTime: "2016-06-14T04:20:20+00:00",
createUserId: "200704122227993",
lastModifiedTime: "2016-06-14T04:20:20+00:00",
lastModifiedUserId: "200704122227993",
@leefsmp
leefsmp / OssSvc.js
Created July 25, 2016 14:50
OSS API Node Service for the Forge Sample
import BaseSvc from './BaseSvc'
import jsonfile from 'jsonfile'
import request from 'request'
import util from 'util'
import fs from 'fs'
export default class OssSvc extends BaseSvc {
/////////////////////////////////////////////////////////////////
@leefsmp
leefsmp / forge.js
Last active July 19, 2016 10:44
Forge endpoint oauth implementation for node
///////////////////////////////////////////////////////////////////////
// Copyright (c) Autodesk, Inc. All rights reserved
// Written by Philippe Leefsma 2016 - ADN/Developer Technical Services
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
@leefsmp
leefsmp / ForgeSvc.js
Last active August 2, 2016 13:44
Forge server-side service for node
///////////////////////////////////////////////////////////////////////
// Copyright (c) Autodesk, Inc. All rights reserved
// Written by Philippe Leefsma 2016 - ADN/Developer Technical Services
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.