How to export view as multiple images in Revit API? - autodesk-forge

Is it possible to export a view as more than 1 image? in any kind of split.
When exporting the view as an Image I want to keep the scaling consistent and Revit will not allow export an image with more than 15000 pixels. So on big Models I want to split the image to keep the meter per pixel consistent.
Any other suggestions are welcome.

I am not aware of any such possibility.
Please be aware of the following rule of thumb:
In general, if a feature is not available in the Revit product manually through the user interface, then the Revit API will not provide it either.
You should therefore research the optimal workflow and best practices to address your task at hand manually through the Revit user interface first.
To do so, please discuss and analyse it with an experienced application engineer, product usage expert, or product support.
Once you have got that part sorted out, it is time to step up into the programming environment.
I hope this clarifies.

I was able to do it by cropping different parts of the view and hiding everything outside the crop before the export. As the image export only export the visible elements.
I've encountered a different issue now, there are different visible objects outside of the actual model that interfere with the image export, sometimes those are elevation markers, site internal origin, other hidden annotations and many more.
Is there a way to hide absolutely everything outside the crop? do I need to go over every instance of a list of possible visible objects and hide them?

Thank you for sharing your solution to the original question on exporting several images displaying different elements by toggling their visibilities.
Regarding your second, new, question, on interfering elements such as 'elevation markers, site internal origin, other hidden annotations and many more':
Yes, indeed, I would suggest hiding those as well, just as you successfully handled the other 'standard' BIM elements, e.g., using the HideElements method, HideElementsTemporary, or, maybe better still for such special element types, hiding their entire categories using HideCategoriesTemporary.

Related

How to show/hide part of an element in Autodesk Viewer v7

We currently use the model derivatives API to upload 3D models and later visualize them in a browser with the Autodesk Viewer v7 (previously Forge Viewer).
For different reasons we have been trying to hide and show parts of the model, but to do so in some cases we need to be able to hide geometric pieces of some elements while still being able to see the rest. For example if we had an element in gray (see image below) we would like to make the part of the element in red transparent.
I have looked into the Viewer API docs and there are functions that allow showing and hiding complete elements, but not cutting elements along a custom path.
While the docs mention the overlay functionality which enables us to add custom geometries by interacting with the THREE library that the Viewer runs on, drawing a copy of the whole model seems inefficient and prone to giving bad results.
Searching in SO I found that the THREE v71 library (which is the version the Viewer uses) has the possibility of occluding elements with the colorWrite option. See these links for reference:
three.js transparent object occlusion
Occlusion of real-world objects using three.js
I tried implementing something similar by using the colorWrite key when creating a new Three Material in an overlay, but nothing happens. This makes me think that either the Autodesk Viewer overwrites the render order (which makes sense) or openly ignores the colorWrite option. Does anyone know why and if there is a workaround for this? Or does anyone know if there is another way to cut an element that I'm not considering?
Please note that we have to do this with multiple elements at the same time and that reuploading the model periodically is not an option for us.
I got the following feedback:
The approach linked in the SO thread doesn't work, because we ignore both the colorWrite material property and the renderOrder mesh property. I also think that the approach would not work as expected in general, because using an invisible object to occlude a part of another object would always be view-dependent, and also occlude other objects in the background (so it wouldn't just 'cut out' a part of a single object).
Generally, this is not really a use-case for LMV, because it's a viewing tool, not a solid modelling tool.
Cut planes might help to get some of what you want, but they also have limitations:
It's possible to define multiple section planes to construct a 'shape' (that's also what the section box does internally). But since they are infinite, you wouldn't be able to cut away parts of one object, but not other objects (or other parts of the same object that intersect the cutplane). They're also designed to be 'outward' facing. The section box, for example, can only be used to narrow the scene down to some elements of interest. It's not possible to do the opposite, i.e. cut out some inner part of the design and keep everything around it.
This is what the section box could offer:

Autodesk Forge Heatmap Overlay

I am brand new to Forge and making my way through some documentation but it seems quite hard to get some of the older examples working (pages don't load correctly etc) and I am currently using version 6, which seems newer than many examples too.
Is it possible in client-side code to take in some user data and generate a heatmap (overlayed ontop of the floor of a house) based on that data (i.e. different blocks of colour, it can be quite rudimentary).
This is using a Revvitt model uploaded to Forge and shown in the Viewer.
I have no experience with Three.JS but if anyone could point me in the right direction, show me a working example, or at least tell me if its possible I would greatly appreciate it!
There are a couple of options, with different levels of complexity:
You could use the official viewer APIs such as setThemingColor and clearThemingColors to add a semi-transparent color tint to selected objects.
If you need to overlay scene elements with anything more sophisticated, you could replace their original material with a custom THREE.ShaderMaterial. Just be sure to follow the documentation of three.js version 71 which is used by Forge Viewer. The process of adding new materials to Forge Viewer, and assigning them to specific objects is explained in https://forge.autodesk.com/blog/forge-viewer-custom-shaders-part-1. The article is a bit old, but I think the relevant parts of it (mainly the createShaderMaterial and selectionHandler functions) can be reused.

How do model browsers categorize by floor or default and display together

this is the default classification
enter image description here
This is floor derivation. The first level classification is floor, and then the default classification is inside.
enter image description here
How can these two categories be displayed together in the model browser to switch between two tabs? Together, it can facilitate users to better switch between explicit and implicit.
Secondly, how to make a list of model browsers with relevant data?
Possible duplicate of Change content of Model Browser in Forge Viewer.
There was indeed a hack to restructure/customise the object tree for Model Browser prior to Viewer V3, but that feature had been removed in later versions, which leaves us with pretty much rebuilding our own Model Browser as the only viable approach to accomplishing, within Viewer, the classification you’re after. See the other question above for details.

Few Questions about PictureChooser Plugin

I'm trying to use the PictureChooser plugin, specifically the ChoosePictureFromLibrary method, and I have a few questions.
Is it possible to show more than just .jpg? I'd like at least .png as well, though maybe other picture types too.
Is it possible not to resize chosen pictures? The maxPixelDimension parameter seems to always resize the image to that size.
Is it possible to have access to the original file name of the chosen picture?
The PictureChooser is really quite a small plugin - it really only has one small class per platform - https://github.com/MvvmCross/MvvmCross/tree/v3.1/Plugins/Cirrious/PictureChooser
Because of this, the easiest route forwards for your specialist needs is probably to "branch" this small part of the code (by repo-forking or just by "copy and paste"). You should then find it straightforward to get hold of filenames, to avoid resizing, and to add any other features you need on the platforms you need to support.
If you create features that you think others may want, then mvx would love to see them open sourced back to the community - but that's not priority 1 - instead, the most important thing is making your app awesome and shipping it.

Image manipulation in ActionScript 3.0 : realistically editing faces

I am a flash developer who has worked mostly on small ActionScript projects, in particular websites, but I am dipping my toes into image manipulation with AS3. I have a project I'm working on to develop an application which would allow a user to upload their own picture into a swf, and then, using a slider, they can alter the image to make themselves look thinner or fatter. The condition is that it should require minimal user input - so ideally the most I could expect from the user would be a couple of control points identifying certain areas of the face in response to prompts e.g. 'click on the centre of the chin' and when the user clicks, the position would be stored, but this would need to be used sparingly, if at all.
So far, I have been able to use the FileReference class to handle the upload, and I am experimenting with using the DisplacementMap filter to edit certain parts of the uploaded image, but I am having serious trouble implementing this in a manner that would allow realistic deformation of the facial features in the image uploaded.
Is there anything that exists that might run along the same lines and that provides an explanation/source code I could look at to get a better idea of how to go around doing this? Or if there are any other ideas on how to manipulate and distort the image that doesn't use the DisplacementMap Filter?
Any feedback and help is greatly appreciated. Thank you for your time.
see http://sakri.net/technology/flash/flex/convolution_filter/ConvolutionFilterExplorer.html
(source code available)