Forge offline Viewer creating new symbols - autodesk-forge

In the forge offline viewer, is it possible to draw some lines for creating new symbols in the drawing and get the coordinates of the symbol? Is it possible to create hatch patterns in the drawing in offline mode? Is it possible to get handles of all objects in a particular layer?

Unfortunately, Forge Viewer is for viewing only purpose, there is no formal creation API available currently, and the loaded model is read only. Through the viewer is built on the top of three.js r71. but it's a private owned maintained one, it doesn't support all features of the three.js.
However, there are a way to add custom shapes onto the Viewer viewport via the markup extension. Markup ext is archive via the drawing svg graphic to the markup canvas. It will make your life easier to add custom graphics. This code snippet is showing how to enter markup editing mode.
var markup;
viewer.loadExtension('Autodesk.Viewing.MarkupsCore').then(function(markupsExt){
markup = markupsExt;
});
markup.enterEditMode();
var cloud = new Autodesk.Viewing.Extensions.Markups.Core.EditModeCloud(markup)
markup.changeEditMode(cloud);
References:
https://forge.autodesk.com/blog/using-autodeskviewingmarkupscore-extension
https://developer.autodesk.com/en/docs/viewer/v5/reference/javascript/markupscore

Related

How to export markups created for Inventor (drawing/part/assembly) file to PDF from viewer

We have created a markup extension in the autodesk viewer. Is it possible to export a markup to PDF using APIs.
The online viewer from Autodesk has Print button which looks to be calling window.print(). Is this the way to print the drawing to PDF?
In the viewer from "Comments" I open a specific markup and ("view markup" window) click "Print" and it prints drawing without markups.
The button "Export" under "Comments" is exporting all the markups into a single PDF file. How do we do this using forge APIs.
Is it possible to print only selected a markup instead of all the markups.?
Thank You for your help.
There is no official/supported way of doing this using the Viewer APIs but you might be able to get markups "baked" into a PDF by combining multiple features/libraries:
the Markups extension in Forge Viewer allows you to render the markups into a PNG file; see this Stack Overflow answer: Autodesk Forge get screenshot with markups
there are 3rd party libraries that allow you to insert semi-transparent PNG images into PDFs, for example pdfkit: https://pdfkit.org/docs/images.html
since the Markups extension uses an <svg> element under the hood, you should also be able to hide any of the SVG elements you don't want included in the PNG

How to change the geometry of the two selected models?

I know getSelection() is get the db id of seletion model.
but after this i don't know how to control this viewer.
There are two windows selected by the viewer.
I want to change the geometry of the two windows.
Forge Viewer is open Revit file by my bucket.
viewer.getSelection()
=>(3) [3043, 3055]//how to?
Unfortunately, the viewer isn't designed to support geometry modification. You can modify your design elements in these ways:
changing their position, orientation, or scale (blog)
hiding them, and potentially inserting your own custom three.js geometry instead (tutorial)
changing their materials, incl. using custom shaders (blog)
But if you actually need to tweak the individual vertices of the mesh geometry, that would be very difficult to do.

Exporting markup data in RVT/CAD format

I am using Autodesk Markupscore Extension to draw markups on 2D view. I want to create a separate rvt or CAD file for the drawn markup, which can further be used/opened in Revit soft. So the newly created 2D view(rvt/CAD) will contain only that part of 2D view which is inside the drawn markup, How can I achieve this?
I can't comment on the Revit specific piece (for that I would suggest that you check out the Revit discussion forums) but if we're talking about where Forge can help, I see two options:
you could have a Revit plugin running in the Forge Design Automation service, accepting a Revit document and some coordinates of 2D markups on the input, removing design elements that are outside of the 2D markups via Revit APIs, and generating a new Revit document on the output.
you could customize Forge Viewer to hide or occlude the parts of the 2D drawings you don't want to be visible, for example, by "hiding" them (making them semi-transparent), by changing their color, or by overlaying them with another content such as a blank SVG rectangle.

World Map Framework for jQuery or HTML5

I have a project which requires an animated world map on its home page similar to this example. Flash is not an option which leaves me with html5 css jquery or other ajax framework.
Do you know any World Map Framework for jQuery, HTML 5 or other ajax frameworks?
The data does not need to be dynamic all I want is for the lines representing the from and to destinations, to be animated.
In my personal order of preference: OpenLayers, Leaflet or Polymaps
http://openlayers.org/
http://leaflet.cloudmade.com/
http://polymaps.org/
All open source, all Javascript, all IE compatible (at least for IE>8, I think)
You can try the following mapping software product which is based on HTML5 / Google Map instead of Flash:
iMapBuilder HTML5 Map Software
Map templates based (alike amMap), but use HTML5 maps instead of Flash Maps. Let you create interactive maps easily with pushpins, lines, mouse-over effects, etc.
Flight Routing Map Base a Custom Google Map
This is a flight routing map which is based on Google map, created using gmap editor.
AmMap switched from flash to JavaScript quite a long time ago, and the demo above is now made with JavaScript.

HTML5 / JavaScript / WebGL viewer of KMZ / KML 3D OBJECTS?

Is there any HTML5/javascript/webgl viewer of KMZ KML 3D OBJECTS ?
i would like to use WEBGL technology to render kmz/kml 3d object (building) created in sketchup and uploaded to google warehouse.
Target is to use browser technologies instead of flash/java to render 3D product overview on white backgrdound with only horizontal rotation.
Thank you for any suggestions
Three.js has a ColladaLoader. SketchUp can export to Collada, and that's what KMZ files use. It's the .dae file in the KMZ.
I built a small library called kamikmz exactly for this purpose. The problem with loading a Collada model straight up is that you need to have the images referenced as textures available on the correct path as well. To overcome this issue I use the jszip library to unzip the kmz file right in the browser and the pass it to threejs.
Right now the library is still in development and has some performance issues when it comes to loading large models, however it works fine for most cases.