thenbs / ng2-adsk-forge-viewer Goto Github PK
View Code? Open in Web Editor NEWAngular wrapper for the Autodesk Forge Viewer.
License: MIT License
Angular wrapper for the Autodesk Forge Viewer.
License: MIT License
Request:
Bump peerDependencies to Angular 15 in package.json
"peerDependencies": {
"@angular/common": "^15.2.4",
"@angular/core": "^15.2.4",
}
Hello!
First of all, thank you for this awesome forge library for angular.
I have integrated it to my sample project and was looking at creating custom markups. I also read about this article https://forge.autodesk.com/blog/3d-markup-icons-and-info-card and was wondering if there is an available counterpart in this library?
Thank you in advance!
Hello I am new to THREE, I want to create a simple 2d Geometry using forge in angular.
I created an extention and tried doing this.
private addToScene() {
const geom = new THREE.SphereGeometry(10, 8, 8);
const material = new THREE.MeshBasicMaterial({ color: 0xff0000 });
const sphereMesh = new THREE.Mesh(geom, material);
sphereMesh.position.set(1, 2, 3);
this.viewer.impl.createOverlayScene('custom-scene');
this.viewer.impl.addOverlay('custom-scene', sphereMesh);
this.viewer.impl.invalidate(true);
}
I get the below error message
three.js:35 THREE.Object3D.add: object not an instance of THREE.Object3D. Mesh {uuid: "1CA8B8ED-5370-45FE-B20C-BB6AF483716E", name: "", type: "Mesh", parent: null, children: Array(0), …}
Hi,
I 'm using your viewer component and I like it very much.
But I do have one question.
How can I load an extension(difftool) that requires a config class?
I cant register it on ViewerScriptsLoaded since I need the loaded models in the config files. If I load the extension on the geometry loaded event I get a leaking viewer error (errorcode 14) with event.target.loadextension(). Is there something I m missing? I can provide some code if I m not making sense.
King regards,
Josip
I am enable to create two Forge Viewer in single application. I have created two viewer but all model loads only in first Forge viewer and second Forge viewer is not working. I think the issue is Angular Forge Viewer component is using same container Id.
I am using ng2-adsk-forge-viewer npm library. so kindly suggest any solution or idea that can be worked.
Hi Team, I'm trying to add multi models in one Viewer, but the component not Public the Autodesk.Viewing.Document in ViewerInitializedEvent
export interface ViewerInitializedEvent {
viewerComponent: ViewerComponent;
viewer: Autodesk.Viewing.Viewer3D;
}
So, I can't using Autodesk.Viewing.Document.load method to custom the Geometry (globalOffset) of models before load it in Viewer. I think this will give you an idea for the next version.
https://forge.autodesk.com/blog/aggregate-multi-models-sequence-forge-viewer
Kind regards 👍
ViewerModule injects ScriptService, but the ScriptService is not injectable in root.
as a result the there are two or more instance when ever the module is injected in different modules in angular and it messes up the Viewer3D.js from forge
providerIn : 'root'
I'm sorry for the question but I do not understand how to load, for example, 2 extensions.
I've create 2 files : hello.extension.ts
and good-bye.extension.ts
I've try to inject in the ctor of the AppComponent
but It's not working because of the missing provider (normal)
Can you explain how to do it?
Thanks for your code and your help !
hi and thanks for adding the features with the UI buttons :) Seems to work.
But I found out when I was trying the get the HTML element from the viewer (usually viewer.container) that is was not implemented in the typings.ts. I need it to create a new dockingpanel
Is this something you can add quickly ?
thanks
br Mattias
Trying to compile in angular 7.
It gives an error in rxjs/Observables and so..
If I change it to rxjs it compiles fine.
Can you fix it?
Will offline mode be supported like the followings:
https://forge.autodesk.com/blog/disconnected-workflows
Hi Alan,
I am Bryan Huang from Autodesk Developer Network. Hope this finds you well.
In response to community feedback we are working on official TypeScript definitions for our Forge SDK and Viewer.js which will be released to DefinitelyTyped once done. Here’s our preliminary work so far:
https://github.com/cyrillef/forge-api.typescript
So I am wondering - seeing what you’ve done here which is so amazing BTW - if you’d like to contribute to our official work? Feel free to drop me a line on [email protected] if you’d like to continue our conversation in private. Look forward to hearing from you!
Cheers,
Bryan
Can you share some advanced examples?
i.e.:
Hi team,
How can i get viewer class to use for another component? I want another component has a function to change model in Viewer, so i need that class to access data.
Appreciate your hard working.
Is your feature request related to a problem? Please describe.
Currently Angular v8 is no longer under support. Versions 9, 10, 11 are now supported.
Describe the solution you'd like
Support for newer versions of Angular
Describe alternatives you've considered
None.
Additional context
Is your feature request related to a problem? Please describe.
Due to the HttpClientModule import in the ViewerModule, app lazy-loaded modules that include ViewerModule get a different instance of HttpClient Service. This leads to a change of the global HttpInterceptor Service behavior, etc.
Describe the solution you'd like
Remove HttpClientModule from ViewerModule imports and require importing HttpClientModule manually in the root application module (AppModule).
Additional context
Made a patch with patch-package
lib and successfully fixed the issue in the existing app with Viewer.
Since the last forge update, this code and example are not working anymore....
Is your feature request related to a problem? Please describe.
We are using your module to use forge viewer in a SharePoint framework webpart but a requirement led to that we needed to add a button to the toolbar. However this was not implemented when I looked through the module
Describe the solution you'd like
Add Autodes.Viewing.UI.Button to module
I am trying to add the viewer to a page with a title bar and left menu pane, but the viewer canvas is sizing to the viewport size, so I have scrollbars.
I have a div that is the expected size. Inside it <adsk-forge-viewer>
is 0x0, <div id=ng2-adsk-forge-viewer-container>
is the expected width but has 0 height.
Then inside that is <div class="adsk-viewing-viewer2>
which has 100% height and width, but is the viewport size. I think it is sizing to the canvas that it contains.
I can fix it by adding
#ng2-adsk-forge-viewer-container {
height: 100%;
width: 100%;
position: relative;
}
to viewer.component.css
and placing the viewer in a div with height: calc(100vh-45)
but I can't see how to get the viewer though npm and add this css from my code to a child component without using the deprecated deep selectors.
Am I missing something really obvious?
Hello,
we don't understand how to create a custom properties panel inside a custom Extension.
It seems that the PropertyPanel is not present in the nd2-adsk-forge-viewer wrapper.
Is there any example to how to add a Panel?
Thank you.
Hello :)
I have some CORS issues fetching from the FORGE api with your package. below is the code I am using to fetch from the api
How should we solve this CORS issue?
this.viewerOptions = {
initializerOptions: {
env: 'AutodeskProduction',
getAccessToken: (onGetAccessToken: (token: string, expire: number) => void) => {
const expireTimeSeconds = 60 * 30;
onGetAccessToken(ACCESS_TOKEN, expireTimeSeconds);
},
api: 'derivativeV2',
enableMemoryManagement: true,
},
viewerConfig: {
extensions: [
],
theme: 'bim-theme',
},
onViewerScriptsLoaded: () => {
},
onViewerInitialized: (args: ViewerInitializedEvent) => {
args.viewerComponent.DocumentId = this.documentId;
//Create list in viewer details
args.viewerComponent.onObjectTreeCreated.subscribe(event => {
this.documentChanged(args);
});
args.viewerComponent.onGeometryLoaded.subscribe(event => {
if (this.elements.length <= 0) {
this.showWarning = true;
}
this.eventEmitterService.onInvokeUpdateElements(this.elements);
this.loaderService.removeLoader("viewerLoader");
})
},
};
I have an error while importing to to appmodule
ERROR in node_modules/ng2-adsk-forge-viewer/lib/component/viewer.component.d.ts(1,23): error TS2688: Cannot find type definition file for 'forge-viewer'.
node_modules/ng2-adsk-forge-viewer/lib/component/viewer.component.d.ts(8,15): error TS2503: Cannot find namespace 'Autodesk'.
node_modules/ng2-adsk-forge-viewer/lib/component/viewer.component.d.ts(10,13): error TS2503: Cannot find namespace 'Autodesk'.
node_modules/ng2-adsk-forge-viewer/lib/component/viewer.component.d.ts(13,11): error TS2503: Cannot find namespace 'Autodesk'.
How can I fix this?
Is your feature request related to a problem? Please describe.
I'm trying to create a tool
class which extends Autodesk.Viewing.ToolInterface
like this:
export class MyTool extends Autodesk.Viewing.ToolInterface {
}
then register/wrap it by an extension like this:
export class MyToolExtension extends Extension {
private tool = new MyTool();
load() {
(this.viewer as Autodesk.Viewing.GuiViewer3D).toolController.registerTool(this.tool);
}
}
Because I have only installed ng2-adsk-forge-viewer
and "@types/forge-viewer": "^7.48.0",
, it's complaining that Autodesk is undefined.
Describe the solution you'd like
I was wondering if there's a way to directly export Autodesk
from ng2-adsk-forge-viewer
like I do this import { Extension } from 'ng2-adsk-forge-viewer';
?
Describe alternatives you've considered
If there's no way to re-export Autodesk
from 'ng2-adsk-forge-viewer', I might need to include a copy of Autodesk in my main repo. Any concerns/comments there?
Additional context
Really appreciate your work here! Everything looks amazing so far.
Do have a non-blocker question, is the viewer in Extension
class actually a GuiViewer3D
(that has toolController), not just Viewer3D
(that doesn't have toolController)?
Thank you tons!
FYI: I can help to contribute! But I can't find README_dev.md
in this Repo, did I miss something?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.