Saving Prefab with AR/VR Toolkit doesn't work - autodesk-forge

I used Autodesk Forge AR/VR Toolkit unity plugin to load a model statically, and then save it as a prefab, then I tried to load the prefab in another project. It just doesn't show up. It doesn't show up even in the same project(if u delete the loaded model and load from the prefab you saved). I am wondering why?
I noticed that the model loaded from Forge AR/VR toolkit doesn't have mesh component and I guess that's the reason. But how come it can be shown correctly when loaded from Forge? How to solve this problem?
Below are some screen-shots
The model is successfully loaded statically from Forge
The prefab was created successfully but when dragging it into project it is invisible

The reason is that you probably created a prefab from the game engine versus the editor. You need to understands how Unity is working regarding creating assets on disk. To create a static prefab, do not launch the game engine, but use the Forge menu, make sure to check the 'Save To Disk' option. After importing the asset, you will see a pivot object in the hierarchy, and a folder in the Resources folder of the Project. Select the pivot object in the hierarchy tree, and select the Forge Menu again, and 'Create Prefab' - that should work just fine now.

Related

Autodesk Forge: How to get started with creating a configurator

I am extremely new to Web Development. I'm trying to create a configurator application that can load a part into the viewer, have a menu to modify its dimensions, and update the viewer. So far, I developed a basic Web Application that can create a bucket, upload a file, translate it, and load it into the viewer following this tutorial: https://forge.autodesk.com/developer/learn/viewer-app/overview
Now, I would like to request custom dimensions from the user and update the file with those dimensions. I'm not sure how I can get started with this as I have very little knowledge on the subject. This is the link I found for modifying models: https://learnforge.autodesk.io/#/tutorials/modifymodels
What would be the basic steps to incorporate the modify models code to this? Also, would I need to download AutoCAD/ Inventor/ Revit/ 3ds max to run or test this code? I'm feeling lost and am not sure where to go from here. Any help would be greatly appreciated.
Here is a more complete sample for Inventor: https://github.com/Autodesk-Forge/forge-configurator-inventor

What would cause Revit Linked files to not load aligned for some projects?

In forge viewer, I display Revit files with their linked files.
To do this, I do the following:
-Load model from main file (main_urn), at offset 0.
-Load model from linked file (link_urn), also at offset 0.
For most of revit projects I import, it works perfectly, linked models are displayed on top of main model.
But, on some revit projects, I have models, that do not superpose at all, event if all are loaded at offset 0.
While I am in revit software, my linked files are clearly aligned with main file.
Is this behaviour known? What would solve this (except manual calibration/positioning)?
Note: I can reproduce the same not only in my app code, but with the code provided here: https://forge.autodesk.com/blog/aggregate-multi-models-sequence-forge-viewer
Note2: The files having this issue cannot be made public.
Thank you,

Forge viewer 3ds Max Viewport

I'm testing out a new workflow with 3ds Max and my model/scene keeps loading in Top view when I translate it into the Forge viewer. I've tried to save the view as a perspective view but I'm still getting the same result in the viewer. In Revit I remember that I could choose the view from the Collaboration settings. How would I modify the view in 3ds max? I'm translating a MAX file. Thanks a lot.
3ds Max does not have the same idea of a "named 3d view" like Revit does. 3ds Max mainly stores geometry in it's global space, in it's scene file (.MAX). It is also saving the viewport configuration (so on load you can have same view(s)), but the idea of named 3d views is not there for the model derivative service translator.
This means you may have to reorient the geometry in the scene, before sending to the translator to get the desired resulting orientation. Or you can orient the view using the viewer to get the correct starting view if that is the issue. For example, to orient the view, you could do this on viewer start:
var front = new THREE.Vector3(0, -1, 0);
viewer.navigation.setPosition(front);
viewer.fitToView (true) ;
Note that 3ds Max has an "Export to LMV SVF" in it's desktop export options. This can be a nice way to test without sending to the model derivative service. You can export to SVF locally, then using the Forge Viewer you can view the local model (I use firefox as it does not complain about cross-origin error in the local disk load). Again, this is nice testing scenario when working with 3ds Max scenes to understand the translator behavior. Hope it helps, kevin
To have a control on what view will be set as default/home view when opening a translated .max file, in 3ds Max follow these steps:
Remove all cameras from the scene, if any.
Select the perspective view, rotate, pan, zoom, in other words position the view as you wish, then press Ctrl+C to create a Physical Camera From View.
Select the Front View, go to Create -> Cameras -> Free Camera and click on Front View (anywhere) to create the Free Camera.
Now if you translate the .max file with this setup, the Camera you create at step 2 will be set as the default/home view.
I recently wrote a blog post on this trick: Control the default view when translating 3ds Max files

Exception when trying to create a directory on Windows Phone 8

I'm getting an error when I try to create a directory (i.e. snapshots) in my wp8 app but I don't understand why it works fine when in my emulator and when I transfer my app directly from my laptop onto my phone but when it's coming from the wp8 store, it generates the following error:
System.UnauthorizedAccessException: Access to the path 'Snapshots\' is denied.
I don't know if this is ok to do but everywhere I deal with files, I don't bother specifying a path but just a folder as I assume that it will go into the "app path\". Is this not the case?
2 Questions arising from the problem:
Why does it work with local app and not app downloaded from the store? Are access rights different?
If I'm not allowed to create files directly into the app's folder (no path provided, just a filename i.e. data.xml) or sub-folder (sub-folder only + filename provided i.e. Snapshots\test.jpg), where should I store my data (xml, jpg, etc...)
Thanks.
I found out the hard way that you should not try to write data directly in the root folder of a wp8 app as it is an "install folder". I found this interesting article/pdf from Microsoft Files and Storage in Windows Phone 8. Check out page 7, where it clearly explains the difference between installation and local folder.
The question originally originate trying to figure out why my live tile would not update and there were numerous reasons, so while unrelated to this question, I'll include them anyway as it may help someone in the future.
Folder creation problem: See above. Still can't explain why it works when app is transferred from pc to phone but when coming from the app store, it doesn't. Point is that I was going about it the wrong way and you should not be storing files in the root folder, even in a sub-folder as it can't be created in this location. You should use isolated storage or data storage.
Files still failed to update the live tiles when storing them in StorageFolder (LocalFolder). I then found these 2 articles which clearly state that images used by the Live Tiles should be stored in Isolated Storage but in a specific location i.e. Shared\ShellContent
WP8 Tip: Creating Live Tiles with Dynamic Images
Capturing image from camera and updating live tile
The minute I applied what was suggested i.e. use the specific path and use isolated storage, it sorted all my problems i.e. creating folder, creating file, etc...
Please note that while it states that you should store the file in \Shared\ShellContent, it also highlights that it can be stored in any sub-folders within that folder, so in my case, I've got \Shared\ShellContent\\Snapshots and it work as expected.
Again, if time permits I'll investigate the StorageFolder some more as I'd like to get it to work as it is the recommended method to use with WP8/WP8.1 by Microsoft and Isolated Storage appears to be recommended for WP7.
I hope it will save you some time if you encounter similar problems.

AS3: Sharing data from a shared object between a flash application and a desktop Air application

I created a shared object through a SWF file using this code:
var so:SharedObject = SharedObject.getLocal("myProjectName");
and it can be shared by all SWF files (web or locally run on stand-alone player)
However, when I try to access the same SO from an adobe Air desktop application, it can't find any data inside it, it does not create a new Shared object with the same name.. it just does not see the stored data.
I tried specifying the path so it can be specifically shared by the two apps by doing this:
var so:SharedObject = SharedObject.getLocal("myProjectName" , "/myProjectName");
but I was getting this error:
Error: Error #2134: Cannot create SharedObject.
at flash.net::SharedObject$/getLocal()
any ideas, thoughts?
I don't believe what you want is possible. A SharedObject is specific to that app. They are meant to be sandboxed so other apps cannot access them (both to prevent naming collisions and for security reasons). Also, and I could be wrong here, but I believe AIR apps and SWFs store them in completely different base directories. Simply put, you will not be able to share these objects, not even between two different SWFs or AIR apps.
Relevant question: ActionScript 3 SharedObjects don't persist across different swfs?